summaryrefslogtreecommitdiffstats
path: root/roles/common/templates/etc
diff options
context:
space:
mode:
Diffstat (limited to 'roles/common/templates/etc')
-rw-r--r--roles/common/templates/etc/fail2ban/jail.local.j214
-rw-r--r--roles/common/templates/etc/iptables/services.j28
-rw-r--r--roles/common/templates/etc/postfix/main.cf.j24
3 files changed, 24 insertions, 2 deletions
diff --git a/roles/common/templates/etc/fail2ban/jail.local.j2 b/roles/common/templates/etc/fail2ban/jail.local.j2
index 0dcab8d..b92cb7a 100644
--- a/roles/common/templates/etc/fail2ban/jail.local.j2
+++ b/roles/common/templates/etc/fail2ban/jail.local.j2
@@ -16,6 +16,10 @@ action = %(action_)s
#
# JAILS
#
+# There is no risk to lock ourself out, since traffic between our machines goes
+# through IPSec, and these packets are accepted before having a chance to enter
+# fail2ban's chain.
+#
[ssh]
@@ -47,3 +51,13 @@ banaction = iptables-allports
port = anyport
logpath = /var/log/auth.log
maxretry = 6
+
+{% if 'MX' in group_names %}
+[postfix]
+
+enabled = true
+port = smtp
+filter = postfix
+logpath = /var/log/mail.log
+maxretry = 10
+{% endif %}
diff --git a/roles/common/templates/etc/iptables/services.j2 b/roles/common/templates/etc/iptables/services.j2
index b1b7f0f..8a9409d 100644
--- a/roles/common/templates/etc/iptables/services.j2
+++ b/roles/common/templates/etc/iptables/services.j2
@@ -5,9 +5,13 @@
# (in|out|inout)[46]? (tcp|udp|..) (port|port:port|port,port) (port|port:port|port,port)
inout udp 500 500 # ISAKMP
-
-in tcp {{ ansible_ssh_port|default('22') }} # SSH
+#inout udp 4500 4500 # IPSec NAT Traversal
out tcp 80,443 # HTTP/HTTPS
out udp 53 # DNS
out udp 67 # DHCP
+
+in tcp {{ ansible_ssh_port|default('22') }} # SSH
+{% if 'MX' in group_names %}
+in tcp 25 # SMTP
+{% endif %}
diff --git a/roles/common/templates/etc/postfix/main.cf.j2 b/roles/common/templates/etc/postfix/main.cf.j2
index 59bf0ba..a856843 100644
--- a/roles/common/templates/etc/postfix/main.cf.j2
+++ b/roles/common/templates/etc/postfix/main.cf.j2
@@ -1,9 +1,13 @@
########################################################################
# Nullmailer configuration
+#
+# {{ ansible_managed }}
+# Do NOT edit this file directly!
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
readme_directory = no
+mail_owner = postfix
myorigin = /etc/mailname
myhostname = {{ ansible_fqdn }}