fix: LS cleanup uses sudo -u for same-UID kill, prevent double kill

This commit is contained in:
Nikketryhard
2026-02-15 17:08:43 -06:00
parent b1bd57ab5e
commit cc5f48967a
2 changed files with 134 additions and 12 deletions

View File

@@ -60,9 +60,11 @@ install() {
cat > "$SUDOERS_FILE" <<EOF
# Allow $REAL_USER to run commands as $LS_USER (for antigravity proxy)
$REAL_USER ALL=($LS_USER) NOPASSWD: ALL
# Allow $REAL_USER to kill $LS_USER's processes (for clean shutdown)
$REAL_USER ALL=(root) NOPASSWD: /usr/bin/kill -TERM *, /usr/bin/kill -KILL *, /usr/bin/pkill -TERM -u $LS_USER *, /usr/bin/pkill -KILL -u $LS_USER *
EOF
chmod 440 "$SUDOERS_FILE"
echo " + sudoers: $REAL_USER can run as $LS_USER"
echo " + sudoers: $REAL_USER can run as $LS_USER + kill $LS_USER processes"
# ── 4. iptables REDIRECT (scoped to UID) ────────────────────────────
# Remove existing rule first (idempotent)