CentOS6でHTTPSアクセス可能にする

導入手順

mod_sslをインストールします。

# yum -y install mod_ssl

続いてSSLサーバ証明書を作成します。

# yum -y install openssl
# openssl genrsa 2024 > server.key
# openssl req -new -key server.key > 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) []:AAAA
Locality Name (eg, city) [Default City]:XXXX-shi
Organization Name (eg, company) [Default Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:omoshiro-joho.com
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
# openssl x509 -req -days 3650 -signkey server.key < server.csr > server.crt

補足ですが、今回は自己署名なので server.csr の生成が余計なステップに見えますが、 外部の認証局に署名してもらう場合は、csr の生成と署名適用は実行者が異なるので、別々のステップとなります。

Apacheの設定を行ないます。 /etc/httpd/conf.d/ssl.conf を開いて、下記の2項目を編集します。

SSLCertificateFile /etc/httpd/conf/ssl/server.crt
SSLCertificateKeyFile /etc/httpd/conf/ssl/server.key

Apacheを再起動します。

# apachectl restart

得られる効果

SSLサーバ証明書は下記の2つの効果がありますが、自己署名のため、暗号化の効果しかありません。 ただ、自分の導入目的は、ホテルや公共のwifiなどの環境から、自サイトの管理画面へログインする際のパスワード保護が目的なので、それで十分です。

個人サーバで実在性証明を満たすには、費用対効果が悪すぎます。 ブラウザで自分のサーバに警告表示が出るのは、気分が良くないので何とかしたいのですが。 Let's encryptというサービスもありますが、実在性証明を満たしているとは思えないので、 いずれ信頼できない認証局という扱いになってしまうような気もしています。


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2020-09-08 (火) 22:23:23