[server] オレオレ証明書の登録方法メモ  #CentOS7.0 + Apache + mod-ssl 編


Tips サーバー テクノロジー


#apacheのインストール $ yum -y install httpd #apacheの起動 $ systemctl start httpd.service #open-sslのインストール $ yum -y install openssl # mod-sslのインストール $ yum -y install mod_ssl



$ openssl genrsa -aes128 1024 > server.key Generating RSA private key, 1024 bit long modulus .......++++++ .......................++++++ e is 65537 (0x10001) Enter pass phrase: ***** Verifying - Enter pass phrase: ***** Verify failure User interface error 139960119879584:error:0906906F:PEM routines:PEM_ASN1_write_bio:read key:pem_lib.c:382:


$ openssl req -new -key server.key > 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) [XX]: *** string is too long, it needs to be less than 2 bytes long Country Name (2 letter code) [XX]:*** State or Province Name (full name) []:*** Locality Name (eg, city) [Default City]:*** Organization Name (eg, company) [Default Company Ltd]:*** Organizational Unit Name (eg, section) []:*** Common Name (eg, your name or your server's hostname) []: Email Address []: Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []:*** An optional company name []:


$ openssl x509 -in server.csr -days 365 -req -signkey server.key > server.crt Signature ok subject=/C=***/ST=***/L=***/O=***/OU=*** Getting Private key Enter pass phrase for server.key: <font color="red">***</font>


$ mv server.* /etc/ssl/certs/


# /etc/httpd/conf.d/ssl.conf の編集 -- ##SSLCertificateFile /etc/pki/tls/certs/localhost.crt SSLCertificateFile /etc/ssl/certs/server.crt -- ##SSLCertificateKeyFile /etc/pki/tls/private/localhost.key SSLCertificateKeyFile /etc/ssl/certs/server.key --


$ systemctl restart httpd.service Enter SSL pass phrase for localhost.localdomain:443 (RSA) : ********



このWebサイトは、独自思考で我が道を行くユゲタの少し尖った思考のTechブログです。 毎日興味がどんどん切り替わるので、テーマはマルチになっています。 もしかしたらアイデアに困っている人の助けになるかもしれません。