1. 程式人生 > >基於ambari 2.4.1 HDP-2.5.0 構建安全的hive資料庫

基於ambari 2.4.1 HDP-2.5.0 構建安全的hive資料庫

基於ambari 2.4.1 HDP-2.5.0 構建安全的hive資料庫 基本條件: 1. 利用ambari 啟用kerberos 基本原理: hadoop 代理機制:hadoop 可以使用"超級"使用者,偽裝為其他使用者提交程式。且可以通過配置對被偽裝的使用者限定使用者名稱,使用者組和IP(或主機名) 詳細參考http://hadoop.apache.org/docs/r2.7.3/hadoop-project-dist/hadoop-common/Superusers.html hadoop 代理機制中限定許可權的配置,其中的hive為hiveserver執行使用者. 對組,使用者,和hosts具有多個值的用','分開。'*'表示不限制 hadoop.proxyuser.hive.groups hadoop.proxyuser.hive.users hadoop.proxyuser.hive.hosts 具體方案: 1. 通過kdc統一管理hive使用者,以檔案或密碼的檔案提供給客戶端進行認證 2. 通過hadoop.proxyuser.hive.groups/users/hosts 對使用者進行hdfs級別的登陸限制 3. 驗證步驟 本示例演示在系統中新增hdp使用者,並通過beeline進行測試 1. 在kdc中分配principal使用者,並匯出keytab拷貝到客戶端 (core-site.xml 中的hadoop.security.auth_to_local會把hdp/[email protected] 解析為hdp使用者 ) addprinc -randkey hdp/[email protected] xst -norandkey -k /tmp/hdp.xj3.keytab hdp/[email protected] 2. 獲取ticket kinit -kt /tmp/hdp.xj3.keytab hdp/xj3 3. 連線 beeline !connect jdbc:hive2://xj2:10000/;principal=hive/[email protected]; 顯示錯誤資訊 Error: Failed to open new session: java.lang.RuntimeException: java.lang.RuntimeException: org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.security.authorize.AuthorizationException): User: hive/
[email protected]
is not allowed to impersonate hdp (state=,code=0) 4. 需要在namenode上建立hdp使用者,並hadoop.proxyuser.hive.groups或hadoop.proxyuser.hive.users許可權,具體配置如下 hadoop.proxyuser.hive.users hdp 在客戶端用beeline 重新測試 備註: 使用引數 hadoop.security.auth_to_local hive.server2.authentication.kerberos.keytab /etc/security/keytabs/hive.service.keytab hive.server2.authentication.kerberos.principal hive/
[email protected]
hive.server2.authentication.spnego.keytab /etc/security/keytabs/spnego.service.keytab hive.server2.authentication.spnego.principal HTTP/[email protected] hive.server2.authentication KERBEROS hive.server2.enable.doAs true hive.server2.thrift.port 10000 hive.server2.thrift.http.port 10001 hive.server2.transport.mode binary 注意事項: 如果通過group限制對hdfs的訪問,需要在namenode上建立相應使用者,以及對應的組 例如:hadoop.proxyuser.hive.groups 引數為hdfs,bdg 當有使用者提交提交程式時,hdfs 會在namenode上檢視主機中使用者的組為bdg,如果不是就不予認證