2019-11-08 16:08:17 +00:00
|
|
|
import ./make-test-python.nix (
|
2019-10-15 04:26:54 +00:00
|
|
|
let
|
|
|
|
chap-secrets = {
|
|
|
|
text = ''"flynn" * "reindeerflotilla" *'';
|
|
|
|
mode = "0640";
|
|
|
|
};
|
|
|
|
in {
|
2022-06-25 22:14:38 +00:00
|
|
|
name = "pppd";
|
|
|
|
|
2019-10-15 04:26:54 +00:00
|
|
|
nodes = {
|
|
|
|
server = {config, pkgs, ...}: {
|
|
|
|
config = {
|
|
|
|
# Run a PPPoE access concentrator server. It will spawn an
|
|
|
|
# appropriate PPP server process when a PPPoE client sets up a
|
|
|
|
# PPPoE session.
|
|
|
|
systemd.services.pppoe-server = {
|
|
|
|
restartTriggers = [
|
|
|
|
config.environment.etc."ppp/pppoe-server-options".source
|
|
|
|
config.environment.etc."ppp/chap-secrets".source
|
|
|
|
];
|
|
|
|
after = ["network.target"];
|
|
|
|
serviceConfig = {
|
|
|
|
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";
|
|
|
|
};
|
|
|
|
wantedBy = ["multi-user.target"];
|
|
|
|
};
|
|
|
|
environment.etc = {
|
|
|
|
"ppp/pppoe-server-options".text = ''
|
|
|
|
lcp-echo-interval 10
|
|
|
|
lcp-echo-failure 2
|
|
|
|
plugin rp-pppoe.so
|
|
|
|
require-chap
|
|
|
|
nobsdcomp
|
|
|
|
noccp
|
|
|
|
novj
|
|
|
|
'';
|
|
|
|
"ppp/chap-secrets" = chap-secrets;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
client = {config, pkgs, ...}: {
|
|
|
|
services.pppd = {
|
|
|
|
enable = true;
|
|
|
|
peers.test = {
|
|
|
|
config = ''
|
|
|
|
plugin rp-pppoe.so eth1
|
|
|
|
name "flynn"
|
|
|
|
noipdefault
|
|
|
|
persist
|
|
|
|
noauth
|
|
|
|
debug
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
environment.etc."ppp/chap-secrets" = chap-secrets;
|
|
|
|
};
|
|
|
|
};
|
2019-11-08 16:08:17 +00:00
|
|
|
|
2019-10-15 04:26:54 +00:00
|
|
|
testScript = ''
|
2019-11-08 16:08:17 +00:00
|
|
|
start_all()
|
|
|
|
client.wait_until_succeeds("ping -c1 -W1 192.0.2.1")
|
|
|
|
server.wait_until_succeeds("ping -c1 -W1 192.0.2.2")
|
2019-10-15 04:26:54 +00:00
|
|
|
'';
|
2019-11-08 16:08:17 +00:00
|
|
|
})
|