allow using all privileged proxy-ctl command for group proxy-suite

This commit is contained in:
FUFSoB committed 2026-04-14 22:57:41 +05:00
1 parent de33512c88
commit ea3bd0a84e
2 files changed
+13 -9

No files matched your search

+5 -9
View File
@@ -911,12 +911,12 @@ in
# nftables must be on for TProxy to work.
networking.nftables.enable = lib.mkIf (sb.tproxy.enable || art.enable || artp.enable || arz.enable) (lib.mkDefault true);
users.groups = lib.mkIf (art.enable || artp.enable || arz.enable) {
users.groups = lib.mkIf cfg.enable {
"${ar.userControl.group}" = { };
};
security.polkit.enable = lib.mkIf (art.enable || artp.enable || arz.enable) true;
security.polkit.extraConfig = lib.mkIf (art.enable || artp.enable || arz.enable) (lib.mkAfter ''
security.polkit.enable = lib.mkIf cfg.enable true;
security.polkit.extraConfig = lib.mkIf cfg.enable (lib.mkAfter ''
polkit.addRule(function(action, subject) {
if (!subject.isInGroup("${ar.userControl.group}")) {
return null;
@@ -927,12 +927,8 @@ in
}
var unit = action.lookup("unit");
if (unit === "proxy-suite-app-tun.service" ||
unit.indexOf("proxy-suite-app-tun-user@") === 0 ||
unit === "proxy-suite-app-tproxy.service" ||
unit.indexOf("proxy-suite-app-tproxy-user@") === 0 ||
unit === "proxy-suite-app-zapret.service" ||
unit.indexOf("proxy-suite-app-zapret-user@") === 0) {
if (unit.indexOf("proxy-suite-") === 0 ||
unit === "zapret-discord-youtube.service") {
return polkit.Result.YES;
}
+8
View File
@@ -912,6 +912,7 @@ let
appRoutingAppZapretConfig = builtins.readFile "${appRoutingAppZapretBase}/config";
appRoutingZapretGlobalCustomScript =
builtins.readFile "${appRoutingZapretBase}/init.d/sysv/custom.d/50-proxy-suite-custom.sh";
appRoutingTunPolkitConfig = appRoutingTunFixture.config.security.polkit.extraConfig;
appRoutingZapretWithoutEnable = forceEval (
(evalProxySuite [
@@ -1709,6 +1710,13 @@ let
true
)
# -- appRouting: proxy-suite group polkit rule covers global proxy-ctl managed units --
(
assert pkgs.lib.hasInfix "unit.indexOf(\"proxy-suite-\") === 0" appRoutingTunPolkitConfig;
assert pkgs.lib.hasInfix "unit === \"zapret-discord-youtube.service\"" appRoutingTunPolkitConfig;
true
)
# -- appRouting: app TProxy helper installs socket cgroup mark rules --
(
assert pkgs.lib.hasInfix "socket cgroupv2" appRoutingTproxyUserStartScript;