-1

In a shell/bash script (I use it for vagrant provision), I configure apache2 server and then restart it. But since I use a key file for https, apache asks for a password. How can I automate this and tell the script my password. Could this be done with something like this?

sudo apachectl restart <<< "mypassword"

(Set aside any security issues: this is only for development and vagrant is insecure by default)

P.S. I really don't want to install any additional software, since script should be as lean as possible.

αғsнιη
  • 41,407

1 Answers1

3

If I understand you correctly, apache2 is prompting for the password to unlock the TLS private key you use for HTTPS?

If you don't want that extra security on expense of usability, your best option is to remove the password from the key as described here: stop apache from asking for SSL password each restart

You can also provide the password via a file and reference it in the apache configuration as described here: SSL password on apache2 restart However this will reduce having the password in the first place to absurdity.

αғsнιη
  • 41,407
Richard Neumann
  • 1,399
  • 3
  • 14
  • 24
  • thank you – someone who actually reads my question! this solved my problem. Didn't need a pwd anyway and couldn't figure out how to generate a key with openssl without a pwd. – Stefan Boehringer Mar 06 '18 at 06:54