core icon indicating copy to clipboard operation
core copied to clipboard

OpenVPN Add listen adresses

Open tomatotoast opened this issue 6 years ago • 9 comments

Important notices Before you add a new report, we ask you kindly to acknowledge the following:

[x] I have read the contributing guide lines at https://github.com/opnsense/core/blob/master/CONTRIBUTING.md

[x] I have searched the existing issues and I'm convinced that mine is new.

Is your feature request related to a problem? Please describe.

currently it is not possible to define a listen address in the openvpn server. For example if you have multiple ips on the wan interface you can't define one ip for vpns and run the vpn server with it. With other functions like: the HAProxy or Postfix it is possible to define a individual listen address.

grafik

Describe the solution you'd like

the possibility to setup one or more IPs in the openvpn server configuration

Describe alternatives you've considered

the workaround is currently: let vpn server listen to localhost and setup a port forwarding from the ip to localhost.

tomatotoast avatar Sep 19 '20 10:09 tomatotoast

Add an Alias and you can select it in Interface section

mimugmail avatar Sep 19 '20 11:09 mimugmail

OpenVPN config itself is rather restrictive so comparing with HAProxy is a bit difficult to accomplish. Have you consulted the OpenVPN documentation on the subject?

fichtner avatar Sep 19 '20 11:09 fichtner

Add an Alias and you can select it in Interface section

Thats is the solution. Thank you.

tomatotoast avatar Sep 19 '20 14:09 tomatotoast

OpenVPN config itself is rather restrictive so comparing with HAProxy is a bit difficult to accomplish. Have you consulted the OpenVPN documentation on the subject?

I thought about the "local" parameter.

tomatotoast avatar Sep 19 '20 14:09 tomatotoast

Solved. Using an IP Alias in the Interface section. Binding Dualstack is not possible in this configuration. As far as i know its only possible while listening to "all" Interfaces. But that is an Upstream "issue".

tomatotoast avatar Sep 19 '20 14:09 tomatotoast

Yep, this is how to trigger the "local" directive. Just double-checked the code. Unfortunately OpenVPN can't specify more than one address so dual-stack is only possible without local address.

fichtner avatar Sep 21 '20 06:09 fichtner

Yep, this is how to trigger the "local" directive. Just double-checked the code. Unfortunately OpenVPN can't specify more than one address so dual-stack is only possible without local address.

Would socat be a solution? Socat is is already shipped in the image. As a plugin one could forward maybe an ipv6 adress to the openvpn socket or another ipv4.

So one could archieve an "dualstack" openvpn config while listening on defined adresses. It Could also be useful for other things.

tomatotoast avatar Sep 21 '20 08:09 tomatotoast

If you get the socat daemon running in production and use it für multiprotocol I can build a plugin.

mimugmail avatar Sep 21 '20 08:09 mimugmail

You can use NAT rules to do the same already. No particular need for socat.

fichtner avatar Sep 21 '20 09:09 fichtner