Browse Source

Basic Mailu mail server configuration.

master
Dan Helfman 1 year ago
parent
commit
5b966789f7

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
1
+site.retry

+ 41
- 38
group_vars/vault.yml View File

@@ -1,39 +1,42 @@
1 1
 $ANSIBLE_VAULT;1.1;AES256
2
-38386533303731643564366434373066323562643961323036663431666263356134376261366236
3
-3235353765353862623962353834356330633432376139610a636263313364313139303930346136
4
-36316630326435623564356364333532303136333031303833396331363438623031393730313036
5
-3037666466366434390a336231626561363166633032313339623839353266323538646166323137
6
-32363734373062383161366364616239316539643031653332363366303532656465646136396239
7
-61323736313532643036393539363466386164313138623434653634373563636332306131306561
8
-36363936613162313663353234356335646131306236666239316533613833353163623861386663
9
-65316161313961653235653564633933383366356231373535623362613134356262333565666331
10
-30313531663032613832643661303236643866323137373364313639613435336636356330653235
11
-34666165393637356463616462343634346436633635633239393830656361326232613265356565
12
-61303335646335353265313637653932383133343961373232613432663536633639323861396135
13
-63663930663537666165313731656265383632613065343362313662663563396433316634626134
14
-37306465633938636364396566373631326563396535366435323338653937613535363536643330
15
-30326533363431383830313435323632613762343936323938366236326665373532393636323438
16
-39396531656336343264663835653732623830306435646461316538336332343234376138633537
17
-31393362376130663832316132643338343636336461656665653039393730346532613239616430
18
-65303333623338636334656330396633356333616566383031373762626165366139373030656564
19
-35343061386265346464303237646530663438306531333834313466343933363363336564316261
20
-39613839366365376161616162636538333865623761306231366232666665336534613636303430
21
-33613361633637666136306563396538323761323333643764623466616163643135636238613566
22
-38666335366165316133313331623436366564316532393961313035356464616166363164356138
23
-38643762303138343264303664646538336661316439666662616232333738396531306165633166
24
-37376663383365396536303634393334373837353135386231303265636563346465396533326139
25
-34343465616663323935373861343461383630663230386164343337303932623134383361316561
26
-31613132313364663637656133393465666239666362663965623233366165393839343938376539
27
-31303330346365666339383334323937373231643861633637333638353630656566663334393936
28
-32313737636266323233313635396430326330393466343437313031306562656165616439333130
29
-35376636306133633030663137393364396636663338313630653366616237643061393166616330
30
-37646530363164616137363032323634393732326365646361313639653236383164373831326361
31
-37383038666365653562386531346134393638373165323563363464353834613066623837633061
32
-63356630313838323031646435333062396138613661643837613162653931626264653139656235
33
-30353830303838623837646131383138353333626264313262383366336532323934343539306231
34
-36623834623139386233653038623366613330386163626539376431613864656461323364373935
35
-33303839613462386433343163643461626535336461303765616536626539393239383634386532
36
-39633362653166393761623935613239306133346635623330393734656436376535333538366663
37
-66333132633965626434363033336432363034353438643439313362613339613134626134333236
38
-34363662386265303962316266613533373666613737663532356536383930636632323038393631
39
-6465393563633134363863333532343162303036663339326566
2
+30343263353163636636376538376330383038353737313137346436373536356539303237343532
3
+6137346636383666656161663166333532393931363535380a616131393636643336363061623736
4
+30303030653033653438316334313032386636653033343830313132613430326566636439366537
5
+6334363330363965310a623734666137373164316532333739633461366562303134373831353931
6
+63396432653461376136633530316663363763613466313563303334303465613734366537636231
7
+38633165613864363862616233323462316665386263376537636164316132356335303963306664
8
+65353230636139343638343633643763366131373536623939663532613631323137663865346465
9
+31613633333335663732303762383530373931656661306239313863316565366566343838616533
10
+62633936336531613039323231663933373863353035393461396463636330346237666136636331
11
+62643030376137656261356661316530343965646430313764323334623431303737663338326335
12
+37626134633163336234636337386463396238306639333166323338643732653338313662373431
13
+62323261663938396661656566353735663137636565383865613439656138633433623930383265
14
+39653133373534386364393034666637306466313865306637643063393130333837336566653266
15
+32333839313365373064373133336334393431623033636633306165396263656663376635366132
16
+33386134353365323434343231643032636536303832383738636466316663326536303430313630
17
+61613834306662366236326432333961633233663762616631363330333638363965643963333235
18
+63346134363334323139323031383030633939646537643562633066656162626131653764303632
19
+31316164346662623462663966656636376130633066313763613861613630383564613738363330
20
+35393839643235383038323737303338383939613734656436656664323235653661623832326661
21
+62376564363131393233623464343636323065643138333638623531666663613633346336626237
22
+39313134326165616231656533346536343037393462373336323733666165623962666136643963
23
+36313434356266396163343164333966633930633665333166623562366535663439336563663137
24
+39343236326165666539633739326432393163346633326433396161346262623132336530393666
25
+64623464653363343261306635646561373766653263663033326661363136613162333833356534
26
+62323065366433326364653735366532626337303838313338663363356461373530363831343464
27
+64333536313031653939356639313666333261336163336362633263383662326434363534383733
28
+63396338303938376633623137346630656131653130373637376464343835663837666165643934
29
+64306134666338393335616332326337363933316433333034613161636433613133353830376636
30
+36303536306163336637633733356662303263633636646232626536653162396462306434653836
31
+36643363623866313137363033396531373436303330633133633738653864633063323132313066
32
+39343933626464623564363661323939643732663266323235376438393966656533383339656535
33
+30643432663764653662303831373962653436306666656461386565346534366566306363373531
34
+39633963326564386534353338336239326336383031393830373534396362336364386464666532
35
+38616464306137356438306232333031306263333363373638656132353534626631313138373930
36
+30356238656234663261323363366664386631656266653132323035656134356436313965613837
37
+30616238636461636237326639613736316339626237386333653738393530613330386137633530
38
+38613462613831366133613262366466303736336435366438373136363062383637326331666161
39
+65353265643365383931356164336564303838326464353765636265306563353965343432303733
40
+37333536316562636366393034353164326633333831623533393730376532303930613030613262
41
+62303238303766663135666363653834313435636234613738616238336238653233363031633331
42
+6266

