1

Are there any directives or constructs I can use in Apache 2.4 to prevent Apache from failing to load at all if a certificate file is missing for an https Virtualhost is missing.

(I am dealing with a process that - on a remote system - creates a configuration file and pushes it to Apache. The issue is that a secure certificate may not have been generated for all the hosts, and I don't want this to cause apache not to start).

Ideally I'd like something which effectivity says "If this file exists, load this virtualhost", or, if it needs to be done within a virtualhost "If file exists, use these directives/files, else use default directives/file" - but I've been unable to find any reference to a way to do this.

davidgo
  • 68,623
  • 13
  • 106
  • 163
  • Could you adjust the script so a holding cert is always present in the event one doesn't generate? – Paul Jul 26 '18 at 01:13
  • Unfortunately this is not an option as the same config file is pushed to multiple servers with different active hosts, and the server generating it can't (as set up) see what certs are available. – davidgo Jul 26 '18 at 01:17
  • 1
    (I appreciate I am not answering your specific question but I also cannot see a way to do it) Once the config file is pushed, apache must need to do a reload to fail because of missing certs. The process that triggers the reload could do an apache config test first, and populate missing certs where needed? – Paul Jul 26 '18 at 02:32
  • @Paul I'm reluctantly contemplating something of this nature - but I don't like it - ie find all the Certificate files in the config and ensure they exist. – davidgo Jul 26 '18 at 02:35
  • `apachectl configtest` will do this for you, then you can parse the output to either automatically address issues, or alert you that something isn't right – Paul Jul 26 '18 at 02:39
  • Thank you for the thought. I just tested it, and disappointingly discovered it only prints the first missing file – davidgo Jul 26 '18 at 02:44
  • Oh. Well that is crap! That would mean a loop testing and fixing which falls into the category of heading in the wrong direction in my book. – Paul Jul 26 '18 at 02:51

0 Answers0