strongswan: allow configuring enabled plugins
This commit is contained in:
@@ -32,8 +32,10 @@ let
|
|||||||
${caConf}
|
${caConf}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
strongswanConf = {setup, connections, ca, secrets}: toFile "strongswan.conf" ''
|
strongswanConf = {setup, connections, ca, secrets, managePlugins, enabledPlugins}: toFile "strongswan.conf" ''
|
||||||
charon {
|
charon {
|
||||||
|
${if managePlugins then "load_modular = no" else ""}
|
||||||
|
${if managePlugins then ("load = " + (concatStringsSep " " enabledPlugins)) else ""}
|
||||||
plugins {
|
plugins {
|
||||||
stroke {
|
stroke {
|
||||||
secrets_file = ${ipsecSecrets secrets}
|
secrets_file = ${ipsecSecrets secrets}
|
||||||
@@ -112,6 +114,25 @@ in
|
|||||||
file.
|
file.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
managePlugins = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
If set to true, this option will disable automatic plugin loading and
|
||||||
|
then tell strongSwan to enable the plugins specified in the
|
||||||
|
<option>enabledPlugins</option> option.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
enabledPlugins = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [];
|
||||||
|
description = ''
|
||||||
|
A list of additional plugins to enable if
|
||||||
|
<option>managePlugins</option> is true.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = with cfg; mkIf enable {
|
config = with cfg; mkIf enable {
|
||||||
@@ -122,7 +143,7 @@ in
|
|||||||
wants = [ "keys.target" ];
|
wants = [ "keys.target" ];
|
||||||
after = [ "network-online.target" "keys.target" ];
|
after = [ "network-online.target" "keys.target" ];
|
||||||
environment = {
|
environment = {
|
||||||
STRONGSWAN_CONF = strongswanConf { inherit setup connections ca secrets; };
|
STRONGSWAN_CONF = strongswanConf { inherit setup connections ca secrets managePlugins enabledPlugins; };
|
||||||
};
|
};
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${pkgs.strongswan}/sbin/ipsec start --nofork";
|
ExecStart = "${pkgs.strongswan}/sbin/ipsec start --nofork";
|
||||||
|
|||||||
Reference in New Issue
Block a user