LoginSignup
2
2

More than 5 years have passed since last update.

オレオレSSL証明書

Last updated at Posted at 2016-05-09

テスト用でSSLを使いたいときや SSLサイトのモックを作るときなどにつかいます。

証明書作成

openssl genrsa -out server.key 2048
openssl req -new -key server.key -out server.csr
openssl x509 -days 3650 -req -signkey server.key -in server.csr -out server.crt

server.key サーバ秘密鍵
server.crt サーバ証明書

apacheの設定

conf/extra/httpd-ssl.conf
SSLCertificateFile  "/path/to/ssl/server.ssl"
SSLCertificateKeyFile "/path/to/ssl/server.key"

再起動

# apachectl graceful

確認

$ curl https://localhost
curl: (60) Peer's certificate issuer has been marked as not trusted by the user.
More details here: http://curl.haxx.se/docs/sslcerts.html

$ curl -k https://localhost

オレオレCA

CentOS 6 で作る例。

CAコマンドで使いやすいようにしちゃう

sudo /etc/pki/tls/misc/CA -newca
cp server.csr newreq.pem
sudo /etc/pki/tls/misc/CA -sign
cp newcert.pem server.crt
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2