OpenVPN blocking external ping, caused by the SPI firewall

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Goto page 1, 2  Next
Author Message
DarkAngel88
DD-WRT Novice


Joined: 07 Nov 2006
Posts: 12

PostPosted: Thu Jul 02, 2020 1:45    Post subject: OpenVPN blocking external ping, caused by the SPI firewall Reply with quote
Hi all,

Here's an issue I've had since I have setup my site2site VPN, using OpenVPN, for which I hope I can get your help!

I've successfully connected SiteA (192.168.1.0/24) to SiteB (192.168.2.0/24) using a OpenVPN TUN. The server is an AsusWRT Merlin and the client is DD-WRT (Build 41113). SiteB (the client) is able to communicate with SiteA (the server) using Ping, SSH, everything... but when it comes to SiteA communicating with SiteB, everything works with the exception of communication with my router . From SiteA, I cannot ping nor ssh to my dd-wrt machine (192.168.2.1 in my current setup) but pinging any other machine from SiteA to SiteB works (from 192.168.2.2 to 192.168.2.254). I've done some testing as to understand what's happenning and while playing with my dd-wrt config, I found out that disabling the SPI firewall fixes the issue. When disabled, I'm able to ping and ssh to by router from SiteA to SiteB. Now I know what the SPI firewall is for and, as my dd-wrt acts as a WAN facing gateway, I would rather keep the SPI firewall active to keep all ports stealth. Is there any special config I could use to enable access to 192.168.2.1 from my SiteA range (192.168.1.0/24)?

Note: the dd-wrt client is not using the WebGUI for configuration but rather a config file that I've pushed and is executed by the command line. I don't know if it changes anything (maybe using the WebGUI does some magic with the SPI firewall to enable ping and communication) but I wanted to be transparent in my post.

Anyone with good knowledge on what could be my issue?

Thanks.
Sponsor
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14208
Location: Texas, USA

PostPosted: Thu Jul 02, 2020 2:07    Post subject: Reply with quote
You may save yourself some of your headaches by upgrading to 43516 and reconfiguring your DD client. I don't even remember if your build was in the middle of the muckery with the mitigation that broke things all to hell, I would have to back-track and check. But my advice is to upgrade to the latest release.
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
DarkAngel88
DD-WRT Novice


Joined: 07 Nov 2006
Posts: 12

PostPosted: Thu Jul 02, 2020 2:09    Post subject: Reply with quote
Hi Kernel,

Thanks for your input. I'll upgrade and report back if this solved anything.

Best!
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14208
Location: Texas, USA

PostPosted: Thu Jul 02, 2020 2:21    Post subject: Reply with quote
One thing to check on either build is the CVE-xxxx mitigation, whether or not it is enabled. That may also cause issues. I am not the VPN guru by any means, but I follow development and issue tracking closely. Your current build is pre-mitigation patches and fun, as I just confirmed, but there were issues with VPN at that point anyway, if memory serves. You may need to post more information if the upgrade doesn't fix things.
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
DarkAngel88
DD-WRT Novice


Joined: 07 Nov 2006
Posts: 12

PostPosted: Thu Jul 02, 2020 2:26    Post subject: Reply with quote
Got it. Currently backing up manually my config pre-upgrade.

What other information would be useful?
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14208
Location: Texas, USA

PostPosted: Thu Jul 02, 2020 2:38    Post subject: Reply with quote
Syslog, firewall log if it is set up; output of iptables -vnL; perhaps the actual manual config details you are using. If you have the "block anonymous wan requests (ping)" enabled on the firewall, that may be screwy. I think that was part of my not being able to ping across my lan on my E4200 a while back. I haven't mucked with it in months, so I would have to look into it at some point.
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
DarkAngel88
DD-WRT Novice


Joined: 07 Nov 2006
Posts: 12

PostPosted: Thu Jul 02, 2020 3:22    Post subject: Reply with quote
Just updated - nothing has changed on that side Sad

