From 4b48b83ce9eea9150c1c3aef63aba375e607b2aa Mon Sep 17 00:00:00 2001 From: "Daniel A. Maierhofer" Date: Sun, 4 Nov 2018 21:01:49 +0100 Subject: [PATCH] Enable SSH with password, iptables for sputnik --- host_vars/sputnik | 7 +++++++ templates/iptables_sputnik_v4.j2 | 14 ++++++++++++++ templates/iptables_sputnik_v6.j2 | 12 ++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 host_vars/sputnik create mode 100644 templates/iptables_sputnik_v4.j2 create mode 100644 templates/iptables_sputnik_v6.j2 diff --git a/host_vars/sputnik b/host_vars/sputnik new file mode 100644 index 0000000..4b33fb3 --- /dev/null +++ b/host_vars/sputnik @@ -0,0 +1,7 @@ +inventory_hostname: sputnik.fet.htu.tuwien.ac.at +inventory_hostname_short: sputnik + +common_iptables_v4: "iptables_sputnik_v4.j2" +common_iptables_v6: "iptables_sputnik_v6.j2" + +common_openssh_password_authentication: "yes" diff --git a/templates/iptables_sputnik_v4.j2 b/templates/iptables_sputnik_v4.j2 new file mode 100644 index 0000000..b7efa99 --- /dev/null +++ b/templates/iptables_sputnik_v4.j2 @@ -0,0 +1,14 @@ +# {{ ansible_managed }} + +*filter +:INPUT DROP [0:0] +:FORWARD DROP [0:0] +:OUTPUT ACCEPT [0:0] +-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT +-A INPUT -p icmp -j ACCEPT +-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT +-A INPUT -i lo -j ACCEPT +-A INPUT -p tcp -j REJECT --reject-with tcp-reset +-A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable +-A INPUT -j REJECT --reject-with icmp-proto-unreachable +COMMIT diff --git a/templates/iptables_sputnik_v6.j2 b/templates/iptables_sputnik_v6.j2 new file mode 100644 index 0000000..d2927b5 --- /dev/null +++ b/templates/iptables_sputnik_v6.j2 @@ -0,0 +1,12 @@ +# {{ ansible_managed }} + +*filter +:INPUT DROP [0:0] +:FORWARD DROP [0:0] +:OUTPUT ACCEPT [0:0] +-A INPUT -p tcp --syn -j DROP +-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT +-A INPUT -p ipv6-icmp -j ACCEPT +-A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT +-A INPUT -i lo -j ACCEPT +COMMIT