mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 03:17:13 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
99 lines
2.7 KiB
Nix
99 lines
2.7 KiB
Nix
import ./make-test-python.nix (
|
|
{ pkgs, ... }:
|
|
{
|
|
name = "ferm";
|
|
meta = with pkgs.lib.maintainers; {
|
|
maintainers = [ mic92 ];
|
|
};
|
|
|
|
nodes = {
|
|
client =
|
|
{ pkgs, ... }:
|
|
with pkgs.lib;
|
|
{
|
|
networking = {
|
|
dhcpcd.enable = false;
|
|
interfaces.eth1.ipv6.addresses = mkOverride 0 [
|
|
{
|
|
address = "fd00::2";
|
|
prefixLength = 64;
|
|
}
|
|
];
|
|
interfaces.eth1.ipv4.addresses = mkOverride 0 [
|
|
{
|
|
address = "192.168.1.2";
|
|
prefixLength = 24;
|
|
}
|
|
];
|
|
};
|
|
};
|
|
server =
|
|
{ pkgs, ... }:
|
|
with pkgs.lib;
|
|
{
|
|
networking = {
|
|
dhcpcd.enable = false;
|
|
useNetworkd = true;
|
|
useDHCP = false;
|
|
interfaces.eth1.ipv6.addresses = mkOverride 0 [
|
|
{
|
|
address = "fd00::1";
|
|
prefixLength = 64;
|
|
}
|
|
];
|
|
interfaces.eth1.ipv4.addresses = mkOverride 0 [
|
|
{
|
|
address = "192.168.1.1";
|
|
prefixLength = 24;
|
|
}
|
|
];
|
|
};
|
|
|
|
services = {
|
|
ferm.enable = true;
|
|
ferm.config = ''
|
|
domain (ip ip6) table filter chain INPUT {
|
|
interface lo ACCEPT;
|
|
proto tcp dport 8080 REJECT reject-with tcp-reset;
|
|
}
|
|
'';
|
|
nginx.enable = true;
|
|
nginx.httpConfig = ''
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
listen 8080;
|
|
listen [::]:8080;
|
|
|
|
location /status { stub_status on; }
|
|
}
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
start_all()
|
|
|
|
client.systemctl("start network-online.target")
|
|
server.systemctl("start network-online.target")
|
|
client.wait_for_unit("network-online.target")
|
|
server.wait_for_unit("network-online.target")
|
|
server.wait_for_unit("ferm.service")
|
|
server.wait_for_unit("nginx.service")
|
|
server.wait_until_succeeds("ss -ntl | grep -q 80")
|
|
|
|
with subtest("port 80 is allowed"):
|
|
client.succeed("curl --fail -g http://192.168.1.1:80/status")
|
|
client.succeed("curl --fail -g http://[fd00::1]:80/status")
|
|
|
|
with subtest("port 8080 is not allowed"):
|
|
server.succeed("curl --fail -g http://192.168.1.1:8080/status")
|
|
server.succeed("curl --fail -g http://[fd00::1]:8080/status")
|
|
|
|
client.fail("curl --fail -g http://192.168.1.1:8080/status")
|
|
client.fail("curl --fail -g http://[fd00::1]:8080/status")
|
|
'';
|
|
}
|
|
)
|