Code:

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
19592 3992K ACCEPT     0    --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
    0     0 ACCEPT     udp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           udp spt:67 dpt:68
    0     0 DROP       udp  --  eth0   *       0.0.0.0/0            0.0.0.0/0           udp dpt:520
    0     0 DROP       udp  --  br0    *       0.0.0.0/0            0.0.0.0/0           udp dpt:520
    0     0 ACCEPT     udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:520
    5   314 DROP       icmp --  eth0   *       0.0.0.0/0            0.0.0.0/0
  267  8904 ACCEPT     2    --  *      *       0.0.0.0/0            0.0.0.0/0
   15  1013 ACCEPT     0    --  lo     *       0.0.0.0/0            0.0.0.0/0           state NEW
 5701  347K ACCEPT     0    --  br0    *       0.0.0.0/0            0.0.0.0/0           state NEW
 4530  245K DROP       0    --  *      *       0.0.0.0/0            0.0.0.0/0

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
   13  4225 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
   15  2482 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
   71 12615 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
   58  9833 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    3   156 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
  188  209K ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
  169 34258 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    4   266 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    4   220 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    2   154 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    3   231 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
  151  112K ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
   97 13116 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    1    64 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    3   192 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  tun0   br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    tun0    0.0.0.0/0            0.0.0.0/0
 198K   78M ACCEPT     0    --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
    0     0 ACCEPT     47   --  *      eth0    192.168.2.0/24       0.0.0.0/0
    0     0 ACCEPT     tcp  --  *      eth0    192.168.2.0/24       0.0.0.0/0           tcp dpt:1723
22748 1617K lan2wan    0    --  *      *       0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  br0    br0     0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     udp  --  eth0   *       0.0.0.0/0            224.0.0.0/4
    0     0 TRIGGER    0    --  eth0   br0     0.0.0.0/0            0.0.0.0/0           TRIGGER type:in match:0 relate:0
22748 1617K trigger_out  0    --  br0    *       0.0.0.0/0            0.0.0.0/0
    0     0 TRIGGER    0    --  eth0   eth1    0.0.0.0/0            0.0.0.0/0           TRIGGER type:in match:0 relate:0
    0     0 trigger_out  0    --  eth1   *       0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  eth1   *       0.0.0.0/0            0.0.0.0/0           state NEW
    0     0 TRIGGER    0    --  eth0   ath0    0.0.0.0/0            0.0.0.0/0           TRIGGER type:in match:0 relate:0
    0     0 trigger_out  0    --  ath0   *       0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  ath0   *       0.0.0.0/0            0.0.0.0/0           state NEW
    0     0 TRIGGER    0    --  eth0   ath1    0.0.0.0/0            0.0.0.0/0           TRIGGER type:in match:0 relate:0
    0     0 trigger_out  0    --  ath1   *       0.0.0.0/0            0.0.0.0/0
    0     0 ACCEPT     0    --  ath1   *       0.0.0.0/0            0.0.0.0/0           state NEW
22656 1612K ACCEPT     0    --  br0    *       0.0.0.0/0            0.0.0.0/0           state NEW
   92  4988 DROP       0    --  *      *       0.0.0.0/0            0.0.0.0/0
... repeating stuff...

