OpenVPN port in NethServer

Hi everyone

I need to use in OpenVPN a port diferent than 1194.

Where can I change that?

@AbsyntH

Can you help?

db vpn setprop YourNameVpn RemotePort 5555
signal-event nethserver-vpn-save

Does someone can confirm it ?

In fact you can, have a look yourself (of course if you know it)

 [root@nethserver-dev ~] # config show openvpn
    BridgeEndIP=
    BridgeName=br0
    BridgeStartIP=
    ClientToClient=disabled
    Compression=enabled
    Mode=routed
    Netmask=
    Network=
    RouteToVPN=disabled
    ServerStatus=disabled
    TapInterface=tap0
    UDPPort=1194
    access=public
    status=enabled

and since there are no values saved ( UDPPort=1194 is needed for the firewall) then you have to search by another way

[root@nethserver-dev ~]# grep -srni '1194' /etc/e-smith/
/etc/e-smith/db/configuration/defaults/openvpn/UDPPort:1:1194
/etc/e-smith/events/nethserver-vpn-create/S30nethserver-openvpn-genclient:32:my $RemotePort = $openvpn->prop('RemotePort') || '1194';
/etc/e-smith/events/actions/nethserver-openvpn-genclient:32:my $RemotePort = $openvpn->prop('RemotePort') || '1194';
/etc/e-smith/events/nethserver-vpn-modify/S30nethserver-openvpn-genclient:32:my $RemotePort = $openvpn->prop('RemotePort') || '1194';

Here you have to understood and read some code inside template…but fortunately perl is easy to read

2 Likes

Right commands are:

config setprop openvpn UDPPort 5555
signal-event nethserver-openvpn-save
signal-event firewall-adjust
2 Likes

thanks giacomo

it should be written here http://docs.nethserver.org/en/latest/vpn.html

@stephdl @giacomo

The commands from Giacomo are correct

Many thanks

Thanks for your confirmation! Let’s ask a pull request for the documentation as requested by @stephdl

@giacomo
Does the IPSEC port can be changed…I looked after the UDPPort with grep but I didn’t find something interesting.

After that I looked and forked the documentation GitHub repository but how trade with foreign Languages, I can see Spanish and Italian. My wife is Spanish, therefore I could write in Spanish, but for Italian, do I need to change my Wife ?

1 Like

Ahahaha nope, take a look at this:

You can calm your wife down :wink:

Therefore, official changes are made in English

Hi @giacomo I’m not trying to demonstrate my knowledge but I’m looking about services that need a nethgui entry to change port directly inside it.
So I’m searching to understand what you did for other services .

When I look about openvpn

[root@nethserver-dev ~]# ls -R /etc/e-smith/events/nethserver-openvpn-save/
/etc/e-smith/events/nethserver-openvpn-save/:
S30nethserver-openvpn-delserver  S80firewall-adjust  services2adjust  templates2expand

/etc/e-smith/events/nethserver-openvpn-save/services2adjust:
openvpn

/etc/e-smith/events/nethserver-openvpn-save/templates2expand:
etc

/etc/e-smith/events/nethserver-openvpn-save/templates2expand/etc:
openvpn

/etc/e-smith/events/nethserver-openvpn-save/templates2expand/etc/openvpn:
host-to-net.conf  host-to-net.pool

Thus I can see that the action firewall-adjust is already called, do we need to launch it again twice ?

No, we don’t :smile: Sorry but I didn’t check the code at time of answer…and to be sure, I just suggested to fire the firewall event.

Thank you for the clarification!