nixos/galene: allow using self-signed certificates
Fixes #356170 Later we might also want to make it easier to run behind nginx as a reverse proxy, for consistency with other modules.
This commit is contained in:
parent
3e3afe5174
commit
87fbf71ed6
@ -128,23 +128,13 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
assertions = [
|
|
||||||
{
|
|
||||||
assertion = cfg.insecure || (cfg.certFile != null && cfg.keyFile != null);
|
|
||||||
message = ''
|
|
||||||
Galene needs both certFile and keyFile defined for encryption, or
|
|
||||||
the insecure flag.
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
systemd.services.galene = {
|
systemd.services.galene = {
|
||||||
description = "galene";
|
description = "galene";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
preStart = ''
|
preStart = ''
|
||||||
${optionalString (cfg.insecure != true) ''
|
${optionalString (cfg.insecure != true && cfg.certFile != null && cfg.keyFile != null) ''
|
||||||
install -m 700 -o '${cfg.user}' -g '${cfg.group}' ${cfg.certFile} ${cfg.dataDir}/cert.pem
|
install -m 700 -o '${cfg.user}' -g '${cfg.group}' ${cfg.certFile} ${cfg.dataDir}/cert.pem
|
||||||
install -m 700 -o '${cfg.user}' -g '${cfg.group}' ${cfg.keyFile} ${cfg.dataDir}/key.pem
|
install -m 700 -o '${cfg.user}' -g '${cfg.group}' ${cfg.keyFile} ${cfg.dataDir}/key.pem
|
||||||
''}
|
''}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user