blob: 166adc3966a0f9a504ef9ad85682a029cf23bb3f [file] [log] [blame]
giolekva7fe15192021-11-19 13:58:16 +04001apiVersion: v1
2kind: ConfigMap
3metadata:
4 name: config
5 namespace: {{ .Release.Namespace }}
6data:
7 maddy.conf: |
giolekva7fe15192021-11-19 13:58:16 +04008 $(hostname) = mail.{{ .Values.ingress.public.domain }}
9 $(primary_domain) = {{ .Values.ingress.public.domain }}
10 $(local_domains) = $(primary_domain)
giolekva75ee2712021-11-26 13:57:12 +040011
giolekva7fe15192021-11-19 13:58:16 +040012 auth.pass_table local_authdb {
13 table sql_table {
14 driver sqlite3
15 dsn credentials.db
16 table_name passwords
17 }
18 }
giolekva75ee2712021-11-26 13:57:12 +040019
giolekva7fe15192021-11-19 13:58:16 +040020 storage.imapsql local_mailboxes {
21 driver sqlite3
22 dsn imapsql.db
23 }
giolekva75ee2712021-11-26 13:57:12 +040024
giolekva7fe15192021-11-19 13:58:16 +040025 hostname $(hostname)
giolekva75ee2712021-11-26 13:57:12 +040026
giolekva7fe15192021-11-19 13:58:16 +040027 msgpipeline local_routing {
giolekva7fe15192021-11-19 13:58:16 +040028 destination postmaster $(local_domains) {
29 modify {
30 replace_rcpt regexp "(.+)\+(.+)@(.+)" "$1@$3"
31 replace_rcpt file /etc/maddy/aliases
32 }
giolekva75ee2712021-11-26 13:57:12 +040033
giolekva7fe15192021-11-19 13:58:16 +040034 deliver_to &local_mailboxes
35 }
giolekva75ee2712021-11-26 13:57:12 +040036
giolekva7fe15192021-11-19 13:58:16 +040037 default_destination {
38 reject 550 5.1.1 "User doesn't exist"
39 }
40 }
giolekva75ee2712021-11-26 13:57:12 +040041
giolekva7fe15192021-11-19 13:58:16 +040042 smtp tcp://0.0.0.0:25 {
giolekva75ee2712021-11-26 13:57:12 +040043 tls off
44
giolekva7fe15192021-11-19 13:58:16 +040045 limits {
46 # Up to 20 msgs/sec across max. 10 SMTP connections.
47 all rate 20 1s
48 all concurrency 10
49 }
giolekva75ee2712021-11-26 13:57:12 +040050
giolekva7fe15192021-11-19 13:58:16 +040051 dmarc yes
52 check {
53 require_mx_record
54 dkim
55 spf
56 }
giolekva75ee2712021-11-26 13:57:12 +040057
giolekva7fe15192021-11-19 13:58:16 +040058 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 }
giolekva75ee2712021-11-26 13:57:12 +040070
giolekva7fe15192021-11-19 13:58:16 +040071 submission tls://0.0.0.0:465 tcp://0.0.0.0:587 {
giolekva75ee2712021-11-26 13:57:12 +040072 tls file /etc/maddy/certs-private/tls.crt /etc/maddy/certs-private/tls.key
73
giolekva7fe15192021-11-19 13:58:16 +040074 limits {
75 # Up to 50 msgs/sec across any amount of SMTP connections.
76 all rate 50 1s
77 }
giolekva75ee2712021-11-26 13:57:12 +040078
giolekva7fe15192021-11-19 13:58:16 +040079 auth &local_authdb
giolekva75ee2712021-11-26 13:57:12 +040080
giolekva7fe15192021-11-19 13:58:16 +040081 source $(local_domains) {
82 destination postmaster $(local_domains) {
83 deliver_to &local_routing
84 }
85 default_destination {
giolekva75ee2712021-11-26 13:57:12 +040086 # modify {
87 # dkim $(primary_domain) $(local_domains) default
88 # }
giolekva7fe15192021-11-19 13:58:16 +040089 deliver_to &remote_queue
90 }
91 }
92 default_source {
93 reject 501 5.1.8 "Non-local sender domain"
94 }
95 }
96
giolekva75ee2712021-11-26 13:57:12 +040097 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}}
giolekva7fe15192021-11-19 13:58:16 +0400103 }
giolekva75ee2712021-11-26 13:57:12 +0400104
giolekva7fe15192021-11-19 13:58:16 +0400105 target.queue remote_queue {
giolekva75ee2712021-11-26 13:57:12 +0400106 target &outbound_gateway
giolekva7fe15192021-11-19 13:58:16 +0400107 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 }
giolekva75ee2712021-11-26 13:57:12 +0400117
giolekva7fe15192021-11-19 13:58:16 +0400118 imap tls://0.0.0.0:993 tcp://0.0.0.0:143 {
giolekva75ee2712021-11-26 13:57:12 +0400119 tls file /etc/maddy/certs-private/tls.crt /etc/maddy/certs-private/tls.key
giolekva7fe15192021-11-19 13:58:16 +0400120 auth &local_authdb
121 storage &local_mailboxes
122 }