-
-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Caddy on OPNSense as Layer 4 Proxy for Wireguard #295
Comments
Hi, Please post your full config, including imports. Put |
Caddyfile:
/usr/local/etc/caddy/caddy.d/* --> is complete empty Log Settings are set to debug already. Here a copy of my logs where you see the problem 2 times with manual restarts. (/var/log/caddy.log)
|
Thanks. Well, I don't think this is normal that Caddy panics in the circumstances you described, though the reason is still unclear for me. According to the log, the panic is triggered by sending a packet to the closed channel here. And the only place I can see where it gets closed is here. We could probably move this line up, so that we close the packets channel after the UDP connection has been removed, but it requires proper testing. @WeidiDeng, what do you think? @pvillmann, do you use the keepalive option? Are you facing the same issue if you add |
I'm using keepalive yes, with 30 seconds... i changed it to 25 but i see that whyever the "last handshake" updates only every 2 min plus/minus from both sides. I don't know if this is a Wireguard / iOS Problem. |
Handshake update occurs every 2 minutes in WireGuard, it's OK. Keepalives are sent to make NAT/proxies in the middle keep your connections open. With keepalives changed to 25, are you still facing the issue or is it fine now? It's important so that we could understand if any fixes are required to eliminate panics. |
my feeling is that it works longer as with 30 seconds but after 20 - 25 minutes the service brokes again.
|
Can I help with addtional Infos ? |
Here I've implemented the idea suggested above. You may try it and communicate the results. Please be advised I haven't tested it. |
Stupid Question.... any idea how I can replace this field on OPNSense ? :) |
You have to make your own build of Caddy using xcaddy. I would advice you try it locally on Windows/Linux/MacOS before deploying on OPNsense. You may also build Caddy in a Docker container like this. |
Okay. i have cloned the your repo and the proxy runs now with xcaddy... I will reach you if the connection brokes. |
i tested it 2 times. At both tries the connection brokes after 25-30 min.... sorry panic: send on closed channel goroutine 44 [running]: |
Hey there. I have another report here. I dont know yet if its also with wireguard but I asked for the Caddyfile. The error looks like the same layer4 closed channel error. https://forum.opnsense.org/index.php?topic=45777.msg229070#msg229070 |
@Monviech Yes, thanks for reporting. The |
@vnxme I think you are right it is out of scope of the Wireguard matcher itself. I got the Caddyfile attached in the linked issue and they use one udp block in the layer 4 global section:
I have followed up and asked if they can test if the crashes still happen without the UDP section. I'll update here when I know. |
They reached back out to me and said Caddy is stable since removing the UDP configuration block. |
Hi together,
I'm trying to use Caddy as Layer 4 Proxy für Wireguard. (Proxy is reachable via IPv4 and IPv6 and forwards the traffic to my IPv6 CGNAT at home).
Basically everythings works fine as long as no connection is active :).
If i connect my mobile phone to the wireguard Server over Caddy and use the connection (active oder passive) the Caddy service stops after 2 - 5 min.
The only thing i have found in caddy.log is:
this is my config:
Thanks :)
The text was updated successfully, but these errors were encountered: