[101]# htpasswd -c /etc/httpd/conf.d/.httpuser bob
New password:
Re-type new password:
Adding password for user gordon
创建其它帐号用来比对的
[101]# htpasswd /etc/httpd/conf.d/.httpuser alice
New password:
Re-type new password:
Adding password for user gordon
#创建好了。注意-c是如果文件不存在则创建,所有,第二次创建帐号的时候就不用了
[101]# cat .httpuser
alice:$apr1$L6DKffOJ$OQGGXY7sVrHAnnrj3lGFO.
bob:$apr1$Z1HGoQHF$9CZHizsbmE21wpasHy0Gm1
[102]$ mkdir -p /etc/httpd/conf.d/ssl
[102]$ cd /etc/httpd/conf.d/ssl
创建CA密钥
[102]$ (umask 066; openssl genrsa 2048 > cakey.pem)
Generating RSA private key, 2048 bit long modulus
..........................................................+++
.............................................+++
e is 65537 (0x10001)
创建CA证书
[102]$ openssl req -new -x509 -key cakey.pem -out cacert.pem -days 888
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) [XX]:CN
State or Province Name (full name) []:beijing
Locality Name (eg, city) [Default City]:beijing
Organization Name (eg, company) [Default Company Ltd]:baidu
Organizational Unit Name (eg, section) []:devops
Common Name (eg, your name or your server's hostname) []:www.baidu.com
Email Address []:
生成证书申请文件
[102]$ openssl req -newkey rsa:1024 -nodes -keyout httpd.key > httpd.csr
Generating a 1024 bit RSA private key
......................................................++++++
......++++++
writing new private key to 'httpd.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) [XX]:CN
State or Province Name (full name) []:beijing
Locality Name (eg, city) [Default City]:beijing
Organization Name (eg, company) [Default Company Ltd]:baidu
Organizational Unit Name (eg, section) []:devops
Common Name (eg, your name or your server's hostname) []:www.baidu.com
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []: