squid self-check: use a public canary, drop the swarm service names from the allow list
This commit is contained in:
parent
698183c16a
commit
10fdf06334
1 changed files with 44 additions and 30 deletions
|
|
@ -20,14 +20,6 @@ let
|
|||
type = lib.types.bool;
|
||||
default = true;
|
||||
};
|
||||
swarm.serviceDomains = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ "forge.t.local" ];
|
||||
};
|
||||
swarm.forge.domain = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "forge.t.local";
|
||||
};
|
||||
network = {
|
||||
bridgeIp = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
|
|
@ -157,6 +149,7 @@ pkgs.testers.runNixOSTest {
|
|||
# has no resolver to answer for an unknown one before the client gives up.
|
||||
"203.0.113.2" = [
|
||||
"forge.t.local"
|
||||
"cache.t.local"
|
||||
"other.t.local"
|
||||
"deny-canary.invalid"
|
||||
];
|
||||
|
|
@ -177,6 +170,7 @@ pkgs.testers.runNixOSTest {
|
|||
# Renders the users file the way hive-c0re does.
|
||||
environment.systemPackages = [ pkgs.mkpasswd ];
|
||||
services.hyperhive.squid.selfcheck.unrestrictedCanary = "other.t.local";
|
||||
services.hyperhive.squid.selfcheck.canary = "cache.t.local";
|
||||
services.hyperhive.squid.allowedDomains = [
|
||||
"forge.t.local"
|
||||
"loop.t.local"
|
||||
|
|
@ -323,6 +317,7 @@ pkgs.testers.runNixOSTest {
|
|||
|
||||
with subtest("an allowed name is tunnelled with a credential and challenged without one"):
|
||||
assert connect("forge.t.local", ATLAS) == "200", "allow canary"
|
||||
assert connect("cache.t.local", ATLAS) == "200", "the self-check canary, allowed on top of the list"
|
||||
assert connect("forge.t.local") == "407", "no credential"
|
||||
assert connect("forge.t.local", "atlas:" + secrets.token_urlsafe(24)) == "407", "wrong password"
|
||||
assert connect("forge.t.local", "nobody:" + PW["atlas"]) == "407", "unknown user"
|
||||
|
|
@ -409,7 +404,7 @@ pkgs.testers.runNixOSTest {
|
|||
proxy.succeed("systemctl start squid-selfcheck.service")
|
||||
proxy.succeed(
|
||||
"journalctl -u squid-selfcheck.service -o cat | "
|
||||
"grep -F 'squid-selfcheck ok=true allow_canary=forge.t.local "
|
||||
"grep -F 'squid-selfcheck ok=true allow_canary=cache.t.local "
|
||||
"allow_status=200 deny_canary=deny-canary.invalid deny_status=403 "
|
||||
"anon_status=407 credential=present "
|
||||
"unrestricted_canary=other.t.local unrestricted_status=200'"
|
||||
|
|
@ -421,7 +416,7 @@ pkgs.testers.runNixOSTest {
|
|||
proxy.fail("systemctl start squid-selfcheck.service")
|
||||
proxy.succeed(
|
||||
"journalctl -u squid-selfcheck.service -o cat | "
|
||||
"grep -F 'squid-selfcheck ok=false allow_canary=forge.t.local "
|
||||
"grep -F 'squid-selfcheck ok=false allow_canary=cache.t.local "
|
||||
"allow_status=200 deny_canary=deny-canary.invalid deny_status=403 "
|
||||
"anon_status=407 credential=present "
|
||||
"unrestricted_canary=other.t.local unrestricted_status=403'"
|
||||
|
|
@ -434,7 +429,7 @@ pkgs.testers.runNixOSTest {
|
|||
proxy.fail("systemctl start squid-selfcheck.service")
|
||||
proxy.succeed(
|
||||
"journalctl -u squid-selfcheck.service -o cat | "
|
||||
"grep -F 'squid-selfcheck ok=false allow_canary=forge.t.local "
|
||||
"grep -F 'squid-selfcheck ok=false allow_canary=cache.t.local "
|
||||
"allow_status=407 deny_canary=deny-canary.invalid deny_status=407 "
|
||||
"anon_status=407 credential=absent "
|
||||
"unrestricted_canary=other.t.local unrestricted_status=407'"
|
||||
|
|
|
|||
Loading…
Reference in a new issue