All checks were successful
Zapret source guards / validate (push) Successful in 10s
Found on the real KDE test machine with the compiled packages: "Stop" removed the firewall table but left nfqws2 running. The engine runs as the person who asked (it drops root itself), and the unit's CapabilityBoundingSet had no CAP_KILL, so the helper's SIGTERM/SIGKILL to another user's process failed silently. The earlier end-to-end tests missed it because `systemctl stop` kills the whole cgroup. Also: the stop path asked Windows for the WinDivert driver service on every stop (a WARNING in the log on Linux); PresetLaunchRuntimeApi.cleanup_windivert_service now returns at once where Cap.DIRECT_ENGINE_PROCESS is missing. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
39 lines
1.8 KiB
Desktop File
39 lines
1.8 KiB
Desktop File
[Unit]
|
|
Description=Zapret helper: firewall rules and the nfqws2 engine for the Zapret window
|
|
Documentation=https://otukcszfwr.zapret.moe/
|
|
After=network-pre.target
|
|
Wants=network-pre.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
# The wrapper starts: python -m platforms.linux.helper (source layout) or the bundled program in helper mode.
|
|
ExecStart=/opt/zapretgui/bin/zapretgui-helper
|
|
# The helper removes its own firewall table on every way out. These two lines are the second net, for the case
|
|
# that the helper was killed (kill -9, out of memory): the table is never left behind to cut the internet.
|
|
ExecStartPre=-/usr/sbin/nft delete table inet zapretgui
|
|
ExecStopPost=-/usr/sbin/nft delete table inet zapretgui
|
|
Restart=on-failure
|
|
RestartSec=2
|
|
# /run/zapretgui: the socket (root:zapretgui 0660, created by the helper), the state file and the engine log.
|
|
RuntimeDirectory=zapretgui
|
|
RuntimeDirectoryMode=0755
|
|
RuntimeDirectoryPreserve=no
|
|
# The engine gives up root itself and continues as the person who asked; the helper needs no more than this.
|
|
# CAP_KILL: the engine runs as that person, so without it the helper cannot stop it (SIGTERM/SIGKILL to another user).
|
|
CapabilityBoundingSet=CAP_KILL CAP_NET_ADMIN CAP_NET_RAW CAP_SETUID CAP_SETGID CAP_SYS_NICE CAP_DAC_READ_SEARCH CAP_CHOWN CAP_DAC_OVERRIDE CAP_SYS_ADMIN
|
|
ProtectSystem=strict
|
|
ProtectHome=read-only
|
|
# The window may ask the helper to rewrite the hosts file (an in-place write of exactly this file, with a first backup
|
|
# in /var/lib/zapretgui). The "-" lets the unit start even on a machine without the file.
|
|
ReadWritePaths=-/etc/hosts
|
|
StateDirectory=zapretgui
|
|
PrivateTmp=yes
|
|
ProtectKernelModules=yes
|
|
ProtectControlGroups=yes
|
|
RestrictAddressFamilies=AF_UNIX AF_NETLINK AF_INET AF_INET6
|
|
LockPersonality=yes
|
|
# Leaving is quick: stop() removes the rules first and the engine second.
|
|
TimeoutStopSec=15
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|