blob: 166adc3966a0f9a504ef9ad85682a029cf23bb3f [file] [log] [blame]
Giorgi Lekveishvili4ec4c022024-08-17 15:09:24 +04001apiVersion: v1
2kind: ConfigMap
3metadata:
4 name: config
5 namespace: {{ .Release.Namespace }}
6data:
7 maddy.conf: |
8 $(hostname) = mail.{{ .Values.ingress.public.domain }}
9 $(primary_domain) = {{ .Values.ingress.public.domain }}
10 $(local_domains) = $(primary_domain)
11
12 auth.pass_table local_authdb {
13 table sql_table {
14 driver sqlite3
15 dsn credentials.db
16 table_name passwords
17 }
18 }
19
20 storage.imapsql local_mailboxes {
21 driver sqlite3
22 dsn imapsql.db
23 }
24
25 hostname $(hostname)
26
27 msgpipeline local_routing {
28 destination postmaster $(local_domains) {
29 modify {
30 replace_rcpt regexp "(.+)\+(.+)@(.+)" "$1@$3"
31 replace_rcpt file /etc/maddy/aliases
32 }
33
34 deliver_to &local_mailboxes
35 }
36
37 default_destination {
38 reject 550 5.1.1 "User doesn't exist"
39 }
40 }
41
42 smtp tcp://0.0.0.0:25 {
43 tls off
44
45 limits {
46 # Up to 20 msgs/sec across max. 10 SMTP connections.
47 all rate 20 1s
48 all concurrency 10
49 }
50
51 dmarc yes
52 check {
53 require_mx_record
54 dkim
55 spf
56 }
57
58 source $(local_domains) {
59 reject 501 5.1.8 "Use Submission for outgoing SMTP"
60 }
61 default_source {
62 destination postmaster $(local_domains) {
63 deliver_to &local_routing
64 }
65 default_destination {
66 reject 550 5.1.1 "User doesn't exist"
67 }
68 }
69 }
70
71 submission tls://0.0.0.0:465 tcp://0.0.0.0:587 {
72 tls file /etc/maddy/certs-private/tls.crt /etc/maddy/certs-private/tls.key
73
74 limits {
75 # Up to 50 msgs/sec across any amount of SMTP connections.
76 all rate 50 1s
77 }
78
79 auth &local_authdb
80
81 source $(local_domains) {
82 destination postmaster $(local_domains) {
83 deliver_to &local_routing
84 }
85 default_destination {
86 # modify {
87 # dkim $(primary_domain) $(local_domains) default
88 # }
89 deliver_to &remote_queue
90 }
91 }
92 default_source {
93 reject 501 5.1.8 "Non-local sender domain"
94 }
95 }
96
97 target.smtp outbound_gateway {
98 hostname {{ .Values.mailGateway.mxHostname }}
99 attempt_starttls false
100 require_tls no
101 auth forward
102 targets {{ .Values.mailGateway.address}}
103 }
104
105 target.queue remote_queue {
106 target &outbound_gateway
107 autogenerated_msg_domain $(primary_domain)
108 bounce {
109 destination postmaster $(local_domains) {
110 deliver_to &local_routing
111 }
112 default_destination {
113 reject 550 5.0.0 "Refusing to send DSNs to non-local addresses"
114 }
115 }
116 }
117
118 imap tls://0.0.0.0:993 tcp://0.0.0.0:143 {
119 tls file /etc/maddy/certs-private/tls.crt /etc/maddy/certs-private/tls.key
120 auth &local_authdb
121 storage &local_mailboxes
122 }