fix: zapret2 file permission fixes
This commit is contained in:
6 files changed
+63
-5
No files matched your search
@@ -109,6 +109,21 @@ let
|
||||
touch ${runtime.autoHostlistFile} ${runtime.userHostlistFile} ${runtime.excludeHostlistFile}
|
||||
# In this unit's sandbox: a name a member left here leads nowhere else.
|
||||
${constants.grantDirAcl pkgs runtime.stateDir (userControlExtraGroupsFor "zapret") "rwX"}
|
||||
${lib.optionalString (userControlAnyAllows "zapret") ''
|
||||
# A list a member renamed in is theirs: nfqws2 appends to it through the group
|
||||
# (after the ACLs, whose mask the group bits are).
|
||||
for f in ${
|
||||
lib.escapeShellArgs [
|
||||
runtime.autoHostlistFile
|
||||
runtime.userHostlistFile
|
||||
runtime.excludeHostlistFile
|
||||
"${runtime.stateDir}/verdicts.tsv"
|
||||
"${runtime.circularStateDir}/state.tsv"
|
||||
]
|
||||
}; do
|
||||
if [ -f "$f" ] && [ ! -L "$f" ]; then chmod g+w -- "$f"; fi
|
||||
done
|
||||
''}
|
||||
${runtime.initScript} start_fw
|
||||
'';
|
||||
|
||||
@@ -125,6 +140,11 @@ let
|
||||
# systemd gives the state directory the unit's group on every start: the group's, which
|
||||
# edits the lists (as autoProxy's units do).
|
||||
// lib.optionalAttrs (userControlAllows "zapret") { Group = cfg.userControl.group; }
|
||||
# userControl.groups' members own what they rename in, writable by their ACL groups:
|
||||
# nfqws2 keeps these groups (runtime.daemonScript) to append to it.
|
||||
// lib.optionalAttrs (userControlExtraGroupsFor "zapret" != [ ]) {
|
||||
SupplementaryGroups = userControlExtraGroupsFor "zapret";
|
||||
}
|
||||
# nfqws2 runs as root and writes its lists in a directory the zapret scope's group
|
||||
# writes to as well.
|
||||
// constants.rootInSharedDirConfig
|
||||
|
||||
@@ -38,6 +38,9 @@ in
|
||||
# Ahead of the proxy at boot, so it starts with the hosts already in.
|
||||
before = [ "proxy-suite-socks.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
# nfqws2 writes verdicts in bursts (a page's unanswered addresses), each a start: the
|
||||
# start limit would fail the path unit with it, and nothing would sync until a reboot.
|
||||
startLimitIntervalSec = 0;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${sync} ${lib.escapeShellArg stateDir} ${lib.escapeShellArg outDir}";
|
||||
|
||||
@@ -437,8 +437,14 @@ let
|
||||
. "$ZAPRET_BASE/init.d/sysv/functions"
|
||||
opt="--qnum=$QNUM $NFQWS2_OPT"
|
||||
filter_apply_hostlist_target opt
|
||||
# --user=root leaves nfqws2 root's own groups (initgroups), and with them only
|
||||
# CAP_NET_ADMIN and CAP_NET_RAW: the unit's Group= and SupplementaryGroups=, through
|
||||
# which it appends to the lists the zapret scope's group renames in (theirs, then),
|
||||
# would be gone. --uid after it keeps uid 0 and the groups the unit started it with.
|
||||
uid=
|
||||
if [ "$(id -u)" = 0 ]; then uid="--uid=0:$(id -G | tr ' ' ,)"; fi
|
||||
set -f
|
||||
exec "$NFQWS2" $NFQWS2_OPT_BASE $opt
|
||||
exec "$NFQWS2" $NFQWS2_OPT_BASE $uid $opt
|
||||
'';
|
||||
in
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user