Search code examples
azuresslhttpsazure-application-gatewayweb-application-firewall

How to get "HTTPS" / SSL Working - Azure WAF (application gateway) with 2 Websites on Linux


I am having trouble with getting SSL/HTTPS working on a Azure WAF (ApplicationGateway) (http / port:80 is working fine)

I will explain the scenario as basic as possible:

The developer has made two websites (for this example: let’s say X.com and Y.com) both on a Linux Front End server in AZURE which sit behind a NSG as well as a Azure Application Gateway WAF

The developer points DNS records of X.com and Y.com to the WAF's single IP (appGatewayFrontendIP)

Users can browse through to both websites http / port:80 with no problem.


The trouble now lies with how to get SSL working, so far:

The developer has applied SSL certificates to both websites on the Linux Web Server in Azure


How does one get SSL working on the WAF?
I have been looking through MS Docs all day but not really sure how to get this to work (https://learn.microsoft.com/en-us/azure/application-gateway/create-ssl-portal)

I see we need to put a PFX certificate inside - I am assuming a selfsigned one is NOT the way to go. However I am non the wiser as to what I do in this scenario -

How do I get a PFX certificate and how does this work when you have 2 websites on a single Front End Linux Server -

Do I need to take off the SSL Certs on the Front End Linux server and instead of .cert get a .PFX cert and upload via Azure Portal?

Any help truly welcome! :)

Thanks


Solution

  • If you want the front-end (ie public IP) to serve up HTTPS you'll need the PFX certificate assigned to the listener of the appropriate back-end site.

    For example: XPfxCert should be assigned to the listener that directs traffic to the X.com app YPfxCert should be assigned to the listener that directs traffic to the Y.com app

    This will encrypt traffic between your customers and the WAF. You'll need to obtain one from a certificate authority (eg. comodoca.com) to ensure your end user does not get one of those errors like you'd see here if you used self-signed: https://self-signed.badssl.com/

    In addition you'll need different certs for the back-end. This will encrypt traffic between the WAF and your apps (even though they're all in Azure you'll still need this). It gets assigned in the HTTPSettings. You may be able to get away with self-signed here; however, at our work we use CA provided certs for both.

    Lastly, if the goal is to host both X.com and Y.com on the same VM you should be able to configure path based rules that would direct traffic appropriately. As an alternative you could have multiple NICs on your VM and configure multiple back-end pools to direct traffic to the appropriate site.

    References: