LoginSignup
1
1

More than 1 year has passed since last update.

OpenSSLで自己証明書を作成する

Posted at

Configファイルを作成する

cert_configを作成する。
下記はAWS 東京リージョンに構築したEC2用の設定。
Domainはワイルドカード(*)を使用している。

[ req ]
prompt             = no
distinguished_name = Domain

[ Domain ]
countryName = JP # 国名
stateOrProvinceName = Tokyo # 都道府県名
organizationName = xxx # 企業名
organizationalUnitName = yyy # 組織名
commonName = *.ap-northeast-1.compute.amazonaws.com # ドメイン名(必須)

[ ExtendedAttributes ]
# "拡張キー使用法"の設定
extendedKeyUsage = 1.3.6.1.5.5.7.3.1 # サーバー認証
# 下記の記法でも可
# extendedKeyUsage = serverAuth

RD Gatewayで自己証明書を利用する場合は、必ず拡張キー使用法サーバー認証に設定する事。
設定しない場合はRD GatewayでImport出来ない。

参考URL:
https://www.openssl.org/docs/manmaster/man5/x509v3_config.html

秘密鍵とサーバー証明書を作成する

秘密鍵(.key)とサーバー証明書(.crt)を作成する。

# 有効期間100年(36500日)の作成例
openssl req -x509 -config cert_config -extensions 'ExtendedAttributes' -nodes -days 36500 -newkey rsa:2048 -keyout xxxxx.key -out xxxxx.crt

証明書をpfx形式に変換する。

openssl pkcs12 -export -out xxxxx.pfx -inkey xxxxx.key -in xxxxx.crt
1
1
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
1
1