fix: zapret and other services started before network was fully established
This commit is contained in:
4 files changed
+26
-4
No files matched your search
@@ -134,7 +134,8 @@ let
|
|||||||
name = serviceNames.socks;
|
name = serviceNames.socks;
|
||||||
value = mkRestartingService {
|
value = mkRestartingService {
|
||||||
description = "sing-box proxy client (SOCKS + TProxy-ready)";
|
description = "sing-box proxy client (SOCKS + TProxy-ready)";
|
||||||
after = [ "network.target" ];
|
after = [ "network-online.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
execStart = scripts.startSocks;
|
execStart = scripts.startSocks;
|
||||||
runtimeDirectory = serviceNames.socks;
|
runtimeDirectory = serviceNames.socks;
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ in
|
|||||||
{
|
{
|
||||||
systemd.services.proxy-suite-tg-ws-proxy = {
|
systemd.services.proxy-suite-tg-ws-proxy = {
|
||||||
description = "Telegram MTProto WebSocket proxy";
|
description = "Telegram MTProto WebSocket proxy";
|
||||||
after = [ "network.target" ];
|
after = [ "network-online.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${startScript}";
|
ExecStart = "${startScript}";
|
||||||
|
|||||||
@@ -338,7 +338,8 @@ in
|
|||||||
|
|
||||||
systemd.services.zapret-discord-youtube = mkOneshotService {
|
systemd.services.zapret-discord-youtube = mkOneshotService {
|
||||||
description = "zapret DPI bypass";
|
description = "zapret DPI bypass";
|
||||||
after = [ "network.target" ];
|
after = [ "network-online.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
preStart = zapretCommonPreStart globalZapretPackage;
|
preStart = zapretCommonPreStart globalZapretPackage;
|
||||||
runtimeDirectory = "proxy-suite-zapret";
|
runtimeDirectory = "proxy-suite-zapret";
|
||||||
@@ -352,7 +353,8 @@ in
|
|||||||
|
|
||||||
systemd.services.proxy-suite-per-app-zapret = lib.mkIf perAppZapretCfg.enable (mkOneshotService {
|
systemd.services.proxy-suite-per-app-zapret = lib.mkIf perAppZapretCfg.enable (mkOneshotService {
|
||||||
description = "proxy-suite per-app-routing zapret backend";
|
description = "proxy-suite per-app-routing zapret backend";
|
||||||
after = [ "network.target" ];
|
after = [ "network-online.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
conflicts = [
|
conflicts = [
|
||||||
"proxy-suite-tproxy.service"
|
"proxy-suite-tproxy.service"
|
||||||
"proxy-suite-tun.service"
|
"proxy-suite-tun.service"
|
||||||
|
|||||||
@@ -199,6 +199,7 @@ let
|
|||||||
_minimalProxyCtl = mkProxyCtlDerived minimal;
|
_minimalProxyCtl = mkProxyCtlDerived minimal;
|
||||||
minimalProxyCtlWrapper = _minimalProxyCtl.wrapper;
|
minimalProxyCtlWrapper = _minimalProxyCtl.wrapper;
|
||||||
minimalProxyCtlScript = _minimalProxyCtl.script;
|
minimalProxyCtlScript = _minimalProxyCtl.script;
|
||||||
|
minimalSocksService = minimal.config.systemd.services."proxy-suite-socks";
|
||||||
|
|
||||||
routeModeFixture = evalProxySuite [
|
routeModeFixture = evalProxySuite [
|
||||||
baseModule
|
baseModule
|
||||||
@@ -242,6 +243,7 @@ let
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
tgSecretFileService = tgSecretFile.config.systemd.services."proxy-suite-tg-ws-proxy";
|
||||||
|
|
||||||
tgWithGlobalTun = evalProxySuite [
|
tgWithGlobalTun = evalProxySuite [
|
||||||
baseModule
|
baseModule
|
||||||
@@ -468,6 +470,7 @@ let
|
|||||||
services.proxy-suite.zapret.enable = true;
|
services.proxy-suite.zapret.enable = true;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
zapretSyncService = zapretSyncFixture.config.systemd.services."zapret-discord-youtube";
|
||||||
zapretSyncRules = mkRoutingRules zapretSyncFixture;
|
zapretSyncRules = mkRoutingRules zapretSyncFixture;
|
||||||
zapretSyncBase = mkZapretBase zapretSyncFixture;
|
zapretSyncBase = mkZapretBase zapretSyncFixture;
|
||||||
|
|
||||||
@@ -1115,6 +1118,7 @@ let
|
|||||||
perAppRoutingZapretFixture.config.systemd.services."proxy-suite-per-app-zapret-user@".serviceConfig.ExecStart;
|
perAppRoutingZapretFixture.config.systemd.services."proxy-suite-per-app-zapret-user@".serviceConfig.ExecStart;
|
||||||
perAppRoutingZapretUserStartScript =
|
perAppRoutingZapretUserStartScript =
|
||||||
builtins.readFile (builtins.head (pkgs.lib.splitString " " perAppRoutingZapretUserStartExec));
|
builtins.readFile (builtins.head (pkgs.lib.splitString " " perAppRoutingZapretUserStartExec));
|
||||||
|
perAppRoutingZapretService = perAppRoutingZapretFixture.config.systemd.services."proxy-suite-per-app-zapret";
|
||||||
perAppRoutingZapretBase = mkZapretBase perAppRoutingZapretFixture;
|
perAppRoutingZapretBase = mkZapretBase perAppRoutingZapretFixture;
|
||||||
perAppRoutingZapretConfig = builtins.readFile "${perAppRoutingZapretBase}/config";
|
perAppRoutingZapretConfig = builtins.readFile "${perAppRoutingZapretBase}/config";
|
||||||
perAppRoutingPerAppZapretBase = mkZapretBaseFor perAppRoutingZapretFixture "proxy-suite-per-app-zapret";
|
perAppRoutingPerAppZapretBase = mkZapretBaseFor perAppRoutingZapretFixture "proxy-suite-per-app-zapret";
|
||||||
@@ -1401,6 +1405,16 @@ let
|
|||||||
assert tgRoutingMarkCollision.success == false;
|
assert tgRoutingMarkCollision.success == false;
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
# -- boot ordering: network-sensitive global services wait for network-online --
|
||||||
|
(
|
||||||
|
assert builtins.elem "network-online.target" minimalSocksService.after;
|
||||||
|
assert builtins.elem "network-online.target" minimalSocksService.wants;
|
||||||
|
assert builtins.elem "network-online.target" tgSecretFileService.after;
|
||||||
|
assert builtins.elem "network-online.target" tgSecretFileService.wants;
|
||||||
|
assert builtins.elem "network-online.target" zapretSyncService.after;
|
||||||
|
assert builtins.elem "network-online.target" zapretSyncService.wants;
|
||||||
|
true
|
||||||
|
)
|
||||||
(
|
(
|
||||||
assert duplicateTags.success == false;
|
assert duplicateTags.success == false;
|
||||||
true
|
true
|
||||||
@@ -2089,6 +2103,8 @@ let
|
|||||||
assert perAppRoutingZapretFixture.config.systemd.services ? "proxy-suite-per-app-zapret";
|
assert perAppRoutingZapretFixture.config.systemd.services ? "proxy-suite-per-app-zapret";
|
||||||
assert perAppRoutingZapretFixture.config.systemd.services ? "proxy-suite-per-app-zapret-user@";
|
assert perAppRoutingZapretFixture.config.systemd.services ? "proxy-suite-per-app-zapret-user@";
|
||||||
assert perAppRoutingZapretFixture.config.systemd.user.services ? "proxy-suite-per-app-zapret-anchor";
|
assert perAppRoutingZapretFixture.config.systemd.user.services ? "proxy-suite-per-app-zapret-anchor";
|
||||||
|
assert builtins.elem "network-online.target" perAppRoutingZapretService.after;
|
||||||
|
assert builtins.elem "network-online.target" perAppRoutingZapretService.wants;
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -2096,6 +2112,8 @@ let
|
|||||||
(
|
(
|
||||||
assert perAppRoutingTunFixture.config.networking.nftables.enable;
|
assert perAppRoutingTunFixture.config.networking.nftables.enable;
|
||||||
assert perAppRoutingTunFixture.config.users.groups ? "proxy-suite";
|
assert perAppRoutingTunFixture.config.users.groups ? "proxy-suite";
|
||||||
|
assert builtins.elem "network-online.target" tunManualFixture.config.systemd.services."proxy-suite-tun".after;
|
||||||
|
assert builtins.elem "network-online.target" tunManualFixture.config.systemd.services."proxy-suite-tun".wants;
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user