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