SSL証明書を作成する2015/01/13 |
サーバー独自のSSL自己署名証明書を作成します。 しかし独自に作成した証明書ではアクセス時に警告が出るため、商用で使う場合は ベリサイン 等の正規の認証局が発行する証明書を利用した方がよいでしょう。 |
[root@www ~]# cd /etc/pki/tls/certs [root@www certs]# make server.key umask 77 ; \ /usr/bin/openssl genrsa -des3 1024 > server.key Generating RSA private key, 1024 bit long modulus ......................................................++++++ .............++++++ e is 61251 (0x10001) Enter pass phrase: # パスフレーズ設定 Verifying - Enter pass phrase: # 再入力 # 秘密鍵からパスフレーズを削除 [root@www certs]# openssl rsa -in server.key -out server.key Enter pass phrase for server.key: # パスフレーズ入力 writing RSA key [root@www certs]# [root@www certs]# make server.csr umask 77 ; \ /usr/bin/openssl req -utf8 -new -key server.key -out server.csr 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]: JP # 国 State or Province Name (full name) [e]: Hiroshima # 地域(県) Locality Name (eg, city) [Default City]: Hiroshima # 都市 Organization Name (eg, company) [Default Company Ltd]: Server World # 組織名 Organizational Unit Name (eg, section) []: IT Solution # 組織の部門名 Common Name (eg, your server's hostname) []: www.srv.world # サーバーのFQDN Email Address []: xxx@srv.world # 管理者アドレス Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: # 空Enter An optional company name []: # 空Enter [root@www certs]# [root@www certs]# openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650 # 有効期限が10年の自己署名証明書を作成 Signature ok subject=/C=JP/ST=Hiroshima/L=Hiroshima/O=Server World/OU=IT Solution/CN=www.srv.world/emailAddress=xxx.srv.world Getting Private key [root@www certs]# chmod 400 server.*
|