cd /etc/pki/tls/certs
mkdir backup.{{commonName}}
mv {{commonName}}* ./backup.{{commonName}}/
openssl genrsa -out ./{{commonName}}.key 2048
openssl req -new -key ./{{commonName}}.key -out ./{{commonName}}.csr
Country Name (2 letter code) [GB]:JP State or Province Name (full name) [Berkshire]: Locality Name (eg, city) [Newbury]: Organization Name (eg, company) [My Company Ltd]: Organizational Unit Name (eg, section) []: Common Name (eg, your name or your server's hostname) []:{{commonName}} Email Address []:keiri@jacof.co.jp Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: ※入力すると不正 An optional company name []: ※入力すると不正
openssl req -text -noout -in {{commonName}}.csr
openssl req -text -noout -in {{commonName}}.csr | grep Subject:
cat {{commonName}}.csr
hostnameにwww.がつくときは2way認証をしない
承認方法注意
ページ認証のスキームをhttpで行う場合にはhttpsへのリダイレクト設定をいったん解除する必要があり、その際DocumentRootの設定がないとステータスコードが404になってしまうので設定を忘れないようにする
curl http://{{commonName}}/.well-known/pki-validation/gsdv.txt
vim {{commonName}}.crt
openssl x509 -text -noout -in {{commonName}}.crt
openssl x509 -text -noout -in {{commonName}}.crt | grep Subject:
vim {{commonName}}.cer
cat {{commonName}}.cer
ls -l /etc/pki/tls/certs/{{commonName}}.crt
ls -l /etc/pki/tls/certs/{{commonName}}.key
ls -l /etc/pki/tls/certs/{{commonName}}.csr
/etc/init.d/httpd configtest
service httpd configtest
/etc/init.d/httpd restart
systemctl restart httpd
rm -rf backup.{{commonName}}
/etc/init.d/httpd configtest
service httpd configtest
/etc/init.d/httpd restart
systemctl restart httpd