send agent traffic through squid once its hive announces it
This commit is contained in:
parent
86e9f49fe6
commit
b551eb02ff
1 changed files with 885 additions and 27 deletions
|
|
@ -4,9 +4,9 @@
|
|||
# must carry a per-agent proxy credential, checked against the users file
|
||||
# hive-c0re renders. A credential's agent either has the swarm's
|
||||
# `unrestricted_internet` flag, and may then reach any destination the deny
|
||||
# rules leave, or reaches only the listed names. No agent sends a credential
|
||||
# yet; the exporter, journal forwarding and the self-check below are how a
|
||||
# deploy shows it works.
|
||||
# rules leave, or reaches only the listed names. An agent sends its credential
|
||||
# once it has fetched it (../agent-modules/egress-proxy.nix); the exporter,
|
||||
# journal forwarding and the self-check below show the proxy works.
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
|
|
@ -19,6 +19,7 @@ let
|
|||
netCfg = hyperhiveCfg.network;
|
||||
|
||||
port = 3128;
|
||||
listen = "${netCfg.bridgeIp}:${toString port}";
|
||||
proxyUrl = "http://${netCfg.bridgeIp}:${toString port}";
|
||||
exporterListen = "127.0.0.1:9301";
|
||||
denyCanary = "deny-canary.invalid";
|
||||
|
|
@ -67,7 +68,7 @@ let
|
|||
# port, and every other user to the listed names. The `dst` denies cost an
|
||||
# unlisted name a lookup on the host's resolver before it is refused.
|
||||
squidConf = ''
|
||||
http_port ${netCfg.bridgeIp}:${toString port}
|
||||
http_port ${listen}
|
||||
pid_filename /run/squid/squid.pid
|
||||
cache_log stdio:/var/log/squid/cache.log
|
||||
coredump_dir /var/cache/squid
|
||||
|
|
@ -197,6 +198,19 @@ let
|
|||
in
|
||||
{
|
||||
options.services.hyperhive.squid = {
|
||||
listen = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = listen;
|
||||
readOnly = true;
|
||||
defaultText = lib.literalMD "`<network.bridgeIp>:3128`";
|
||||
description = ''
|
||||
The address squid listens on, as `<bridge IP>:<port>`. Read-only.
|
||||
hive-c0re hands it to every container as the `HIVE_SQUID_PROXY` fact,
|
||||
which is what tells an agent that this host's squid checks its proxy
|
||||
credential and applies its `unrestricted_internet` flag.
|
||||
'';
|
||||
};
|
||||
|
||||
allowedDomains = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = hyperhiveCfg.swarm.serviceDomains;
|
||||
|
|
|
|||
Loading…
Reference in a new issue