LoginSignup
4
4

More than 5 years have passed since last update.

OpenSSLでプライベートCAを構築する方法

Last updated at Posted at 2016-12-14

CAの作成

CAのディレクトリを作成

mkdir /etc/pki/myCA

設定ファイルを用意

/etc/pki/tls/openssl.cnfをmyCAにコピー
openssl.cnfの以下を編集

[ CA_default ]
dir = /etc/pki/myCA

[ req ]
default_md = sha256

[ usr_cert ]
basicConstraints=CA:TRUE
nsCertType = client, email

以下のディレクトリとファイルを作成

mkdir certs
mkdir crl
mkdir newcerts
mkdir private
touch index.txt
touch serial
echo "01" > serial

認証局の秘密鍵を作成

openssl req -new -config ./openssl.cnf -x509 -keyout cakey.pem -out cacert.pem -days 3650 -sha256

サーバ証明書の作成

鍵の作成

openssl genrsa -out 出力ファイル

CSRを作成

openssl req -new -sha256 -key 鍵ファイル -out 出力ファイル

サーバ証明書をsha256で署名する

openssl ca -md sha256 -config /etc/pki/myCA/openssl.cnf -cert CAの証明書 -keyfile CAの秘密鍵 -out 出力ファイル -infiles CSRファイル

4
4
1

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
4
4