Skip to content

Commit 7f92173

Browse files
andrew-drycee
authored andcommittedNov 2, 2017
strongswan: allow configuring enabled plugins
1 parent 0807f4a commit 7f92173

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed
 

‎nixos/modules/services/networking/strongswan.nix

+23-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ let
3232
${caConf}
3333
'';
3434

35-
strongswanConf = {setup, connections, ca, secrets}: toFile "strongswan.conf" ''
35+
strongswanConf = {setup, connections, ca, secrets, managePlugins, enabledPlugins}: toFile "strongswan.conf" ''
3636
charon {
37+
${if managePlugins then "load_modular = no" else ""}
38+
${if managePlugins then ("load = " + (concatStringsSep " " enabledPlugins)) else ""}
3739
plugins {
3840
stroke {
3941
secrets_file = ${ipsecSecrets secrets}
@@ -112,6 +114,25 @@ in
112114
file.
113115
'';
114116
};
117+
118+
managePlugins = mkOption {
119+
type = types.bool;
120+
default = false;
121+
description = ''
122+
If set to true, this option will disable automatic plugin loading and
123+
then tell strongSwan to enable the plugins specified in the
124+
<option>enabledPlugins</option> option.
125+
'';
126+
};
127+
128+
enabledPlugins = mkOption {
129+
type = types.listOf types.str;
130+
default = [];
131+
description = ''
132+
A list of additional plugins to enable if
133+
<option>managePlugins</option> is true.
134+
'';
135+
};
115136
};
116137

117138
config = with cfg; mkIf enable {
@@ -122,7 +143,7 @@ in
122143
wants = [ "keys.target" ];
123144
after = [ "network-online.target" "keys.target" ];
124145
environment = {
125-
STRONGSWAN_CONF = strongswanConf { inherit setup connections ca secrets; };
146+
STRONGSWAN_CONF = strongswanConf { inherit setup connections ca secrets managePlugins enabledPlugins; };
126147
};
127148
serviceConfig = {
128149
ExecStart = "${pkgs.strongswan}/sbin/ipsec start --nofork";

0 commit comments

Comments
 (0)
Please sign in to comment.