+ 3
- 0
roles/mail_server_docker/meta/main.yml View File

@@ -0,0 +1,3 @@
1
+dependencies:
2
+  - role: docker_compose
3
+  - role: web_server

+ 76
- 0
roles/mail_server_docker/tasks/main.yml View File

@@ -0,0 +1,76 @@
1
+- name: create configuration file directoroy
2
+  file: path=/etc/mailu state=directory
3
+  tags:
4
+    - mail_server_docker
5
+
6
+- name: write configuration file
7
+  template:
8
+    src: configuration.j2
9
+    dest: /etc/mailu/config
10
+    mode: 0600
11
+  tags:
12
+    - mail_server_docker
13
+
14
+- name: run mail server containers
15
+  docker_service:
16
+    project_name: mail_server
17
+    pull: yes
18
+    definition:
19
+      version: '3'
20
+      services:
21
+        redis:
22
+          image: redis:alpine
23
+          restart: always
24
+          volumes:
25
+            - "/var/lib/mailu/redis:/data"
26
+        imap:
27
+          image: mailu/dovecot:{{ mail_server_mailu_version }}
28
+          restart: always
29
+          env_file: /etc/mailu/config
30
+          volumes:
31
+            - "/var/lib/mailu/data:/data"
32
+            - "/var/lib/mailu/mail:/mail"
33
+            - "/var/lib/mailu/overrides:/overrides"
34
+        smtp:
35
+          image: mailu/postfix:{{ mail_server_mailu_version }}
36
+          restart: always
37
+          env_file: /etc/mailu/config
38
+          volumes:
39
+            - "/var/lib/mailu/data:/data"
40
+            - "/var/lib/mailu/overrides:/overrides"
41
+        antispam:
42
+          image: mailu/rspamd:{{ mail_server_mailu_version }}
43
+          restart: always
44
+          env_file: /etc/mailu/config
45
+          volumes:
46
+            - "/var/lib/mailu/filter:/var/lib/rspamd"
47
+            - "/var/lib/mailu/dkim:/dkim"
48
+            - "/var/lib/mailu/overrides/rspamd:/etc/rspamd/override.d"
49
+        admin:
50
+          image: mailu/admin:{{ mail_server_mailu_version }}
51
+          restart: always
52
+          env_file: /etc/mailu/config
53
+          environment:
54
+            VIRTUAL_HOST: "{{ mail_server_hostname }}"
55
+            LETSENCRYPT_HOST: "{{ mail_server_hostname }}"
56
+            LETSENCRYPT_EMAIL: "{{ admin_email }}"
57
+          volumes:
58
+            - "/var/lib/mailu/data:/data"
59
+            - "/var/lib/mailu/dkim:/dkim"
60
+            - /var/run/docker.sock:/var/run/docker.sock:ro
61
+          expose:
62
+            - "80"
63
+          depends_on:
64
+            - redis
65
+        fetchmail:
66
+          image: mailu/fetchmail:{{ mail_server_mailu_version }}
67
+          restart: always
68
+          env_file: /etc/mailu/config
69
+          volumes:
70
+            - "/var/lib/mailu/data:/data"
71
+      networks:
72
+        default:
73
+          external:
74
+            name: shared
75
+  tags:
76
+    - mail_server_docker

