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

1
  • lol this is not a sudo problem!! for all who marked my question as duplicate. I don't want sudo pwd but the cert-key pwd... Mar 6, 2018 at 6:51

1 Answer 1

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.

1
  • 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. Mar 6, 2018 at 6:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .