blob: 346fd062fc99ce61d0bb9f915d17bd037dc7fed2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
let
chap-secrets = {
text = ''"flynn" * "reindeerflotilla" *'';
mode = "0640";
};
in
{ pkgs, ... }:
{
name = "pppd";
meta = with pkgs.lib.maintainers; {
maintainers = [ stv0g ];
};
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.rp-pppoe}/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 pppoe.so
require-chap
nobsdcomp
noccp
novj
'';
"ppp/chap-secrets" = chap-secrets;
};
};
};
client =
{ config, pkgs, ... }:
{
services.pppd = {
enable = true;
peers.test = {
config = ''
plugin pppoe.so eth1
name "flynn"
noipdefault
persist
noauth
debug
'';
};
};
environment.etc."ppp/chap-secrets" = chap-secrets;
};
};
testScript = ''
start_all()
client.wait_until_succeeds("ping -c1 -W1 192.0.2.1")
server.wait_until_succeeds("ping -c1 -W1 192.0.2.2")
'';
}
|