+ 115
- 0
roles/mail_server_docker/templates/configuration.j2 View File

@@ -0,0 +1,115 @@
1
+# Mailu main configuration file
2
+#
3
+# Most configuration variables can be modified through the Web interface,
4
+# these few settings must however be configured before starting the mail
5
+# server and require a restart upon change.
6
+
7
+###################################
8
+# Common configuration variables
9
+###################################
10
+
11
+# Set this to the path where Mailu data and configuration is stored
12
+ROOT=/var/lib/mailu
13
+
14
+# Mailu version to run (1.0, 1.1, etc. or master)
15
+VERSION={{ mail_server_mailu_version }}
16
+
17
+# Set to a randomly generated 16 bytes string
18
+SECRET_KEY={{ mail_server_secret_key }}
19
+
20
+# Address where listening ports should bind
21
+BIND_ADDRESS4=127.0.0.1
22
+BIND_ADDRESS6=::1
23
+
24
+# Main mail domain
25
+DOMAIN={{ mail_server_hostname }}
26
+
27
+# Hostnames for this server, separated with comas
28
+HOSTNAMES={{ mail_server_public_hostnames | join(',') }}
29
+
30
+# Postmaster local part (will append the main mail domain)
31
+POSTMASTER=admin
32
+
33
+# Choose how secure connections will behave (value: letsencrypt, cert, notls, mail)
34
+TLS_FLAVOR=letencrypt
35
+
36
+# Authentication rate limit (per source IP address)
37
+AUTH_RATELIMIT=10/minute;1000/hour
38
+
39
+# Opt-out of statistics, replace with "True" to opt out
40
+DISABLE_STATISTICS=True
41
+
42
+###################################
43
+# Optional features
44
+###################################
45
+
46
+# Expose the admin interface (value: true, false)
47
+ADMIN=true
48
+
49
+# Choose which webmail to run if any (values: roundcube, rainloop, none)
50
+WEBMAIL=none
51
+
52
+# Dav server implementation (value: radicale, none)
53
+WEBDAV=none
54
+
55
+# Antivirus solution (value: clamav, none)
56
+ANTIVIRUS=none
57
+
58
+###################################
59
+# Mail settings
60
+###################################
61
+
62
+# Message size limit in bytes
63
+# Default: accept messages up to 50MB
64
+MESSAGE_SIZE_LIMIT=50000000
65
+
66
+# Networks granted relay permissions, make sure that you include your Docker
67
+# internal network (default to 172.17.0.0/16)
68
+RELAYNETS=172.16.0.0/12
69
+
70
+# Will relay all outgoing mails if configured
71
+RELAYHOST=
72
+
73
+# Fetchmail delay
74
+FETCHMAIL_DELAY=600
75
+
76
+# Recipient delimiter, character used to delimiter localpart from custom address part
77
+# e.g. localpart+custom@domain;tld
78
+RECIPIENT_DELIMITER=-
79
+
80
+# DMARC rua and ruf email
81
+DMARC_RUA=admin
82
+DMARC_RUF=admin
83
+
84
+# Weclome email, enable and set a topic and body if you wish to send welcome
85
+# emails to all users.
86
+WELCOME=false
87
+WELCOME_SUBJECT=Welcome to your new email account
88
+WELCOME_BODY=Welcome to your new email account. If you can read this, then it is configured properly!
89
+
90
+###################################
91
+# Web settings
92
+###################################
93
+
94
+# Path to the admin interface if enabled
95
+WEB_ADMIN=/admin
96
+
97
+# Path to the webmail if enabled
98
+WEB_WEBMAIL=/webmail
99
+
100
+# Website name
101
+SITENAME=Mail
102
+
103
+# Linked Website URL
104
+WEBSITE=https://{{ mail_server_hostname }}
105
+
106
+###################################
107
+# Advanced settings
108
+###################################
109
+
110
+# Docker-compose project name, this will prepended to containers names.
111
+COMPOSE_PROJECT_NAME=mail_server
112
+
113
+# Default password scheme used for newly created accounts and changed passwords
114
+# (value: SHA512-CRYPT, SHA256-CRYPT, MD5-CRYPT, CRYPT)
115
+PASSWORD_SCHEME=SHA512-CRYPT

