web hdfs设置ssl访问
要设置WebHDFS的SSL访问,您需要执行以下步骤:
-
生成SSL证书和密钥:
- 使用工具生成自签名证书和密钥,或者从受信任的证书颁发机构(CA)获取证书和密钥。
- 确保证书和密钥文件的格式符合要求(如PEM格式)。
-
配置Hadoop集群:
-
在hdfs-site.xml文件中添加以下属性:
<property> <name>dfs.http.policy</name> <value>HTTPS_ONLY</value> </property> <property> <name>dfs.datanode.https.address</name> <value>datanode_hostname:datanode_https_port</value> </property> <property> <name>dfs.namenode.https-address</name> <value>namenode_hostname:namenode_https_port</value> </property> -
在core-site.xml文件中添加以下属性:
<property> <name>hadoop.ssl.enabled</name> <value>true</value> </property> <property> <name>hadoop.ssl.keystores.factory.class</name> <value>org.apache.hadoop.security.ssl.FileBasedKeyStoresFactory</value> </property> <property> <name>hadoop.ssl.server.conf</name> <value>ssl-server.xml</value> </property> <property> <name>hadoop.ssl.client.conf</name> <value>ssl-client.xml</value> </property> -
创建ssl-server.xml文件,并在其中添加以下内容:
<configuration> <property> <name>ssl.server.keystore.location</name> <value>/path/to/server/keystore</value> </property> <property> <name>ssl.server.keystore.password</name> <value>keystore_password</value> </property> <property> <name>ssl.server.truststore.location</name> <value>/path/to/server/truststore</value> </property> <property> <name>ssl.server.truststore.password</name> <value>truststore_password</value> </property> </configuration> -
创建ssl-client.xml文件,并在其中添加以下内容(如果客户端需要验证服务器证书):
<configuration> <property> <name>ssl.client.keystore.location</name> <value>/path/to/client/keystore</value> </property> <property> <name>ssl.client.keystore.password</name> <value>keystore_password</value> </property> <property> <name>ssl.client.truststore.location</name> <value>/path/to/client/truststore</value> </property> <property> <name>ssl.client.truststore.password</name> <value>truststore_password</value> </property> </configuration>
-
-
配置WebHDFS代理用户:
- 将以下属性添加到hdfs-site.xml文件中:
<property> <name>dfs.web.authentication.kerberos.principal</name> <value>HTTP/hostname@REALM</value> </property> <property> <name>dfs.web.authentication.kerberos.keytab</name> <value>/path/to/http.keytab</value> </property>
- 将以下属性添加到hdfs-site.xml文件中:
-
重启Hadoop集群。
-
配置SSL终端用户访问权限:
- 在hdfs-site.xml文件中添加以下属性,以限制特定用户使用SSL进行访问:
<property> <name>dfs.webhdfs.ssl.require.client.cert</name> <value>true</value> </property> <property> <name>dfs.webhdfs.ssl.enabled</name> <value>true</value> </property> <property> <name>dfs.webhdfs.ssl.hosts</name> <value>hostname1,hostname2,...</value> </property>
- 在hdfs-site.xml文件中添加以下属性,以限制特定用户使用SSL进行访问:
-
重启Hadoop集群。
完成上述步骤后,您应该能够使用SSL访问WebHDFS。请确保在配置文件中替换适当的值,如证书和密钥的路径、密码、主机名等
原文地址: https://www.cveoy.top/t/topic/ioPe 著作权归作者所有。请勿转载和采集!