Chain logdrop (0 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 LOG        0    --  *      *       0.0.0.0/0            0.0.0.0/0           state INVALID LOG flags 7 level 4 prefix `DROP '
    0     0 DROP       0    --  *      *       0.0.0.0/0            0.0.0.0/0

Chain logreject (0 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 REJECT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with tcp-reset

Chain trigger_out (4 references)
 pkts bytes target     prot opt in     out     source               destination
    0     0 TRIGGER    tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp dpt:51413 TRIGGER type:out match:51413 relate:51413
    0     0 TRIGGER    udp  --  *      *       0.0.0.0/0            0.0.0.0/0           udp dpt:51413 TRIGGER type:out match:51413 relate:51413


As said earlier, as soon as I disable the SPI firewall, I can ping my router from SiteA which leads me to think it is a firewall issue. Is there a correlation between the SPI firewall and IPTables?
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14208
Location: Texas, USA

PostPosted: Thu Jul 02, 2020 3:42    Post subject: Reply with quote
Yes. The SPI firewall uses iptables, that is the actual command used. Try enabling the firewall, but leave "block anonymous wan requests (ping)" disabled / unchecked, reboot the router and test that.
_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
DarkAngel88
DD-WRT Novice


Joined: 07 Nov 2006
Posts: 12

PostPosted: Thu Jul 02, 2020 5:36    Post subject: Reply with quote
Unfortunately nothing has changed. I do see the modification inside iptables though:

Code:
    0     0 ACCEPT     icmp --  eth0   *       0.0.0.0/0            0.0.0.0/0


Do you think this rule should be added for the tunnel as well? I do not have lots of knowledge on iptables though...
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Thu Jul 02, 2020 7:50    Post subject: Re: OpenVPN blocking external ping, caused by the SPI firewa Reply with quote
DarkAngel88 wrote:
Hi all,

Here's an issue I've had since I have setup my site2site VPN, using OpenVPN, for which I hope I can get your help!


Note: the dd-wrt client is not using the WebGUI for configuration but rather a config file that I've pushed and is executed by the command line. I don't know if it changes anything (maybe using the WebGUI does some magic with the SPI firewall to enable ping and communication) but I wanted to be transparent in my post.

Anyone with good knowledge on what could be my issue?

Thanks.


Of course the webGUI takes care of firewall rules Smile

So make it easy on yourself use the webGUI

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
DarkAngel88
DD-WRT Novice


Joined: 07 Nov 2006
Posts: 12

PostPosted: Thu Jul 02, 2020 14:08    Post subject: Reply with quote
Interresting egc... I wasn't sure it was the case but now with your comment.

Is there a way to import a specific .conf file from openvpn? It would be easier this way and my little pinky tells me it won't be possible... but maybe you could tell me otherwise! I've tried using the same conf but I have to way to debug my openvpn Client (yes, syslog are enabled Smile).

If I'm unable to import my conf file, is there an easy way to debug my openvpn client config?

Thanks!
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Thu Jul 02, 2020 15:41    Post subject: Reply with quote
DarkAngel88 wrote:
Interresting egc... I wasn't sure it was the case but now with your comment.

Is there a way to import a specific .conf file from openvpn? It would be easier this way and my little pinky tells me it won't be possible... but maybe you could tell me otherwise! I've tried using the same conf but I have to way to debug my openvpn Client (yes, syslog are enabled Smile).

If I'm unable to import my conf file, is there an easy way to debug my openvpn client config?

Thanks!


No you cannot use your own conf file in the regular builds (I am running an experimental build which has that possibility but BS is kind of reluctant on this matter)
You can try to add all of your conf file in the Additional Config so that it will be added to the DDWRT conf file this sometimes works.

This is a recurring problem, many VPN providers just give you a conf file or users using pfsens servers or other servers only have a conf file and it is normally fairly easy to translate the conf to the GUI.

So if just adding your conf file to the Additional Config does not work you can post (or PM me) your conf file I will see if I can translate it to the GUI.

Of course it is possible to run openvpn just from the CLI but then you need to know how to set all the rules, it is still on my list to make a frame work with example how to do that with rout-up and down scripts with the necessary rules but that is not finished yet Sad

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
DarkAngel88
DD-WRT Novice


Joined: 07 Nov 2006
Posts: 12

PostPosted: Thu Jul 02, 2020 18:02    Post subject: Reply with quote
Yes, you're right about the part where VPN providers often give conf file that now, needs to be translated to the right settings.

I was able to translate most of my conf file (thanks for the help BTW) but I'm unable to test it properly. Can you tell me where the conf file is located on dd-wrt? It will give me a better idea as of if I've translated the conf file properly.

Also, is it normal that I don't verbose openvpn logs inside /var/log/messages? I've applied the openvpn config file but the only error I see is the following:

Code:
Options error: specify only one of --tls-server, --tls-client, or --secret


Granted, I'm using a static key but I don't see any option to force the usage of only a static key. From reading the dd-wrt wiki about openvpn, it seem like it always uses the certificate paths when generating the config file for openvpn and, as a result, I'm getting a conflict error when trying to start the openvpn client.
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Thu Jul 02, 2020 18:41    Post subject: Reply with quote
DarkAngel88 wrote:
Yes, you're right about the part where VPN providers often give conf file that now, needs to be translated to the right settings.

I was able to translate most of my conf file (thanks for the help BTW) but I'm unable to test it properly. Can you tell me where the conf file is located on dd-wrt? It will give me a better idea as of if I've translated the conf file properly.

Also, is it normal that I don't verbose openvpn logs inside /var/log/messages? I've applied the openvpn config file but the only error I see is the following:

Code:
Options error: specify only one of --tls-server, --tls-client, or --secret


Granted, I'm using a static key but I don't see any option to force the usage of only a static key. From reading the dd-wrt wiki about openvpn, it seem like it always uses the certificate paths when generating the config file for openvpn and, as a result, I'm getting a conflict error when trying to start the openvpn client.


Well if you give enough information we come to the heart of the story Smile

From the server setup guide:
Quote:
Due to an incompatibility in DDWRT it is not possible to setup with a static key only (both server and client) for a workaround see the paragraph "Running from the command line"


So if you want to use a static key only you have to setup via the command line.

So basically you have two choices use keys/certificates or wait a few days till I finished writing up how to use the CLI with DDWRT

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Fri Jul 03, 2020 10:07    Post subject: Reply with quote
There is another option you can dynamically remove the setting which makes DDWRT incompatible with static key and then restart VPN.

There is a thread about this, basically use SED to remove "client" (or "server" for the server) and then restart

Will see of I can find it

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum