[root@localhost ssl]# openssl req -new -key server.key -out server.csr Enter pass phrase for server.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) [GB]:cn State or Province Name (full name) [Berkshire]:shanghai Locality Name (eg, city) [Newbury]:shanghai Organization Name (eg, company) [My Company Ltd]:gongsilong Organizational Unit Name (eg, section) []:business Common Name (eg, your name or your server‘s hostname) []:ops Email Address []:mch@gongsilong.com
Please enter the following ‘extra‘ attributes to be sent with your certificate request A challenge password []:gongsilong0617 An optional company name []:gongsilong [root@localhost ssl]#
[root@localhost client]# openssl req -new -key client.key -out client.csr Enter pass phrase for client.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) [GB]:cn State or Province Name (full name) [Berkshire]:shanghai Locality Name (eg, city) [Newbury]:shanghai Organization Name (eg, company) [My Company Ltd]:gongsilong Organizational Unit Name (eg, section) []:business Common Name (eg, your name or your server‘s hostname) []:ops Email Address []:mch@gongsilong.com
Please enter the following ‘extra‘ attributes to be sent with your certificate request A challenge password []:plclient0618 An optional company name []:gongsilong
[root@localhost ssl]# openssl req -new -x509 -nodes -keyout ca.key -out ca.crt Generating a 1024 bit RSA private key .......++++++ ................++++++ writing new private key to ‘ca.key‘ Enter PEM pass phrase: Verifying - Enter PEM pass phrase: ----- 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) [GB]:cn State or Province Name (full name) [Berkshire]:shanghai Locality Name (eg, city) [Newbury]: writing new private key to ‘ca.key‘Organization Name (eg, company) [My Company Ltd]: [root@localhost ssl]# openssl req -new -x509 -keyout ca.key -out ca.crt Generating a 1024 bit RSA private key ..............++++++ ..................................................++++++ writing new private key to ‘ca.key‘ Enter PEM pass phrase: Verifying - Enter PEM pass phrase: ----- 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) [GB]:cn State or Province Name (full name) [Berkshire]:shanghai Locality Name (eg, city) [Newbury]:shanghai Organization Name (eg, company) [My Company Ltd]:gongsilong Organizational Unit Name (eg, section) []:business Common Name (eg, your name or your server‘s hostname) []:ops Email Address []:mch@gongsilong.com [root@localhost ssl]# [root@localhost ssl]# mch@gongsilong.com -bash: mch@gongsilong.com: command not found [root@localhost ssl]#
签署证书准备工作: [root@mail ssl]# vim /etc/pki/tls/openssl.cnf #dir = ../../CA //修改如下 dir = /etc/pki/plocc/CA
[root@localhost conf]# service nginx stop stop nginx Enter PEM pass phrase: phrase is too short, needs to be at least 4 chars Enter PEM pass phrase: phrase is too short, needs to be at least 4 chars Enter PEM pass phrase: