move userControl to root options
This commit is contained in:
4 files changed
+261
-69
No files matched your search
+70
-1
@@ -914,6 +914,45 @@ let
|
||||
builtins.readFile "${appRoutingZapretBase}/init.d/sysv/custom.d/50-proxy-suite-custom.sh";
|
||||
appRoutingTunPolkitConfig = appRoutingTunFixture.config.security.polkit.extraConfig;
|
||||
|
||||
userControlGlobalOnlyFixture = evalProxySuite [
|
||||
baseModule
|
||||
{
|
||||
services.proxy-suite.userControl = {
|
||||
global.enable = true;
|
||||
perApp.enable = false;
|
||||
};
|
||||
}
|
||||
];
|
||||
userControlGlobalOnlyPolkitConfig = userControlGlobalOnlyFixture.config.security.polkit.extraConfig;
|
||||
|
||||
userControlPerAppOnlyFixture = evalProxySuite [
|
||||
baseModule
|
||||
{
|
||||
services.proxy-suite = {
|
||||
appRouting = {
|
||||
enable = true;
|
||||
createDefaultProfiles = true;
|
||||
backends.tun.enable = true;
|
||||
};
|
||||
userControl = {
|
||||
global.enable = false;
|
||||
perApp.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
userControlPerAppOnlyPolkitConfig = userControlPerAppOnlyFixture.config.security.polkit.extraConfig;
|
||||
|
||||
userControlDisabledFixture = evalProxySuite [
|
||||
baseModule
|
||||
{
|
||||
services.proxy-suite.userControl = {
|
||||
global.enable = false;
|
||||
perApp.enable = false;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
appRoutingZapretWithoutEnable = forceEval (
|
||||
(evalProxySuite [
|
||||
baseModule
|
||||
@@ -1710,13 +1749,43 @@ let
|
||||
true
|
||||
)
|
||||
|
||||
# -- appRouting: proxy-suite group polkit rule covers global proxy-ctl managed units --
|
||||
# -- userControl: default polkit rule covers both per-app and global proxy-ctl managed units --
|
||||
(
|
||||
assert pkgs.lib.hasInfix "unit.indexOf(\"proxy-suite-app-\") === 0" appRoutingTunPolkitConfig;
|
||||
assert pkgs.lib.hasInfix "unit.indexOf(\"proxy-suite-\") === 0" appRoutingTunPolkitConfig;
|
||||
assert pkgs.lib.hasInfix "unit.indexOf(\"proxy-suite-app-\") !== 0" appRoutingTunPolkitConfig;
|
||||
assert pkgs.lib.hasInfix "unit === \"zapret-discord-youtube.service\"" appRoutingTunPolkitConfig;
|
||||
true
|
||||
)
|
||||
|
||||
# -- userControl: global-only rule excludes per-app units --
|
||||
(
|
||||
assert userControlGlobalOnlyFixture.config.users.groups ? "proxy-suite";
|
||||
assert pkgs.lib.hasInfix "unit.indexOf(\"proxy-suite-\") === 0" userControlGlobalOnlyPolkitConfig;
|
||||
assert pkgs.lib.hasInfix "unit.indexOf(\"proxy-suite-app-\") !== 0" userControlGlobalOnlyPolkitConfig;
|
||||
assert builtins.match ".*unit\\.indexOf\\(\"proxy-suite-app-\"\\) === 0.*" userControlGlobalOnlyPolkitConfig == null;
|
||||
assert pkgs.lib.hasInfix "unit === \"zapret-discord-youtube.service\"" userControlGlobalOnlyPolkitConfig;
|
||||
true
|
||||
)
|
||||
|
||||
# -- userControl: per-app-only rule covers app-scoped helpers only --
|
||||
(
|
||||
assert userControlPerAppOnlyFixture.config.users.groups ? "proxy-suite";
|
||||
assert pkgs.lib.hasInfix "unit.indexOf(\"proxy-suite-app-\") === 0" userControlPerAppOnlyPolkitConfig;
|
||||
assert builtins.match ".*unit\\.indexOf\\(\"proxy-suite-app-\"\\) !== 0.*" userControlPerAppOnlyPolkitConfig == null;
|
||||
assert builtins.match ".*unit === \"zapret-discord-youtube\\.service\".*" userControlPerAppOnlyPolkitConfig == null;
|
||||
true
|
||||
)
|
||||
|
||||
# -- userControl: disabling both scopes removes group and polkit wiring --
|
||||
(
|
||||
assert !(userControlDisabledFixture.config.users.groups ? "proxy-suite");
|
||||
assert !userControlDisabledFixture.config.security.polkit.enable;
|
||||
assert builtins.match ".*subject\\.isInGroup\\(\"proxy-suite\"\\).*" userControlDisabledFixture.config.security.polkit.extraConfig == null;
|
||||
assert builtins.match ".*org\\.freedesktop\\.systemd1\\.manage-units.*" userControlDisabledFixture.config.security.polkit.extraConfig == null;
|
||||
true
|
||||
)
|
||||
|
||||
# -- appRouting: app TProxy helper installs socket cgroup mark rules --
|
||||
(
|
||||
assert pkgs.lib.hasInfix "socket cgroupv2" appRoutingTproxyUserStartScript;
|
||||
|
||||
Reference in new issue
Block a user