Wire Encryption, TLS Certificates and Apache Knox Gateway

Big Data and Hadoop Administrator 15 min min read Updated: Nov 17, 2026 Advanced
Wire Encryption, TLS Certificates and Apache Knox Gateway
Advanced Topic 5 of 5

What Needs Encrypting in Transit

TrafficMechanismKey property
Client / daemon RPCSASL with Kerberos, privacy QOPhadoop.rpc.protection=privacy
HDFS block data transferSASL data transfer protectiondfs.data.transfer.protection=privacy
Web UIs and REST (NN, RM, NM, history)HTTPS (TLS)dfs.http.policy=HTTPS_ONLY, yarn.http.policy=HTTPS_ONLY
MapReduce shuffleTLSmapreduce.shuffle.ssl.enabled=true
Hive, Kafka, HBase, ZooKeeperEach has its own TLS/SASL settingSee service docs

Quality of Protection Levels

ValueEffect
authenticationOnly authenticate. Data not protected
integrityAuthenticate and detect tampering
privacyAuthenticate, detect tampering and encrypt
xml <!-- core-site.xml --> <property><name>hadoop.rpc.protection</name><value>privacy</value></property> <property><name>hadoop.ssl.require.client.cert</name><value>false</value></property> <property><name>hadoop.ssl.hostname.verifier</name><value>DEFAULT</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>

Create Keystores and Truststores

bash # 1. key pair and CSR for each host keytool -genkeypair -alias $(hostname -f) -keyalg RSA -keysize 2048 -validity 825 \ -dname "CN=$(hostname -f),OU=Hadoop,O=Example,C=US" -ext "SAN=dns:$(hostname -f)" \ -keystore /etc/security/serverKeys/keystore.jks keytool -certreq -alias $(hostname -f) -keystore /etc/security/serverKeys/keystore.jks -file host.csr # 2. sign host.csr with your company CA, then import the CA and the signed cert keytool -importcert -alias rootca -file ca.pem -keystore /etc/security/serverKeys/keystore.jks keytool -importcert -alias $(hostname -f) -file host-signed.pem -keystore /etc/security/serverKeys/keystore.jks # 3. truststore with the CA so daemons trust each other keytool -importcert -alias rootca -file ca.pem -keystore /etc/security/serverKeys/truststore.jks keytool -list -keystore /etc/security/serverKeys/keystore.jks
xml <!-- ssl-server.xml --> <property><name>ssl.server.keystore.location</name><value>/etc/security/serverKeys/keystore.jks</value></property> <property><name>ssl.server.keystore.password</name><value>${KEYSTORE_PASS}</value></property> <property><name>ssl.server.truststore.location</name><value>/etc/security/serverKeys/truststore.jks</value></property> <property><name>ssl.server.truststore.password</name><value>${TRUST_PASS}</value></property>
Passwords in files: Use Hadoop credential providers (hadoop credential create ssl.server.keystore.password -provider jceks://file/...) instead of plain text where supported, and restrict file modes. Track certificate expiry dates with monitoring: expired certs are a very common outage.
bash hdfs getconf -confKey dfs.http.policy curl --cacert ca.pem https://master1.example.com:9871/jmx?qry=Hadoop:service=NameNode,name=NameNodeInfo echo | openssl s_client -connect master1.example.com:9871 2>/dev/null | openssl x509 -noout -dates

Apache Knox: One Gateway for Users

Without a gateway, users need network access to dozens of host ports and each service has its own login. Knox is a reverse proxy: one HTTPS entry point, central authentication (LDAP, SSO) and URL rewriting.

text Users / BI tools --HTTPS--> Knox gateway (8443) --> WebHDFS, YARN RM, Hive (HTTP mode), HBase REST, UIs | LDAP / AD authentication, Ranger Knox plugin authorization, audit
xml <!-- conf/topologies/prod.xml : defines URL https://knox:8443/gateway/prod/... --> <topology> <gateway> <provider> <role>authentication</role><name>ShiroProvider</name><enabled>true</enabled> <param><name>main.ldapRealm</name><value>org.apache.knox.gateway.shirorealm.KnoxLdapRealm</value></param> <param><name>main.ldapRealm.userDnTemplate</name><value>uid={0},ou=people,dc=example,dc=com</value></param> <param><name>main.ldapRealm.contextFactory.url</name><value>ldaps://ldap.example.com:636</value></param> <param><name>urls./**</name><value>authcBasic</value></param> </provider> </gateway> <service><role>WEBHDFS</role><url>https://nn1.example.com:9871/webhdfs</url></service> <service><role>RESOURCEMANAGER</role><url>https://rm1.example.com:8090/ws</url></service> <service><role>HIVE</role><url>http://hs2.example.com:10001/cliservice</url></service> </topology>
bash # user lists a directory through Knox curl -iku alice:*** "https://knox.example.com:8443/gateway/prod/webhdfs/v1/user/alice?op=LISTSTATUS" # Hive through Knox (HiveServer2 must be in HTTP transport mode) beeline -u "jdbc:hive2://knox.example.com:8443/;ssl=true;transportMode=http;httpPath=gateway/prod/hive" -n alice
Network design: Put Knox in a DMZ or edge subnet. Block direct user access to NameNode, ResourceManager and Hive ports with the firewall, so Knox is the only door.

Verification Checklist

  • All web UIs only on HTTPS and certificates are from a trusted CA
  • Certificate expiry alerts at 30 and 7 days
  • Cipher suites and TLS versions follow company policy (TLS 1.2 and above)
  • Knox topologies stored in Git, LDAP bind password in the Knox credential store
  • Test: sniff traffic (lab) and confirm there is no plain text

Conclusion

Set RPC and data transfer protection to privacy, use HTTPS everywhere with managed keystores and truststores, watch certificate expiry, and publish services to users through the Knox gateway with LDAP login and audit.

Quick Summary: rpc privacy + data transfer privacy + HTTPS_ONLY + Knox topology.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators