Skip to content

Commit 6a1579c

Browse files
committed
Enable proxy protocol support for sieve protocol. See docker-mailserver#156.
1 parent b994822 commit 6a1579c

File tree

5 files changed

+95
-9
lines changed

5 files changed

+95
-9
lines changed

charts/docker-mailserver/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,6 @@ In addition to tests above, a "snapshot" test is created for each manifest file.
268268
If you're comfortable with the changes to the saved snapshot, then regenerate the snapshots, by running the following from the root of the repo
269269

270270
```console
271-
$helm plugin install https://github.com/lrills/helm-unittest
272-
$helm unittest helm-chart/docker-mailserver
271+
helm plugin install https://github.com/helm-unittest/helm-unittest.git
272+
helm unittest -u charts/docker-mailserver
273273
```

charts/docker-mailserver/templates/deployment.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ spec:
249249
{{- if and (.Values.deployment.env.ENABLE_MANAGESIEVE) (not .Values.deployment.env.SMTP_ONLY) }}
250250
- name: managesieve
251251
containerPort: 4190
252+
{{- if .Values.proxyProtocol.enabled }}
253+
- name: managesieve-proxy
254+
containerPort: 14190
255+
{{- end }}
252256
{{- end }}
253257

254258
{{- if .Values.metrics.enabled }}

charts/docker-mailserver/templates/service.yaml

+10-5
Original file line numberDiff line numberDiff line change
@@ -118,23 +118,28 @@ spec:
118118
{{- end }}
119119
{{- end }}
120120

121-
{{- if .Values.deployment.env.ENABLE_RSPAMD }}
121+
{{- if .Values.deployment.env.ENABLE_RSPAMD }}
122122
- name: rspamd
123123
targetPort: rspamd
124124
port: 11334
125-
{{- end }}
125+
{{- end }}
126126

127-
{{- if and (.Values.deployment.env.ENABLE_MANAGESIEVE) (not .Values.deployment.env.SMTP_ONLY) }}
127+
{{- if and (.Values.deployment.env.ENABLE_MANAGESIEVE) (not .Values.deployment.env.SMTP_ONLY) }}
128128
- name: managesieve
129129
targetPort: managesieve
130130
port: 4190
131+
{{- if .Values.proxyProtocol.enabled }}
132+
- name: managesieve-proxy
133+
targetPort: managesieve-proxy
134+
port: 14190
131135
{{- end }}
136+
{{- end }}
132137

133-
{{- if .Values.metrics.enabled }}
138+
{{- if .Values.metrics.enabled }}
134139
- name: metrics
135140
port: 9154
136141
targetPort: 9154
137-
{{- end }}
142+
{{- end }}
138143

139144
type: {{ default "ClusterIP" .Values.service.type }}
140145
{{- if eq .Values.service.type "LoadBalancer" }}

charts/docker-mailserver/tests/__snapshot__/configmap_test.yaml.snap

