非対話式でApache HTTPD Webサーバーを起動する

非対話式でApache HTTPD Webサーバーを起動する

Apache httpd Webサーバーを起動したときに表示されるパスワードを非対話式で提供したいと思います。

パスワードは変数です。

次のように手動でパスワードを入力して入力する必要はありません。

/web/apps/perf/apache/2.4.46/https-model/bin/apachectl -k start
Apache/2.4.46 mod_ssl (Pass Phrase Dialog)
Some of your private key files are encrypted for security reasons.
In order to read them you have to provide the pass phrases.

Private key model.com:443:0 (/web/apps/perf/apache/2.4.46/https-model/ssl/model.key)
Enter pass phrase:

次のオプションを試しましたが、その何も役に立ちませんでした。

echo -n "mypassword" | /web/apps/perf/apache/2.4.46/https-model/bin/apachectl -k start
echo "mypassword" >> /web/apps/perf/apache/2.4.46/https-model/bin/apachectl -k start
/web/apps/perf/apache/2.4.46/https-model/bin/apachectl -k start << echo "mypassword"
/web/apps/perf/apache/2.4.46/https-model/bin/apachectl -k start << cat mypasswordfile (where mypasswordfile is a file having the password.)

何か提案してもらえますか?

ベストアンサー1

SSL証明書秘密鍵がパスワードで保護されているようです。最良かつ簡単な方法は、キーからパスワードを削除することです。

openssl rsa -in [original.key] -out [new.key]

キーのパスワードを入力するように求められます。実行後、new.keyにパスワードはありません。これを置き換えるか、Apacheに「新しい」生成されたキーを指すようにすることができます。

何らかの理由で秘密鍵のパスワードを設定する場合は、次の方法を使用できます。https://serverfault.com/a/160835

おすすめ記事