Add E-Mail Server

This commit is contained in:
Mathias Teier 2021-04-02 13:09:32 +02:00
parent c20692e73c
commit 5b61d2cce5
No known key found for this signature in database
GPG Key ID: 8CE851A755C27766
4 changed files with 131 additions and 4 deletions

32
mail/docker-compose.yml Normal file
View File

@ -0,0 +1,32 @@
version: '2.4'
services:
mailserver:
image: mailserver/docker-mailserver:9.1.0
hostname: mail
domainname: kagent.at
container_name: mailserver
#env_file: mailserver.env
environment:
- ENABLE_SPAMASSASSIN=1
- SPAMASSASSIN_SPAM_TO_INBOX=1
- ENABLE_CLAMAV=1
- ENABLE_FAIL2BAN=1
- ENABLE_POSTGREY=0
- ENABLE_SASLAUTHD=0
- ONE_DIR=1
- DMS_DEBUG=0
- SSL_TYPE=letsencrypt
ports:
- "25:25"
- "143:143"
- "587:587"
- "993:993"
volumes:
- /var/mail/data:/var/mail
- /var/mail/state:/var/mail-state
- /var/log/mail:/var/log/mail
- /etc/localtime:/etc/localtime:ro
- ./config/:/tmp/docker-mailserver/${SELINUX_LABEL}
- /etc/letsencrypt:/etc/letsencrypt
restart: unless-stopped
cap_add: [ "NET_ADMIN", "SYS_PTRACE" ]

36
mail/start.yml Normal file
View File

@ -0,0 +1,36 @@
---
- hosts: teier.eu
gather_facts: no
tasks:
- name: Check dc directory
stat:
path: /dc/mail
register: mail_dc_dir_stat
- name: Create mail dc directory
file:
path: /dc/mail
state: directory
mode: 0755
group: root
owner: root
when: mail_dc_dir_stat.islnk is not defined
- name: Copy mailserver.env
copy:
src: mailserver.env
dest: /dc/mail/
- name: Copy setup.sh
copy:
src: setup.sh
dest: /dc/mail/
- name: Copy compose file
copy:
src: docker-compose.yml
dest: /dc/mail/
- name: Start mail
shell: "cd /dc/mail && docker-compose up -d"

6
mail/teardown.yml Normal file
View File

@ -0,0 +1,6 @@
---
- hosts: teier.eu
gather_facts: no
tasks:
- name: Teardown mail
shell: "cd /dc/mail && docker-compose down"

View File

@ -1,7 +1,7 @@
--- ---
- name: Configure UFW - name: Configure UFW
hosts: teier.eu hosts: teier.eu
gather_facts: yes gather_facts: no
tasks: tasks:
- name: Install ufw - name: Install ufw
@ -47,13 +47,66 @@
port: '8448' port: '8448'
proto: tcp proto: tcp
- name: Allow SMTP Outgoing - name: Allow SMTP
community.general.ufw: community.general.ufw:
rule: allow rule: allow
direction: out
port: '587' port: '587'
proto: tcp proto: tcp
- name: Allow Mail
community.general.ufw:
rule: allow
port: '25'
proto: tcp
- name: Allow Mail
community.general.ufw:
rule: allow
port: '143'
proto: tcp
- name: Allow Mail
community.general.ufw:
rule: allow
port: '587'
proto: tcp
- name: Allow Mail
community.general.ufw:
rule: allow
port: '993'
proto: tcp
- name: Allow Taript
community.general.ufw:
rule: allow
port: '22'
proto: tcp
- name: Allow Retrocraft
community.general.ufw:
rule: allow
port: '25566'
proto: tcp
- name: Allow Garry's Mod
community.general.ufw:
rule: allow
port: '17015'
proto: udp
- name: Allow Garry's Mod
community.general.ufw:
rule: allow
port: '27015'
proto: udp
- name: Allow Garry's Mod
community.general.ufw:
rule: allow
port: '27015'
proto: tcp
- name: Allow all access from RFC1918 networks to this host - name: Allow all access from RFC1918 networks to this host
community.general.ufw: community.general.ufw:
rule: allow rule: allow