fix: multiple fixes + cleanup and formatting
This commit is contained in:
59 files changed
+1357
-920
No files matched your search
@@ -207,8 +207,11 @@ in
|
||||
awgOnly.config.environment.systemPackages;
|
||||
assert builtins.elem awgOnly.config.services.proxy-suite.amneziaWg.userspacePackage
|
||||
awgOnly.config.environment.systemPackages;
|
||||
assert pkgs.lib.versionAtLeast awgOnly.config.services.proxy-suite.amneziaWg.toolsPackage.version "3.1";
|
||||
assert pkgs.lib.versionAtLeast awgOnly.config.services.proxy-suite.amneziaWg.userspacePackage.version "3.1";
|
||||
assert pkgs.lib.versionAtLeast awgOnly.config.services.proxy-suite.amneziaWg.toolsPackage.version
|
||||
"3.1";
|
||||
assert pkgs.lib.versionAtLeast
|
||||
awgOnly.config.services.proxy-suite.amneziaWg.userspacePackage.version
|
||||
"3.1";
|
||||
assert pkgs.lib.hasInfix "cmd_awg" ctl.script;
|
||||
assert
|
||||
ctl.awgProfiles == [
|
||||
@@ -218,11 +221,15 @@ in
|
||||
true
|
||||
)
|
||||
(
|
||||
assert pkgs.lib.versionAtLeast defaultPackages.config.services.proxy-suite.amneziaWg.toolsPackage.version "3.1";
|
||||
assert
|
||||
pkgs.lib.versionAtLeast defaultPackages.config.services.proxy-suite.amneziaWg.userspacePackage.version "3.1";
|
||||
assert
|
||||
pkgs.lib.versionAtLeast defaultPackages.config.services.proxy-suite.amneziaWg.kernelModulePackage.version "3.1";
|
||||
assert pkgs.lib.versionAtLeast
|
||||
defaultPackages.config.services.proxy-suite.amneziaWg.toolsPackage.version
|
||||
"3.1";
|
||||
assert pkgs.lib.versionAtLeast
|
||||
defaultPackages.config.services.proxy-suite.amneziaWg.userspacePackage.version
|
||||
"3.1";
|
||||
assert pkgs.lib.versionAtLeast
|
||||
defaultPackages.config.services.proxy-suite.amneziaWg.kernelModulePackage.version
|
||||
"3.1";
|
||||
true
|
||||
)
|
||||
(
|
||||
|
||||
+64
-44
@@ -11,7 +11,9 @@
|
||||
let
|
||||
generated = import ./read-generated.nix;
|
||||
startScript =
|
||||
fixture: generated.readDerivation fixture.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart;
|
||||
fixture:
|
||||
generated.readDerivation
|
||||
fixture.config.systemd.services."proxy-suite-socks".serviceConfig.ExecStart;
|
||||
|
||||
chained = evalProxySuite [
|
||||
baseModule
|
||||
@@ -70,9 +72,13 @@ in
|
||||
assertions = [
|
||||
# Detours are resolved at start, once subscription and runtime entries exist.
|
||||
(
|
||||
assert pkgs.lib.hasInfix ''{"outbounds":{"exit":"primary"},"subscriptions":{"sub":"primary"}}'' (startScript chained);
|
||||
assert pkgs.lib.hasInfix ''{"outbounds":{"exit":"primary"},"subscriptions":{"sub":"primary"}}'' (
|
||||
startScript chained
|
||||
);
|
||||
assert pkgs.lib.hasInfix "proxy-suite-outbound-detours" (startScript chained);
|
||||
assert pkgs.lib.hasInfix ''/var/lib/proxy-suite/outbounds.d/$RUNTIME_OB_TAG.detour'' (startScript chained);
|
||||
assert pkgs.lib.hasInfix "/var/lib/proxy-suite/outbounds.d/$RUNTIME_OB_TAG.detour" (
|
||||
startScript chained
|
||||
);
|
||||
true
|
||||
)
|
||||
|
||||
@@ -85,51 +91,52 @@ in
|
||||
]);
|
||||
in
|
||||
assert pkgs.lib.hasInfix ''--argjson ex '["primary"]' '' script;
|
||||
assert pkgs.lib.hasInfix ''excluded: ($tags - $selectable)'' script;
|
||||
assert pkgs.lib.hasInfix "excluded: ($tags - $selectable)" script;
|
||||
true
|
||||
)
|
||||
|
||||
# An inbound pinned to a chained outbound gets the whole chain.
|
||||
(
|
||||
let
|
||||
script = generated.readDerivation
|
||||
(evalProxySuite [
|
||||
{
|
||||
system.stateVersion = "26.05";
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
script =
|
||||
generated.readDerivation
|
||||
(evalProxySuite [
|
||||
{
|
||||
system.stateVersion = "26.05";
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
outbounds = [
|
||||
{
|
||||
tag = "hop";
|
||||
url = "http://hop.example.com:8080";
|
||||
}
|
||||
{
|
||||
tag = "exit";
|
||||
url = "http://exit.example.com:8080";
|
||||
detour = "hop";
|
||||
}
|
||||
];
|
||||
};
|
||||
inbounds = {
|
||||
enable = true;
|
||||
serverAddress = "203.0.113.1";
|
||||
listeners.main = {
|
||||
type = "socks";
|
||||
port = 1081;
|
||||
via = "exit";
|
||||
users = [
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [
|
||||
{
|
||||
name = "a";
|
||||
password = "b";
|
||||
tag = "hop";
|
||||
url = "http://hop.example.com:8080";
|
||||
}
|
||||
{
|
||||
tag = "exit";
|
||||
url = "http://exit.example.com:8080";
|
||||
detour = "hop";
|
||||
}
|
||||
];
|
||||
};
|
||||
inbounds = {
|
||||
enable = true;
|
||||
serverAddress = "203.0.113.1";
|
||||
listeners.main = {
|
||||
type = "socks";
|
||||
port = 1081;
|
||||
via = "exit";
|
||||
users = [
|
||||
{
|
||||
name = "a";
|
||||
password = "b";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
]).config.systemd.services."proxy-suite-inbounds".serviceConfig.ExecStart;
|
||||
}
|
||||
]).config.systemd.services."proxy-suite-inbounds".serviceConfig.ExecStart;
|
||||
in
|
||||
assert pkgs.lib.hasInfix "# via outbound: hop" script;
|
||||
assert pkgs.lib.hasInfix "--arg hop hop '.streamSettings.sockopt.dialerProxy = $hop'" script;
|
||||
@@ -138,12 +145,20 @@ in
|
||||
|
||||
# User rules first, fake IP last and only for what comes through the TUN.
|
||||
(
|
||||
assert builtins.head tunDns.rules == { domain_suffix = [ "corp.example" ]; server = "corp"; };
|
||||
assert pkgs.lib.last tunDns.rules == {
|
||||
inbound = [ "tun-in" ];
|
||||
query_type = [ "A" "AAAA" ];
|
||||
server = "fakeip";
|
||||
};
|
||||
assert
|
||||
builtins.head tunDns.rules == {
|
||||
domain_suffix = [ "corp.example" ];
|
||||
server = "corp";
|
||||
};
|
||||
assert
|
||||
pkgs.lib.last tunDns.rules == {
|
||||
inbound = [ "tun-in" ];
|
||||
query_type = [
|
||||
"A"
|
||||
"AAAA"
|
||||
];
|
||||
server = "fakeip";
|
||||
};
|
||||
assert builtins.any (s: s.tag == "fakeip") tunDns.servers;
|
||||
assert builtins.any (s: s.tag == "corp") tunDns.servers;
|
||||
assert tunDns.strategy == "ipv4_only";
|
||||
@@ -151,7 +166,8 @@ in
|
||||
)
|
||||
# Fake addresses survive a restart, one cache per TUN config.
|
||||
(
|
||||
assert (mkTunConfig dnsFixture).experimental.cache_file.path == "/var/lib/proxy-suite/fakeip/tun.db";
|
||||
assert
|
||||
(mkTunConfig dnsFixture).experimental.cache_file.path == "/var/lib/proxy-suite/fakeip/tun.db";
|
||||
assert (mkTunConfig dnsFixture).experimental.cache_file.store_fakeip;
|
||||
true
|
||||
)
|
||||
@@ -209,7 +225,11 @@ in
|
||||
(
|
||||
assert !(builtins.any (s: s.tag == "fakeip") tproxyDns.servers);
|
||||
assert !((mkTProxyConfig dnsFixture).experimental ? cache_file);
|
||||
assert builtins.head tproxyDns.rules == { domain_suffix = [ "corp.example" ]; server = "corp"; };
|
||||
assert
|
||||
builtins.head tproxyDns.rules == {
|
||||
domain_suffix = [ "corp.example" ];
|
||||
server = "corp";
|
||||
};
|
||||
true
|
||||
)
|
||||
]
|
||||
|
||||
@@ -74,20 +74,29 @@ in
|
||||
# IPv6 goes through the same port on ::1; without it IPv6 is left alone.
|
||||
(
|
||||
let
|
||||
tproxyTags = config: map (inbound: inbound.tag) (builtins.filter (inbound: inbound.type == "tproxy") config.inbounds);
|
||||
tproxyTags =
|
||||
config:
|
||||
map (inbound: inbound.tag) (builtins.filter (inbound: inbound.type == "tproxy") config.inbounds);
|
||||
in
|
||||
assert pkgs.lib.hasInfix "delete table inet singbox" tproxyManualStartScript;
|
||||
assert pkgs.lib.hasInfix "-6 route replace local default dev lo table 100" tproxyManualStartScript;
|
||||
assert pkgs.lib.hasInfix "-6 rule add fwmark 1 table 100" tproxyManualStartScript;
|
||||
assert pkgs.lib.hasInfix "-6 rule del fwmark 1 table 100" tproxyManualStopScript;
|
||||
assert pkgs.lib.hasInfix "table inet singbox" tproxyManualNftRules;
|
||||
assert pkgs.lib.hasInfix "meta l4proto { tcp, udp } tproxy ip to 127.0.0.1:1085 meta mark set 1" tproxyManualNftRules;
|
||||
assert pkgs.lib.hasInfix "meta l4proto { tcp, udp } tproxy ip6 to [::1]:1085 meta mark set 1" tproxyManualNftRules;
|
||||
assert tproxyTags tproxyManualConfig == [ "tproxy-in" "tproxy-in6" ];
|
||||
assert pkgs.lib.hasInfix "meta l4proto { tcp, udp } tproxy ip to 127.0.0.1:1085 meta mark set 1"
|
||||
tproxyManualNftRules;
|
||||
assert pkgs.lib.hasInfix "meta l4proto { tcp, udp } tproxy ip6 to [::1]:1085 meta mark set 1"
|
||||
tproxyManualNftRules;
|
||||
assert
|
||||
tproxyTags tproxyManualConfig == [
|
||||
"tproxy-in"
|
||||
"tproxy-in6"
|
||||
];
|
||||
assert !(pkgs.lib.hasInfix "-6 rule add" tproxyIPv4OnlyStartScript);
|
||||
assert pkgs.lib.hasInfix "-6 rule del fwmark 1 table 100" tproxyIPv4OnlyStartScript;
|
||||
assert !(pkgs.lib.hasInfix "tproxy ip6" tproxyIPv4OnlyNftRules);
|
||||
assert pkgs.lib.hasInfix "meta nfproto ipv4 meta l4proto { tcp, udp } meta mark set 1" tproxyIPv4OnlyNftRules;
|
||||
assert pkgs.lib.hasInfix "meta nfproto ipv4 meta l4proto { tcp, udp } meta mark set 1"
|
||||
tproxyIPv4OnlyNftRules;
|
||||
assert tproxyTags tproxyIPv4OnlyConfig == [ "tproxy-in" ];
|
||||
true
|
||||
)
|
||||
@@ -95,10 +104,19 @@ in
|
||||
# family. Off, they stay IPv4-only and wrapped apps' IPv6 is unreachable.
|
||||
(
|
||||
let
|
||||
tunAddress = config: (builtins.head (builtins.filter (inbound: inbound.type or "" == "tun") config.inbounds)).address;
|
||||
xrayGateway = config: (builtins.head (builtins.filter (inbound: inbound.protocol or "" == "tun") config.inbounds)).settings.gateway;
|
||||
tunAddress =
|
||||
config:
|
||||
(builtins.head (builtins.filter (inbound: inbound.type or "" == "tun") config.inbounds)).address;
|
||||
xrayGateway =
|
||||
config:
|
||||
(builtins.head (builtins.filter (inbound: inbound.protocol or "" == "tun") config.inbounds))
|
||||
.settings.gateway;
|
||||
in
|
||||
assert tunAddress tunDefaultConfig == [ "172.19.0.1/30" checkConstants.globalTunIPv6Address ];
|
||||
assert
|
||||
tunAddress tunDefaultConfig == [
|
||||
"172.19.0.1/30"
|
||||
checkConstants.globalTunIPv6Address
|
||||
];
|
||||
assert tunAddress ipv4OnlyTunConfig == [ "172.19.0.1/30" ];
|
||||
assert pkgs.lib.hasInfix "-6 route replace unreachable default table 101" ipv4OnlyPerAppTunUpScript;
|
||||
assert !(pkgs.lib.hasInfix "-6 addr replace" ipv4OnlyPerAppTunUpScript);
|
||||
|
||||
@@ -59,13 +59,15 @@ let
|
||||
};
|
||||
}
|
||||
];
|
||||
tproxyIPv4OnlyStartScript = generated.readDerivation
|
||||
tproxyIPv4OnlyFixture.config.systemd.services."proxy-suite-tproxy".serviceConfig.ExecStart;
|
||||
tproxyIPv4OnlyStartScript =
|
||||
generated.readDerivation
|
||||
tproxyIPv4OnlyFixture.config.systemd.services."proxy-suite-tproxy".serviceConfig.ExecStart;
|
||||
tproxyIPv4OnlyConfig = mkTProxyConfig tproxyIPv4OnlyFixture;
|
||||
tproxyIPv4OnlyNftRules = mkTProxyNftRules tproxyIPv4OnlyFixture;
|
||||
ipv4OnlyTunConfig = mkTunConfig tproxyIPv4OnlyFixture;
|
||||
ipv4OnlyPerAppTunUpScript = generated.readDerivation
|
||||
tproxyIPv4OnlyFixture.config.systemd.services."proxy-suite-per-app-tun".serviceConfig.ExecStartPost;
|
||||
ipv4OnlyPerAppTunUpScript =
|
||||
generated.readDerivation
|
||||
tproxyIPv4OnlyFixture.config.systemd.services."proxy-suite-per-app-tun".serviceConfig.ExecStartPost;
|
||||
|
||||
# XRay's TUN configures IPv6 itself: with it off, its up script must not touch IPv6 addresses.
|
||||
xrayIPv4OnlyFixture = evalProxySuite [
|
||||
@@ -82,8 +84,9 @@ let
|
||||
)
|
||||
];
|
||||
xrayIPv4OnlyTunConfig = mkTunConfig xrayIPv4OnlyFixture;
|
||||
xrayIPv4OnlyTunUpScript = generated.readDerivation
|
||||
xrayIPv4OnlyFixture.config.systemd.services."proxy-suite-tun".serviceConfig.ExecStartPost;
|
||||
xrayIPv4OnlyTunUpScript =
|
||||
generated.readDerivation
|
||||
xrayIPv4OnlyFixture.config.systemd.services."proxy-suite-tun".serviceConfig.ExecStartPost;
|
||||
|
||||
tproxyAutostartFixture = evalProxySuite [
|
||||
baseModule
|
||||
|
||||
+4
-2
@@ -67,11 +67,13 @@ in
|
||||
in
|
||||
assert guiFixture.config.security.polkit.enable;
|
||||
# nixpkgs 26.11+: no setuid pkexec unless asked for, and without it pkexec refuses to run.
|
||||
assert guiFixture.config.security.wrappers ? pkexec && guiFixture.config.security.wrappers.pkexec.enable;
|
||||
assert
|
||||
guiFixture.config.security.wrappers ? pkexec && guiFixture.config.security.wrappers.pkexec.enable;
|
||||
assert
|
||||
builtins.match ''.*action\.lookup\("program"\) === "/nix/store/[^"]*proxy-ctl/bin/proxy-ctl".*AUTH_ADMIN_KEEP.*'' rules
|
||||
!= null;
|
||||
assert builtins.match ".*AUTH_ADMIN_KEEP.*" tuiOffFixture.config.security.polkit.extraConfig == null;
|
||||
assert
|
||||
builtins.match ".*AUTH_ADMIN_KEEP.*" tuiOffFixture.config.security.polkit.extraConfig == null;
|
||||
true
|
||||
)
|
||||
(
|
||||
|
||||
@@ -92,7 +92,8 @@ in
|
||||
assert pkgs.lib.hasInfix "--backend xray" hybridStartScript;
|
||||
assert pkgs.lib.hasInfix "_proxy_suite_add_xray_sidecar_ob" hybridStartScript;
|
||||
assert pkgs.lib.hasInfix "hybrid XRay json sidecar" hybridXrayRawStartScript;
|
||||
assert pkgs.lib.hasInfix ''{type: "socks", tag: $tag, server: "127.0.0.1"'' hybridXrayRawStartScript;
|
||||
assert pkgs.lib.hasInfix ''{type: "socks", tag: $tag, server: "127.0.0.1"''
|
||||
hybridXrayRawStartScript;
|
||||
assert pkgs.lib.hasInfix "udp: true" hybridXrayRawStartScript;
|
||||
assert pkgs.lib.hasInfix "{routing_mark: 2}" hybridXrayRawStartScript;
|
||||
assert pkgs.lib.hasInfix "sing_box_preserved_rules" hybridBackendJqFilter;
|
||||
|
||||
@@ -108,7 +108,8 @@ in
|
||||
assert pkgs.lib.hasInfix ''chgrp proxy-suite-daemon "$backend_config"'' localProxyAuthStartScript;
|
||||
assert pkgs.lib.hasInfix ''chmod 640 "$backend_config"'' localProxyAuthStartScript;
|
||||
# The backend itself runs unprivileged.
|
||||
assert pkgs.lib.hasInfix "setpriv --reuid=proxy-suite-daemon --regid=proxy-suite-daemon" localProxyAuthStartScript;
|
||||
assert pkgs.lib.hasInfix "setpriv --reuid=proxy-suite-daemon --regid=proxy-suite-daemon"
|
||||
localProxyAuthStartScript;
|
||||
true
|
||||
)
|
||||
|
||||
|
||||
@@ -100,8 +100,7 @@ in
|
||||
(
|
||||
assert pkgs.lib.hasInfix "Usage: proxy-ctl <group>" perAppRoutingProxychainsScript;
|
||||
assert pkgs.lib.hasInfix "local proxy backend" perAppRoutingProxychainsScript;
|
||||
assert pkgs.lib.hasInfix "restart active services"
|
||||
perAppRoutingProxychainsScript;
|
||||
assert pkgs.lib.hasInfix "restart active services" perAppRoutingProxychainsScript;
|
||||
assert pkgs.lib.hasInfix "apps run <profile> -- <cmd>" perAppRoutingProxychainsScript;
|
||||
assert pkgs.lib.hasInfix "apps" perAppRoutingProxychainsScript;
|
||||
true
|
||||
|
||||
@@ -31,12 +31,13 @@ let
|
||||
perAppRoutingTproxyUserStartScript = generated.readDerivation (
|
||||
(mkPerAppUserRules perAppRoutingTproxyFixture).perAppTproxyUserRuleStart
|
||||
);
|
||||
perAppRoutingTproxyNftRules = generated.readDerivation
|
||||
(import ../../modules/proxy-suite/nftables.nix {
|
||||
inherit (pkgs) lib;
|
||||
inherit pkgs;
|
||||
cfg = perAppRoutingTproxyFixture.config.services.proxy-suite;
|
||||
}).perAppTproxyRulesFile;
|
||||
perAppRoutingTproxyNftRules =
|
||||
generated.readDerivation
|
||||
(import ../../modules/proxy-suite/nftables.nix {
|
||||
inherit (pkgs) lib;
|
||||
inherit pkgs;
|
||||
cfg = perAppRoutingTproxyFixture.config.services.proxy-suite;
|
||||
}).perAppTproxyRulesFile;
|
||||
in
|
||||
{
|
||||
assertions = [
|
||||
@@ -67,7 +68,8 @@ in
|
||||
# -- perAppRouting: app TProxy helper installs socket cgroup mark rules --
|
||||
(
|
||||
assert pkgs.lib.hasInfix "socket cgroupv2" perAppRoutingTproxyUserStartScript;
|
||||
assert pkgs.lib.hasInfix "add rule inet proxy_suite_per_app_tproxy output" perAppRoutingTproxyUserStartScript;
|
||||
assert pkgs.lib.hasInfix "add rule inet proxy_suite_per_app_tproxy output"
|
||||
perAppRoutingTproxyUserStartScript;
|
||||
assert pkgs.lib.hasInfix "meta mark set" perAppRoutingTproxyUserStartScript;
|
||||
assert pkgs.lib.hasInfix "ct mark set" perAppRoutingTproxyUserStartScript;
|
||||
true
|
||||
@@ -78,7 +80,11 @@ in
|
||||
(
|
||||
let
|
||||
inherit (pkgs.lib) hasInfix splitString;
|
||||
guardedBeforeMark = chain: hasInfix "ct direction reply return" (builtins.head (splitString "ct mark 17 meta mark set 17" chain));
|
||||
guardedBeforeMark =
|
||||
chain:
|
||||
hasInfix "ct direction reply return" (
|
||||
builtins.head (splitString "ct mark 17 meta mark set 17" chain)
|
||||
);
|
||||
chains = splitString "chain output" perAppRoutingTproxyNftRules;
|
||||
in
|
||||
assert guardedBeforeMark (builtins.elemAt chains 0);
|
||||
@@ -90,8 +96,10 @@ in
|
||||
|
||||
# -- perAppRouting: app TProxy startup installs nftables and loopback policy route --
|
||||
(
|
||||
assert pkgs.lib.hasInfix "delete table inet proxy_suite_per_app_tproxy" perAppRoutingTproxyStartScript;
|
||||
assert pkgs.lib.hasInfix "-6 route replace local default dev lo table 102" perAppRoutingTproxyStartScript;
|
||||
assert pkgs.lib.hasInfix "delete table inet proxy_suite_per_app_tproxy"
|
||||
perAppRoutingTproxyStartScript;
|
||||
assert pkgs.lib.hasInfix "-6 route replace local default dev lo table 102"
|
||||
perAppRoutingTproxyStartScript;
|
||||
assert pkgs.lib.hasInfix "-6 rule add fwmark 17 table 102" perAppRoutingTproxyStartScript;
|
||||
assert pkgs.lib.hasInfix "-6 rule del fwmark 17 table 102" perAppRoutingTproxyStopScript;
|
||||
assert pkgs.lib.hasInfix "rule del fwmark 17 table 102" perAppRoutingTproxyStartScript;
|
||||
|
||||
@@ -38,12 +38,13 @@ let
|
||||
perAppRoutingTunUserStartScript = generated.readDerivation (
|
||||
(mkPerAppUserRules perAppRoutingTunFixture).perAppTunUserRuleStart
|
||||
);
|
||||
perAppRoutingTunNftRules = generated.readDerivation
|
||||
(import ../../modules/proxy-suite/nftables.nix {
|
||||
inherit (pkgs) lib;
|
||||
inherit pkgs;
|
||||
cfg = perAppRoutingTunFixture.config.services.proxy-suite;
|
||||
}).perAppTunChainFile;
|
||||
perAppRoutingTunNftRules =
|
||||
generated.readDerivation
|
||||
(import ../../modules/proxy-suite/nftables.nix {
|
||||
inherit (pkgs) lib;
|
||||
inherit pkgs;
|
||||
cfg = perAppRoutingTunFixture.config.services.proxy-suite;
|
||||
}).perAppTunChainFile;
|
||||
|
||||
perAppRoutingTunWithTproxyFixture = evalProxySuite [
|
||||
baseModule
|
||||
@@ -98,7 +99,11 @@ in
|
||||
);
|
||||
in
|
||||
assert inbound.interface_name == "psperapptun0";
|
||||
assert inbound.address == [ "172.20.0.1/30" "fd66:20::1/64" ];
|
||||
assert
|
||||
inbound.address == [
|
||||
"172.20.0.1/30"
|
||||
"fd66:20::1/64"
|
||||
];
|
||||
assert inbound.auto_route == false;
|
||||
assert inbound.auto_redirect == false;
|
||||
assert inbound.strict_route == false;
|
||||
@@ -147,7 +152,8 @@ in
|
||||
assert perAppRoutingTunServiceConfig.ExecStartPre == perAppRoutingTunServiceConfig.ExecStopPost;
|
||||
# With proxy.ipv6, wrapped apps' IPv6 goes through the app TUN too.
|
||||
assert pkgs.lib.hasInfix ''-6 addr replace "$tun6_cidr" dev psperapptun0'' perAppRoutingTunUpScript;
|
||||
assert pkgs.lib.hasInfix "-6 route replace default dev psperapptun0 table 101" perAppRoutingTunUpScript;
|
||||
assert pkgs.lib.hasInfix "-6 route replace default dev psperapptun0 table 101"
|
||||
perAppRoutingTunUpScript;
|
||||
assert !(pkgs.lib.hasInfix "unreachable" perAppRoutingTunUpScript);
|
||||
assert pkgs.lib.hasInfix "-6 rule add fwmark 16 table 101" perAppRoutingTunUpScript;
|
||||
assert pkgs.lib.hasInfix "-6 route flush table 101" perAppRoutingTunCleanupScript;
|
||||
@@ -160,8 +166,9 @@ in
|
||||
# -- perAppRouting: wrapped apps' replies to incoming connections skip the mark (and the
|
||||
# user rule appended after it), so they leave directly --
|
||||
(
|
||||
assert pkgs.lib.hasInfix "ct direction reply return"
|
||||
(builtins.head (pkgs.lib.splitString "ct mark 16 meta mark set 16" perAppRoutingTunNftRules));
|
||||
assert pkgs.lib.hasInfix "ct direction reply return" (
|
||||
builtins.head (pkgs.lib.splitString "ct mark 16 meta mark set 16" perAppRoutingTunNftRules)
|
||||
);
|
||||
true
|
||||
)
|
||||
|
||||
|
||||
@@ -190,12 +190,11 @@ in
|
||||
perAppRoutingZapretWithoutGlobalFixture.config.systemd.services ? "proxy-suite-per-app-zapret";
|
||||
assert
|
||||
perAppRoutingZapretWithoutGlobalFixture.config.systemd.services
|
||||
? "proxy-suite-per-app-zapret-user@";
|
||||
? "proxy-suite-per-app-zapret-user@";
|
||||
assert
|
||||
perAppRoutingZapretWithoutGlobalFixture.config.systemd.user.services
|
||||
? "proxy-suite-per-app-zapret-anchor";
|
||||
assert
|
||||
!(perAppRoutingZapretWithoutGlobalFixture.config.systemd.services ? "proxy-suite-zapret");
|
||||
? "proxy-suite-per-app-zapret-anchor";
|
||||
assert !(perAppRoutingZapretWithoutGlobalFixture.config.systemd.services ? "proxy-suite-zapret");
|
||||
assert builtins.length perAppRoutingZapretWithoutGlobalProfiles == 2;
|
||||
assert builtins.any (
|
||||
profile: profile.name == "zapret" && profile.route == "zapret"
|
||||
|
||||
+258
-90
@@ -27,7 +27,12 @@ let
|
||||
inbounds:
|
||||
evalProxySuite [
|
||||
baseModule
|
||||
{ services.proxy-suite.inbounds = { enable = true; } // inbounds; }
|
||||
{
|
||||
services.proxy-suite.inbounds = {
|
||||
enable = true;
|
||||
}
|
||||
// inbounds;
|
||||
}
|
||||
];
|
||||
|
||||
relayFixture = mkInbounds { listeners.vless-in = realityListener; };
|
||||
@@ -278,7 +283,9 @@ let
|
||||
if lib.any (a: lib.hasInfix fragment a.message) failed then
|
||||
true
|
||||
else
|
||||
throw "proxy-inbounds check: expected an assertion matching '${fragment}', got: ${builtins.toJSON (map (a: a.message) failed)}";
|
||||
throw "proxy-inbounds check: expected an assertion matching '${fragment}', got: ${
|
||||
builtins.toJSON (map (a: a.message) failed)
|
||||
}";
|
||||
|
||||
mkRejectsListener =
|
||||
listener:
|
||||
@@ -453,23 +460,20 @@ let
|
||||
};
|
||||
} "targets a sing-box-only outbound")
|
||||
|
||||
(mkRejects (baseProxy // { inbounds.enable = true; })
|
||||
"requires at least one entry in inbounds.listeners"
|
||||
)
|
||||
(mkRejects (
|
||||
baseProxy // { inbounds.enable = true; }
|
||||
) "requires at least one entry in inbounds.listeners")
|
||||
|
||||
# recursiveUpdate, not //: this one nests into proxy, which baseProxy sets.
|
||||
(mkRejects
|
||||
(lib.recursiveUpdate baseProxy {
|
||||
proxy.listener.port = 1080;
|
||||
inbounds = {
|
||||
enable = true;
|
||||
listeners.clash = realityListener // {
|
||||
port = 1080;
|
||||
};
|
||||
(mkRejects (lib.recursiveUpdate baseProxy {
|
||||
proxy.listener.port = 1080;
|
||||
inbounds = {
|
||||
enable = true;
|
||||
listeners.clash = realityListener // {
|
||||
port = 1080;
|
||||
};
|
||||
})
|
||||
"collides with proxy.listener.port"
|
||||
)
|
||||
};
|
||||
}) "collides with proxy.listener.port")
|
||||
|
||||
# AmneziaWG listeners.
|
||||
(mkRejectsListener (awgListener // { tls.enable = true; }) "AmneziaWG takes no tls")
|
||||
@@ -511,24 +515,37 @@ let
|
||||
|
||||
assertions = [
|
||||
# Listeners are rendered at start time.
|
||||
(assert relayConfig.inbounds == [ ]; true)
|
||||
(
|
||||
assert relayConfig.inbounds == [ ];
|
||||
true
|
||||
)
|
||||
|
||||
# AsIs when relayed through sing-box; IPOnDemand when XRay dials (see the template).
|
||||
(assert relayConfig.routing.domainStrategy == "AsIs"; true)
|
||||
(assert exitConfig.routing.domainStrategy == "IPOnDemand"; true)
|
||||
|
||||
(assert hasOutbound relayConfig "proxy"; true)
|
||||
(assert (ruleByTag relayConfig "inbound-final").outboundTag == "proxy"; true)
|
||||
(
|
||||
assert
|
||||
(builtins.head (builtins.filter (ob: ob.tag == "proxy") relayConfig.outbounds)).protocol
|
||||
== "socks";
|
||||
assert relayConfig.routing.domainStrategy == "AsIs";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert exitConfig.routing.domainStrategy == "IPOnDemand";
|
||||
true
|
||||
)
|
||||
|
||||
(
|
||||
assert hasOutbound relayConfig "proxy";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (ruleByTag relayConfig "inbound-final").outboundTag == "proxy";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
(builtins.head (builtins.filter (ob: ob.tag == "proxy") relayConfig.outbounds))
|
||||
.settings.servers
|
||||
(builtins.head (builtins.filter (ob: ob.tag == "proxy") relayConfig.outbounds)).protocol == "socks";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
(builtins.head (builtins.filter (ob: ob.tag == "proxy") relayConfig.outbounds)).settings.servers
|
||||
== [
|
||||
{
|
||||
address = "127.0.0.1";
|
||||
@@ -539,15 +556,36 @@ let
|
||||
)
|
||||
|
||||
# A pure exit node needs no proxy outbound at all.
|
||||
(assert !hasOutbound exitConfig "proxy"; true)
|
||||
(assert (ruleByTag exitConfig "inbound-final").outboundTag == "direct"; true)
|
||||
(
|
||||
assert !hasOutbound exitConfig "proxy";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (ruleByTag exitConfig "inbound-final").outboundTag == "direct";
|
||||
true
|
||||
)
|
||||
|
||||
# Safety rules come first.
|
||||
(assert builtins.head (ruleTags relayConfig) == "inbound-block-private"; true)
|
||||
(assert (ruleByTag relayConfig "inbound-block-private").outboundTag == "block"; true)
|
||||
(assert (ruleByTag relayConfig "inbound-block-ru-domain").domain == [ "geosite:category-ru" ]; true)
|
||||
(assert (ruleByTag relayConfig "inbound-block-ru-ip").ip == [ "geoip:ru" ]; true)
|
||||
(assert !builtins.elem "inbound-block-private" (ruleTags unguardedConfig); true)
|
||||
(
|
||||
assert builtins.head (ruleTags relayConfig) == "inbound-block-private";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (ruleByTag relayConfig "inbound-block-private").outboundTag == "block";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (ruleByTag relayConfig "inbound-block-ru-domain").domain == [ "geosite:category-ru" ];
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (ruleByTag relayConfig "inbound-block-ru-ip").ip == [ "geoip:ru" ];
|
||||
true
|
||||
)
|
||||
(
|
||||
assert !builtins.elem "inbound-block-private" (ruleTags unguardedConfig);
|
||||
true
|
||||
)
|
||||
# serverAddress is exempt after blockPrivate, before the country blocks.
|
||||
(
|
||||
assert
|
||||
@@ -559,8 +597,7 @@ let
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
(ruleByTag namedConfig "inbound-server-address-direct").domain == [ "full:vpn.example.ru" ];
|
||||
assert (ruleByTag namedConfig "inbound-server-address-direct").domain == [ "full:vpn.example.ru" ];
|
||||
true
|
||||
)
|
||||
# Names that resolve private are refused where XRay dials them itself.
|
||||
@@ -579,29 +616,68 @@ let
|
||||
assert (ruleByTag namedConfig "inbound-server-address-direct").port == "443";
|
||||
true
|
||||
)
|
||||
(assert (ruleByTag blockedConfig "inbound-proxy-domain").inboundTag == [ "open" ]; true)
|
||||
(assert (ruleByTag blockedConfig "inbound-server-address-direct").inboundTag == [ "open" ]; true)
|
||||
# No address to exempt when it is detected at runtime instead.
|
||||
(assert !builtins.elem "inbound-server-address-direct" (ruleTags relayConfig); true)
|
||||
(
|
||||
assert
|
||||
(ruleByTag ipNamedConfig "inbound-server-address-direct").ip == [ "82.146.44.102" ];
|
||||
assert (ruleByTag blockedConfig "inbound-proxy-domain").inboundTag == [ "open" ];
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (ruleByTag blockedConfig "inbound-server-address-direct").inboundTag == [ "open" ];
|
||||
true
|
||||
)
|
||||
# No address to exempt when it is detected at runtime instead.
|
||||
(
|
||||
assert !builtins.elem "inbound-server-address-direct" (ruleTags relayConfig);
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (ruleByTag ipNamedConfig "inbound-server-address-direct").ip == [ "82.146.44.102" ];
|
||||
true
|
||||
)
|
||||
(
|
||||
assert !builtins.elem "inbound-block-ru-domain" (ruleTags unguardedConfig);
|
||||
true
|
||||
)
|
||||
(assert !builtins.elem "inbound-block-ru-domain" (ruleTags unguardedConfig); true)
|
||||
|
||||
# A per-listener via becomes its own rule; listeners on the default do not.
|
||||
(assert builtins.elem "inbound-via-local-exit" (ruleTags mixedConfig); true)
|
||||
(assert !builtins.elem "inbound-via-relayed" (ruleTags mixedConfig); true)
|
||||
(assert (ruleByTag mixedConfig "inbound-via-local-exit").inboundTag == [ "local-exit" ]; true)
|
||||
(assert (ruleByTag mixedConfig "inbound-via-local-exit").outboundTag == "direct"; true)
|
||||
(
|
||||
assert builtins.elem "inbound-via-local-exit" (ruleTags mixedConfig);
|
||||
true
|
||||
)
|
||||
(
|
||||
assert !builtins.elem "inbound-via-relayed" (ruleTags mixedConfig);
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (ruleByTag mixedConfig "inbound-via-local-exit").inboundTag == [ "local-exit" ];
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (ruleByTag mixedConfig "inbound-via-local-exit").outboundTag == "direct";
|
||||
true
|
||||
)
|
||||
|
||||
# The pinned listener gets its own rule; the default one rides the final rule.
|
||||
(assert (ruleByTag pinnedConfig "inbound-via-through-de").outboundTag == "de-vps"; true)
|
||||
(assert (ruleByTag pinnedConfig "inbound-final").outboundTag == "nl-vps"; true)
|
||||
(
|
||||
assert (ruleByTag pinnedConfig "inbound-via-through-de").outboundTag == "de-vps";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (ruleByTag pinnedConfig "inbound-final").outboundTag == "nl-vps";
|
||||
true
|
||||
)
|
||||
# Pinned outbounds are injected at start and need no local proxy.
|
||||
(assert !hasOutbound pinnedConfig "proxy"; true)
|
||||
(assert outboundTags pinnedConfig == [ "direct" "block" ]; true)
|
||||
(
|
||||
assert !hasOutbound pinnedConfig "proxy";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
outboundTags pinnedConfig == [
|
||||
"direct"
|
||||
"block"
|
||||
];
|
||||
true
|
||||
)
|
||||
# Only referenced outbounds are rendered, so the sing-box-only one is fine.
|
||||
(
|
||||
assert
|
||||
@@ -614,23 +690,46 @@ let
|
||||
)
|
||||
|
||||
# The final rule always comes last.
|
||||
(assert lib.last (ruleTags relayConfig) == "inbound-final"; true)
|
||||
(assert lib.last (ruleTags mixedConfig) == "inbound-final"; true)
|
||||
|
||||
# Without zapret running there is nothing to route around it.
|
||||
(assert !builtins.elem "inbound-zapret-direct-domain" (ruleTags relayConfig); true)
|
||||
|
||||
# The spec carries secret paths, never their contents.
|
||||
(assert builtins.length relaySpec.listeners == 1; true)
|
||||
(assert (builtins.head relaySpec.listeners).tag == "vless-in"; true)
|
||||
(assert (builtins.head relaySpec.listeners).listen == "::"; true)
|
||||
(
|
||||
assert
|
||||
(builtins.head (builtins.head relaySpec.listeners).users).uuidFile == "/run/secrets/uuid";
|
||||
assert lib.last (ruleTags relayConfig) == "inbound-final";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert lib.last (ruleTags mixedConfig) == "inbound-final";
|
||||
true
|
||||
)
|
||||
|
||||
# Without zapret running there is nothing to route around it.
|
||||
(
|
||||
assert !builtins.elem "inbound-zapret-direct-domain" (ruleTags relayConfig);
|
||||
true
|
||||
)
|
||||
|
||||
# The spec carries secret paths, never their contents.
|
||||
(
|
||||
assert builtins.length relaySpec.listeners == 1;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (builtins.head relaySpec.listeners).tag == "vless-in";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (builtins.head relaySpec.listeners).listen == "::";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (builtins.head (builtins.head relaySpec.listeners).users).uuidFile == "/run/secrets/uuid";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (builtins.head relaySpec.listeners).reality.privateKeyFile == "/run/secrets/reality-key";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert relaySpec.shareLinks;
|
||||
true
|
||||
)
|
||||
(assert (builtins.head relaySpec.listeners).reality.privateKeyFile == "/run/secrets/reality-key"; true)
|
||||
(assert relaySpec.shareLinks; true)
|
||||
|
||||
# Firewall: TCP for every listener, UDP only where the protocol uses it.
|
||||
(
|
||||
@@ -649,15 +748,33 @@ let
|
||||
];
|
||||
true
|
||||
)
|
||||
(assert wsListener.port == 10002 && wsListener.sharePort == 443; true)
|
||||
(assert noFirewallFixture.config.networking.firewall.allowedTCPPorts == [ ]; true)
|
||||
(
|
||||
assert wsListener.port == 10002 && wsListener.sharePort == 443;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert noFirewallFixture.config.networking.firewall.allowedTCPPorts == [ ];
|
||||
true
|
||||
)
|
||||
|
||||
# The unit exists, and only waits on the client stack when it relays.
|
||||
(assert (service relayFixture).wantedBy == [ "multi-user.target" ]; true)
|
||||
(assert builtins.elem "proxy-suite-socks.service" (service relayFixture).after; true)
|
||||
(assert !builtins.elem "proxy-suite-socks.service" (service exitFixture).after; true)
|
||||
(
|
||||
assert (service relayFixture).wantedBy == [ "multi-user.target" ];
|
||||
true
|
||||
)
|
||||
(
|
||||
assert builtins.elem "proxy-suite-socks.service" (service relayFixture).after;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert !builtins.elem "proxy-suite-socks.service" (service exitFixture).after;
|
||||
true
|
||||
)
|
||||
# Not `requires`: direct-routed listeners keep serving if the client is down.
|
||||
(assert (service relayFixture).requires == [ ]; true)
|
||||
(
|
||||
assert (service relayFixture).requires == [ ];
|
||||
true
|
||||
)
|
||||
# A stop collects what XRay counted since the last timer run.
|
||||
(
|
||||
assert
|
||||
@@ -676,20 +793,44 @@ let
|
||||
)
|
||||
|
||||
# AmneziaWG: the spec carries each listener's loopback inbound, in listener order.
|
||||
(assert (awgSpecListener "home").amneziaWg.internalPort == 18700; true)
|
||||
(assert (awgSpecListener "roam").amneziaWg.internalPort == 18701; true)
|
||||
(assert (awgSpecListener "home").amneziaWg.internalListen == "::"; true)
|
||||
(assert (awgSpecListener "roam").amneziaWg.internalListen == "127.0.0.1"; true)
|
||||
(assert (awgSpecListener "home").amneziaWg.fwmark == 2; true)
|
||||
(assert (awgSpecListener "home").amneziaWg.interfaceName == "awgi-home"; true)
|
||||
(
|
||||
assert (awgSpecListener "home").amneziaWg.internalPort == 18700;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (awgSpecListener "roam").amneziaWg.internalPort == 18701;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (awgSpecListener "home").amneziaWg.internalListen == "::";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (awgSpecListener "roam").amneziaWg.internalListen == "127.0.0.1";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (awgSpecListener "home").amneziaWg.fwmark == 2;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert (awgSpecListener "home").amneziaWg.interfaceName == "awgi-home";
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
(awgSpecListener "roam").amneziaWg.stateFile == "/var/lib/proxy-suite/awg-inbounds/roam/state.json";
|
||||
true
|
||||
)
|
||||
(assert !((awgSpecListener "vless-in") ? amneziaWg); true)
|
||||
(
|
||||
assert !((awgSpecListener "vless-in") ? amneziaWg);
|
||||
true
|
||||
)
|
||||
# UDP only, and the interfaces past the host firewall.
|
||||
(assert awgFixture.config.networking.firewall.allowedTCPPorts == [ 443 ]; true)
|
||||
(
|
||||
assert awgFixture.config.networking.firewall.allowedTCPPorts == [ 443 ];
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
lib.sort lib.lessThan awgFixture.config.networking.firewall.allowedUDPPorts == [
|
||||
@@ -704,22 +845,37 @@ let
|
||||
true
|
||||
)
|
||||
(
|
||||
assert
|
||||
lib.hasInfix ''iifname "awgi-home" accept'' awgFixture.config.networking.firewall.extraReversePathFilterRules;
|
||||
assert lib.hasInfix ''iifname "awgi-home" accept''
|
||||
awgFixture.config.networking.firewall.extraReversePathFilterRules;
|
||||
true
|
||||
)
|
||||
# The interfaces come up before XRay renders their links.
|
||||
(assert builtins.elem "proxy-suite-inbounds-awg.service" (service awgFixture).after; true)
|
||||
(assert builtins.elem "proxy-suite-inbounds-awg.service" (service awgFixture).wants; true)
|
||||
(assert !(relayFixture.config.systemd.services ? "proxy-suite-inbounds-awg"); true)
|
||||
(
|
||||
assert builtins.elem "proxy-suite-inbounds-awg.service" (service awgFixture).after;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert builtins.elem "proxy-suite-inbounds-awg.service" (service awgFixture).wants;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert !(relayFixture.config.systemd.services ? "proxy-suite-inbounds-awg");
|
||||
true
|
||||
)
|
||||
(
|
||||
assert lib.hasInfix "rule add pref 8990 fwmark 20 table 103" (awgStartScript awgFixture);
|
||||
assert lib.hasInfix "awg_inbound.py prepare" (awgStartScript awgFixture);
|
||||
true
|
||||
)
|
||||
# IPv6 routing only where a listener has IPv6.
|
||||
(assert lib.hasInfix "-6 rule add pref 8990" (awgStartScript awgFixture); true)
|
||||
(assert !lib.hasInfix "-6 rule add pref 8990" (awgStartScript awgProxyFixture); true)
|
||||
(
|
||||
assert lib.hasInfix "-6 rule add pref 8990" (awgStartScript awgFixture);
|
||||
true
|
||||
)
|
||||
(
|
||||
assert !lib.hasInfix "-6 rule add pref 8990" (awgStartScript awgProxyFixture);
|
||||
true
|
||||
)
|
||||
# Transparent sockets only where there is something to divert.
|
||||
(
|
||||
assert lib.hasInfix "net_admin" (readInboundsStart awgFixture);
|
||||
@@ -727,9 +883,18 @@ let
|
||||
true
|
||||
)
|
||||
# Forwarding only for "lan" listeners.
|
||||
(assert awgFixture.config.boot.kernel.sysctl."net.ipv4.ip_forward" == 1; true)
|
||||
(assert awgFixture.config.boot.kernel.sysctl."net.ipv6.conf.all.forwarding" == 1; true)
|
||||
(assert !(awgProxyFixture.config.services.proxy-suite.internal.sysctl ? "net.ipv4.ip_forward"); true)
|
||||
(
|
||||
assert awgFixture.config.boot.kernel.sysctl."net.ipv4.ip_forward" == 1;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert awgFixture.config.boot.kernel.sysctl."net.ipv6.conf.all.forwarding" == 1;
|
||||
true
|
||||
)
|
||||
(
|
||||
assert !(awgProxyFixture.config.services.proxy-suite.internal.sysctl ? "net.ipv4.ip_forward");
|
||||
true
|
||||
)
|
||||
# "lan" clients reach private networks and each other natively, "proxy" clients nothing but via.
|
||||
(
|
||||
let
|
||||
@@ -749,7 +914,10 @@ let
|
||||
assert !lib.hasInfix "10.67.0.0/24 oifname" rules;
|
||||
true
|
||||
)
|
||||
(assert !lib.hasInfix "masquerade" (awgRules awgProxyFixture); true)
|
||||
(
|
||||
assert !lib.hasInfix "masquerade" (awgRules awgProxyFixture);
|
||||
true
|
||||
)
|
||||
|
||||
]
|
||||
++ failing;
|
||||
|
||||
+90
-85
@@ -456,29 +456,32 @@
|
||||
# proxy_ctl.py's function-level tests: the probe verdict table and exit walk,
|
||||
# autoProxy learn/queue, inbound stats and subscriptions, apps run.
|
||||
proxy-ctl-unit =
|
||||
pkgs.runCommand "proxy-suite-proxy-ctl-unit-check" { nativeBuildInputs = [ pkgs.python3 ]; } ''
|
||||
export SING_BOX=${pkgs.sing-box}/bin/sing-box
|
||||
export PYTHONDONTWRITEBYTECODE=1
|
||||
python ${../../pkgs/proxy-ctl}/test_proxy_ctl.py
|
||||
touch "$out"
|
||||
'';
|
||||
pkgs.runCommand "proxy-suite-proxy-ctl-unit-check" { nativeBuildInputs = [ pkgs.python3 ]; }
|
||||
''
|
||||
export SING_BOX=${pkgs.sing-box}/bin/sing-box
|
||||
export PYTHONDONTWRITEBYTECODE=1
|
||||
python ${../../pkgs/proxy-ctl}/test_proxy_ctl.py
|
||||
touch "$out"
|
||||
'';
|
||||
|
||||
# proxy-suitectl, nix-on-droid's service manager: real processes restarted, timed and stopped.
|
||||
proxy-suite-supervisor-unit =
|
||||
pkgs.runCommand "proxy-suite-supervisor-unit-check" { nativeBuildInputs = [ pkgs.python3 ]; } ''
|
||||
export PYTHONDONTWRITEBYTECODE=1 HOME="$TMPDIR"
|
||||
python ${../../pkgs/proxy-ctl}/test_proxy_supervisor.py
|
||||
touch "$out"
|
||||
'';
|
||||
pkgs.runCommand "proxy-suite-supervisor-unit-check" { nativeBuildInputs = [ pkgs.python3 ]; }
|
||||
''
|
||||
export PYTHONDONTWRITEBYTECODE=1 HOME="$TMPDIR"
|
||||
python ${../../pkgs/proxy-ctl}/test_proxy_supervisor.py
|
||||
touch "$out"
|
||||
'';
|
||||
|
||||
# proxy_export: the running config made portable, and sing-box still accepts it.
|
||||
proxy-export-unit =
|
||||
pkgs.runCommand "proxy-suite-proxy-export-unit-check" { nativeBuildInputs = [ pkgs.python3 ]; } ''
|
||||
export SING_BOX=${pkgs.sing-box}/bin/sing-box
|
||||
export PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=${../../pkgs/proxy-ctl}
|
||||
python ${../../pkgs/proxy-ctl}/test_proxy_export.py
|
||||
touch "$out"
|
||||
'';
|
||||
pkgs.runCommand "proxy-suite-proxy-export-unit-check" { nativeBuildInputs = [ pkgs.python3 ]; }
|
||||
''
|
||||
export SING_BOX=${pkgs.sing-box}/bin/sing-box
|
||||
export PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=${../../pkgs/proxy-ctl}
|
||||
python ${../../pkgs/proxy-ctl}/test_proxy_export.py
|
||||
touch "$out"
|
||||
'';
|
||||
|
||||
# proxy-tui driven headless: keys turn into the right proxy-ctl argv.
|
||||
proxy-tui-unit =
|
||||
@@ -492,11 +495,12 @@
|
||||
|
||||
# proxy_model: the status strip, tab loads and the tray menu tree, without a UI toolkit.
|
||||
proxy-model-unit =
|
||||
pkgs.runCommand "proxy-suite-proxy-model-unit-check" { nativeBuildInputs = [ pkgs.python3 ]; } ''
|
||||
export PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=${../../pkgs/proxy-ctl}
|
||||
python ${../../pkgs/proxy-ctl}/test_proxy_model.py
|
||||
touch "$out"
|
||||
'';
|
||||
pkgs.runCommand "proxy-suite-proxy-model-unit-check" { nativeBuildInputs = [ pkgs.python3 ]; }
|
||||
''
|
||||
export PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=${../../pkgs/proxy-ctl}
|
||||
python ${../../pkgs/proxy-ctl}/test_proxy_model.py
|
||||
touch "$out"
|
||||
'';
|
||||
|
||||
# proxy_gui and proxy_sni import against GTK4/libadwaita, the D-Bus interfaces parse,
|
||||
# and the tray menu serializes to dbusmenu's layout type. No display needed.
|
||||
@@ -520,8 +524,7 @@
|
||||
|
||||
# autoProxy slowness routing: sampler and judge.
|
||||
autoproxy-slowness =
|
||||
pkgs.runCommand "proxy-suite-autoproxy-slowness-check"
|
||||
{ nativeBuildInputs = [ pkgs.jq ]; }
|
||||
pkgs.runCommand "proxy-suite-autoproxy-slowness-check" { nativeBuildInputs = [ pkgs.jq ]; }
|
||||
''
|
||||
sample=${../../modules/proxy-suite/autoproxy-slow-sample.jq}
|
||||
judge=${../../modules/proxy-suite/autoproxy-slow-judge.jq}
|
||||
@@ -582,73 +585,75 @@
|
||||
# autoProxy probe order: one exit per network first, bad exits last; and the
|
||||
# strikes that make an exit bad.
|
||||
autoproxy-rounds =
|
||||
pkgs.runCommand "proxy-suite-autoproxy-rounds-check" { nativeBuildInputs = [ pkgs.jq ]; } ''
|
||||
echo '[{"tag":"direct"},{"tag":"a"},{"tag":"b"},{"tag":"a2"},{"tag":"b2"},{"tag":"c"}]' > index.json
|
||||
echo '{"exits":{"a":{"asn":"AS1","bad":true},"b":{"asn":"AS2"},"a2":{"asn":"AS1"},
|
||||
"b2":{"asn":"AS2"},"c":{"asn":"AS3","bad":false}}}' > state.json
|
||||
r="$(jq -c --slurpfile s state.json -f ${../../modules/proxy-suite/autoproxy-rounds.jq} index.json)"
|
||||
printf '%s\n' "$r"
|
||||
# A refused a takes neither AS1's first place (a2 does) nor any place before b2.
|
||||
jq -e '. == {r1: "b,a2,c", r2: "b2,a", ordered: ["b", "a2", "b2", "c", "a"]}' <<<"$r" > /dev/null
|
||||
pkgs.runCommand "proxy-suite-autoproxy-rounds-check" { nativeBuildInputs = [ pkgs.jq ]; }
|
||||
''
|
||||
echo '[{"tag":"direct"},{"tag":"a"},{"tag":"b"},{"tag":"a2"},{"tag":"b2"},{"tag":"c"}]' > index.json
|
||||
echo '{"exits":{"a":{"asn":"AS1","bad":true},"b":{"asn":"AS2"},"a2":{"asn":"AS1"},
|
||||
"b2":{"asn":"AS2"},"c":{"asn":"AS3","bad":false}}}' > state.json
|
||||
r="$(jq -c --slurpfile s state.json -f ${../../modules/proxy-suite/autoproxy-rounds.jq} index.json)"
|
||||
printf '%s\n' "$r"
|
||||
# A refused a takes neither AS1's first place (a2 does) nor any place before b2.
|
||||
jq -e '. == {r1: "b,a2,c", r2: "b2,a", ordered: ["b", "a2", "b2", "c", "a"]}' <<<"$r" > /dev/null
|
||||
|
||||
k() {
|
||||
jq -c --argjson tags "$1" --arg d "$2" --arg why "$3" --argjson now "$4" --argjson ttl 100 \
|
||||
-f ${../../modules/proxy-suite/autoproxy-strike.jq} <<<"$5"
|
||||
}
|
||||
s='{"exits":{"a":{"asn":"AS1"},"b":{}}}'
|
||||
# One destination is not enough, however often it strikes.
|
||||
s="$(k '["a"]' sekai.test refused 1000 "$s")"
|
||||
s="$(k '["a","b"]' sekai.test refused 1010 "$s")"
|
||||
jq -e '.exits.a.bad == false and .exits.a.asn == "AS1" and .exits.b.bad == false' <<<"$s" > /dev/null
|
||||
# A second one is.
|
||||
s="$(k '["a"]' pximg.net slow 1020 "$s")"
|
||||
jq -e '.exits.a | .bad and .badBy == ["sekai.test refused", "pximg.net slow"]' <<<"$s" > /dev/null
|
||||
jq -e '.exits.b.bad == false' <<<"$s" > /dev/null
|
||||
# A TTL later the older strike has expired.
|
||||
s="$(k '[]' "" "" 1115 "$s")"
|
||||
jq -e '.exits.a | (.bad | not) and .badBy == ["pximg.net slow"]' <<<"$s" > /dev/null
|
||||
# A block page may be a passing challenge: one is not enough either.
|
||||
s="$(k '["b"]' colorfulpalette.org wall:aws-waf 1120 "$s")"
|
||||
jq -e '.exits.b | (.bad | not) and .badBy == ["colorfulpalette.org wall:aws-waf"]' <<<"$s" > /dev/null
|
||||
s="$(k '["b"]' fandom.com wall:cloudflare 1130 "$s")"
|
||||
jq -e '.exits.b | .bad and .badBy == ["colorfulpalette.org wall:aws-waf", "fandom.com wall:cloudflare"]' <<<"$s" > /dev/null
|
||||
touch "$out"
|
||||
'';
|
||||
k() {
|
||||
jq -c --argjson tags "$1" --arg d "$2" --arg why "$3" --argjson now "$4" --argjson ttl 100 \
|
||||
-f ${../../modules/proxy-suite/autoproxy-strike.jq} <<<"$5"
|
||||
}
|
||||
s='{"exits":{"a":{"asn":"AS1"},"b":{}}}'
|
||||
# One destination is not enough, however often it strikes.
|
||||
s="$(k '["a"]' sekai.test refused 1000 "$s")"
|
||||
s="$(k '["a","b"]' sekai.test refused 1010 "$s")"
|
||||
jq -e '.exits.a.bad == false and .exits.a.asn == "AS1" and .exits.b.bad == false' <<<"$s" > /dev/null
|
||||
# A second one is.
|
||||
s="$(k '["a"]' pximg.net slow 1020 "$s")"
|
||||
jq -e '.exits.a | .bad and .badBy == ["sekai.test refused", "pximg.net slow"]' <<<"$s" > /dev/null
|
||||
jq -e '.exits.b.bad == false' <<<"$s" > /dev/null
|
||||
# A TTL later the older strike has expired.
|
||||
s="$(k '[]' "" "" 1115 "$s")"
|
||||
jq -e '.exits.a | (.bad | not) and .badBy == ["pximg.net slow"]' <<<"$s" > /dev/null
|
||||
# A block page may be a passing challenge: one is not enough either.
|
||||
s="$(k '["b"]' colorfulpalette.org wall:aws-waf 1120 "$s")"
|
||||
jq -e '.exits.b | (.bad | not) and .badBy == ["colorfulpalette.org wall:aws-waf"]' <<<"$s" > /dev/null
|
||||
s="$(k '["b"]' fandom.com wall:cloudflare 1130 "$s")"
|
||||
jq -e '.exits.b | .bad and .badBy == ["colorfulpalette.org wall:aws-waf", "fandom.com wall:cloudflare"]' <<<"$s" > /dev/null
|
||||
touch "$out"
|
||||
'';
|
||||
|
||||
# `proxy-ctl proxy auto forget|clear`, as the runner applies them.
|
||||
autoproxy-edit =
|
||||
pkgs.runCommand "proxy-suite-autoproxy-edit-check" { nativeBuildInputs = [ pkgs.jq ]; } ''
|
||||
edit() { jq -c --arg op "$1" --arg d "$2" -f ${../../modules/proxy-suite/autoproxy-edit.jq} <<<"$3"; }
|
||||
s='{
|
||||
"domains": {"last.fm": {"exit": "a", "host": "www.last.fm"}, "pximg.net": {"exit": "b", "host": "i.pximg.net"}},
|
||||
"hosts": {"www.last.fm": {"domain": "last.fm"}, "cdn.last.fm": {"domain": "last.fm"}, "i.pximg.net": {"domain": "pximg.net"}},
|
||||
"backlog": {"api.last.fm": {"domain": "last.fm", "hits": 3}, "x.test": {"domain": "x.test", "hits": 1}},
|
||||
"slowWant": {"last.fm": 1}, "slowSkip": {"pximg.net": 1},
|
||||
"exits": {
|
||||
"a": {"asn": "AS1", "strikes": {"last.fm": {"why": "refused", "at": 1}, "sekai.test": {"why": "slow", "at": 2}}, "bad": true,
|
||||
"badBy": ["last.fm refused", "sekai.test slow"]},
|
||||
"b": {"asn": "AS2"}
|
||||
},
|
||||
"egress": "203.0.113.1", "lastRun": 5
|
||||
}'
|
||||
pkgs.runCommand "proxy-suite-autoproxy-edit-check" { nativeBuildInputs = [ pkgs.jq ]; }
|
||||
''
|
||||
edit() { jq -c --arg op "$1" --arg d "$2" -f ${../../modules/proxy-suite/autoproxy-edit.jq} <<<"$3"; }
|
||||
s='{
|
||||
"domains": {"last.fm": {"exit": "a", "host": "www.last.fm"}, "pximg.net": {"exit": "b", "host": "i.pximg.net"}},
|
||||
"hosts": {"www.last.fm": {"domain": "last.fm"}, "cdn.last.fm": {"domain": "last.fm"}, "i.pximg.net": {"domain": "pximg.net"}},
|
||||
"backlog": {"api.last.fm": {"domain": "last.fm", "hits": 3}, "x.test": {"domain": "x.test", "hits": 1}},
|
||||
"slowWant": {"last.fm": 1}, "slowSkip": {"pximg.net": 1},
|
||||
"exits": {
|
||||
"a": {"asn": "AS1", "strikes": {"last.fm": {"why": "refused", "at": 1}, "sekai.test": {"why": "slow", "at": 2}}, "bad": true,
|
||||
"badBy": ["last.fm refused", "sekai.test slow"]},
|
||||
"b": {"asn": "AS2"}
|
||||
},
|
||||
"egress": "203.0.113.1", "lastRun": 5
|
||||
}'
|
||||
|
||||
# Forget: every trace of the one domain, and a strike it made no longer counts.
|
||||
f="$(edit forget last.fm "$s")"
|
||||
jq -e '(.domains | keys) == ["pximg.net"]' <<<"$f" > /dev/null
|
||||
jq -e '(.hosts | keys) == ["i.pximg.net"] and (.backlog | keys) == ["x.test"]' <<<"$f" > /dev/null
|
||||
jq -e '.slowWant == {} and .slowSkip == {"pximg.net": 1}' <<<"$f" > /dev/null
|
||||
jq -e '.exits.a | .asn == "AS1" and (.bad | not) and .badBy == ["sekai.test slow"]' <<<"$f" > /dev/null
|
||||
jq -e '.exits.b == {"asn": "AS2"}' <<<"$f" > /dev/null
|
||||
# A domain it never knew changes nothing.
|
||||
jq -e --argjson s "$s" '. == $s' <<<"$(edit forget nope.test "$s")" > /dev/null
|
||||
# Forget: every trace of the one domain, and a strike it made no longer counts.
|
||||
f="$(edit forget last.fm "$s")"
|
||||
jq -e '(.domains | keys) == ["pximg.net"]' <<<"$f" > /dev/null
|
||||
jq -e '(.hosts | keys) == ["i.pximg.net"] and (.backlog | keys) == ["x.test"]' <<<"$f" > /dev/null
|
||||
jq -e '.slowWant == {} and .slowSkip == {"pximg.net": 1}' <<<"$f" > /dev/null
|
||||
jq -e '.exits.a | .asn == "AS1" and (.bad | not) and .badBy == ["sekai.test slow"]' <<<"$f" > /dev/null
|
||||
jq -e '.exits.b == {"asn": "AS2"}' <<<"$f" > /dev/null
|
||||
# A domain it never knew changes nothing.
|
||||
jq -e --argjson s "$s" '. == $s' <<<"$(edit forget nope.test "$s")" > /dev/null
|
||||
|
||||
# Clear: every route and verdict; the exits, backlog and egress stay.
|
||||
c="$(edit clear "" "$s")"
|
||||
jq -e '.domains == {} and .hosts == {} and (has("slowWant") | not) and (has("slowSkip") | not)' <<<"$c" > /dev/null
|
||||
jq -e '.exits.a | .asn == "AS1" and .strikes == {} and (.bad | not) and .badBy == []' <<<"$c" > /dev/null
|
||||
jq -e '(.backlog | keys) == ["api.last.fm", "x.test"] and .egress == "203.0.113.1" and .lastRun == 5' <<<"$c" > /dev/null
|
||||
touch "$out"
|
||||
'';
|
||||
# Clear: every route and verdict; the exits, backlog and egress stay.
|
||||
c="$(edit clear "" "$s")"
|
||||
jq -e '.domains == {} and .hosts == {} and (has("slowWant") | not) and (has("slowSkip") | not)' <<<"$c" > /dev/null
|
||||
jq -e '.exits.a | .asn == "AS1" and .strikes == {} and (.bad | not) and .badBy == []' <<<"$c" > /dev/null
|
||||
jq -e '(.backlog | keys) == ["api.last.fm", "x.test"] and .egress == "203.0.113.1" and .lastRun == 5' <<<"$c" > /dev/null
|
||||
touch "$out"
|
||||
'';
|
||||
|
||||
# A probe that exits 0 printing nothing: jq reads "" as no input at all, so the
|
||||
# "error" guard downstream saw "" instead of "error" and let it through to
|
||||
|
||||
@@ -177,11 +177,13 @@ in
|
||||
true
|
||||
)
|
||||
(
|
||||
assert !(ipServer.config.systemd.services ? proxy-suite-tor) && (ipSpec.onionListeners or [ ]) == [ ];
|
||||
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;
|
||||
assert builtins.elem "proxy-suite-tor.service"
|
||||
onionServer.config.systemd.services.proxy-suite-inbounds.after;
|
||||
true
|
||||
)
|
||||
(
|
||||
|
||||
@@ -19,9 +19,7 @@ let
|
||||
# JSON. The context is dropped so the check may mention it.
|
||||
expectedOutboundFile =
|
||||
value:
|
||||
builtins.unsafeDiscardStringContext "${
|
||||
pkgs.writeText "proxy-suite-core" (builtins.toJSON value)
|
||||
}";
|
||||
builtins.unsafeDiscardStringContext "${pkgs.writeText "proxy-suite-core" (builtins.toJSON value)}";
|
||||
|
||||
# SingBox dials SSH natively: no unit, no local SOCKS listener.
|
||||
sshNativeSingBox = evalProxySuite [
|
||||
@@ -367,7 +365,9 @@ let
|
||||
(
|
||||
assert pkgs.lib.hasInfix expectedNativeSingBoxOutbound sshNativeSingBoxStart;
|
||||
# The daemon cannot read the key where it lives: it gets a group-readable copy.
|
||||
assert pkgs.lib.hasInfix "install -m 0640 -g proxy-suite-daemon /run/secrets/ssh-key \"$SSH_IDENTITY\"" sshNativeSingBoxStart;
|
||||
assert pkgs.lib.hasInfix
|
||||
"install -m 0640 -g proxy-suite-daemon /run/secrets/ssh-key \"$SSH_IDENTITY\""
|
||||
sshNativeSingBoxStart;
|
||||
assert pkgs.lib.hasInfix "'.private_key_path = $key'" sshNativeSingBoxStart;
|
||||
true
|
||||
)
|
||||
@@ -392,7 +392,10 @@ let
|
||||
)
|
||||
# The keys must not be baked into the store-resident outbound JSON.
|
||||
(
|
||||
assert !(pkgs.lib.hasInfix "host_key" (builtins.toJSON sshHostKeyFile.config.services.proxy-suite.sshProxy.hostKey));
|
||||
assert
|
||||
!(pkgs.lib.hasInfix "host_key" (
|
||||
builtins.toJSON sshHostKeyFile.config.services.proxy-suite.sshProxy.hostKey
|
||||
));
|
||||
true
|
||||
)
|
||||
|
||||
@@ -443,7 +446,8 @@ let
|
||||
true
|
||||
)
|
||||
(
|
||||
assert pkgs.lib.hasInfix ''UserKnownHostsFile="$CREDENTIALS_DIRECTORY/known_hosts"'' standaloneStartScript;
|
||||
assert pkgs.lib.hasInfix ''UserKnownHostsFile="$CREDENTIALS_DIRECTORY/known_hosts"''
|
||||
standaloneStartScript;
|
||||
true
|
||||
)
|
||||
# Secrets reach the unprivileged user as credentials.
|
||||
|
||||
@@ -77,19 +77,16 @@ in
|
||||
# absent a pin - at start, keeping every tag for rules that name one.
|
||||
(
|
||||
assert pkgs.lib.hasInfix ''PROXY_TAG="$PINNED_OUTBOUND"'' subscriptionFirstSelectionStartScript;
|
||||
assert
|
||||
pkgs.lib.hasInfix ''[{type:"selector",tag:"proxy",outbounds:[$t],default:$t}] + .''
|
||||
subscriptionFirstSelectionStartScript;
|
||||
assert pkgs.lib.hasInfix ''[{type:"selector",tag:"proxy",outbounds:[$t],default:$t}] + .''
|
||||
subscriptionFirstSelectionStartScript;
|
||||
true
|
||||
)
|
||||
|
||||
# The pin is read from state, and one that names nothing is dropped.
|
||||
(
|
||||
assert
|
||||
pkgs.lib.hasInfix "/var/lib/proxy-suite/pinned-outbound" subscriptionOnlyStartScript;
|
||||
assert
|
||||
pkgs.lib.hasInfix "pinned outbound '$PINNED_OUTBOUND' is not available"
|
||||
subscriptionOnlyStartScript;
|
||||
assert pkgs.lib.hasInfix "/var/lib/proxy-suite/pinned-outbound" subscriptionOnlyStartScript;
|
||||
assert pkgs.lib.hasInfix "pinned outbound '$PINNED_OUTBOUND' is not available"
|
||||
subscriptionOnlyStartScript;
|
||||
true
|
||||
)
|
||||
|
||||
@@ -134,10 +131,8 @@ in
|
||||
# Declared and runtime subscriptions both go through the same two entry
|
||||
# points, with the tag passed raw.
|
||||
(
|
||||
assert pkgs.lib.hasInfix "_proxy_suite_load_subscription community "
|
||||
subscriptionOnlyStartScript;
|
||||
assert pkgs.lib.hasInfix "_proxy_suite_fetch_subscription community "
|
||||
subscriptionOnlyUpdateScript;
|
||||
assert pkgs.lib.hasInfix "_proxy_suite_load_subscription community " subscriptionOnlyStartScript;
|
||||
assert pkgs.lib.hasInfix "_proxy_suite_fetch_subscription community " subscriptionOnlyUpdateScript;
|
||||
assert pkgs.lib.hasInfix ''_proxy_suite_load_subscription "$RUNTIME_SUB_TAG"''
|
||||
subscriptionOnlyStartScript;
|
||||
assert pkgs.lib.hasInfix ''_proxy_suite_fetch_subscription "$RUNTIME_SUB_TAG"''
|
||||
@@ -147,8 +142,10 @@ in
|
||||
|
||||
# The fetcher's output must land in the cache, not after a stray newline.
|
||||
(
|
||||
assert pkgs.lib.hasInfix ''--tag-prefix "$tag" --links-out "$links.tmp" > "$cache.tmp"'' subscriptionOnlyStartScript;
|
||||
assert pkgs.lib.hasInfix ''--tag-prefix "$tag" --links-out "$links.tmp" > "$cache.tmp"'' subscriptionOnlyUpdateScript;
|
||||
assert pkgs.lib.hasInfix ''--tag-prefix "$tag" --links-out "$links.tmp" > "$cache.tmp"''
|
||||
subscriptionOnlyStartScript;
|
||||
assert pkgs.lib.hasInfix ''--tag-prefix "$tag" --links-out "$links.tmp" > "$cache.tmp"''
|
||||
subscriptionOnlyUpdateScript;
|
||||
true
|
||||
)
|
||||
|
||||
@@ -190,14 +187,12 @@ in
|
||||
|
||||
# Runtime spool dirs are root-only unless userControl grants outbounds (see user-control.nix).
|
||||
(
|
||||
assert
|
||||
builtins.any (
|
||||
rule: builtins.match "d /var/lib/proxy-suite/outbounds\\.d 0700 root root -" rule != null
|
||||
) minimal.config.systemd.tmpfiles.rules;
|
||||
assert
|
||||
builtins.any (
|
||||
rule: builtins.match "d /var/lib/proxy-suite/subscriptions\\.d 0700 root root -" rule != null
|
||||
) minimal.config.systemd.tmpfiles.rules;
|
||||
assert builtins.any (
|
||||
rule: builtins.match "d /var/lib/proxy-suite/outbounds\\.d 0700 root root -" rule != null
|
||||
) minimal.config.systemd.tmpfiles.rules;
|
||||
assert builtins.any (
|
||||
rule: builtins.match "d /var/lib/proxy-suite/subscriptions\\.d 0700 root root -" rule != null
|
||||
) minimal.config.systemd.tmpfiles.rules;
|
||||
true
|
||||
)
|
||||
|
||||
|
||||
@@ -5,19 +5,17 @@
|
||||
}:
|
||||
|
||||
let
|
||||
proxyWithSubscriptions =
|
||||
subscriptions:
|
||||
{
|
||||
system.stateVersion = "26.05";
|
||||
services.proxy-suite = {
|
||||
proxyWithSubscriptions = subscriptions: {
|
||||
system.stateVersion = "26.05";
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
backend = "sing-box";
|
||||
inherit subscriptions;
|
||||
};
|
||||
backend = "sing-box";
|
||||
inherit subscriptions;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
subscriptionUrlFileFixture = evalProxySuite [
|
||||
(proxyWithSubscriptions [
|
||||
|
||||
@@ -86,7 +86,8 @@ in
|
||||
assert tgWithGlobalTunServiceConfig.User == "proxy-suite-daemon";
|
||||
assert tgWithGlobalTunServiceConfig.ExecStartPre == "+${tgWithGlobalTunModule.bypassUpScript}";
|
||||
assert tgWithGlobalTunServiceConfig.ExecStopPost == "+${tgWithGlobalTunModule.bypassDownScript}";
|
||||
assert pkgs.lib.hasInfix "\"system.slice/proxy-suite-tg-ws-proxy.service\" meta mark set 4" tgWithGlobalTunBypassUp;
|
||||
assert pkgs.lib.hasInfix "\"system.slice/proxy-suite-tg-ws-proxy.service\" meta mark set 4"
|
||||
tgWithGlobalTunBypassUp;
|
||||
assert pkgs.lib.hasInfix "delete table inet proxy_suite_tg_ws_proxy" tgWithGlobalTunBypassDown;
|
||||
assert pkgs.lib.hasInfix "rule add pref 8999 fwmark 4 lookup main" tgWithGlobalTunBypassUp;
|
||||
assert pkgs.lib.hasInfix "rule del pref 8999 fwmark 4 lookup main" tgWithGlobalTunBypassDown;
|
||||
|
||||
@@ -75,7 +75,10 @@ let
|
||||
inherit (pkgs) lib;
|
||||
inherit pkgs cfg;
|
||||
packages = import ../../../pkgs/default.nix { inherit pkgs; };
|
||||
derived = import ../../../modules/proxy-suite/derived.nix { inherit (pkgs) lib; inherit cfg; };
|
||||
derived = import ../../../modules/proxy-suite/derived.nix {
|
||||
inherit (pkgs) lib;
|
||||
inherit cfg;
|
||||
};
|
||||
};
|
||||
tgWithGlobalTunBypassUp = generated.readDerivation tgWithGlobalTunModule.bypassUpScript;
|
||||
tgWithGlobalTunBypassDown = generated.readDerivation tgWithGlobalTunModule.bypassDownScript;
|
||||
|
||||
+153
-119
@@ -54,9 +54,12 @@ let
|
||||
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;
|
||||
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;
|
||||
@@ -64,10 +67,12 @@ let
|
||||
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;
|
||||
});
|
||||
singBoxTProxy = mkTProxyConfig (
|
||||
mkFixture "sing-box" {
|
||||
proxy.tun.enable = false;
|
||||
proxy.tproxy.enable = true;
|
||||
}
|
||||
);
|
||||
|
||||
xray = mkFixture "xray" { proxy.tproxy.enable = true; };
|
||||
xrayStart = socksStartOf xray;
|
||||
@@ -85,7 +90,9 @@ let
|
||||
|
||||
bridges = mkFixture "sing-box" {
|
||||
tor = {
|
||||
bridges.lines = [ "obfs4 192.0.2.1:443 0123456789ABCDEF0123456789ABCDEF01234567 cert=x iat-mode=0" ];
|
||||
bridges.lines = [
|
||||
"obfs4 192.0.2.1:443 0123456789ABCDEF0123456789ABCDEF01234567 cert=x iat-mode=0"
|
||||
];
|
||||
bridges.file = "/run/secrets/tor-bridges";
|
||||
};
|
||||
};
|
||||
@@ -143,7 +150,9 @@ let
|
||||
exitNode = mkFixture "sing-box" exitInbounds;
|
||||
exitNodeConfig = mkInboundsConfig exitNode;
|
||||
exitNodeRules = exitNodeConfig.routing.rules;
|
||||
exitNodeNoOnion = mkInboundsConfig (mkFixture "sing-box" (exitInbounds // { tor.routeOnion = false; }));
|
||||
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.
|
||||
@@ -166,25 +175,23 @@ let
|
||||
]
|
||||
)
|
||||
);
|
||||
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
|
||||
'';
|
||||
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;
|
||||
@@ -192,93 +199,111 @@ let
|
||||
|
||||
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 = {
|
||||
# Enabled but used for nothing.
|
||||
{ tor.enable = true; }
|
||||
# An outbound without a backend.
|
||||
{
|
||||
tor = {
|
||||
enable = true;
|
||||
listeners = [ "missing" ];
|
||||
asOutbound = true;
|
||||
};
|
||||
};
|
||||
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;
|
||||
}
|
||||
# "tor" is taken.
|
||||
{
|
||||
tor = {
|
||||
enable = true;
|
||||
asOutbound = true;
|
||||
};
|
||||
listeners.b = listener // {
|
||||
port = 10444;
|
||||
sharePort = 443;
|
||||
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;
|
||||
outbounds = [
|
||||
{
|
||||
tag = "vps";
|
||||
url = "http://vps.example.com:8080";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
# Upstream through the proxy with Tor its only outbound: Tor through itself.
|
||||
{
|
||||
tor = {
|
||||
enable = true;
|
||||
asOutbound = true;
|
||||
upstream = "proxy";
|
||||
};
|
||||
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;
|
||||
@@ -297,7 +322,8 @@ in
|
||||
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);
|
||||
assert
|
||||
!(lib.any (r: r.ruleTag or "" == "inbound-tor-onion") (mkInboundsConfig onion).routing.rules);
|
||||
true
|
||||
)
|
||||
(
|
||||
@@ -315,12 +341,13 @@ in
|
||||
|
||||
# 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;
|
||||
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;
|
||||
assert hasInfix ''{"protocol":"socks","settings":{"address":"127.0.0.1","port":18530},"tag":"tor"}''
|
||||
xrayStart;
|
||||
true
|
||||
)
|
||||
(
|
||||
@@ -443,9 +470,12 @@ in
|
||||
# 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)
|
||||
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";
|
||||
&&
|
||||
(mkProxyCtlDerived singBox).wrapperEnv.TOR_CONTROL_SOCKET == "/run/proxy-suite-tor/control/socket";
|
||||
true
|
||||
)
|
||||
(
|
||||
@@ -455,7 +485,8 @@ in
|
||||
&& 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;
|
||||
&& 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.
|
||||
@@ -475,7 +506,10 @@ in
|
||||
&& 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;
|
||||
&& !(hasInfix "hs_ed25519_secret_key" onionStart)
|
||||
&& hasInfix "proxy-suite-tor-onion-key" (
|
||||
toString (services onion).proxy-suite-tor.serviceConfig.ExecStartPre
|
||||
);
|
||||
true
|
||||
)
|
||||
(
|
||||
|
||||
+2
-1
@@ -157,7 +157,8 @@ in
|
||||
true
|
||||
)
|
||||
(
|
||||
assert hasInfix singBoxHop hybridStart && hasInfix "_proxy_suite_add_sing_box_ob \"$OB_JSON\"" hybridStart;
|
||||
assert
|
||||
hasInfix singBoxHop hybridStart && hasInfix "_proxy_suite_add_sing_box_ob \"$OB_JSON\"" hybridStart;
|
||||
true
|
||||
)
|
||||
# Only the tunnel reads the profile, at start; the private key never reaches the store.
|
||||
|
||||
@@ -41,7 +41,13 @@
|
||||
) xrayTproxyConfig.inbounds;
|
||||
# Apps' DNS through TProxy is answered by XRay, as sing-box's hijack-dns.
|
||||
assert builtins.any (
|
||||
rule: (rule.ruleTag or "") == "dns-hijack" && rule.inboundTag == [ "tproxy-in" "tproxy-in6" ]
|
||||
rule:
|
||||
(rule.ruleTag or "") == "dns-hijack"
|
||||
&&
|
||||
rule.inboundTag == [
|
||||
"tproxy-in"
|
||||
"tproxy-in6"
|
||||
]
|
||||
) xrayTproxyConfig.routing.rules;
|
||||
assert builtins.any (outbound: outbound.tag == "dns-out") xrayTproxyConfig.outbounds;
|
||||
assert specificRule.outboundTag == "proxy-suite-ob-primary";
|
||||
|
||||
@@ -30,7 +30,11 @@
|
||||
rule: (rule ? ruleTag) && rule.ruleTag == "dns-hijack"
|
||||
) xrayTunConfig.routing.rules;
|
||||
tunDnsUpstreamRules = builtins.filter (
|
||||
rule: builtins.elem (rule.ruleTag or "") [ "dns-upstream-direct" "dns-upstream-remote" ]
|
||||
rule:
|
||||
builtins.elem (rule.ruleTag or "") [
|
||||
"dns-upstream-direct"
|
||||
"dns-upstream-remote"
|
||||
]
|
||||
) xrayTunConfig.routing.rules;
|
||||
in
|
||||
assert tunInbound.protocol == "tun";
|
||||
@@ -47,7 +51,11 @@
|
||||
assert tunHasDirectGeositeRule;
|
||||
assert tunHasDnsHijackRule;
|
||||
# Servers route by their own tags: local direct, remote through the proxy.
|
||||
assert map (rule: rule.inboundTag) tunDnsUpstreamRules == [ [ "local" ] [ "remote" ] ];
|
||||
assert
|
||||
map (rule: rule.inboundTag) tunDnsUpstreamRules == [
|
||||
[ "local" ]
|
||||
[ "remote" ]
|
||||
];
|
||||
assert xrayTunConfig.dns.queryStrategy == "UseIP";
|
||||
assert (builtins.head xrayTunConfig.dns.servers).address == "fakedns";
|
||||
assert (builtins.head xrayTunConfig.dns.servers).tag == "fakedns";
|
||||
@@ -110,18 +118,20 @@
|
||||
# No uplink src: it would go stale when the uplink address changes.
|
||||
assert !(pkgs.lib.hasInfix "uplink_addr" xrayTunUpScript);
|
||||
# Every rule the up script adds is flushed first, v4 and v6.
|
||||
assert builtins.all (
|
||||
priority:
|
||||
pkgs.lib.hasInfix "-4 rule del pref ${toString priority}" xrayTunUpScript
|
||||
&& pkgs.lib.hasInfix "-6 rule del pref ${toString priority}" xrayTunUpScript
|
||||
) [
|
||||
checkConstants.xrayTunMarkBypassRulePriority
|
||||
checkConstants.xrayTunServiceUserRulePriority
|
||||
checkConstants.xrayTunPerAppTunRulePriority
|
||||
checkConstants.xrayTunDnsRulePriority
|
||||
checkConstants.xrayTunMainRulePriority
|
||||
checkConstants.tunAutoRouteRulePriority
|
||||
];
|
||||
assert builtins.all
|
||||
(
|
||||
priority:
|
||||
pkgs.lib.hasInfix "-4 rule del pref ${toString priority}" xrayTunUpScript
|
||||
&& pkgs.lib.hasInfix "-6 rule del pref ${toString priority}" xrayTunUpScript
|
||||
)
|
||||
[
|
||||
checkConstants.xrayTunMarkBypassRulePriority
|
||||
checkConstants.xrayTunServiceUserRulePriority
|
||||
checkConstants.xrayTunPerAppTunRulePriority
|
||||
checkConstants.xrayTunDnsRulePriority
|
||||
checkConstants.xrayTunMainRulePriority
|
||||
checkConstants.tunAutoRouteRulePriority
|
||||
];
|
||||
true
|
||||
)
|
||||
];
|
||||
|
||||
@@ -43,7 +43,8 @@ let
|
||||
tunedRuntime = runtimeDir zapret2Tuned globalService;
|
||||
noAutoRuntime = runtimeDir zapret2NoAuto globalService;
|
||||
z2kRuntime = runtimeDir zapret2Z2k globalService;
|
||||
cutoffProbe = zapret2Global.config.systemd.services.proxy-suite-zapret2-cutoff.serviceConfig.ExecStart;
|
||||
cutoffProbe =
|
||||
zapret2Global.config.systemd.services.proxy-suite-zapret2-cutoff.serviceConfig.ExecStart;
|
||||
socksStart = fixture: fixture.config.systemd.services.proxy-suite-socks.serviceConfig.ExecStart;
|
||||
|
||||
proxyCtlEnv = fixture: (mkProxyCtlDerived fixture).wrapperEnv;
|
||||
@@ -67,7 +68,8 @@ in
|
||||
== "proxy-suite";
|
||||
assert envValue zapret2PerApp perAppService "HOSTLIST_BASE=" == "/var/lib/proxy-suite/zapret2";
|
||||
assert
|
||||
envValue zapret2PerApp perAppService "Z2K_STATE_DIR_OVERRIDE=" == "/var/lib/proxy-suite/zapret2/circular";
|
||||
envValue zapret2PerApp perAppService "Z2K_STATE_DIR_OVERRIDE="
|
||||
== "/var/lib/proxy-suite/zapret2/circular";
|
||||
true
|
||||
)
|
||||
|
||||
@@ -85,7 +87,8 @@ in
|
||||
assert !(zapretDiscordYoutubeGlobal.config.systemd.services ? proxy-suite-zapret2-cutoff);
|
||||
assert (proxyCtlEnv zapret2Global).ZAPRET_CUTOFF_ENABLED == "1";
|
||||
assert
|
||||
envValue zapret2Global globalService "Z2K_TCP16_ASN=" == "/var/lib/proxy-suite/zapret2/cutoff/asn.txt";
|
||||
envValue zapret2Global globalService "Z2K_TCP16_ASN="
|
||||
== "/var/lib/proxy-suite/zapret2/cutoff/asn.txt";
|
||||
true
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user