Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For mod_ssl in apache to work, you need your RSA private key on the server. If the key is passphrase protected, you have to enter the passphrase whenever you restart apache. There is SSLPassPhraseDialog so you can store the key encrypted and have a program pass it the phrase, but that really isn't any more secure than keeping it unencrypted.

I'm wondering if apache supports, or can be made to support, using a key agent for operations needing the private key, much like how ssh-agent for openssh works. That way I only need to type the passphrase to the key whenever the server itself reboots (assuming the agent doesn't die somehow during normal operations).

I realize that the key is stored in memory inside the agent, and obtaining it from memory possible, but it's hard to do. Also, if the agent is actually forwarded over ssh from another host and the key is in memory over there, then obtaining the private key is impossible, if just the webserver is compromised.

If the answer is "no" on apache currently supporting this, what is the answer on "can it be made to support this"? I'm unsure how the key operations work, and what level of exposure is needed on the private key, and figured I'd ask before I dove into the code to try and hack something together myself.

share|improve this question
up vote 2 down vote accepted

Your idea is interesting at first sight but it is not really relevant. Your proposal only pushes the security issue elsewhere.

Your Apache2 process will have to communicate with the "private key cache" thanks to IPC or API and this channel should be protected too or else an attacker may query the certificate easily.

So if you are not confident in your filesystem security to let your server certificate without passphrase, such a cache mechanism is not more secure.

By the way, there are only few reasons to fully restart Apache2 - like SSL configuration changes. You should prefer the apachectl graceful command which does not require the certificate to be reloaded, and so you are not asked for the passphrase again.

Another idea: if your server security is well monitored thanks to IDS and file integrity checker and it raises an alert in case your system and your SSL certificate may have been compromised, then you can take the risk, rely on revocation lists and let your certificate without passphrase protection to ease your life.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.