「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicrosofttech.osscons.jp/]]」は、「[[Open棟梁Project>https://github.com/OpenTouryoProject/]]」,「[[OSSコンソーシアム .NET開発基盤部会>https://www.osscons.jp/dotNetDevelopmentInfrastructure/]]」によって運営されています。 -[[戻る>IIS]] * 目次 [#o22500dc] #contents *概要 [#nc150cda] 自己署名証明書は、随分、簡単になった。 *詳細 [#pad16528] 以下を参照 **自己証明証明書 [#rc4d204b] 自己署名入り証明書は、 -GUIで簡単に生成&設定可能(ただし、CNが、localhostかNetBIOS名になっている) --IIS で SSL/TLS を 自己署名入り証明書 で 設定 する方法 - galife~ https://garafu.blogspot.com/2014/03/iis-ssltls.html -[[OpenSSL>#wc42b90a]]や[[PowerShell>#aef9c5a5]]などのツールを使って生成するケースもある。 --OpenSSL で SSL 自己証明書を発行する手順~ https://weblabo.oscasierra.net/openssl-gencert-1/ --Windowsにて自己署名証明書の作成 - goodbyegangsterのブログ~ https://goodbyegangster.hatenablog.com/entry/2019/10/09/231611 -開発環境であれば、[[IIS Express]]の証明書を使用することもできる。 **証明書発行要求の生成 [#de96ef83] -CNに任意のFQDN名を設定する(IPアドレスを設定することも可能) -CNに任意のFQDN名を設定する~ (IPアドレスを設定することも可能) -以下のツールで発行可能 --[[IIS Manager>#jab4ab58]] --[[PowerShell>#aef9c5a5]] --[[OpenSSL>#wc42b90a]] -証明書発行要求を生成し、公認CA(認証局)に送信する際、~ [[CAの公開する手順>#yf9b6819]]などを参考にして、生成すると良い。 ***IIS Manager [#jab4ab58] -参考 --Windows Server Tips ---IISでhttpsのサイトを作成する - SSLサイトの構成~ https://www.ipentec.com/document/windows-windows-server-iis-setup-https-site ---SAN(Subject Alternative Name)フィールド を含むSSL証明書を作成する~ https://www.ipentec.com/document/windows-server-create-ssl-certification-including-san-dns-name-field ***PowerShell [#aef9c5a5] -参考 --IIS 自己証明書の警告エラー無しで作成方法。~ localhostをSSL/TLSで接続。 これくらいブログ~ http://korekurai.com/itrelated/iis-localhost-create-self-signed-certificate.html ***[[OpenSSL]] [#wc42b90a] >openssl req -out testsite.csr -key server.key -new 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) [AU]:jp State or Province Name (full name) [Some-State]:hoge Locality Name (eg, city) []:hoge Organization Name (eg, company) [Internet Widgits Pty Ltd]:open Organizational Unit Name (eg, section) []:touryo Common Name (e.g. server FQDN or YOUR name) []:(FQDN名) Email Address []: Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []: -参考 --IISのSSL証明書をDebian + OpenSSLで作成する - Symfoware~ https://symfoware.blog.fc2.com/blog-entry-1123.html ***参考 [#yf9b6819] -SSL サーバ証明書:DigiCert|(デジサート) --サーバー証明書 IIS 10 CSR作成方法~ https://rms.ne.jp/sslserver/csr/csr-iis10-html/ --IIS10サーバー証明書インストール方法~ https://rms.ne.jp/sslserver/install/install-iis10-html/ **証明書発行要求に応答 [#tb32bec3] Chromeで、NET::ERR_CERT_COMMON_NAME_INVALIDが出る場合、~ SAN(Subject Alternative Name)フィールドを含める必要がある。 ***[[証明書サービス (AD CS)]] [#v49f2306] [[Active Directory]] の [[証明書サービス (AD CS)]]を使用する。 ***[[OpenSSL]] [#b1ec45f2] [[証明書サービス (AD CS)>#v49f2306]]はサーバOSのみなので、~ クライアントOSの場合は、[[OpenSSL]]を利用する。 -普通に証明書発行要求に応答する。 --認証局の秘密鍵を作成 >openssl genrsa -des3 -out server.key 1024 Generating RSA private key, 1024 bit long modulus (2 primes) .................................+++++ ..................+++++ e is 65537 (0x010001) Enter pass phrase for server.key:(任意のパスフレーズ) Verifying - Enter pass phrase for server.key:(任意のパスフレーズ) --PEMフレーズ(PEM phrase)で暗号化解除 >openssl rsa -in server.key -out server.key Enter pass phrase for server.key:(任意のパスフレーズ) writing RSA key --証明書発行要求に応答する。 >openssl x509 -in testsite.txt -out testsite.crt -req -signkey server.key -days 3650 Signature ok subject=C = JP, ST = hoge, L = hoge, O = hoge, OU = hoge, CN = FQDN名 Getting Private key --応答のフォーマットをcrtからpkcs12に変換する。 >openssl pkcs12 -export -in testsite.crt -inkey server.key -out testsite.pkcs12 Enter Export Password:(IISで完了するには空白に設定) Verifying - Enter Export Password:(IISで完了するには空白に設定) --IISで「証明書の要求の完了」を行う。~ 新しい証明書の証明書ストアは「個人」を選択する。 --サイトに証明書をバインドして、~ 「信頼されたルート証明機関」にpkcs12をインポートする。 -SAN(Subject Alternative Name)フィールドを含める場合、 --最初の手順は前述と同様。 --san.txtを準備する。 subjectAltName = DNS:(FQDN名) --証明書発行要求に応答する~ (-extfile san.txt を指定する)。 >openssl x509 -in testsite.txt -out testsite.crt -req -signkey server.key -days 3650 -extfile san.txt Signature ok subject=C = JP, ST = hoge, L = hoge, O = hoge, OU = hoge, CN = FQDN名 Getting Private key --残りの手順は前述と同様。 -参考 --SAN(Subject Alternative Name) のオレオレ証明書 - Qiita~ https://qiita.com/nis_nagaid_1984/items/b8f87d41ea108d47af61 *参考 [#c234eeff] **[[証明書]] [#k49a989a] **[[IIS Express>IIS Express#e3024cbb]] [#xbf97dca] ---- Tags: [[:インフラストラクチャ]], [[:Windows]], [[:IIS]], [[:障害対応]], [[:性能]], [[:デバッグ]]