nixos/postfix: replace tls cert/key options and allow removing settings from rendered main.cf (#413427)
This commit is contained in:
@@ -46,6 +46,11 @@
|
|||||||
|
|
||||||
- `renovate` was updated to v40. See the [upstream release notes](https://github.com/renovatebot/renovate/releases/tag/40.0.0) for breaking changes.
|
- `renovate` was updated to v40. See the [upstream release notes](https://github.com/renovatebot/renovate/releases/tag/40.0.0) for breaking changes.
|
||||||
|
|
||||||
|
- The Postfix module has been updated and likely requires configuration changes:
|
||||||
|
- The `services.postfix.sslCert` and `sslKey` options were removed and you now need to configure
|
||||||
|
- [services.postfix.config.smtpd_tls_chain_files](#opt-services.postfix.config.smtpd_tls_chain_files) for server certificates,
|
||||||
|
- [services.postfix.config.smtp_tls_chain_files](#opt-services.postfix.config) for client certificates.
|
||||||
|
|
||||||
## Other Notable Changes {#sec-release-25.11-notable-changes}
|
## Other Notable Changes {#sec-release-25.11-notable-changes}
|
||||||
|
|
||||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||||
|
|||||||
@@ -5,6 +5,10 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkOption
|
||||||
|
types
|
||||||
|
;
|
||||||
|
|
||||||
cfg = config.services.postfix;
|
cfg = config.services.postfix;
|
||||||
user = cfg.user;
|
user = cfg.user;
|
||||||
@@ -47,7 +51,11 @@ let
|
|||||||
);
|
);
|
||||||
mkEntry = name: value: "${escape name} =${mkVal value}";
|
mkEntry = name: value: "${escape name} =${mkVal value}";
|
||||||
in
|
in
|
||||||
lib.concatStringsSep "\n" (lib.mapAttrsToList mkEntry cfg.config) + "\n" + cfg.extraConfig;
|
lib.concatStringsSep "\n" (
|
||||||
|
lib.mapAttrsToList mkEntry (lib.filterAttrsRecursive (_: value: value != null) cfg.config)
|
||||||
|
)
|
||||||
|
+ "\n"
|
||||||
|
+ cfg.extraConfig;
|
||||||
|
|
||||||
masterCfOptions =
|
masterCfOptions =
|
||||||
{
|
{
|
||||||
@@ -564,16 +572,60 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkOption {
|
config = lib.mkOption {
|
||||||
type =
|
type = lib.types.submodule {
|
||||||
with lib.types;
|
freeformType =
|
||||||
attrsOf (oneOf [
|
with types;
|
||||||
bool
|
attrsOf (
|
||||||
int
|
nullOr (oneOf [
|
||||||
str
|
bool
|
||||||
(listOf str)
|
int
|
||||||
]);
|
str
|
||||||
|
(listOf str)
|
||||||
|
])
|
||||||
|
);
|
||||||
|
options = {
|
||||||
|
smtpd_tls_chain_files = mkOption {
|
||||||
|
type = with types; listOf path;
|
||||||
|
default = [ ];
|
||||||
|
example = [
|
||||||
|
"/var/lib/acme/mail.example.com/privkey.pem"
|
||||||
|
"/var/lib/acme/mail.example.com/fullchain.pem"
|
||||||
|
];
|
||||||
|
description = ''
|
||||||
|
List of paths to the server private keys and certificates.
|
||||||
|
|
||||||
|
::: {.caution}
|
||||||
|
The order of items matters and a private key must always be followed by the corresponding certificate.
|
||||||
|
:::
|
||||||
|
|
||||||
|
<https://www.postfix.org/postconf.5.html#smtpd_tls_chain_files>
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
smtpd_tls_security_level = mkOption {
|
||||||
|
type = types.enum [
|
||||||
|
"none"
|
||||||
|
"may"
|
||||||
|
"encrypt"
|
||||||
|
];
|
||||||
|
default = if config.services.postfix.config.smtpd_tls_chain_files != [ ] then "may" else "none";
|
||||||
|
defaultText = lib.literalExpression ''
|
||||||
|
if config.services.postfix.config.smtpd_tls_chain_files != [ ] then "may" else "none"
|
||||||
|
'';
|
||||||
|
example = "may";
|
||||||
|
description = ''
|
||||||
|
The server TLS security level. Enable TLS by configuring at least `may`.
|
||||||
|
|
||||||
|
<https://www.postfix.org/postconf.5.html#smtpd_tls_security_level>
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
description = ''
|
description = ''
|
||||||
The main.cf configuration file as key value set.
|
The main.cf configuration file as key value set.
|
||||||
|
|
||||||
|
Null values will not be rendered.
|
||||||
'';
|
'';
|
||||||
example = {
|
example = {
|
||||||
mail_owner = "postfix";
|
mail_owner = "postfix";
|
||||||
@@ -599,18 +651,6 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
sslCert = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "";
|
|
||||||
description = "SSL certificate to use.";
|
|
||||||
};
|
|
||||||
|
|
||||||
sslKey = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "";
|
|
||||||
description = "SSL key to use.";
|
|
||||||
};
|
|
||||||
|
|
||||||
recipientDelimiter = lib.mkOption {
|
recipientDelimiter = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "";
|
default = "";
|
||||||
@@ -974,18 +1014,6 @@ in
|
|||||||
// lib.optionalAttrs (cfg.tlsTrustedAuthorities != "") {
|
// lib.optionalAttrs (cfg.tlsTrustedAuthorities != "") {
|
||||||
smtp_tls_CAfile = cfg.tlsTrustedAuthorities;
|
smtp_tls_CAfile = cfg.tlsTrustedAuthorities;
|
||||||
smtp_tls_security_level = lib.mkDefault "may";
|
smtp_tls_security_level = lib.mkDefault "may";
|
||||||
}
|
|
||||||
// lib.optionalAttrs (cfg.sslCert != "") {
|
|
||||||
smtp_tls_cert_file = cfg.sslCert;
|
|
||||||
smtp_tls_key_file = cfg.sslKey;
|
|
||||||
|
|
||||||
smtp_tls_security_level = lib.mkDefault "may";
|
|
||||||
|
|
||||||
smtpd_tls_cert_file = cfg.sslCert;
|
|
||||||
smtpd_tls_key_file = cfg.sslKey;
|
|
||||||
|
|
||||||
smtpd_tls_security_level = lib.mkDefault "may";
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
services.postfix.masterConfig =
|
services.postfix.masterConfig =
|
||||||
@@ -1150,6 +1178,12 @@ in
|
|||||||
(lib.mkRemovedOptionModule [ "services" "postfix" "sslCACert" ]
|
(lib.mkRemovedOptionModule [ "services" "postfix" "sslCACert" ]
|
||||||
"services.postfix.sslCACert was replaced by services.postfix.tlsTrustedAuthorities. In case you intend that your server should validate requested client certificates use services.postfix.extraConfig."
|
"services.postfix.sslCACert was replaced by services.postfix.tlsTrustedAuthorities. In case you intend that your server should validate requested client certificates use services.postfix.extraConfig."
|
||||||
)
|
)
|
||||||
|
(lib.mkRemovedOptionModule [ "services" "postfix" "sslCert" ]
|
||||||
|
"services.postfix.sslCert was removed. Use services.postfix.config.smtpd_tls_chain_files for the server certificate, or services.postfix.config.smtp_tls_chain_files for the client certificate."
|
||||||
|
)
|
||||||
|
(lib.mkRemovedOptionModule [ "services" "postfix" "sslKey" ]
|
||||||
|
"services.postfix.sslKey was removed. Use services.postfix.config.smtpd_tls_chain_files for server private key, or services.postfix.config.smtp_tls_chain_files for the client private key."
|
||||||
|
)
|
||||||
|
|
||||||
(lib.mkChangedOptionModule
|
(lib.mkChangedOptionModule
|
||||||
[ "services" "postfix" "useDane" ]
|
[ "services" "postfix" "useDane" ]
|
||||||
|
|||||||
@@ -14,8 +14,10 @@ import ./make-test-python.nix {
|
|||||||
enableSubmission = true;
|
enableSubmission = true;
|
||||||
enableSubmissions = true;
|
enableSubmissions = true;
|
||||||
tlsTrustedAuthorities = "${certs.ca.cert}";
|
tlsTrustedAuthorities = "${certs.ca.cert}";
|
||||||
sslCert = "${certs.${domain}.cert}";
|
config.smtpd_tls_chain_files = [
|
||||||
sslKey = "${certs.${domain}.key}";
|
certs.${domain}.key
|
||||||
|
certs.${domain}.cert
|
||||||
|
];
|
||||||
submissionsOptions = {
|
submissionsOptions = {
|
||||||
smtpd_sasl_auth_enable = "yes";
|
smtpd_sasl_auth_enable = "yes";
|
||||||
smtpd_client_restrictions = "permit";
|
smtpd_client_restrictions = "permit";
|
||||||
|
|||||||
Reference in New Issue
Block a user