From 7dca5ec239e4610d7aa812be706002617560011e Mon Sep 17 00:00:00 2001 From: Sheogorath <sheogorath@shivering-isles.com> Date: Mon, 27 Jun 2022 01:02:30 +0200 Subject: [PATCH] fix(postfix): Add ability to overwrite service name Currently the service name for dovecot was hardcoded in the image, which makes it incompatible with MoK. As a result this patch updates the image to allow a dynamic overwrite on startup as well as updating MoK to account for the new functionality. --- charts/mok/Chart.yaml | 2 +- charts/mok/README.md | 4 ++-- charts/mok/templates/postfix.yaml | 3 +++ charts/mok/values.yaml | 2 +- images/postfix/.release | 2 +- images/postfix/config/master.cf | 8 -------- images/postfix/docker/start.sh | 5 +++++ 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/charts/mok/Chart.yaml b/charts/mok/Chart.yaml index 7ca8ae232..39a06c2a4 100644 --- a/charts/mok/Chart.yaml +++ b/charts/mok/Chart.yaml @@ -3,7 +3,7 @@ name: mok description: | Mail on Kubernetes (MoK) is a project to deploy a functional mailserver that runs without a database server on Kubernetes, taking advantage of configmaps and secret. type: application -version: 0.1.2 +version: 0.1.3 sources: - https://de.postfix.org/ftpmirror/index.html - https://github.com/dovecot/core diff --git a/charts/mok/README.md b/charts/mok/README.md index 92a513173..aad2ed006 100644 --- a/charts/mok/README.md +++ b/charts/mok/README.md @@ -1,6 +1,6 @@ # mok -  +  Mail on Kubernetes (MoK) is a project to deploy a functional mailserver that runs without a database server on Kubernetes, taking advantage of configmaps and secret. @@ -55,7 +55,7 @@ Mail on Kubernetes (MoK) is a project to deploy a functional mailserver that run | postfix.affinity | object | `{}` | | | postfix.image.pullPolicy | string | `"IfNotPresent"` | | | postfix.image.repository | string | `"quay.io/shivering-isles/postfix"` | postfix container image | -| postfix.image.tag | string | `"0.1.0"` | Overrides the image tag whose default is "latest" | +| postfix.image.tag | string | `"0.1.1"` | Overrides the image tag whose default is "latest" | | postfix.imagePullSecrets | list | `[]` | | | postfix.nodeSelector | object | `{}` | | | postfix.podAnnotations | object | `{}` | | diff --git a/charts/mok/templates/postfix.yaml b/charts/mok/templates/postfix.yaml index 3fb47c26b..29da5d20e 100644 --- a/charts/mok/templates/postfix.yaml +++ b/charts/mok/templates/postfix.yaml @@ -66,6 +66,9 @@ spec: {{- toYaml .Values.postfix.podSecurityContext | nindent 8 }} containers: - name: postfix + env: + - name: DOVECOT_SERVICE_NAME + value: {{ include "mok.fullname" . }}-dovecot-internal.{{ .Release.Namespace }}.svc.cluster.local image: {{ .Values.postfix.image.repository }}:{{.Values.postfix.image.tag | default "latest" }} imagePullPolicy: {{ .Values.postfix.image.pullPolicy }} lifecycle: diff --git a/charts/mok/values.yaml b/charts/mok/values.yaml index 63b7b95d5..b0cc7a10c 100644 --- a/charts/mok/values.yaml +++ b/charts/mok/values.yaml @@ -44,7 +44,7 @@ postfix: repository: quay.io/shivering-isles/postfix pullPolicy: IfNotPresent # -- Overrides the image tag whose default is "latest" - tag: "0.1.0" + tag: "0.1.1" imagePullSecrets: [] diff --git a/images/postfix/.release b/images/postfix/.release index 85f180f38..30d504277 100644 --- a/images/postfix/.release +++ b/images/postfix/.release @@ -1 +1 @@ -release=0.1.0 +release=0.1.1 diff --git a/images/postfix/config/master.cf b/images/postfix/config/master.cf index d978e1e9c..8c2e8ab8a 100644 --- a/images/postfix/config/master.cf +++ b/images/postfix/config/master.cf @@ -111,10 +111,6 @@ submission inet n - y - - smtpd -o syslog_name=postfix/submission -o smtpd_tls_security_level=encrypt -o tls_preempt_cipherlist=yes - -o smtpd_sasl_type=dovecot - -o smtpd_sasl_path=inet:dovecot-internal:12345 - -o smtpd_sasl_security_options=noanonymous - -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_login_maps=lmdb:/srv/tmp/sender-login-maps -o cleanup_service_name=headers-cleanup @@ -124,10 +120,6 @@ submissions inet n - y - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_tls_security_level=encrypt -o tls_preempt_cipherlist=yes - -o smtpd_sasl_type=dovecot - -o smtpd_sasl_path=inet:dovecot-internal:12345 - -o smtpd_sasl_security_options=noanonymous - -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o smtpd_sender_login_maps=lmdb:/srv/tmp/sender-login-maps -o cleanup_service_name=headers-cleanup diff --git a/images/postfix/docker/start.sh b/images/postfix/docker/start.sh index 6285b6739..cec07c39b 100644 --- a/images/postfix/docker/start.sh +++ b/images/postfix/docker/start.sh @@ -37,6 +37,10 @@ fi ## postconf -e "myhostname = $HOSTNAME" +if [ -n DOVECOT_SERVICE_NAME ]; then + postconf -e "smtpd_sasl_path = inet:${DOVECOT_SERVICE_NAME}:12345" + postconf -e "virtual_transport = lmtp:inet:${DOVECOT_SERVICE_NAME}:24" +fi cp /srv/virtual/* /srv/tmp find /srv/tmp -type f -exec postmap lmdb://{} \; @@ -45,6 +49,7 @@ find /srv/tmp -type f -exec postmap lmdb://{} \; ## Kube DNS Support ## +mkdir -p /var/spool/postfix/etc/ cp /etc/resolv.conf /var/spool/postfix/etc/ ######## -- GitLab