@@ -32,13 +32,13 @@ let
3232 ${caConf}
3333 '';
3434
35− strongswanConf = {setup, connections, ca, secrets, managePlugins, enabledPlugins}: toFile "strongswan.conf" ''
35+ strongswanConf = {setup, connections, ca, secretsFile, managePlugins, enabledPlugins}: toFile "strongswan.conf" ''
3636 charon {
3737 ${if managePlugins then "load_modular = no" else ""}
3838 ${if managePlugins then ("load = " + (concatStringsSep " " enabledPlugins)) else ""}
3939 plugins {
4040 stroke {
41− secrets_file = ${ipsecSecrets secrets}
41+ secrets_file = ${secretsFile}
4242 }
4343 }
4444 }
@@ -135,7 +135,18 @@ in
135135 };
136136 };
137137
138− config = with cfg; mkIf enable {
138+
139+ config = with cfg;
140+ let
141+ secretsFile = ipsecSecrets cfg.secrets;
142+ in
143+ mkIf enable
144+ {
145+
146+ # here we should use the default strongswan ipsec.secrets and
147+ # append to it (default one is empty so not a pb for now)
148+ environment.etc."ipsec.secrets".source = secretsFile;
149+
139150 systemd.services.strongswan = {
140151 description = "strongSwan IPSec Service";
141152 wantedBy = [ "multi-user.target" ];
@@ -143,11 +154,15 @@ in
143154 wants = [ "keys.target" ];
144155 after = [ "network-online.target" "keys.target" ];
145156 environment = {
146− STRONGSWAN_CONF = strongswanConf { inherit setup connections ca secrets managePlugins enabledPlugins; };
157+ STRONGSWAN_CONF = strongswanConf { inherit setup connections ca secretsFile managePlugins enabledPlugins; };
147158 };
148159 serviceConfig = {
149160 ExecStart = "${pkgs.strongswan}/sbin/ipsec start --nofork";
150161 };
162+ preStart = ''
163+ # with 'nopeerdns' setting, ppp writes into this folder
164+ mkdir -m 700 -p /etc/ppp
165+ '';
151166 };
152167 };
153168}