# This file is managed by Helm
#
# LDAP Transports
#
#################################

# Use this instead of mail_spool if you want to to deliver to Maildir in
# home-directory - change the definition of LOCAL_DELIVERY
#
ldap_delivery:
  debug_print = "ldap_user for $local_part@$domain"
  driver = appendfile
  # We want the files to be owned by the user
  user = ${lookup ldap{\
              {{- if .Values.ldap.auth.enabled }}
              user=${env{LDAP_USER}{$value} fail } \
              pass=${env{LDAP_PASSWORD}{$value} fail } \
              {{- end }}
              ldap:///LDAP_BASE?\
              {{ .Values.ldap.uidNumberAttribute }}?sub?\
              (&({{ .Values.ldap.uidAttribute }}=${quote_ldap:$local_part})\
                ({{ .Values.ldap.userFilter }})\
              )\
              }}
  group = ${lookup ldap{\
              {{- if .Values.ldap.auth.enabled }}
              user=${env{LDAP_USER}{$value} fail } \
              pass=${env{LDAP_PASSWORD}{$value} fail } \
              {{- end }}
              ldap:///LDAP_BASE?\
              {{ .Values.ldap.gidNumberAttribute }}?sub?\
              (&({{ .Values.ldap.uidAttribute }}=${quote_ldap:$local_part})\
                ({{ .Values.ldap.userFilter }})\
              )\
              }}

  directory = /var/mail/${local_part_data}
  directory_mode = 0770
  mode = 0660
  maildir_format = true
  use_lockfile = true

  delivery_date_add
  envelope_to_add
  return_path_add

  mode_fail_narrower = false
  # This transport always chdirs to $home before trying to deliver. If
  # $home is not accessible, this chdir fails and prevents delivery.
  # If you are in a setup where home directories might not be
  # accessible, uncomment the current_directory line below.
  # current_directory = /

# Local Variables:
# mode: conf-space
# compile-command: "make -C ../../../.. diff"
# End:
