Apache-Httpd

以非互動方式啟動 apache HTTPD 網路伺服器

  • August 19, 2021

我希望以非互動方式提供啟動 apache httpd 網路伺服器時提示的密碼。

密碼將是一個變數。

我不希望手動提示和輸入密碼,如下所示:

/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.)

你能建議嗎?

看起來您的 SSL 證書私鑰受密碼保護。通常,最好和最簡單的方法是從密鑰中刪除密碼。

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

系統將提示您輸入密鑰的密碼。執行後,new.key 將沒有密碼。您可以替換它或將 Apache 指向“新”生成的密鑰。

如果由於某種原因您想為您的私鑰設置密碼,您可以使用這種方法 - https://serverfault.com/a/160835

引用自:https://unix.stackexchange.com/questions/665066