about summary refs log tree commit diff stats
path: root/linux/conf/iptables/ipt-client.sh
diff options
context:
space:
mode:
authorSilvino <silvino@bk.ru>2021-02-25 23:22:17 +0000
committerSilvino <silvino@bk.ru>2021-02-25 23:22:17 +0000
commitd12b35a47b9a872ecb5e037f1c2b02e1ea8927fb (patch)
tree8fdac6dfc8cabb9f85a2db3a3bd628cfe44438cd /linux/conf/iptables/ipt-client.sh
parent0a6b0fc9769daf0932cb207c3285baa31547b489 (diff)
parenta3628fc49db4d88ff3e4067268650710d1da3f6f (diff)
downloaddoc-d12b35a47b9a872ecb5e037f1c2b02e1ea8927fb.tar.gz
merge openbsd branch into develop
new directory layout
Diffstat (limited to 'linux/conf/iptables/ipt-client.sh')
-rw-r--r--linux/conf/iptables/ipt-client.sh60
1 files changed, 60 insertions, 0 deletions
diff --git a/linux/conf/iptables/ipt-client.sh b/linux/conf/iptables/ipt-client.sh
new file mode 100644
index 0000000..3e82bf7
--- /dev/null
+++ b/linux/conf/iptables/ipt-client.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+echo "setting dhcp network..."
+
+if [ "${GW}" == "" ]; then
+
+	$IPT -A INPUT  -j srv_icmp
+	$IPT -A OUTPUT -j srv_icmp
+	$IPT -A INPUT  -j srv_dhcp
+	$IPT -A OUTPUT -j srv_dhcp
+
+	echo "no gateway, wating for one..."
+
+	while [ "${GW}" == "" ]
+	do
+		#we wait for a connection
+		sleep 2;
+		GW=$(ip route | grep "default via" | cut -d " " -f 3)
+	done
+fi
+
+echo "setting client network..."
+
+####### Input Chain ######
+$IPT -A INPUT -j blocker
+$IPT -A INPUT -j blockip_in
+
+$IPT -A INPUT -i ${PUB_IF} -j cli_dns_in
+$IPT -A INPUT -i ${PUB_IF} -j cli_http_in
+$IPT -A INPUT -i ${PUB_IF} -j cli_https_in
+$IPT -A INPUT -i ${PUB_IF} -j cli_git_in
+$IPT -A INPUT -i ${PUB_IF} -j cli_ssh_in
+$IPT -A INPUT -i ${PUB_IF} -j srv_icmp
+$IPT -A INPUT -i ${PUB_IF} -j cli_pops_in
+$IPT -A INPUT -i ${PUB_IF} -j cli_smtps_in
+$IPT -A INPUT -i ${PUB_IF} -j cli_irc_in
+$IPT -A INPUT -i ${PUB_IF} -j cli_ftp_in
+$IPT -A INPUT -i ${PUB_IF} -j cli_gpg_in
+$IPT -A INPUT -i ${PUB_IF} -p udp --sport 520 --dport 520 -j ACCEPT
+
+
+####### Output Chain ######
+$IPT -A OUTPUT -j blocker
+$IPT -A OUTPUT -j blockip_out
+
+$IPT -A OUTPUT -o ${PUB_IF} -j cli_dns_out
+$IPT -A OUTPUT -o ${PUB_IF} -j cli_https_out
+$IPT -A OUTPUT -o ${PUB_IF} -j cli_ssh_out
+$IPT -A OUTPUT -o ${PUB_IF} -j cli_git_out
+$IPT -A OUTPUT -o ${PUB_IF} -j cli_git_out
+$IPT -A OUTPUT -o ${PUB_IF} -j srv_icmp
+$IPT -A OUTPUT -o ${PUB_IF} -j cli_pops_out
+$IPT -A OUTPUT -o ${PUB_IF} -j cli_smtps_out
+$IPT -A OUTPUT -o ${PUB_IF} -j cli_irc_out
+$IPT -A OUTPUT -o ${PUB_IF} -j cli_ftp_out
+$IPT -A OUTPUT -o ${PUB_IF} -j cli_gpg_out
+$IPT -A OUTPUT -o ${PUB_IF} -p udp --sport 1024:655335 --dport 1024:65535 -j ACCEPT
+
+## log everything else and drop
+ipt_log