@@ -0,0 +1,62 @@
1+import ./make-test.nix (
2+ let
3+ chap-secrets = {
4+ text = ''"flynn" * "reindeerflotilla" *'';
5+ mode = "0640";
6+ };
7+ in {
8+ nodes = {
9+ server = {config, pkgs, ...}: {
10+ config = {
11+ # Run a PPPoE access concentrator server. It will spawn an
12+ # appropriate PPP server process when a PPPoE client sets up a
13+ # PPPoE session.
14+ systemd.services.pppoe-server = {
15+ restartTriggers = [
16+ config.environment.etc."ppp/pppoe-server-options".source
17+ config.environment.etc."ppp/chap-secrets".source
18+ ];
19+ after = ["network.target"];
20+ serviceConfig = {
21+ 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";
22+ };
23+ wantedBy = ["multi-user.target"];
24+ };
25+ environment.etc = {
26+ "ppp/pppoe-server-options".text = ''
27+ lcp-echo-interval 10
28+ lcp-echo-failure 2
29+ plugin rp-pppoe.so
30+ require-chap
31+ nobsdcomp
32+ noccp
33+ novj
34+ '';
35+ "ppp/chap-secrets" = chap-secrets;
36+ };
37+ };
38+ };
39+ client = {config, pkgs, ...}: {
40+ services.pppd = {
41+ enable = true;
42+ peers.test = {
43+ config = ''
44+ plugin rp-pppoe.so eth1
45+ name "flynn"
46+ noipdefault
47+ persist
48+ noauth
49+ debug
50+ '';
51+ };
52+ };
53+ environment.etc."ppp/chap-secrets" = chap-secrets;
54+ };
55+ };
56+
57+ testScript = ''
58+ startAll;
59+ $client->waitUntilSucceeds("ping -c1 -W1 192.0.2.1");
60+ $server->waitUntilSucceeds("ping -c1 -W1 192.0.2.2");
61+ '';
62+ })