OPNsense Forum

English Forums => Web Proxy Filtering and Caching => Topic started by: browne on February 25, 2021, 10:42:40 am

Title: [SOLVED] LE: multiple domains with different WAN IPs, individual certificates
Post by: browne on February 25, 2021, 10:42:40 am
Hello,

I have set up my OPNsense as a reverse proxy using HAProxy and Let's Encrypt.

Right now I only have one certificate for my domain1.browne.com that has WAN1_IP.
However I need another certificate for my domain2.browne.com that has WAN2_IP.

My setup looks like this:
WAN1_IP (10.1.1.1) --> domain1.browne.com --> already uses a LE certificate (certificate1)
WAN2_IP (10.1.1.2) --> domain2.browne.com --> doesn't use LE certificate, but needs one (certificate2)

I know how to create the 2nd WAN interface and all that...
But how do I tell the ACME client to use WAN1 to generate certificate1 and use WAN2 for certificate2?

When I try to get certificate2 the ACME client on OPNsense always uses the default gateway, which is in my case WAN1 (10.1.1.1). The certificate generation then fails because certificate2 is resolving domain2 (10.1.1.2) during acme challenge. So the IP (WAN1) requesting the certificate (certificate2) is not matching to the IP of the domain (domain2) listed inside the certificate.
Title: Re: Let's Encrypt: multiple WAN IPs with individual certificates
Post by: Greelan on February 25, 2021, 11:15:29 am
Not really sure what you are asking. LE issues certificates for domains, not IPs. Presumably you can have certs issued for whatever domains you want nginx to listen on, and have DNS records for each domain that point to the WAN IP that you want to reach that domain on? Maybe I have just misunderstood what you are after.
Title: Re: Let's Encrypt: multiple WAN IPs with individual certificates
Post by: browne on February 25, 2021, 11:42:27 am
I know that LE issues certificates for domains not IPs.

I updated the first post.
Title: Let's Encrypt: multiple domains with different WAN IPs, individual certificates
Post by: Greelan on February 25, 2021, 12:24:42 pm
Ah, just saw your revisions. So have edited my post too!

Maybe switch to DNS challenge to get around this issue?
Title: Re: Let's Encrypt: multiple domains with different WAN IPs, individual certificates
Post by: smyers119 on February 25, 2021, 03:18:31 pm
Services --> Let's Encrypt --> Challenge Type

Make a new HTTP challenge using the 2nd WAN.
Title: Re: Let's Encrypt: multiple domains with different WAN IPs, individual certificates
Post by: browne on February 25, 2021, 05:09:17 pm
Services --> Let's Encrypt --> Challenge Type

Make a new HTTP challenge using the 2nd WAN.
In the meantime someone in the german forum already told me to do so.
But thank you still!

This works perfectly fine.