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;
    }
  {{ if .Values.nginx.noAuthSmtpServerIP -}}
  noauthsmtp.conf: |-
    server {
      listen 25;
      server_name localhost;
      protocol smtp;
      smtp_auth none;
      smtp_capabilities none;
      auth_http localhost:8080/noauth;
      xclient on;
    }
  {{- end }} 
  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;