fix: awg & warp fixes

This commit is contained in:
fufsob committed 2026-09-28 02:52:13 +00:00
1 parent 08b00cf449
commit d25fcb5468
17 files changed
+277 -7

No files matched your search

+40
View File
@@ -29,6 +29,10 @@ let
amneziaWg = {
enable = true;
kernelModulePackage = null;
serverUdpPorts = [
3478
"49152-65535"
];
profiles = {
de = {
asOutbound = "interface";
@@ -58,6 +62,10 @@ let
deStart = generated.readDerivation de.serviceConfig.ExecStart;
plainTunnel = generated.readDerivation services.proxy-suite-awg-plain.serviceConfig.ExecStart;
dnsServer = dnsServerByTag (mkTProxyConfig singBox) "awg-dns-de";
home = services.proxy-suite-awg-home;
homeStart = generated.readDerivation home.serviceConfig.ExecStart;
homeStop = generated.readDerivation home.serviceConfig.ExecStop;
deStop = generated.readDerivation de.serviceConfig.ExecStop;
warpInterface = mkProxySuite {
enable = true;
@@ -112,6 +120,38 @@ in
assert (mkProxyCtlDerived singBox).awgProfiles == [ "home" ];
true
)
# IPv6 needs a route for sockets bound to the interface: a table of its own, looked up
# only by them, and gone with the unit.
(
assert hasInfix "route replace default dev awg-de table 110" deStart;
assert hasInfix "rule add pref 8991 oif awg-de table 110" deStart;
assert hasInfix "rule del pref 8991 oif awg-de" deStop;
assert !(hasInfix "fib daddr type local" deStart);
true
)
# A global profile answers connections to this host the way they came, not through itself.
(
assert hasInfix
''ct state new iifname != { "lo", "awg-home" } fib daddr type local ct mark set $fwmark''
homeStart;
assert hasInfix "type route hook output priority mangle - 5" homeStart;
assert hasInfix "nft delete table inet proxy-suite-awg-awg-home" homeStop;
assert !(hasInfix "oif awg-home" homeStart);
# UDP services answer from the right address even on a socket bound to every address.
assert hasInfix "for port in 3478 49152-65535" homeStart;
assert hasInfix ''rule add pref 8989 ipproto udp sport "$port" lookup main'' homeStart;
assert hasInfix "rule del pref 8989" homeStop;
# src_valid_mark goes back to what it was before awg-quick turned it on.
assert hasInfix
"cat /proc/sys/net/ipv4/conf/all/src_valid_mark > /run/proxy-suite-awg-home/src_valid_mark"
homeStart;
assert hasInfix
"cat /run/proxy-suite-awg-home/src_valid_mark > /proc/sys/net/ipv4/conf/all/src_valid_mark"
homeStop;
assert !(hasInfix "src_valid_mark" deStart);
assert !(hasInfix "pref 8989" deStart);
true
)
# "singBox": a tunnel unit behind a loopback SOCKS hop, fed the prepared profile.
(
assert hasInfix ''"server":"127.0.0.1","server_port":18602,"tag":"plain","type":"socks"''
+5 -1
View File
@@ -901,7 +901,11 @@ let
(ok (builtins.elem "proxy-suite-inbounds-awg.service" (service awgFixture).wants))
(ok (!(relayFixture.config.systemd.services ? "proxy-suite-inbounds-awg")))
(
assert lib.hasInfix "rule add pref 8990 fwmark 20 table 103" (awgStartScript awgFixture);
# Scoped to the listener's interface, so src_valid_mark cannot make clients martians.
assert lib.hasInfix "rule add pref 8990 iif awgi-home fwmark 20 table 103" (
awgStartScript awgFixture
);
assert !(lib.hasInfix "rule add pref 8990 fwmark 20" (awgStartScript awgFixture));
assert lib.hasInfix "awg_inbound.py prepare" (awgStartScript awgFixture);
true
)
+31
View File
@@ -83,6 +83,17 @@ let
};
};
amneziaWgAutostart = mkProxySuite {
enable = true;
amneziaWg.enable = true;
warp = {
enable = true;
configFile = profile;
asAmneziaWg = true;
autostart = true;
};
};
amneziaWgEndpoint = mkProxySuite {
enable = true;
amneziaWg.enable = true;
@@ -144,6 +155,17 @@ let
};
proxy.enable = true;
}
# autostart is the global profile's; an outbound always runs.
{
enable = true;
warp = {
enable = true;
configFile = profile;
asOutbound = "singBox";
autostart = true;
};
proxy.enable = true;
}
# Tag collision with a declared outbound.
{
enable = true;
@@ -268,6 +290,15 @@ in
assert !(amneziaWg.config.systemd.services ? "proxy-suite-warp-tunnel");
true
)
# The global profile starts on demand (proxy-ctl awg on warp), or at boot with autostart.
(
assert
amneziaWg.config.systemd.services."proxy-suite-awg-warp".wantedBy == [ ]
&&
builtins.elem "multi-user.target"
amneziaWgAutostart.config.systemd.services."proxy-suite-awg-warp".wantedBy;
true
)
# endpoint replaces the profile's Endpoint at conversion; the sing-box tunnel gets it quoted.
(
assert