+67-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,30 @@ manifest should match snapshot:
22
1: |
33
apiVersion: v1
44
data:
5-
dovecot.cf: "\nhaproxy_trusted_networks = 10.0.0.0/8 192.168.0.0/16 172.16.0.0/16\nservice imap-login {\n inet_listener imap {\n port = 143\n }\n \n inet_listener imaps {\n port = 993\n ssl = yes\n }\n \n inet_listener imap_proxy {\n haproxy = yes\n port = 10143\n ssl = no\n }\n\n inet_listener imaps_proxy {\n haproxy = yes\n port = 10993\n ssl = yes\n }\n}\n"
5+
dovecot.cf: |2
6+
haproxy_trusted_networks = 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12
7+
service imap-login {
8+
inet_listener imap {
9+
port = 143
10+
}
11+
12+
inet_listener imaps {
13+
port = 993
14+
ssl = yes
15+
}
16+
17+
inet_listener imap_proxy {
18+
haproxy = yes
19+
port = 10143
20+
ssl = no
21+
}
22+
23+
inet_listener imaps_proxy {
24+
haproxy = yes
25+
port = 10993
26+
ssl = yes
27+
}
28+
}
629
kind: ConfigMap
730
metadata:
831
labels:
@@ -26,7 +49,49 @@ manifest should match snapshot:
2649
3: |
2750
apiVersion: v1
2851
data:
29-
user-patches.sh: "#!/bin/bash\n# Make sure to keep this file in sync with https://github.com/docker-mailserver/docker-mailserver/blob/master/target/postfix/master.cf!\ncat <<EOS >> /etc/postfix/master.cf\n\n# Submission with proxy\n10587 inet n - n - - smtpd\n -o syslog_name=postfix/submission\n -o smtpd_tls_security_level=encrypt\n -o smtpd_sasl_auth_enable=yes\n -o smtpd_sasl_type=dovecot\n -o smtpd_reject_unlisted_recipient=no\n -o smtpd_sasl_authenticated_header=yes\n -o smtpd_client_restrictions=permit_sasl_authenticated,reject\n -o smtpd_relay_restrictions=permit_sasl_authenticated,reject\n -o smtpd_sender_restrictions=\\$mua_sender_restrictions\n -o smtpd_discard_ehlo_keywords=\n -o milter_macro_daemon_name=ORIGINATING\n -o cleanup_service_name=sender-cleanup\n -o smtpd_upstream_proxy_protocol=haproxy \n\n# Submissions with proxy\n10465 inet n - n - - smtpd\n -o syslog_name=postfix/submissions\n -o smtpd_tls_wrappermode=yes\n -o smtpd_sasl_auth_enable=yes\n -o smtpd_sasl_type=dovecot\n -o smtpd_reject_unlisted_recipient=no\n -o smtpd_sasl_authenticated_header=yes\n -o smtpd_client_restrictions=permit_sasl_authenticated,reject\n -o smtpd_relay_restrictions=permit_sasl_authenticated,reject\n -o smtpd_sender_restrictions=\\$mua_sender_restrictions\n -o smtpd_discard_ehlo_keywords=\n -o milter_macro_daemon_name=ORIGINATING\n -o cleanup_service_name=sender-cleanup\n -o smtpd_upstream_proxy_protocol=haproxy\n\n# Smtp with proxy\n12525 inet n - n - 1 postscreen\n -o syslog_name=postfix/smtp-proxy\n -o postscreen_upstream_proxy_protocol=haproxy\n -o postscreen_cache_map=btree:$data_directory/postscreen_10025_cache\nEOS\n"
52+
user-patches.sh: |
53+
#!/bin/bash
54+
# Make sure to keep this file in sync with https://github.com/docker-mailserver/docker-mailserver/blob/master/target/postfix/master.cf!
55+
cat <<EOS >> /etc/postfix/master.cf
56+
57+
# Submission with proxy
58+
10587 inet n - n - - smtpd
59+
-o syslog_name=postfix/submission
60+
-o smtpd_tls_security_level=encrypt
61+
-o smtpd_sasl_auth_enable=yes
62+
-o smtpd_sasl_type=dovecot
63+
-o smtpd_reject_unlisted_recipient=no
64+
-o smtpd_sasl_authenticated_header=yes
65+
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
66+
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
67+
-o smtpd_sender_restrictions=\$mua_sender_restrictions
68+
-o smtpd_discard_ehlo_keywords=
69+
-o milter_macro_daemon_name=ORIGINATING
70+
-o cleanup_service_name=sender-cleanup
71+
-o smtpd_upstream_proxy_protocol=haproxy
72+
73+
# Submissions with proxy
74+
10465 inet n - n - - smtpd
75+
-o syslog_name=postfix/submissions
76+
-o smtpd_tls_wrappermode=yes
77+
-o smtpd_sasl_auth_enable=yes
78+
-o smtpd_sasl_type=dovecot
79+
-o smtpd_reject_unlisted_recipient=no
80+
-o smtpd_sasl_authenticated_header=yes
81+
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
82+
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
83+
-o smtpd_sender_restrictions=\$mua_sender_restrictions
84+
-o smtpd_discard_ehlo_keywords=
85+
-o milter_macro_daemon_name=ORIGINATING
86+
-o cleanup_service_name=sender-cleanup
87+
-o smtpd_upstream_proxy_protocol=haproxy
88+
89+
# Smtp with proxy
90+
12525 inet n - n - 1 postscreen
91+
-o syslog_name=postfix/smtp-proxy
92+
-o postscreen_upstream_proxy_protocol=haproxy
93+
-o postscreen_cache_map=btree:$data_directory/postscreen_10025_cache
94+
EOS
3095
kind: ConfigMap
3196
metadata:
3297
labels:

charts/docker-mailserver/values.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,18 @@ configMaps:
541541
}
542542
}
543543
{{- end -}}
544+
545+
{{- if and (.Values.deployment.env.ENABLE_MANAGESIEVE) (not .Values.deployment.env.SMTP_ONLY) }}
546+
service managesieve-login {
547+
inet_listener sieve {
548+
port = 4190
549+
}
550+
551+
inet_listener sieve_proxy {
552+
port = 14190
553+
}
554+
}
555+
{{- end -}}
544556
{{- end -}}
545557
546558
fts-xapian-plugin.conf:

0 commit comments

Comments
 (0)