mailsystem: Add option to use selfsigned certificates in preparation for testing
This commit is contained in:
parent
6d6b856bee
commit
a592881b8b
5 changed files with 84 additions and 18 deletions
|
|
@ -3,23 +3,28 @@
|
|||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
}:
|
||||
with (import ./common.nix {inherit config;}); let
|
||||
cfg = config.mailsystem;
|
||||
in {
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts."${cfg.fqdn}" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
config =
|
||||
lib.mkIf cfg.enable {
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts."${cfg.fqdn}" = {
|
||||
forceSSL = true;
|
||||
enableACME = cfg.certificateScheme == "acme";
|
||||
sslCertificate = lib.mkIf (cfg.certificateScheme == "selfsigned") sslCertPath;
|
||||
sslCertificateKey = lib.mkIf (cfg.certificateScheme == "selfsigned") sslKeyPath;
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [80 443];
|
||||
}
|
||||
// lib.mkIf (cfg.enable && cfg.certificateScheme == "acme") {
|
||||
security.acme.certs."${cfg.fqdn}".reloadServices = [
|
||||
"postfix.service"
|
||||
"dovecot2.service"
|
||||
];
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [80 443];
|
||||
|
||||
security.acme.certs."${cfg.fqdn}".reloadServices = [
|
||||
"postfix.service"
|
||||
"dovecot2.service"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue