'Cloud Service/Hadoop'에 해당되는 글 1건

  1. 2016.05.02 HDFS 권한 분석

시작으로는 HDFS Permission부터 이해해보자.


HDFS Permission Overview

 하둡 파일 시스템은 Files Directories를 관리하기 위해서 POSIX model를 수단으로 하였다. File, Directories는 사용자 와 그룹과 연관 지어진다.

 기존 POSIX model 과 차이점은 HDFS에서는 실행파일에 대한 개념이 존재 하지 않는다.

파일의 경우

r permission은 파일을 읽어들이는데 필요

w permission은 파일을 쓰거나, 파일에 추가내용 적을시 필요

디렉토리 경우

r permission은 디렉토리의 리스트를 확인시 필요

w permission은 파일 또는 디렉토리를 생성 또는 삭제에 필요하다.

x permission은 자식 디렉토리에 접근하기 위해 필요하다.

 

디렉토리에 대해서는 소유자 또는 슈퍼유저 파일 소유자를 제외하고 디렉토리 접근 방지 설정을 할 수 있다.

종합적으로 파일이나 디렉토리의 권한을 관리하기위한 Model이다. 파일또는 디렉토리가 생성되면, 그 소유자는 클라이언트 프로세스 사용자 ID 이며, 그룹은 소유자의 그룹이다.

 

ACL (액세스 제어 목록)

HDFS는 기존의 POSIX 권한 모델 뿐만 아니라, ACL을 지원한다. ACL은 사용자와 그룹의 계층 권한을 구현하는데 유용하다.

ACL은 파일의 소유자와 파일의 그룹 뿐만 아니라 명명된 사용자 또는 명명된 그룹에 권한 설정하는 방법을 제공한다.

기본적으로 ACL을 제공하지는 않지만 네임노드 구성에서

dfs.namenode.acls.enabled= true 로 설정하면 이후부터 ACL인식이 가능합니다.

 

ACL 을 이용한 권한 관리



 

ACL Control 방법

JAVA methods:

·       public void modifyAclEntries(Path path, List<AclEntry> aclSpec) throws IOException;

·       public void removeAclEntries(Path path, List<AclEntry> aclSpec) throws IOException;

·       public void public void removeDefaultAcl(Path path) throws IOException;

·       public void removeAcl(Path path) throws IOException;

·       public void setAcl(Path path, List<AclEntry> aclSpec) throws IOException;

·       public AclStatus getAclStatus(Path path) throws IOException;

 

ACLs Shell Commands

·       hdfs dfs -getfacl [-R] <path>
Displays the Access Control Lists (ACLs) of files and directories. If a directory has a default ACL, then getfacl also displays the default ACL.

·       hdfs dfs -setfacl [-R] [-b |-k -m |-x <acl_spec> <path>] |[--set <acl_spec> <path>]
Sets Access Control Lists (ACLs) of files and directories.

hdfs dfs -setfacl -x user:alice /user/hdfs/file

 

·       hdfs dfs -ls <args>
The output of ls will append a ‘+’ character to the permissions string of any file or directory that has an ACL.

 

 

ACL 권한 체크 절차




참조 사이트 : 

Permission JAVA API https://hadoop.apache.org/docs/r2.6.1/api/org/apache/hadoop/conf/Configuration.html
리눅스 Secure Guide https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsPermissionsGuide.html


Posted by MIDDLE
,