既存のプルチェーン証明書の拡張

既存のプルチェーン証明書の拡張

サブドメインの新しい証明書を作成する代わりに、既存のファイルを拡張したいと思います。

私のファイルにはすでに次のフィールドがあります。

certtool -i < /etc/letsencrypt/live/example.org-0002/fullchain.pem|grep DNSname
                        DNSname: forum.example.com
                        DNSname: m.example.de
                        DNSname: m.example.org
                        DNSname: example.com
                        DNSname: example.de
                        DNSname: example.org
                        DNSname: wiki.example.org
                        DNSname: www.example.com
                        DNSname: www.example.de
                        DNSname: www.example.org

( certtoolDebian パッケージの一部)gnutls-bin

わかりました。このcertbot --expandオプションがありますが、正しいドメインをリセットしないと、次のサフィックスを含む新しい証明書が生成されます。-0003

既存の証明書ファイルにのみドメインを追加したい場合は、これが発生しないようにするにはどうすればよいですか?

ベストアンサー1

出力からリストを生成するには、次のコマンドを使用します。

echo 'echo "-d $@"'>/tmp/runme.sh
chmod +x /tmp/runme.sh
domains_with_hyphen_d="$(certtool -i < /etc/letsencrypt/live/example.org-0002/fullchain.pem|grep DNSname|cut -d ":" -f2| xargs -n 1 /tmp/runme.sh|xargs)"
certbot certonly --webroot -w /usr/share/nginx/html/ --expand -d newsubdomain.example.org $domains_with_hyphen_d

おすすめ記事