A
Annelise Mikhouser
Guest
Hello Guys,
in advance I would apologize for my bad English.
I use the OpenVPN Client on my Router to route my internet traffic over VPN. Over the normal WAN IP the ports are not accessible from outside. But when I enable my VPN Connection via "Client 2" some ports are open from outside. The VPN provider doesn't firewall my VPN WAN IP. When I do a portscan some ports are open (Port 22, 80, 433 and so on)! So I need to firewall the tun interface with some iptables.
But unfortunately I don’t get these rules to run :\
I hope someone can help me to find the right commands to solve this problem.
My settings / my procedure:
- I am running an Asus AC87U with Firmware Asus Merlin 380.59.
- I have OpenVPN - Client 2 configured, so that my internet traffic
is routed over VPN (Client 2 with policy rules and static ip's for each device= killswitch is activated)
- I have a SSH access via Putty to the Router (Administration – System – Enable SSH – LAN only)
- I formatted and enabled the JFFS Partition. It seems to be mounted:
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro,relatime)
devtmpfs on /dev type devtmpfs (rw,relatime,size=127740k,nr_inodes=31935,mode=755)
proc on /proc type proc (rw,relatime)
tmpfs on /tmp type tmpfs (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
/dev/mtdblock4 on /jffs type jffs2 (rw,noatime)
usbfs on /proc/bus/usb type usbfs (rw,relatime)
XXX@RT-AC87U-D970:/tmp/home/root#
XXX@RT-AC87U-D970:/tmp/home/root#
- I have found the right VPN Interface with the command “ifconfig”
tun12
Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:XX.XX.X.X P-t-P:XX.XX.X.X Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:16114796 errors:0 dropped:0 overruns:0 frame:0
TX packets:8709101 errors:0 dropped:16676 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:3993608687 (3.7 GiB) TX bytes:487072189 (464.5 MiB)
- I tried to set iptables via firewall-start (alternate with nat-start):
I. "cd /jffs/scripts/firewall-start"
II. "vi firewall-start"
III. I put this commands inside the file
#!/bin/sh
iptables -I INPUT -i tun12 -p tcp --dport 22 -m state --state NEW -j DROP
iptables -I INPUT -i tun12 -p tcp --dport 80 -m state --state NEW -j DROP
logger -t firewall-start services start script finished
or
#!/bin/sh
iptables -I INPUT -i tun12 -p tcp --dport 22 -j DROP
iptables -I INPUT -i tun12 -p tcp --dport 80 -j DROP
logger -t firewall-start services start script finished
IV. ":wq" -> save and quit
V. "chmod a+rx /jffs/scripts/firewall-start"
VI. "chmod 777 firewall-start"
After I restart the router nothing happens/no script is starting when I look into the syslog???
When I want to start the script manually with “/firewall-start” I get this output:
-sh: firewall-start: not found
The logger only shows a sys-log when I push the command "./firewall-start":
Nov 7 18:49:11 firewall-start: services start script finished
...but the ports are still open when i do a portscan again. The script does not seem to start. What I’m doing wrong?
THX for your Support
in advance I would apologize for my bad English.
I use the OpenVPN Client on my Router to route my internet traffic over VPN. Over the normal WAN IP the ports are not accessible from outside. But when I enable my VPN Connection via "Client 2" some ports are open from outside. The VPN provider doesn't firewall my VPN WAN IP. When I do a portscan some ports are open (Port 22, 80, 433 and so on)! So I need to firewall the tun interface with some iptables.
But unfortunately I don’t get these rules to run :\
I hope someone can help me to find the right commands to solve this problem.
My settings / my procedure:
- I am running an Asus AC87U with Firmware Asus Merlin 380.59.
- I have OpenVPN - Client 2 configured, so that my internet traffic
is routed over VPN (Client 2 with policy rules and static ip's for each device= killswitch is activated)
- I have a SSH access via Putty to the Router (Administration – System – Enable SSH – LAN only)
- I formatted and enabled the JFFS Partition. It seems to be mounted:
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro,relatime)
devtmpfs on /dev type devtmpfs (rw,relatime,size=127740k,nr_inodes=31935,mode=755)
proc on /proc type proc (rw,relatime)
tmpfs on /tmp type tmpfs (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
/dev/mtdblock4 on /jffs type jffs2 (rw,noatime)
usbfs on /proc/bus/usb type usbfs (rw,relatime)
XXX@RT-AC87U-D970:/tmp/home/root#
XXX@RT-AC87U-D970:/tmp/home/root#
- I have found the right VPN Interface with the command “ifconfig”
tun12
Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:XX.XX.X.X P-t-P:XX.XX.X.X Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:16114796 errors:0 dropped:0 overruns:0 frame:0
TX packets:8709101 errors:0 dropped:16676 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:3993608687 (3.7 GiB) TX bytes:487072189 (464.5 MiB)
- I tried to set iptables via firewall-start (alternate with nat-start):
I. "cd /jffs/scripts/firewall-start"
II. "vi firewall-start"
III. I put this commands inside the file
#!/bin/sh
iptables -I INPUT -i tun12 -p tcp --dport 22 -m state --state NEW -j DROP
iptables -I INPUT -i tun12 -p tcp --dport 80 -m state --state NEW -j DROP
logger -t firewall-start services start script finished
or
#!/bin/sh
iptables -I INPUT -i tun12 -p tcp --dport 22 -j DROP
iptables -I INPUT -i tun12 -p tcp --dport 80 -j DROP
logger -t firewall-start services start script finished
IV. ":wq" -> save and quit
V. "chmod a+rx /jffs/scripts/firewall-start"
VI. "chmod 777 firewall-start"
After I restart the router nothing happens/no script is starting when I look into the syslog???
When I want to start the script manually with “/firewall-start” I get this output:
-sh: firewall-start: not found
The logger only shows a sys-log when I push the command "./firewall-start":
Nov 7 18:49:11 firewall-start: services start script finished
...but the ports are still open when i do a portscan again. The script does not seem to start. What I’m doing wrong?
THX for your Support
Last edited by a moderator: