services/mail: use addresses from hosts config

This commit is contained in:
Max Headroom 2022-06-18 16:20:12 +02:00
parent bf9af1c5d8
commit 26ab120eaa

View file

@ -1,4 +1,4 @@
{ config, tools, ... }: { config, hosts, tools, ... }:
let let
inherit (tools.meta) domain; inherit (tools.meta) domain;
certDir = config.security.acme.certs."mail.${domain}".directory; certDir = config.security.acme.certs."mail.${domain}".directory;
@ -9,6 +9,8 @@ let
dkimSocket = builtins.replaceStrings ["local:"] ["unix:"] config.services.opendkim.socket; dkimSocket = builtins.replaceStrings ["local:"] ["unix:"] config.services.opendkim.socket;
lmtpSocket = "lmtp:unix:/run/dovecot2/lmtp"; lmtpSocket = "lmtp:unix:/run/dovecot2/lmtp";
postfixLdapMailboxes = "ldap:${config.age.secrets."postfix-ldap-mailboxes.cf".path}"; postfixLdapMailboxes = "ldap:${config.age.secrets."postfix-ldap-mailboxes.cf".path}";
inherit (hosts.${config.networking.hostName}) interfaces;
in in
{ {
age.secrets."postfix-ldap-mailboxes.cf" = { age.secrets."postfix-ldap-mailboxes.cf" = {
@ -39,7 +41,7 @@ in
# TODO: un-hardcode # TODO: un-hardcode
networks = [ networks = [
"localhost" "localhost"
"10.1.0.1/32" "${interfaces.vstub.addr}/32"
"10.10.0.0/16" "10.10.0.0/16"
"10.100.0.0/16" "10.100.0.0/16"
]; ];
@ -48,8 +50,11 @@ in
config = { config = {
myhostname = "mx.${domain}"; myhostname = "mx.${domain}";
# TODO: un-hardcode + add ip address instead of $myhostname inet_interfaces = [
inet_interfaces = [ "localhost" "$myhostname" "10.1.0.1" ]; "localhost"
interfaces.primary.addr
interfaces.vstub.addr
];
disable_vrfy_command = true; disable_vrfy_command = true;