+ 4
- 0
roles/web_server/tasks/main.yml View File

@@ -35,6 +35,10 @@
35 35
             - /etc/nginx/vhost.d:/etc/nginx/vhost.d
36 36
             - /etc/nginx/htpasswd:/etc/nginx/htpasswd:ro
37 37
             - /usr/share/nginx/html:/usr/share/nginx/html
38
+          networks:
39
+            default:
40
+              aliases:
41
+                - front  # For mailu.
38 42
         nginx-docker-gen:
39 43
           image: jwilder/docker-gen
40 44
           restart: always

+ 10
- 4
site.yml View File

@@ -40,6 +40,8 @@
40 40
 - hosts: apps.torsion.org
41 41
   vars_files:
42 42
     - group_vars/vault.yml
43
+  vars:
44
+    admin_email: webmaster@torsion.org
43 45
   roles:
44 46
     - common
45 47
     - role: backup_docker
@@ -48,18 +50,22 @@
48 50
       backup_ssh_key_file: apps-root
49 51
       backup_known_hosts_key_file: rsync-net
50 52
       backup_encryption_passphrase: "{{ backup_encryption_passphrase_apps }}"
53
+    - role: mail_server_docker
54
+      mail_server_hostname: mail2.torsion.org
55
+      mail_server_secret_key: "{{ mail_server_secret_key_apps }}"
56
+      mail_server_public_hostnames:
57
+        - torsion.org
58
+        - luminotes.com
59
+        - coderific.com
60
+      mail_server_mailu_version: 1.5.1
51 61
     - role: calendar_server
52 62
       calendar_server_hostname: calendar.torsion.org
53
-      admin_email: webmaster@torsion.org
54 63
     - role: mediagoblin
55 64
       mediagoblin_from_email: media@torsion.org
56 65
       mediagoblin_hostname: media.torsion.org
57 66
       mediagoblin_email_host: mail.torsion.org
58 67
       mediagoblin_email_port: 465
59
-      admin_email: webmaster@torsion.org
60 68
     - role: gitea
61 69
       gitea_hostname: projects.torsion.org
62
-      admin_email: webmaster@torsion.org
63 70
     - role: container_dashboard
64 71
       container_dashboard_hostname: apps.torsion.org
65
-      admin_email: webmaster@torsion.org

Loading…
Cancel
Save