at 25.11-pre 2.1 kB view raw
1import ./make-test-python.nix ( 2 let 3 chap-secrets = { 4 text = ''"flynn" * "reindeerflotilla" *''; 5 mode = "0640"; 6 }; 7 in 8 { pkgs, ... }: 9 { 10 name = "pppd"; 11 12 meta = with pkgs.lib.maintainers; { 13 maintainers = [ stv0g ]; 14 }; 15 16 nodes = { 17 server = 18 { config, pkgs, ... }: 19 { 20 config = { 21 # Run a PPPoE access concentrator server. It will spawn an 22 # appropriate PPP server process when a PPPoE client sets up a 23 # PPPoE session. 24 systemd.services.pppoe-server = { 25 restartTriggers = [ 26 config.environment.etc."ppp/pppoe-server-options".source 27 config.environment.etc."ppp/chap-secrets".source 28 ]; 29 after = [ "network.target" ]; 30 serviceConfig = { 31 ExecStart = "${pkgs.rpPPPoE}/sbin/pppoe-server -F -O /etc/ppp/pppoe-server-options -q ${pkgs.ppp}/sbin/pppd -I eth1 -L 192.0.2.1 -R 192.0.2.2"; 32 }; 33 wantedBy = [ "multi-user.target" ]; 34 }; 35 environment.etc = { 36 "ppp/pppoe-server-options".text = '' 37 lcp-echo-interval 10 38 lcp-echo-failure 2 39 plugin pppoe.so 40 require-chap 41 nobsdcomp 42 noccp 43 novj 44 ''; 45 "ppp/chap-secrets" = chap-secrets; 46 }; 47 }; 48 }; 49 client = 50 { config, pkgs, ... }: 51 { 52 services.pppd = { 53 enable = true; 54 peers.test = { 55 config = '' 56 plugin pppoe.so eth1 57 name "flynn" 58 noipdefault 59 persist 60 noauth 61 debug 62 ''; 63 }; 64 }; 65 environment.etc."ppp/chap-secrets" = chap-secrets; 66 }; 67 }; 68 69 testScript = '' 70 start_all() 71 client.wait_until_succeeds("ping -c1 -W1 192.0.2.1") 72 server.wait_until_succeeds("ping -c1 -W1 192.0.2.2") 73 ''; 74 } 75)