From 54d3415885f534100e566c250aa09905ab943135 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Tue, 20 Aug 2024 22:55:30 +0100 Subject: [PATCH] pppoe convert to using a config file mostly for ease of implementation but does mean we don't have username/password secrets on the command line --- modules/ppp/pppoe.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/ppp/pppoe.nix b/modules/ppp/pppoe.nix index 1dd38d5..d2beb92 100644 --- a/modules/ppp/pppoe.nix +++ b/modules/ppp/pppoe.nix @@ -1,6 +1,7 @@ { liminix , lib +, output-template , ppp , pppoe , writeAshScript @@ -15,7 +16,7 @@ }: let inherit (liminix.services) longrun; - inherit (lib) optional optionals; + inherit (lib) optional optionals concatStringsSep; name = "${interface.name}.pppoe"; ip-up = writeAshScript "ip-up" {} '' . ${serviceFns} @@ -61,8 +62,11 @@ longrun { inherit name; run = '' . ${serviceFns} + mkdir -p /run/${name} + chmod 0700 /run/${name} + echo ${concatStringsSep " " ppp-options'} | ${output-template}/bin/output-template '{{' '}}' > /run/${name}/${name}.conf echo Starting pppoe, pppd pid is $$ - exec ${ppp}/bin/pppd pty "${pppoe}/bin/pppoe ${timeoutOpt} -I $(output ${interface} ifname)" ${lib.concatStringsSep " " ppp-options'} + exec ${ppp}/bin/pppd pty "${pppoe}/bin/pppoe ${timeoutOpt} -I $(output ${interface} ifname)" file /run/${name}/${name}.conf ''; notification-fd = 10; timeout-up = if lcpEcho.failure != null