Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
Tutorials and FAQs
»
Tutorial: Caddy (Reverse Proxy) + Let's Encrypt Certificates + Dynamic DNS
« previous
next »
Print
Pages:
1
...
15
16
[
17
]
Author
Topic: Tutorial: Caddy (Reverse Proxy) + Let's Encrypt Certificates + Dynamic DNS (Read 41464 times)
pacman
Newbie
Posts: 18
Karma: 0
Re: Tutorial: Caddy (Reverse Proxy) + Let's Encrypt Certificates + Dynamic DNS
«
Reply #240 on:
December 02, 2024, 11:34:41 am »
Quote from: Monviech (Cedrik) on December 01, 2024, 12:49:11 pm
Where do you want to use https?
Domain (Frontend) or HTTP Handler (Upstream to Backend)?
Domain (Fronted), the backend has only http.
Logged
Monviech (Cedrik)
Global Moderator
Hero Member
Posts: 1664
Karma: 178
Re: Tutorial: Caddy (Reverse Proxy) + Let's Encrypt Certificates + Dynamic DNS
«
Reply #241 on:
December 02, 2024, 12:34:07 pm »
Have you checked the Caddy Certificate widget (dashboard) if there is a certificate when you enable https for the frontend? If not check the caddy logs why it fails to issue one.
Logged
Hardware:
DEC740
stefan21
Full Member
Posts: 105
Karma: 10
Re: Tutorial: Caddy (Reverse Proxy) + Let's Encrypt Certificates + Dynamic DNS
«
Reply #242 on:
December 03, 2024, 07:07:38 pm »
Actually I tried to split port 443 in HAProxy. I couldn't find a working solution for my setup. While struggling around Cedrik gave me the hint to try Caddy. The idea behind HAProxy was to restrict access to the LAN and to present all certs to any clients or applications in the LAN. Connections from outside are only allowed through VPN. In this setup there's only a minimum of ports at the WAN interface open.
The main reason for port-sharing is that more and more wifi's in hotels or airports have only two ports open. As long as there's no deep packet inspection, one could use port 443 for openvpn. In other enviroments wireguard maybe a good choice.
Here are the steps sharing the port 443 between openvpn and a web application running on https, which are working for me. As pre-requisites there are (up-to-date)
OPNsense 24.7.9_1-amd64
FreeBSD 14.1-RELEASE-p6
OpenSSL 3.0.15
- all DNS records setup at the ISP/DNS registrar
- all (let's encrypt) certificates are stored at the correct local places and up-to-date
- there's a user created for openvpn
- local certificates have been created for the vpn-server and the vpn-client (user)
- there's a VPN instance up and running bound to 127.0.0.1 on port 1194
a) in Caddy - general settings - enable caddy and layer4 proxy. Advanced, Log, DNS, etc. are left on default.
b) in reverse proxy - http access - create your acl. I allow access only to LAN and VPN. HTTP response code for me is 403, the message is "HTTP 403 - Forbidden"
c) in reverse proxy - Domains - create your web-application on port 443 (https). Don't forget the corresponding certificate and the access list to this application.
d) in reverse proxy - http handlers - create the web-application which belongs to step c). Handler is "handle", leave path to "any", directive is "reverse_proxy", leave http version on default, protocol is "https", define your upstream domain/IP on the upstream port 443. Leave upstream path empty. Change the TLS server name that matches the SAN "Subject Alternative Name" of the offered upstream certificate.
e) in layer4 proxy - leave/change routing type "listener_wrappers", protocol is TCP, local port leave empty, matchers is "openvpn", mode and key is "any", upstream domain is "127.0.0.1", upstream port is 1194. Leave the rest empty/on default.
Connect your roadwarrior through port 443 to the openvpn instance. I used for client export "file only".
That's it. Working at least for me. If there are questions with this setup, I'll try to help. I had to start over for a second try. The first approach didn't work as expected. While re-installing (I removed every leftover from caddy via cli) it worked in the way I described. This time I was better prepared and didn't change or alter any setting while configuring caddy. Be sure to have all pre-requisites working as they should. Then start configuring caddy.
I can't push the DNS through the linux client (not working with WIN-clients), access to the LAN apps works only with IP's. Or connecting via vnc to a machine in the LAN. I can live with that. Or maybe someone is able to rule this out.
regards,
stefan
P.S. thank's to cedrik - all credits to him
«
Last Edit: December 03, 2024, 07:10:39 pm by stefan21
»
Logged
Print
Pages:
1
...
15
16
[
17
]
« previous
next »
OPNsense Forum
»
English Forums
»
Tutorials and FAQs
»
Tutorial: Caddy (Reverse Proxy) + Let's Encrypt Certificates + Dynamic DNS