nixos: add racoon ipsec IKE deamon
This commit is contained in:
parent
4e51a466bd
commit
b5114de4ac
@ -293,6 +293,7 @@
|
|||||||
./services/networking/privoxy.nix
|
./services/networking/privoxy.nix
|
||||||
./services/networking/prosody.nix
|
./services/networking/prosody.nix
|
||||||
./services/networking/quassel.nix
|
./services/networking/quassel.nix
|
||||||
|
./services/networking/racoon.nix
|
||||||
./services/networking/radicale.nix
|
./services/networking/radicale.nix
|
||||||
./services/networking/radvd.nix
|
./services/networking/radvd.nix
|
||||||
./services/networking/rdnssd.nix
|
./services/networking/rdnssd.nix
|
||||||
|
42
nixos/modules/services/networking/racoon.nix
Normal file
42
nixos/modules/services/networking/racoon.nix
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.racoon;
|
||||||
|
in {
|
||||||
|
options.services.racoon = {
|
||||||
|
enable = mkEnableOption "Whether to enable racoon.";
|
||||||
|
|
||||||
|
config = mkOption {
|
||||||
|
description = "Contents of racoon configuration file.";
|
||||||
|
default = "";
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
configPath = mkOption {
|
||||||
|
description = "Location of racoon config if config is not provided.";
|
||||||
|
default = "/etc/racoon/racoon.conf";
|
||||||
|
type = types.path;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
systemd.services.racoon = {
|
||||||
|
description = "Racoon Daemon";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [ "network.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
ExecStart = "${pkgs.ipsecTools}/bin/racoon -f ${
|
||||||
|
if (cfg.config != "") then pkgs.writeText "racoon.conf" cfg.config
|
||||||
|
else cfg.configPath
|
||||||
|
}";
|
||||||
|
ExecReload = "${pkgs.ipsecTools}/bin/racoonctl reload-config";
|
||||||
|
PIDFile = "/var/run/racoon.pid";
|
||||||
|
Type = "forking";
|
||||||
|
Restart = "always";
|
||||||
|
};
|
||||||
|
preStart = "rm /var/run/racoon.pid || true";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user