File tree Expand file tree Collapse file tree 16 files changed +52
-25
lines changed
continuous-integration/jenkins Expand file tree Collapse file tree 16 files changed +52
-25
lines changed Original file line number Diff line number Diff line change 4343 default = 8080 ;
4444 type = types . uniq types . int ;
4545 description = ''
46- Specifies port number on which the jenkins HTTP interface listens. The default is 8080
46+ Specifies port number on which the jenkins HTTP interface listens. The default is 8080.
4747 '' ;
4848 } ;
4949
Original file line number Diff line number Diff line change 142142 services . dbus . enable = true ;
143143 services . dbus . packages = [ avahi ] ;
144144
145+ # Enabling Avahi without exposing it in the firewall doesn't make
146+ # sense.
147+ networking . firewall . allowedUDPPorts = [ 5353 ] ;
148+
145149 } ;
146150
147151}
Original file line number Diff line number Diff line change 3333 services . httpd . enable = true ;
3434 services . httpd . adminAddr = "foo@example.org" ;
3535 services . httpd . documentRoot = "/tmp" ;
36+
37+ networking . firewall . enable = false ; # FIXME: figure out what ports we actually need
3638 } ;
3739
3840 router =
5052 virtualisation . vlans = [ 2 ] ;
5153 networking . defaultGateway =
5254 nodes . router . config . networking . interfaces . eth2 . ipAddress ;
55+ networking . firewall . enable = false ;
5356 } ;
5457
5558 client2 =
5659 { config , pkgs , ... } :
5760 { environment . systemPackages = [ pkgs . transmission ] ;
61+ networking . firewall . enable = false ;
5862 } ;
5963 } ;
6064
6670 # Enable NAT on the router and start miniupnpd.
6771 $router->waitForUnit("nat");
6872 $router->succeed(
69- "iptables -t nat -N MINIUPNPD",
70- "iptables -t nat -A PREROUTING -i eth1 -j MINIUPNPD",
73+ "iptables -w - t nat -N MINIUPNPD",
74+ "iptables -w - t nat -A PREROUTING -i eth1 -j MINIUPNPD",
7175 "echo 1 > /proc/sys/net/ipv4/ip_forward",
7276 "miniupnpd -f ${ miniupnpdConf nodes } "
7377 );
Original file line number Diff line number Diff line change 1717 config =
1818 { services . httpd . enable = true ;
1919 services . httpd . adminAddr = "foo@example.org" ;
20+ networking . firewall . allowedTCPPorts = [ 80 ] ;
21+ networking . firewall . allowPing = true ;
2022 } ;
2123 } ;
2224
6567 $machine->succeed("nixos-container start $id1");
6668
6769 # Execute commands via the root shell.
68- $machine->succeed("echo uname | nixos-container root-shell $id1") =~ /Linux/;
70+ $machine->succeed("nixos-container run $id1 -- uname ") =~ /Linux/;
6971 $machine->succeed("nixos-container set-root-password $id1 foobar");
7072
7173 # Destroy the containers.
Original file line number Diff line number Diff line change 1717 { config , pkgs , ... } :
1818 { services . httpd . enable = true ;
1919 services . httpd . adminAddr = "foo@example.org" ;
20+ networking . firewall . enable = false ;
2021 } ;
2122 } ;
2223
3334 $walled->succeed("curl -v http://localhost/ >&2");
3435
3536 # Connections to the firewalled machine should fail.
36- $attacker->fail("curl -v http://walled/ >&2");
37+ $attacker->fail("curl --fail --connect-timeout 2 http://walled/ >&2");
3738 $attacker->fail("ping -c 1 walled >&2");
3839
3940 # Outgoing connections/pings should still work.
Original file line number Diff line number Diff line change 7979 virtualisation . writableStore = true ;
8080 virtualisation . pathsInNixDB = channelContents ++ [ pkgs . hello . src ] ;
8181 virtualisation . memorySize = 768 ;
82+
83+ networking . firewall . allowedTCPPorts = [ 80 ] ;
8284 } ;
8385
8486 channelContents = [ pkgs . rlwrap ] ;
Original file line number Diff line number Diff line change 1212 { config , pkgs , ... } :
1313 { services . httpd . enable = true ;
1414 services . httpd . adminAddr = "foo@example.org" ;
15+ networking . firewall . allowedTCPPorts = [ 80 ] ;
1516 } ;
1617
1718 router =
Original file line number Diff line number Diff line change 33# 2. jenkins user can be extended on both master and slave
44# 3. jenkins service not started on slave node
55{ pkgs , ... } :
6+
67{
78 nodes = {
8- master = { pkgs , config , ... } : {
9- services . jenkins . enable = true ;
9+
10+ master =
11+ { config , pkgs , ... } :
12+ { services . jenkins . enable = true ;
1013
1114 # should have no effect
1215 services . jenkinsSlave . enable = true ;
1316
1417 users . extraUsers . jenkins . extraGroups = [ "users" ] ;
1518 } ;
16- slave = { pkgs , config , ... } : {
17- services . jenkinsSlave . enable = true ;
19+
20+ slave =
21+ { config , pkgs , ... } :
22+ { services . jenkinsSlave . enable = true ;
1823
1924 users . extraUsers . jenkins . extraGroups = [ "users" ] ;
2025 } ;
26+
2127 } ;
2228
2329 testScript = ''
Original file line number Diff line number Diff line change 1111 server = { config , pkgs , ... } : {
1212 services . murmur . enable = true ;
1313 services . murmur . registerName = "NixOS tests" ;
14+ networking . firewall . allowedTCPPorts = [ config . services . murmur . port ] ;
1415 } ;
1516
1617 client1 = client ;
Original file line number Diff line number Diff line change 1515 services . mysql . replication . role = "master" ;
1616 services . mysql . initialDatabases = [ { name = "testdb" ; schema = ./testdb.sql ; } ] ;
1717 services . mysql . initialScript = pkgs . writeText "initmysql"
18- ''
19- create user '${ replicateUser } '@'%' identified by '${ replicatePassword } ';
20- grant replication slave on *.* to '${ replicateUser } '@'%';
21- '' ;
18+ ''
19+ create user '${ replicateUser } '@'%' identified by '${ replicatePassword } ';
20+ grant replication slave on *.* to '${ replicateUser } '@'%';
21+ '' ;
22+ networking . firewall . allowedTCPPorts = [ 3306 ] ;
2223 } ;
2324
2425 slave1 =
You can’t perform that action at this time.
0 commit comments