28 lines
738 B
Bash
Executable File
28 lines
738 B
Bash
Executable File
#!/bin/bash
|
|
sysctl -w net.ipv4.ip_forward=1
|
|
iptables -F -t filter
|
|
iptables -F nat
|
|
|
|
iptables -P INPUT DROP
|
|
iptables -P OUTPUT DROP
|
|
iptables -P FORWARD DROP
|
|
|
|
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
|
|
iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
|
|
|
|
iptables -A OUTPUT -p tcp --dport 80 -j ACCEPT
|
|
iptables -A INPUT -p tcp --sport 80 -j ACCEPT
|
|
|
|
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT
|
|
iptables -A INPUT -p udp --sport 53 -j ACCEPT
|
|
|
|
iptables -A OUTPUT -p tcp -d 10.121.38.1 --dport 8080 -j ACCEPT
|
|
iptables -A INPUT -p tcp -d 10.121.38.1 --sport 8080 -j ACCEPT
|
|
|
|
iptables -t nat -A POSTROUTING -o enp0s3 -j MASQUERADE
|
|
iptables -A FORWARD -o enp0s3 -j ACCEPT
|
|
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
|
|
|
|
|
|
|