Apstraサーバーを初めて起動すると、一意の自己署名証明書が自動的に生成され、 /etc/aos/nginx.conf.d
でApstraサーバーに保存されます(nginx.crt
はWebサーバーの公開鍵、 nginx.key
は秘密鍵です)。証明書は、ApstraサーバーとREST APIの暗号化に使用されます。これは、内部のデバイスとサーバーの接続用ではありません。システムのバックアップ時にHTTPS証明書は保持されないため、 etc/aos
フォルダを手動でバックアップする必要があります。デフォルトの SSL 証明を置き換えることをお勧めします。Web サーバー証明書の管理は、エンド ユーザーの責任です。ジュニパーのサポートはベストエフォートのみとなります。
- 既存の OpenSSL キーをバックアップします。
admin@aos-server:/$ sudo -s
[sudo] password for admin:
root@aos-server:/# cd /etc/aos/nginx.conf.d
root@aos-server:/etc/aos/nginx.conf.d# cp nginx.crt nginx.crt.old
root@aos-server:/etc/aos/nginx.conf.d# cp nginx.key nginx.key.old
- 組み込みの openssl コマンドを使用して、新しい OpenSSL 秘密キーを作成します。
root@aos-server:/etc/aos/nginx.conf.d# openssl genrsa -out nginx.key 2048
Generating RSA private key, 2048 bit long modulus
.............+++
......+++
e is 65537 (0x10001)
注意:
nginx.crt
ファイル名やnginx.key
ファイル名は変更しないでください。これらはnginx.conf
で言及されています。その後のサービス アップグレードの一環として、これらのファイルは置き換えられる可能性があるため、ファイル名は予測可能である必要があります。
また、このファイルはApstraサーバーのアップグレード中に置き換えられる可能性があり、行った変更は破棄されるため、 nginx.conf
で設定を変更しないでください。
- 証明書署名要求を作成します。ApstraサーバーのHTTPSサービス用に主観的な代替名(SAN)を使用して署名付きSSL 証明を作成する場合は、OpenSSLテンプレートを手動で作成する必要があります。詳細については、ジュニパーサポートナレッジベース記事KB37299をご覧ください。
注意:
高度な証明書要求用のカスタム OpenSSL 構成ファイルを作成した場合は、それらを Nginx 構成フォルダーに残さないでください。起動時に、Nginxはそれら(* .conf)をロードしようとし、サービス障害を引き起こします。
root@aos-server:/etc/aos/nginx.conf.d# openssl req -new -sha256 -key nginx.key -out nginx.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) [AU]:US
State or Province Name (full name) [Some-State]:California
Locality Name (eg, city) []:Menlo Park
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Apstra, Inc
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:aos-server.apstra.com
Email Address []:support@apstra.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
- 証明書署名要求 (nginx.csr) を認証局に送信します。必要な手順は、このドキュメントの範囲外です。CA 命令は実装ごとに異なります。有効なSSL 証明であれば何でも構いません。以下の例は、証明書に自己署名するためのものです。
root@aos-server:/etc/aos/nginx.conf.d# openssl req -x509 -sha256 -days 3650 -key nginx.key -in nginx.csr -out nginx.crt
root@aos-server:/etc/aos/nginx.conf.d#
- SSL証明書が一致していることを確認します:秘密鍵、公開鍵、CSR。
root@aos-server:/etc/aos/nginx.conf.d# openssl rsa -noout -modulus -in nginx.key | openssl md5
(stdin)= 60ac4532a708c98d70fee0dbcaab1e75
root@aos-server:/etc/aos/nginx.conf.d# openssl req -noout -modulus -in nginx.csr | openssl md5
(stdin)= 60ac4532a708c98d70fee0dbcaab1e75
root@aos-server:/etc/aos/nginx.conf.d# openssl x509 -noout -modulus -in nginx.crt | openssl md5
(stdin)= 60ac4532a708c98d70fee0dbcaab1e75
- 新しい証明書を読み込むには、nginx コンテナーを再起動します。
root@aos-server:/etc/aos/nginx.conf.d# docker restart aos_nginx_1
aos_nginx_1
root@aos-server:/etc/aos/nginx.conf.d
- 新しい証明書が Web ブラウザーにあること、および新しい証明書の共通名が 'aos-server.apstra.com' と一致することを確認します。