root@master:/opt/cloudera/security/pki# $JAVA_HOME/bin/keytool -genkeypair -alias $(hostname -f) -keyalg RSA -keystore /opt/cloudera/security/pki/$(hostname -f).jks -keysize 2048 -dname "CN=$(hostname -f),OU=Engineering,O=Cloudera,L=Palo Alto,ST=California,C=US" -ext san=dns:$(hostname -f) Enter keystore password: Re-enter new password: Enter key password for <master> (RETURN if same as keystore password): Re-enter new password:
root@master:/opt/cloudera/security/pki# openssl genrsa -des3 -out ca.key 2048 Generating RSA private key, 2048 bit long modulus ..................................+++ ......................................................................................................+++ e is 65537 (0x10001) Enter pass phrase for ca.key: Verifying - Enter pass phrase for ca.key:
root@master:/opt/cloudera/security/pki# openssl req -new -key ca.key -out ca.csr Enter pass phrase for ca.key: You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:US State or Province Name (full name) [Some-State]:California Locality Name (eg, city) []:Palo Alto Organization Name (eg, company) [Internet Widgits Pty Ltd]:Cloudera Organizational Unit Name (eg, section) []:Engineering Common Name (e.g. server FQDN or YOUR name) []:master Email Address []:
Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []:
用自己的私钥给自己签发根证书,生成crt文件
1 2 3 4 5 6
root@master:/opt/cloudera/security/pki# openssl x509 -req -days 3650 -in ca.csr -signkey ca.key -out ca.crt Signature ok subject=/C=US/ST=California/L=Palo Alto/O=Cloudera/OU=Engineering/CN=master Getting Private key Enter pass phrase for ca.key: