메뉴 건너뛰기

Bigdata, Semantic IoT, Hadoop, NoSQL

Bigdata, Hadoop ecosystem, Semantic IoT등의 프로젝트를 진행중에 습득한 내용을 정리하는 곳입니다.
필요한 분을 위해서 공개하고 있습니다. 문의사항은 gooper@gooper.com로 메일을 보내주세요.


1. 암호화 key 목록 확인

 - sudo -u hdfs kinit -kt /var/lib/keytab/hdfs.keytab hdfs

 - sudo -u hdfs hdfs crypto -listZones

   --> /tmp/zone1 testkey


2. 암호화 zone생성

 - sudo -u hdfs kinit -kt /var/lib/keytab/hdfs.keytab hdfs

 - sudo -u hdfs hdfs dfs mkdir /tmp/zone1

 - sudo -u hdfs hdfs dfs crypto -createZone -keyName testkey -path /tmp/zone1


3. hdfs dfs -copyFromLocal /home/hadoop/testfile.txt /tmp/zone1 수행시 발생할 수 있는 오류

- coyFromLocal: Permission denied: user=hadoop, access=WRITE, inode='/tmp/zone1/':hdfs:supergroup:drwxr-xr-x <- 이 경우는 Ranger->Hadoop SQL에서 Policy를 생성하고 url에 "hdfs://nameservice1/tmp/zone1"을 입력, Allow Conditions의 Select User에 hadoop을 입력, Permission에 "All"을 선택하고 저장해서 권한을 부여해준다. 또한 이곳에 테이블을 생성(impala 혹은 kudu)하여 CRUD하기 위해서 database에 test(db명이 test인 경우)를 선택하고 table, column에는 *을 입력한다. Allow Conditions의 Select User에 hadoop을 선택하고 Permissions에는 select, read, refresh를 선택하고 "save"를 클릭하여 권한을 부여해준다. hive table을 생성하는 경우는 Ranger->Service Manager->HDFS(cm_hdfs)에서 Policy를 등록해주고 Resource Path를 "/tmp/zone1"와 같이 등록및 Select User(예, hadoop), Permissions (예,CRUD권한, Read/Write/Execute)를 선택후 save해서 권한을 부여해 준다.

- copyFromLocal: User:hadoop not allowed to do 'DECRYPT_EEK' ON 'testkey'   <- 이 경우는 아래와 같이 Ranger에서 관련 권한을 부여해야 함.


* Ranger에서 권한 설정(로그인 id : keyadmin로 로그인 해야 cm_kms정책이 보이며 수정할 수 있다, 아래의 설명은 testkey를 만들고 hadoop계정에 testkey에 대한 권한을 부여하는 경우임.)

1. Encryption -> Key Manager ->Select Service에서  cm_kms를 선택한다. 

   (이때, Error! Connection refused: Please check the KMS provider URL and whether the Ranger KMS is running오류가 발생하면  Service Manager -> KMS 우측 "수정" 버튼클릭 -> Config Properties에서 KMS URL을 변경해준다.

     (Ranger KMS의 TLS가 비활성화된 경우 : kms://http@node01.gooper.com:9292/kms, Ranger KMS의 TLS가 활성화된 경우 : kms://https@node01.gooper.com:9494/kms )

   )

1.1 "Add New Key"를 클릭한다. (필요시)

  . Key Name : testkey

  . Cipher : AES/CTR/NoPadding  (default로 설정됨)

  . Length : 128 혹은 256

1.2 "Save"를 눌러서 저장해준다. 


2. Access Manager -> Service Manager에서 KMS중 cm_kms를 클릭한다. 

3 Add New Policy를 클릭하여 새로운 kms정책을 만든다.

  . Policy Name : policy_testkey

  . Key Name : testkey

  . Allow Conditions항목에서 

     Select User에 hadoop을 선택, Permission에 Get, Get Keys, Get Metadata,, Generate EEk, Decrypt EEK를 선택한다.

4. 저장(save)한다. 


* 관리자 계정을 위한 cm_kms의 Policy Name이 all-keyname항목에는 다음과 같이 설정해줘야 한다. 

  - User : keyadmin -> Permissions : Create, Delete, Rollover, Set key Material, Get, Get Keys, Get Metadata, Generate EEK, Decrypt EEK

  - User : hive -> Permissions : Get Metadata, Decrypt EEK

  - User : hbase -> Permissions : Decrypt EEK

  - User : hadoop, impala, hdfs -> Permissions : Get Metadata, Generate EEK, Decrlypt EEK  <= 이항목은 관리를 위해서 추가적으로 부여되어야 함



A personal place to organize information learned during the development of such Hadoop, Hive, Hbase, Semantic IoT, etc.
We are open to the required minutes. Please send inquiries to gooper@gooper.com.

위로