{pkgs, lib, config, nodes, ...}:
let inherit (builtins) attrNames toFile;
inherit (lib) types;
- inherit (config.services) x509 postfix dovecot2 postgrey;
+ inherit (config.services) x509 postfix dovecot2 postgrey openldap;
unlines = lib.concatStringsSep "\n";
unwords = lib.concatStringsSep " ";
when = x: y: if x == null then "" else y;
+ unlines (lib.mapAttrsToList
(from: to: "${from} ${unwords to}")
postfix.aliases));
+ mapFiles."ldap-virtual_alias_maps.cf" =
+ toFile "ldap-virtual_alias_maps.cf" ''
+ version = 3
+ debuglevel = 3
+ server_host = ldapi://
+ bind = sasl
+ sasl_mechs = EXTERNAL
+ search_base = ou=posix,${openldap.domainSuffix}
+ scope = sub
+ dereference = 0
+ query_filter = (&(mail=%s))
+ result_format = %s
+ result_attribute = mailAlias
+ '';
sslCert = x509.cert;
sslKey = x509.key;
#enableSubmission = true;
config.networking.hostName
"${config.networking.hostName}.localdomain"
];
- networks = [ "127.0.0.0/8" "[::1]/128" ];
+ networks = [
+ "127.0.0.0/8"
+ "[::1]/128"
+ ];
recipientDelimiter = "+";
config = {
# Appending .domain is the MUA's job
#smtp_header_checks = "regexp:/var/lib/postfix/smtp_header_checks";
smtp_mime_header_checks = "";
smtp_nested_header_checks = "";
- smtp_tls_exclude_ciphers = [ "RC4" "aNULL" ];
+ smtp_tls_exclude_ciphers = [ "ADH" "MD5" "CAMELLIA" "SEED" "3DES" "DES" "RC4" "eNULL" "aNULL" ];
#smtp_tls_fingerprint_digest = "sha1";
smtp_tls_loglevel = "1";
#smtp_tls_note_starttls_offer = true;
smtpd_relay_restrictions = [
"permit_mynetworks"
"permit_sasl_authenticated"
+ # NOTE: permit auth through dovecot's SASL
"reject_unauth_destination"
];
#smtpd_restriction_classes = "";
"permit_mynetworks"
"permit_tls_clientcerts"
"permit_sasl_authenticated"
+ # NOTE: permit auth through dovecot's SASL
#"check_sender_access hash:/var/lib/postfix/conf/sender_access"
"reject_unauth_pipelining"
"reject_non_fqdn_sender"
virtual_alias_domains = [];
virtual_alias_maps = [
"hash:/etc/postfix/virtual_alias_maps"
- #"ldap:aliases"
+ #TODO: "ldap:/etc/postfix/ldap-virtual_alias_maps.cf"
#"hash:/etc/postfix/virtual_alias-dovecot"
#"hash:/var/lib/postfix/conf/valias"
#"regexp:/etc/sympa/virtual_alias"