feat: tor support
This commit is contained in:
42 files changed
+1853
-69
No files matched your search
@@ -111,6 +111,11 @@ let
|
||||
enable = true;
|
||||
asOutbound = "singBox";
|
||||
};
|
||||
tor = {
|
||||
enable = true;
|
||||
asOutbound = true;
|
||||
onionService.enable = true;
|
||||
};
|
||||
perAppRouting = {
|
||||
enable = true;
|
||||
proxychains.enable = true;
|
||||
@@ -169,6 +174,12 @@ in
|
||||
assert lib.hasPrefix "/home/u/.local/state/" hmCfg.services.proxy-suite.host.stateDir;
|
||||
assert hmCfg.systemd.user.services ? proxy-suite-socks;
|
||||
assert hmCfg.systemd.user.services ? proxy-suite-inbounds;
|
||||
assert hmCfg.systemd.user.services ? proxy-suite-tor;
|
||||
# Rootless, there is no userControl group to hand the control socket to.
|
||||
assert
|
||||
!(lib.hasInfix "proxy-suite-tor-control-dir" (
|
||||
toString (hmCfg.systemd.user.services.proxy-suite-tor.Service.ExecStartPre or [ ])
|
||||
));
|
||||
assert forced hmCfg.systemd.user.services;
|
||||
# No setpriv on a user manager: nothing to drop to.
|
||||
assert
|
||||
@@ -204,6 +215,7 @@ in
|
||||
assert lib.hasInfix "proxy-suitectl boot" nodCfg.build.activationAfter.proxySuite;
|
||||
assert lib.hasInfix "proxy-suitectl ensure" nodCfg.environment.etc.profile.text;
|
||||
assert forced nodCfg.build.activationAfter.proxySuite;
|
||||
assert nodCfg.services.proxy-suite.internal.services.proxy-suite-tor.enable;
|
||||
# Android bans apps from netlink's route groups, which stock sing-box subscribes to.
|
||||
assert nodCfg.services.proxy-suite.proxy.singBox.package.passthru.rootlessNetlink or false;
|
||||
assert !(hmCfg.services.proxy-suite.proxy.singBox.package.passthru.rootlessNetlink or false);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
let
|
||||
inherit (checkLib)
|
||||
mkRouting
|
||||
evalProxySuite
|
||||
mkRoutingRules
|
||||
mkRouteModeRules
|
||||
@@ -124,6 +125,21 @@ let
|
||||
;
|
||||
};
|
||||
|
||||
torChecks = import ./tor.nix {
|
||||
inherit
|
||||
pkgs
|
||||
evalProxySuite
|
||||
mkBadProxySuiteFixture
|
||||
mkFailingAssertions
|
||||
mkRouting
|
||||
mkTunConfig
|
||||
mkTProxyConfig
|
||||
mkInboundsSpec
|
||||
mkInboundsConfig
|
||||
mkProxyCtlDerived
|
||||
;
|
||||
};
|
||||
|
||||
proxyInboundsChecks = import ./proxy-inbounds.nix {
|
||||
inherit
|
||||
pkgs
|
||||
@@ -276,6 +292,7 @@ let
|
||||
++ localProxyAuthChecks.assertions
|
||||
++ sshProxyChecks.assertions
|
||||
++ warpChecks.assertions
|
||||
++ torChecks.assertions
|
||||
++ proxyInboundsChecks.assertions
|
||||
++ tgWsProxyChecks.assertions
|
||||
++ xrayBackendChecks.assertions
|
||||
@@ -297,6 +314,7 @@ in
|
||||
proxy-suite-module = builtins.seq validated (pkgs.writeText "proxy-suite-module-check" "ok");
|
||||
amneziawg-secret-manifest = amneziaWgChecks.manifest;
|
||||
xray-jq-filter-runtime = xrayBackendChecks.runtime;
|
||||
tor-guard-runtime = torChecks.runtime;
|
||||
per-app-zapret-runtime = perAppRoutingChecks.runtime;
|
||||
zapret-hostlist-rules = zapretChecks.rules;
|
||||
zapret2-config = zapret2Checks.runtime;
|
||||
|
||||
@@ -372,6 +372,8 @@
|
||||
has work awg on
|
||||
has torrent apps run
|
||||
has unpin proxy
|
||||
has newnym tor
|
||||
has --onion inbounds link
|
||||
has community-de proxy pin
|
||||
|
||||
# Flags, and completion past the first of several arguments.
|
||||
@@ -785,6 +787,7 @@
|
||||
singBoxCfg = null;
|
||||
sshProxyCfg = null;
|
||||
warpCfg = null;
|
||||
torCfg = null;
|
||||
awgOutbounds = null;
|
||||
constants = null;
|
||||
pureXrayEnabled = null;
|
||||
|
||||
@@ -47,6 +47,7 @@ let
|
||||
};
|
||||
|
||||
ipServer = mkServer { };
|
||||
onionServer = mkServer { onion.enable = true; };
|
||||
domainServer = mkServer {
|
||||
domain = "vpn.example.com";
|
||||
network.dhcp = true;
|
||||
@@ -57,6 +58,7 @@ let
|
||||
listener = spec: tag: lib.head (builtins.filter (l: l.tag == tag) spec.listeners);
|
||||
|
||||
ipSpec = mkInboundsSpec ipServer;
|
||||
onionSpec = mkInboundsSpec onionServer;
|
||||
domainSpec = mkInboundsSpec domainServer;
|
||||
uplink = fixture: fixture.config.systemd.network.networks."10-uplink";
|
||||
ipCert = ipServer.config.security.acme.certs."203.0.113.10";
|
||||
@@ -159,5 +161,40 @@ in
|
||||
assert ipServer.config.services.openssh.settings.PermitRootLogin == "no";
|
||||
true
|
||||
)
|
||||
|
||||
# onion.enable: every listener behind the onion service, and nothing opened for it.
|
||||
(
|
||||
assert failedAssertions onionServer == [ ];
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
lib.sort (a: b: a < b) onionSpec.onionListeners == [
|
||||
"vless-reality"
|
||||
"vless-tls"
|
||||
"vless-ws"
|
||||
];
|
||||
true
|
||||
)
|
||||
(
|
||||
assert !(ipServer.config.systemd.services ? proxy-suite-tor) && (ipSpec.onionListeners or [ ]) == [ ];
|
||||
true
|
||||
)
|
||||
(
|
||||
assert builtins.elem "proxy-suite-tor.service" onionServer.config.systemd.services.proxy-suite-inbounds.after;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
onionServer.config.networking.firewall.allowedTCPPorts
|
||||
== ipServer.config.networking.firewall.allowedTCPPorts;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
lib.hasInfix "--onion" onionServer.config.services.getty.helpLine
|
||||
&& !(lib.hasInfix "--onion" ipServer.config.services.getty.helpLine);
|
||||
true
|
||||
)
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,497 @@
|
||||
{
|
||||
pkgs,
|
||||
evalProxySuite,
|
||||
mkBadProxySuiteFixture,
|
||||
mkFailingAssertions,
|
||||
mkRouting,
|
||||
mkTunConfig,
|
||||
mkTProxyConfig,
|
||||
mkInboundsSpec,
|
||||
mkInboundsConfig,
|
||||
mkProxyCtlDerived,
|
||||
}:
|
||||
|
||||
let
|
||||
generated = import ./read-generated.nix;
|
||||
inherit (pkgs) lib;
|
||||
inherit (lib) hasInfix;
|
||||
|
||||
listener = {
|
||||
type = "vless";
|
||||
port = 10443;
|
||||
users = [ { uuidFile = "/run/secrets/uuid"; } ];
|
||||
};
|
||||
|
||||
mkFixture =
|
||||
backend: settings:
|
||||
evalProxySuite [
|
||||
{
|
||||
system.stateVersion = "26.05";
|
||||
services.proxy-suite = lib.recursiveUpdate {
|
||||
enable = true;
|
||||
tor = {
|
||||
enable = true;
|
||||
asOutbound = true;
|
||||
};
|
||||
proxy = {
|
||||
enable = true;
|
||||
inherit backend;
|
||||
tun.enable = true;
|
||||
outbounds = [
|
||||
{
|
||||
tag = "vps";
|
||||
url = "http://vps.example.com:8080";
|
||||
}
|
||||
];
|
||||
};
|
||||
} settings;
|
||||
}
|
||||
];
|
||||
# Only proxy-suite's: these fixtures are not bootable systems.
|
||||
failedAssertions =
|
||||
fixture:
|
||||
map (a: a.message) (
|
||||
builtins.filter (a: !a.assertion && lib.hasPrefix "proxy-suite" a.message) fixture.config.assertions
|
||||
);
|
||||
services = fixture: fixture.config.systemd.services;
|
||||
socksStartOf = fixture: generated.readDerivation (services fixture).proxy-suite-socks.serviceConfig.ExecStart;
|
||||
torStartOf = fixture: generated.readDerivation (services fixture).proxy-suite-tor.serviceConfig.ExecStart;
|
||||
dnsOut = config: (lib.head (builtins.filter (o: o.tag == "dns-out") config.outbounds)).settings.rules;
|
||||
|
||||
singBox = mkFixture "sing-box" { };
|
||||
singBoxStart = socksStartOf singBox;
|
||||
singBoxTorStart = torStartOf singBox;
|
||||
singBoxTun = mkTunConfig singBox;
|
||||
singBoxModes = (mkRouting singBox).singBoxRouteModeRules;
|
||||
singBoxTorUnit = (services singBox).proxy-suite-tor;
|
||||
singBoxTProxy = mkTProxyConfig (mkFixture "sing-box" {
|
||||
proxy.tun.enable = false;
|
||||
proxy.tproxy.enable = true;
|
||||
});
|
||||
|
||||
xray = mkFixture "xray" { proxy.tproxy.enable = true; };
|
||||
xrayStart = socksStartOf xray;
|
||||
xrayRouting = mkRouting xray;
|
||||
|
||||
hybrid = mkFixture "hybrid" { };
|
||||
hybridStart = socksStartOf hybrid;
|
||||
|
||||
controlled = mkFixture "sing-box" { userControl.enable = true; };
|
||||
|
||||
relayTorStart = torStartOf (mkFixture "sing-box" { tor.clientOnly = false; });
|
||||
|
||||
noOnion = mkFixture "sing-box" { tor.routeOnion = false; };
|
||||
noOnionTun = mkTunConfig noOnion;
|
||||
|
||||
bridges = mkFixture "sing-box" {
|
||||
tor = {
|
||||
bridges.lines = [ "obfs4 192.0.2.1:443 0123456789ABCDEF0123456789ABCDEF01234567 cert=x iat-mode=0" ];
|
||||
bridges.file = "/run/secrets/tor-bridges";
|
||||
};
|
||||
};
|
||||
bridgesStart = torStartOf bridges;
|
||||
|
||||
viaProxy = mkFixture "sing-box" {
|
||||
tor.upstream = "proxy";
|
||||
proxy.listener.auth = {
|
||||
username = "local-user";
|
||||
passwordFile = "/run/secrets/local-proxy-password";
|
||||
};
|
||||
};
|
||||
viaProxyStart = torStartOf viaProxy;
|
||||
viaProxyTor = (services viaProxy).proxy-suite-tor;
|
||||
|
||||
onion = evalProxySuite [
|
||||
{
|
||||
system.stateVersion = "26.05";
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
tor = {
|
||||
enable = true;
|
||||
onionService = {
|
||||
enable = true;
|
||||
secretKeyFile = "/run/secrets/hs_ed25519_secret_key";
|
||||
};
|
||||
};
|
||||
inbounds = {
|
||||
enable = true;
|
||||
serverAddress = "vpn.example.com";
|
||||
routing.via = "direct";
|
||||
listeners.plain = listener;
|
||||
listeners.shared = listener // {
|
||||
port = 10444;
|
||||
address = "127.0.0.1";
|
||||
sharePort = 443;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
# An exit node: its clients' .onion names still reach Tor, through the local proxy.
|
||||
exitInbounds = {
|
||||
inbounds = {
|
||||
enable = true;
|
||||
serverAddress = "vpn.example.com";
|
||||
routing.via = "direct";
|
||||
listeners.plain = listener;
|
||||
listeners.closed = listener // {
|
||||
port = 10445;
|
||||
via = "block";
|
||||
};
|
||||
};
|
||||
};
|
||||
exitNode = mkFixture "sing-box" exitInbounds;
|
||||
exitNodeConfig = mkInboundsConfig exitNode;
|
||||
exitNodeRules = exitNodeConfig.routing.rules;
|
||||
exitNodeNoOnion = mkInboundsConfig (mkFixture "sing-box" (exitInbounds // { tor.routeOnion = false; }));
|
||||
|
||||
# inbounds.routing.blockPrivate's resolve guard must come after the .onion rule: resolving
|
||||
# a .onion name fails, and the connection with it. autoProxy's probe pins sit first.
|
||||
guardFilter = pkgs.writeText "proxy-suite-tor-guard-check.jq" (
|
||||
import ../../modules/proxy-suite/service/script-blocks/backend-jq-filter.nix {
|
||||
inherit lib;
|
||||
pureXrayEnabled = false;
|
||||
proxyInboundsGuardPrivate = true;
|
||||
selectionMode = "selector";
|
||||
}
|
||||
);
|
||||
guardRouteRules = pkgs.writeText "proxy-suite-tor-guard-rules.json" (
|
||||
builtins.toJSON (
|
||||
(mkRouting exitNode).singBoxRouteModeRules.common
|
||||
++ [
|
||||
{
|
||||
domain_suffix = [ "ru" ];
|
||||
outbound = "direct";
|
||||
}
|
||||
]
|
||||
)
|
||||
);
|
||||
guardRuntime =
|
||||
pkgs.runCommand "proxy-suite-tor-guard-check" { nativeBuildInputs = [ pkgs.jq ]; }
|
||||
''
|
||||
echo '{"inbounds":[],"outbounds":[],"dns":{"rules":[]},"route":{"rules":[]}}' |
|
||||
jq --argjson obs '[]' --argjson auth_enabled false --arg user "" --arg password "" \
|
||||
--argjson route_enabled true --argjson route_rules "$(cat ${guardRouteRules})" \
|
||||
--arg route_final proxy --arg dns_final remote --argjson clear_dns_rules false \
|
||||
--argjson probe_inbounds '[]' --argjson autoproxy_rule_sets '[]' --argjson autoproxy_rules '[]' \
|
||||
--argjson probe_pin_rules '[{"inbound":["probe-in-0"],"outbound":"direct"}]' \
|
||||
-f ${guardFilter} > rules.json
|
||||
jq -e '
|
||||
.route.rules as $r
|
||||
| ($r | map(.domain_suffix? == ["onion"]) | index(true)) as $onion
|
||||
| ($r | map(.action? == "resolve") | index(true)) as $guard
|
||||
| ($r | map(.domain_suffix? == ["ru"]) | index(true)) as $ru
|
||||
| $onion != null and $guard > $onion and $guard < $ru
|
||||
' rules.json
|
||||
touch $out
|
||||
'';
|
||||
|
||||
onionStart = torStartOf onion;
|
||||
onionSpec = mkInboundsSpec onion;
|
||||
onionInbounds = (services onion).proxy-suite-inbounds;
|
||||
|
||||
invalidAssertions = mkFailingAssertions mkBadProxySuiteFixture (
|
||||
map (case: { enable = true; } // case) [
|
||||
# Enabled but used for nothing.
|
||||
{ tor.enable = true; }
|
||||
# An outbound without a backend.
|
||||
{
|
||||
tor = {
|
||||
enable = true;
|
||||
asOutbound = true;
|
||||
};
|
||||
}
|
||||
# "tor" is taken.
|
||||
{
|
||||
tor = {
|
||||
enable = true;
|
||||
asOutbound = true;
|
||||
};
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [
|
||||
{
|
||||
tag = "tor";
|
||||
url = "http://proxy.example.com:8080";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
# Snowflake ignores Socks5Proxy.
|
||||
{
|
||||
tor = {
|
||||
enable = true;
|
||||
asOutbound = true;
|
||||
upstream = "proxy";
|
||||
bridges.lines = [ "snowflake 192.0.2.3:80 2B280B23E1107BB62ABFC40DDCC8824814F80A72" ];
|
||||
};
|
||||
proxy.enable = true;
|
||||
}
|
||||
# The SOCKS port on the proxy's own.
|
||||
{
|
||||
tor = {
|
||||
enable = true;
|
||||
asOutbound = true;
|
||||
socksPort = 1080;
|
||||
};
|
||||
proxy = {
|
||||
enable = true;
|
||||
listener.port = 1080;
|
||||
};
|
||||
}
|
||||
# An onion service without inbounds, and one naming a listener that is not there.
|
||||
{
|
||||
tor = {
|
||||
enable = true;
|
||||
onionService.enable = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
tor = {
|
||||
enable = true;
|
||||
onionService = {
|
||||
enable = true;
|
||||
listeners = [ "missing" ];
|
||||
};
|
||||
};
|
||||
inbounds = {
|
||||
enable = true;
|
||||
routing.via = "direct";
|
||||
listeners.plain = listener;
|
||||
};
|
||||
}
|
||||
# Two listeners on one onion port.
|
||||
{
|
||||
tor = {
|
||||
enable = true;
|
||||
onionService.enable = true;
|
||||
};
|
||||
inbounds = {
|
||||
enable = true;
|
||||
routing.via = "direct";
|
||||
listeners.a = listener // {
|
||||
sharePort = 443;
|
||||
};
|
||||
listeners.b = listener // {
|
||||
port = 10444;
|
||||
sharePort = 443;
|
||||
};
|
||||
};
|
||||
}
|
||||
]);
|
||||
in
|
||||
{
|
||||
runtime = guardRuntime;
|
||||
|
||||
assertions = [
|
||||
(
|
||||
assert failedAssertions exitNode == [ ];
|
||||
assert
|
||||
lib.head exitNodeRules == {
|
||||
type = "field";
|
||||
ruleTag = "inbound-tor-onion";
|
||||
domain = [ "domain:onion" ];
|
||||
inboundTag = [ "plain" ];
|
||||
outboundTag = "proxy";
|
||||
};
|
||||
assert lib.any (o: o.tag == "proxy") exitNodeConfig.outbounds;
|
||||
assert builtins.elem "proxy-suite-socks.service" (services exitNode).proxy-suite-inbounds.wants;
|
||||
assert !(lib.any (r: r.ruleTag or "" == "inbound-tor-onion") exitNodeNoOnion.routing.rules);
|
||||
assert !(lib.any (r: r.ruleTag or "" == "inbound-tor-onion") (mkInboundsConfig onion).routing.rules);
|
||||
true
|
||||
)
|
||||
(
|
||||
assert lib.all (f: failedAssertions f == [ ]) [
|
||||
singBox
|
||||
xray
|
||||
hybrid
|
||||
noOnion
|
||||
bridges
|
||||
viaProxy
|
||||
onion
|
||||
];
|
||||
true
|
||||
)
|
||||
|
||||
# Every backend dials Tor's SOCKS listener as the "tor" outbound.
|
||||
(
|
||||
assert hasInfix ''{"server":"127.0.0.1","server_port":18530,"tag":"tor","type":"socks"}'' singBoxStart;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
hasInfix ''{"protocol":"socks","settings":{"address":"127.0.0.1","port":18530},"tag":"tor"}'' xrayStart;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert hasInfix ''"tag":"tor","type":"socks"'' hybridStart;
|
||||
true
|
||||
)
|
||||
# Only rules and detours reach it: never selected, tested, or used as an autoProxy exit.
|
||||
(
|
||||
assert
|
||||
hasInfix ''(if length > 1 then ["tor"] else [] end) as $tor'' singBoxStart
|
||||
&& hasInfix ''(.tag | ltrimstr("proxy-suite-ob-")) != "tor"'' singBoxStart;
|
||||
true
|
||||
)
|
||||
# Not after Tor: with upstream = "proxy" that would be a cycle.
|
||||
(
|
||||
assert
|
||||
builtins.elem "proxy-suite-tor.service" (services singBox).proxy-suite-socks.wants
|
||||
&& !(builtins.elem "proxy-suite-tor.service" (services singBox).proxy-suite-socks.after)
|
||||
&& builtins.elem "proxy-suite-socks.service" viaProxyTor.after;
|
||||
true
|
||||
)
|
||||
|
||||
# .onion goes to Tor in every route mode, after DNS hijack and sniffing.
|
||||
(
|
||||
assert
|
||||
builtins.elemAt singBoxModes.common 2 == {
|
||||
domain_suffix = [ "onion" ];
|
||||
outbound = "tor";
|
||||
};
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
xrayRouting.xrayRouteModeRules.common == [
|
||||
{
|
||||
type = "field";
|
||||
ruleTag = "tor-onion";
|
||||
domain = [ "domain:onion" ];
|
||||
outboundTag = "tor";
|
||||
}
|
||||
]
|
||||
&& lib.head xrayRouting.xrayRoutingRules == lib.head xrayRouting.xrayRouteModeRules.common;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
!(lib.any (r: r ? domain_suffix) (mkRouting noOnion).singBoxRouteModeRules.common)
|
||||
&& !(lib.any (r: r ? domain_suffix) noOnionTun.dns.rules);
|
||||
true
|
||||
)
|
||||
# Onion names never reach a resolver: a fake address where traffic is captured, NXDOMAIN elsewhere.
|
||||
(
|
||||
assert
|
||||
lib.take 2 singBoxTun.dns.rules == [
|
||||
{
|
||||
inbound = [ "tun-in" ];
|
||||
domain_suffix = [ "onion" ];
|
||||
query_type = [
|
||||
"A"
|
||||
"AAAA"
|
||||
];
|
||||
server = "fakeip";
|
||||
}
|
||||
{
|
||||
domain_suffix = [ "onion" ];
|
||||
action = "predefined";
|
||||
rcode = "NXDOMAIN";
|
||||
}
|
||||
]
|
||||
&& lib.any (s: s.tag == "fakeip") singBoxTun.dns.servers;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
(lib.head singBoxTProxy.dns.rules).inbound == [
|
||||
"tproxy-in"
|
||||
"tproxy-in6"
|
||||
]
|
||||
&& lib.any (s: s.tag == "fakeip") singBoxTProxy.dns.servers;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
lib.take 2 (dnsOut (mkTunConfig xray)) == [
|
||||
{
|
||||
action = "hijack";
|
||||
qType = "1,28";
|
||||
domain = [ "domain:onion" ];
|
||||
}
|
||||
{
|
||||
action = "return";
|
||||
rCode = 3;
|
||||
domain = [ "domain:onion" ];
|
||||
}
|
||||
]
|
||||
&& (lib.head (dnsOut (mkTProxyConfig xray))).action == "return";
|
||||
true
|
||||
)
|
||||
|
||||
# Tor runs as the service user, which TUN and TProxy let through, and keeps its keys private.
|
||||
(
|
||||
assert
|
||||
singBoxTorUnit.serviceConfig.User == "proxy-suite-daemon"
|
||||
&& singBoxTorUnit.serviceConfig.StateDirectory == "proxy-suite/tor"
|
||||
&& singBoxTorUnit.serviceConfig.StateDirectoryMode == "0700";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
hasInfix "SocksPort 127.0.0.1:18530" singBoxTorStart
|
||||
&& hasInfix "DNSPort 0" singBoxTorStart
|
||||
&& hasInfix "ClientOnly 1" singBoxTorStart
|
||||
&& !(hasInfix "ClientOnly" relayTorStart)
|
||||
&& hasInfix "ControlSocket unix:$RUNTIME_DIRECTORY/control/socket" singBoxTorStart
|
||||
&& !(hasInfix "UseBridges" singBoxTorStart)
|
||||
&& !(hasInfix "Socks5Proxy" singBoxTorStart)
|
||||
&& !(hasInfix "HiddenService" singBoxTorStart);
|
||||
true
|
||||
)
|
||||
# userControl's group can use the control socket: that is `proxy-ctl tor status|newnym`.
|
||||
(
|
||||
assert
|
||||
hasInfix "proxy-suite-tor-control-dir" (toString (services controlled).proxy-suite-tor.serviceConfig.ExecStartPre)
|
||||
&& !(singBoxTorUnit.serviceConfig ? ExecStartPre)
|
||||
&& (mkProxyCtlDerived singBox).wrapperEnv.TOR_CONTROL_SOCKET == "/run/proxy-suite-tor/control/socket";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
hasInfix "UseBridges 1" bridgesStart
|
||||
&& hasInfix "/bin/lyrebird" bridgesStart
|
||||
&& hasInfix "ClientTransportPlugin snowflake exec" bridgesStart
|
||||
&& hasInfix "Bridge obfs4 192.0.2.1:443 " bridgesStart
|
||||
&& hasInfix ''"$CREDENTIALS_DIRECTORY/bridges"'' bridgesStart
|
||||
&& builtins.elem "bridges:/run/secrets/tor-bridges" (services bridges).proxy-suite-tor.serviceConfig.LoadCredential;
|
||||
true
|
||||
)
|
||||
# Through the local proxy, with its password read at start, never written to the store.
|
||||
(
|
||||
assert
|
||||
hasInfix "Socks5Proxy 127.0.0.1:1080" viaProxyStart
|
||||
&& hasInfix ''echo "Socks5ProxyUsername "local-user'' viaProxyStart
|
||||
&& hasInfix ''"$CREDENTIALS_DIRECTORY/proxy-password"'' viaProxyStart
|
||||
&& builtins.elem "proxy-password:/run/secrets/local-proxy-password" viaProxyTor.serviceConfig.LoadCredential;
|
||||
true
|
||||
)
|
||||
|
||||
# The onion service forwards each listener's share port to where it listens.
|
||||
(
|
||||
assert
|
||||
hasInfix "HiddenServiceDir $STATE_DIRECTORY/onion" onionStart
|
||||
&& hasInfix "HiddenServicePort 10443 127.0.0.1:10443" onionStart
|
||||
&& hasInfix "HiddenServicePort 443 127.0.0.1:10444" onionStart
|
||||
&& hasInfix "SocksPort 0" onionStart
|
||||
&& hasInfix "hs_ed25519_secret_key" onionStart;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
lib.sort (a: b: a < b) onionSpec.onionListeners == [
|
||||
"plain"
|
||||
"shared"
|
||||
]
|
||||
&& builtins.elem "proxy-suite-tor.service" onionInbounds.after
|
||||
&& builtins.elem "proxy-suite-tor.service" onionInbounds.wants;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert !(onion.config.systemd.services ? proxy-suite-socks);
|
||||
true
|
||||
)
|
||||
]
|
||||
++ invalidAssertions;
|
||||
}
|
||||
@@ -17,6 +17,7 @@ let
|
||||
proxyCfg = null;
|
||||
sshProxyCfg = null;
|
||||
warpCfg = null;
|
||||
torCfg = null;
|
||||
awgOutbounds = null;
|
||||
constants = null;
|
||||
hybridEnabled = null;
|
||||
|
||||
Reference in new issue
Block a user