diff --git a/charts/mailproxy/v0.1.0/templates/nginx-configmap.yaml b/charts/mailproxy/v0.1.0/templates/nginx-configmap.yaml index f08e0da..a7b829c 100644 --- a/charts/mailproxy/v0.1.0/templates/nginx-configmap.yaml +++ b/charts/mailproxy/v0.1.0/templates/nginx-configmap.yaml @@ -1,10 +1,45 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "mailproxy.fullname" . }}-nginxconf + name: {{ include "mailproxy.fullname" . }}-nginx-conf labels: {{- include "mailproxy.labels" . | nindent 4 }} data: + nginx-conf: |- + user nginx; + worker_processes auto; + + error_log /var/log/nginx/error.log notice; + pid /var/run/nginx.pid; + + events { + worker_connections 1024; + } + + http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile off; + #tcp_nopush on; + + keepalive_timeout 65; + + #gzip on; + + include /etc/nginx/conf.d/*.conf; + } + + mail { + include /etc/nginx/mailhosts/*.conf; + } + phpfpm-conf: |- upstream backend { server {{ include "mailproxy.fullname" . }}-mailauth:9000; @@ -36,40 +71,5 @@ data: include fastcgi_params; } } - imap-conf: |- - server { - listen 993; - server_name localhost; - protocol imap; - auth_http localhost:8080/auth-mail.php; - ssl on; - proxy_pass_error_message on; - } - pop-conf: |- - server { - listen 995; - server_name localhost; - protocol pop3; - auth_http localhost:8080/auth-mail.php; - ssl on; - proxy_pass_error_message on; - } - smtp-conf: |- - server { - listen 587; - server_name localhost; - protocol smtp; - auth_http localhost:8080/auth-mail.php; - starttls only; - xclient on; - proxy_pass_error_message on; - } - ssl-conf: |- - ssl_certificate /etc/nginx/ssl/tls.crt; - ssl_certificate_key /etc/nginx/ssl/tls.key; - ssl_session_timeout 5m; - ssl_protocols TLSv1 TLSv1.1 TLSv1.2; - ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH; - ssl_prefer_server_ciphers on; \ No newline at end of file diff --git a/charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml b/charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml index 199f511..9108e7c 100644 --- a/charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml +++ b/charts/mailproxy/v0.1.0/templates/nginx-deployment.yaml @@ -45,20 +45,17 @@ spec: path: / port: http volumeMounts: + - mountPath: /etc/nginx/nginx.conf + subPath: nginx-conf + name: nginx-conf - mountPath: /etc/nginx/conf.d/phpfpm.conf subPath: phpfpm-conf - name: nginxconf - - mountPath: /etc/nginx/conf.d/imap.conf - subPath: imap-conf - name: nginxconf - - mountPath: /etc/nginx/conf.d/pop.conf - subPath: pop-conf - name: nginxconf - - mountPath: /etc/nginx/conf.d/smtp.conf - subPath: smtp-conf - name: nginxconf + name: nginx-conf + - mountPath: /etc/nginx/mailhosts + name: mailhosts-conf + readOnly: true - mountPath: /etc/nginx/ssl - name: {{ include "mailproxy.fullname" . }}-tls + name: mailproxy-tls readOnly: true resources: {{- toYaml .Values.nginx.resources | nindent 12 }} @@ -75,9 +72,12 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} volumes: - - name: nginxconf + - name: nginx-conf + configMap: + name: {{ include "mailproxy.fullname" . }}-nginx-conf + - name: mailhosts-conf configMap: - name: {{ include "mailproxy.fullname" . }}-nginxconf - - name: {{ include "mailproxy.fullname" . }}-tls + name: {{ include "mailproxy.fullname" . }}-mailhosts-conf + - name: mailproxy-tls secret: secretName: {{ include "mailproxy.fullname" . }}-tls diff --git a/charts/mailproxy/v0.1.0/templates/nginx-mailhosts-conf.yaml b/charts/mailproxy/v0.1.0/templates/nginx-mailhosts-conf.yaml new file mode 100644 index 0000000..933bc60 --- /dev/null +++ b/charts/mailproxy/v0.1.0/templates/nginx-mailhosts-conf.yaml @@ -0,0 +1,44 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "mailproxy.fullname" . }}-mailhosts-conf + labels: + {{- include "mailproxy.labels" . | nindent 4 }} +data: + imap.conf: |- + server { + listen 993; + server_name localhost; + protocol imap; + auth_http localhost:8080/auth-mail.php; + ssl on; + proxy_pass_error_message on; + } + pop.conf: |- + server { + listen 995; + server_name localhost; + protocol pop3; + auth_http localhost:8080/auth-mail.php; + ssl on; + proxy_pass_error_message on; + } + smtp.conf: |- + server { + listen 587; + server_name localhost; + protocol smtp; + auth_http localhost:8080/auth-mail.php; + starttls only; + xclient on; + proxy_pass_error_message on; + } + ssl.conf: |- + ssl_certificate /etc/nginx/ssl/tls.crt; + ssl_certificate_key /etc/nginx/ssl/tls.key; + ssl_session_timeout 5m; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH; + ssl_prefer_server_ciphers on; + + \ No newline at end of file