squid: base allow list for every authed user, and no start limit on the list reload
This commit is contained in:
parent
10fdf06334
commit
e78a529ec2
1 changed files with 82 additions and 12 deletions
|
|
@ -497,11 +497,13 @@ let
|
|||
lines = lib.splitString "\n" hiveOtel.services.squid.configText;
|
||||
at = l: lib.lists.findFirstIndex (x: x == l) null lines;
|
||||
allow = at "http_access allow allowed_dst";
|
||||
base = at "http_access allow base_dst";
|
||||
unrestricted = at "http_access allow unrestricted";
|
||||
authed = at "http_access deny !authed";
|
||||
firstAllow = if unrestricted < allow then unrestricted else allow;
|
||||
firstAllow = lib.min base (lib.min unrestricted allow);
|
||||
in
|
||||
allow != null
|
||||
&& base != null
|
||||
&& unrestricted != null
|
||||
&& authed != null
|
||||
&& at "http_access deny to_localhost" != null
|
||||
|
|
@ -529,13 +531,15 @@ let
|
|||
{
|
||||
# Control: the allow ACL line is found and holds the canary, so the
|
||||
# absence of the swarm's service names is not a lookup of nothing.
|
||||
name = "squid's default allow-list is the self-check canary alone, with no swarm service name";
|
||||
name = "squid's default allow-list is the self-check canary alone and its base list is the Claude Code hosts, with no swarm service name";
|
||||
ok =
|
||||
let
|
||||
lines = lib.splitString "\n" hiveOtel.services.squid.configText;
|
||||
acl = lib.findFirst (l: lib.hasPrefix "acl allowed_dst dstdomain " l) "" (map lib.trim lines);
|
||||
baseAcl = lib.findFirst (l: lib.hasPrefix "acl base_dst dstdomain " l) "" (map lib.trim lines);
|
||||
in
|
||||
acl == "acl allowed_dst dstdomain ${hiveOtel.services.hyperhive.squid.selfcheck.canary}"
|
||||
&& baseAcl == "acl base_dst dstdomain api.anthropic.com claude.ai platform.claude.com"
|
||||
&& hiveOtel.services.hyperhive.squid.selfcheck.canary == "cache.nixos.org"
|
||||
&& !(builtins.elem hiveOtel.services.hyperhive.swarm.forge.domain (lib.splitString " " acl));
|
||||
}
|
||||
|
|
@ -580,6 +584,8 @@ let
|
|||
in
|
||||
at "http_access allow unrestricted" != null
|
||||
&& at "http_access deny !allowed_dst" != null
|
||||
&& at "http_access deny !authed" < at "http_access allow base_dst"
|
||||
&& at "http_access allow base_dst" < at "http_access allow unrestricted"
|
||||
&& at "http_access allow unrestricted" < at "http_access deny !allowed_dst"
|
||||
&& at "http_access deny !allowed_dst" < at "http_access allow allowed_dst"
|
||||
&& builtins.elem ''acl unrestricted proxy_auth "${list}"'' lines
|
||||
|
|
@ -597,6 +603,7 @@ let
|
|||
svc = hiveOtel.systemd.services.squid-unrestricted-reload.serviceConfig;
|
||||
in
|
||||
path.pathConfig.PathChanged == list
|
||||
&& hiveOtel.systemd.services.squid-unrestricted-reload.startLimitIntervalSec == 0
|
||||
&& builtins.elem "paths.target" path.wantedBy
|
||||
&& lib.hasSuffix "systemctl try-reload-or-restart squid.service" svc.ExecStart
|
||||
&& builtins.elem "f ${list} 0640 hive-core squid - -" rules
|
||||
|
|
|
|||
Loading…
Reference in a new issue