Introduce system name and domain options
Bring them up from the DMARC reporting section to the mailserver toplevel so they become reusable for the upcoming TLSRPT integration. We default to the first domain in the domains option, if not set explicitly, so that `systemDomain` doesn't become a blocker for existing setups. We still encourage picking out the intended one, which is likely the one used for the MX hostname. This also simplifies the DMARC reporting configuration, which doesn't need to be so fine-grained. Co-Authored-By: Emily <git@emilylange.de>
This commit is contained in:
parent
0aeb2849ad
commit
2b240501e0
5 changed files with 58 additions and 59 deletions
88
default.nix
88
default.nix
|
@ -69,6 +69,35 @@ in
|
|||
description = "The fully qualified domain name of the mail server.";
|
||||
};
|
||||
|
||||
systemName = mkOption {
|
||||
type = types.str;
|
||||
default = "${cfg.systemDomain} mail system";
|
||||
defaultText = literalExpression "\${config.mailserver.systemDomain} mail system";
|
||||
example = "ACME Corp.";
|
||||
description = ''
|
||||
The sender name given in automated reports.
|
||||
'';
|
||||
};
|
||||
|
||||
systemDomain = mkOption {
|
||||
type = types.str;
|
||||
default =
|
||||
if (config.networking.domain != null && lib.elem config.networking.domain cfg.domains) then
|
||||
config.networking.domain
|
||||
else
|
||||
lib.head cfg.domains;
|
||||
defaultText = literalExpression ''
|
||||
if config.networking.domain != null && lib.elem config.networking.domain cfg.domains then
|
||||
config.networking.domain
|
||||
else
|
||||
lib.head cfg.domains
|
||||
'';
|
||||
example = literalExpression "config.networking.domain";
|
||||
description = ''
|
||||
The primary domain used for sending automated reports.
|
||||
'';
|
||||
};
|
||||
|
||||
domains = mkOption {
|
||||
type = types.listOf types.str;
|
||||
example = [ "example.com" ];
|
||||
|
@ -972,51 +1001,6 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
localpart = mkOption {
|
||||
type = types.str;
|
||||
default = "dmarc-noreply";
|
||||
example = "dmarc-report";
|
||||
description = ''
|
||||
The local part of the email address used for outgoing DMARC reports.
|
||||
'';
|
||||
};
|
||||
|
||||
domain = mkOption {
|
||||
type = types.enum cfg.domains;
|
||||
example = "example.com";
|
||||
description = ''
|
||||
The domain from which outgoing DMARC reports are served.
|
||||
'';
|
||||
};
|
||||
|
||||
email = mkOption {
|
||||
type = types.str;
|
||||
default = with cfg.dmarcReporting; "${localpart}@${domain}";
|
||||
defaultText = literalExpression ''"''${localpart}@''${domain}"'';
|
||||
readOnly = true;
|
||||
description = ''
|
||||
The email address used for outgoing DMARC reports. Read-only.
|
||||
'';
|
||||
};
|
||||
|
||||
organizationName = mkOption {
|
||||
type = types.str;
|
||||
example = "ACME Corp.";
|
||||
description = ''
|
||||
The name of your organization used in the `org_name` attribute in
|
||||
DMARC reports.
|
||||
'';
|
||||
};
|
||||
|
||||
fromName = mkOption {
|
||||
type = types.str;
|
||||
default = cfg.dmarcReporting.organizationName;
|
||||
defaultText = literalMD "{option}`mailserver.dmarcReporting.organizationName`";
|
||||
description = ''
|
||||
The sender name for DMARC reports. Defaults to the organization name.
|
||||
'';
|
||||
};
|
||||
|
||||
excludeDomains = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
|
@ -1471,5 +1455,19 @@ in
|
|||
(mkRemovedOptionModule [ "mailserver" "smtpdForbidBareNewline" ] ''
|
||||
The workaround for the SMTP Smuggling attack is default enabled in Postfix >3.9. Use `services.postfix.config.smtpd_forbid_bare_newline` if you need to deviate from its default.
|
||||
'')
|
||||
(mkRenamedOptionModule [ "mailserver" "dmarcReporting" "domain" ] [ "mailserver" "systemDomain" ])
|
||||
(mkRenamedOptionModule
|
||||
[ "mailserver" "dmarcReporting" "organizationName" ]
|
||||
[ "mailserver" "systemName" ]
|
||||
)
|
||||
(mkRemovedOptionModule [ "mailserver" "dmarcReporting" "localpart" ] ''
|
||||
The localpart is now fixed at `noreply-dmarc` to simplify the configuration.
|
||||
'')
|
||||
(mkRemovedOptionModule [ "mailserver" "dmarcReporting" "email" ] ''
|
||||
The address is now fixed at `noreply-dmarc@''${config.mailserver.systemDomain}` to simplify the configuration.
|
||||
'')
|
||||
(mkRemovedOptionModule [ "mailserver" "dmarcReporting" "fromName" ] ''
|
||||
The name in the `FROM` field for DMARC report now uses the `mailserver.systemName`.
|
||||
'')
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue