I first set up TO to be a openvpn client, and it works great. I also did some routing to exclude certain IP ranges from going over the vpn.
Now I want to enable the openvpn server in the TO as well, to be able to connect to my LAN and use the same vpn connection the TO is using for the LAN.
When I set up the openvpn server through Foris, it only works if I disable the openvpn client first. With the client enabled at the same time, it does not work, because the external client connection is not established because the handshake fails due to a time out. I believe this is due to the fact that the response of the TO from the openvpn server is not send through the same route it came in, but the VPN the TO is connected to.
Things I tried:
Marking the openvpn packets (port 1194) and route them not through the vpn - Marking seems to work, I guess the routing also but the handshake is not completed.
Binding the openvpn server to a specific interface - Then I lost routing into my LAN
You need to have two different configuration files listening on different ports (e.g. one on 1194 and one on 1195). I didn’t use Foris, but one of my two Omnias has 3 openVPN configurations (2 servers, 1 client) running.
The TO-client connects to the external VPN server on1194, but I am sure it does not start the connection from this port. I also get no error on the server start in the logs, so the 1194 port should not be in use on the TO.
As you managed to do it, could you share your config, so I can simply copy it? Do you have some special routing in place?
port 1194
proto tcp
dev tun0
topology subnet
ca /etc/openvpn/ca.crt
cert /etc/openvpn/cert.crt
key /etc/openvpn/cert.key # This file should be kept secret
dh /etc/openvpn/dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist /tmp/openvpn/clients/ipp.txt
keepalive 10 120
tls-auth /etc/openvpn/ta.key 0 # This file is secret
comp-lzo
persist-key
persist-tun
verb 3
mute 20
# Internal routes for my network
push "route 192.168.10.0 255.255.255.0"
push "route 192.168.20.0 255.255.255.0"
client-to-client
cipher AES-256-CBC
auth SHA512
tls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-256-CBC-SHA:TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA:TLS-DHE-RSA-WITH-AES-128-CBC-SHA:TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA
status /var/log/openvpn-server-status.log
Server 2:
port 1196
proto tcp
dev tun2
ca /etc/openvpn/ca.crt
cert /etc/openvpn/cert2.crt
key /etc/openvpn/cert2.key
dh /etc/openvpn/dh2048.pem
server 10.8.4.0 255.255.255.0
ifconfig-pool-persist /tmp/openvpn/clients/ipp-local.txt
# Internal routes for a client, you can leave out this one and the "route"
# statement that follow
client-config-dir ccd
route 192.168.20.0 255.255.255.0
client-to-client
keepalive 10 120
tls-auth /etc/openvpn/ta.key 0
comp-lzo
persist-key
persist-tun
verb 3
mute 20
push "route 192.168.10.0 255.255.255.0"
push "route 10.8.0.0 255.255.255.0"
mssfix
client-to-client
cipher AES-256-CBC
auth SHA512
tls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-256-CBC-SHA:TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA:TLS-DHE-RSA-WITH-AES-128-CBC-SHA:TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA
status /var/log/openvpn-server-2-status.log
topology subnet
Client:
client
dev tun
proto udp
remote my.remote.example.com 1195
resolv-retry infinite
nobind
persist-key
persist-tun
ca /etc/openvpn/external-ca.crt
cert /etc/openvpn/client.crt
key /etc/openvpn/client.key
ns-cert-type server
tls-auth /etc/openvpn/ta-external.key 1
comp-lzo
verb 3
topology subnet
keepalive 10 60
cipher AES-256-CBC
auth SHA512
tls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384:TLS-DHE-RSA-WITH-AES-128-GCM-SHA256:TLS-DHE-RSA-WITH-AES-256-CBC-SHA:TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA:TLS-DHE-RSA-WITH-AES-128-CBC-SHA:TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA
status /var/log/openvpn-status.client.log
I added a route from the wan_ip to the vpn exceptions. No the LAN clients are using the vpn and I can access the openvpn server. I just hope I did not tear up more security holes than I want to close.