# ifconfig eth0 Link encap:Ethernet HWaddr ::::: inet addr:1.1.1.1 Bcast:1.1.1.255 Mask:255.255.255.0 inet6 addr: fe80:::::/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:417428 errors:0 dropped:230 overruns:0 frame:0 TX packets:17595 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:28249193 (28.2 MB) TX bytes:4653027 (4.6 MB) eth0:0 Link encap:Ethernet HWaddr ::::: inet addr:2.2.2.2 Bcast:2.2.2.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:507 errors:0 dropped:0 overruns:0 frame:0 TX packets:507 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:44121 (44.1 KB) TX bytes:44121 (44.1 KB)
# cat /etc/shorewall/interfaces #ZONE INTERFACE BROADCAST OPTIONS net4 eth0 detect tcpflags,logmartians,nosmurfs # cat /etc/shorewall/zones #ZONE TYPE OPTIONS IN OUT fw firewall net4 ipv4 # cat /etc/shorewall/policy #SOURCE DEST POLICY LOG LIMIT: CONNLIMIT: $FW net4 ACCEPT net4 $FW DROP info net4 all DROP info # The FOLLOWING POLICY MUST BE LAST all all REJECT info # cat /etc/shorewall/rules #ACTION SOURCE DEST PROTO DEST SOURCE SECTION NEW # ------------------------- INTERNET -------------------------------- ACCEPT net4 $FW:1.1.1.1 tcp 22 ACCEPT net4 $FW:1.1.1.1 tcp 25 ACCEPT net4 $FW:1.1.1.1 tcp 80 # ------------------------- VPN ------------------------------------- ACCEPT net4 $FW:2.2.2.2 udp 1194
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:10.8.0.1 PtP:10.1.0.2 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:3261 errors:0 dropped:0 overruns:0 frame:0 TX packets:2624 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:351155 (351.1 KB) TX bytes:1043254 (1.0 MB)
$telnet 10.8.0.1 25 $sudo tail /var/log/syslog ... Shorewall:INPUT:REJECT:IN=tun0 OUT= MAC= SRC=10.8.0.6 DST=10.8.0.1 ... PROTO=TCP SPT=36879 DPT=25 ...
all all REJECT info
# cat /etc/shorewall/interfaces #ZONE INTERFACE BROADCAST OPTIONS net4 eth0 detect tcpflags,logmartians,nosmurfs vpn4 tun0 detect tcpflags,logmartians,nosmurfs #NEW # cat /etc/shorewall/zones #ZONE TYPE OPTIONS IN OUT fw firewall net4 ipv4 vpn4 ipv4 #NEW # cat /etc/shorewall/policy #SOURCE DEST POLICY LOG LIMIT: CONNLIMIT: $FW net4 ACCEPT vpn4 $FW ACCEPT #NEW vpn4 net4 ACCEPT #NEW net4 $FW DROP info net4 all DROP info # The FOLLOWING POLICY MUST BE LAST all all REJECT info # cat /etc/shorewall/rules #ACTION SOURCE DEST PROTO DEST SOURCE SECTION NEW # ------------------------- INTERNET -------------------------------- ACCEPT net4 $FW:1.1.1.1 tcp 22 ACCEPT net4 $FW:1.1.1.1 tcp 25 ACCEPT net4 $FW:1.1.1.1 tcp 80 # ------------------------- VPN ------------------------------------- ACCEPT net4 $FW:2.2.2.2 udp 1194 # SNAT, for access to internet -- NEW # cat /etc/shorewall/masq #INTERFACE SOURCE ADDRESS PROTO PORT(S) IPSEC MARK eth0 10.8.0.0/24 2.2.2.2
# /etc/shorewall/policy: vpn4 $FW ACCEPT #NEW
# cat /etc/shorewall/interfaces #ZONE INTERFACE BROADCAST OPTIONS net4 eth0 detect tcpflags,logmartians,nosmurfs vpn4 tun0 detect tcpflags,logmartians,nosmurfs # cat /etc/shorewall/zones #ZONE TYPE OPTIONS IN OUT fw firewall net4 ipv4 vpn4 ipv4 # cat /etc/shorewall/policy #SOURCE DEST POLICY LOG LIMIT: CONNLIMIT: $FW net4 ACCEPT #vpn4 $FW ACCEPT #NEW #vpn4 net4 ACCEPT #NEW net4 $FW DROP info net4 all DROP info # The FOLLOWING POLICY MUST BE LAST all all REJECT info # cat /etc/shorewall/rules #ACTION SOURCE DEST PROTO DEST SOURCE SECTION NEW # ------------------------- INTERNET -------------------------------- ACCEPT net4 $FW:1.1.1.1 tcp 22 ACCEPT net4 $FW:1.1.1.1 tcp 25 ACCEPT net4 $FW:1.1.1.1 tcp 80 # ------------------------- VPN ------------------------------------- ACCEPT net4 $FW:2.2.2.2 udp 1194 # ------------------------- NEW ------------------------------------- ACCEPT vpn4 net4 ACCEPT vpn4 $FW:1.1.1.1 tcp 22 ACCEPT vpn4 $FW:1.1.1.1 tcp 25 ACCEPT vpn4 $FW:1.1.1.1 tcp 80 # cat /etc/shorewall/masq #INTERFACE SOURCE ADDRESS PROTO PORT(S) IPSEC MARK eth0 10.8.0.0/24 2.2.2.2
Source: https://habr.com/ru/post/197302/
All Articles