1

We have an apache server in our office premises which is used for some ssl related requests. The office premise has 2 internet connections with static ip address. The internet connections are switched based on load and availability automatically by a hardware firewall and router. The port forwarding is set correctly for the same.

The problem we are facing is that we need to change the SSL certificate on the server based on the ip address which is currently in use(which changes at average frequency of 1 day). Is there some automatic way in which we can use the correct SSL certificate depending on the ip address in use?

10
  • So we could as well assume that you have a dynamic IP?
    – William
    Commented Oct 7, 2014 at 12:52
  • No it is not a dynamic ip it is 2 static ips, so a hardcoded solution will also work in which we can run some batch script to change the certificate.
    – puneet
    Commented Oct 7, 2014 at 13:01
  • Two static IP's that change from time to time?
    – William
    Commented Oct 7, 2014 at 13:04
  • Yes, automatically so that internet can be switched seamlessly without any obstruction due to network failures.
    – puneet
    Commented Oct 7, 2014 at 13:04
  • Yes, so we could assume your IP is dynamic.
    – William
    Commented Oct 7, 2014 at 13:05

1 Answer 1

1

Apache can be configured to serve different SSL for each of your IP addresses. To do so, you need to set up Virtual hosts for each IP address on port 433. For example:

Listen 2.2.2.2:443
Listen 3.3.3.3:443

<VirtualHost 2.2.2.2:443>
    ServerName secure.com
    DocumentRoot /home/foo/secure.com
    SSLEngine on
    SSLCertificateFile /home/foo/ssl/secure.com.crt
    SSLCertificateKeyFile /home/foo/ssl/secure.com.key
    SSLCACertificateFile /home/foo/ssl/ca.txt
</VirtualHost>

<VirtualHost 3.3.3.3:443>
    ServerName secure.net
    DocumentRoot /home/foo/secure.net
    SSLEngine on
    SSLCertificateFile /home/foo/ssl/secure.net.crt
    SSLCertificateKeyFile /home/foo/ssl/secure.net.key
    SSLCACertificateFile /home/foo/ssl/ca.txt
</VirtualHost>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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