Skip to content

Instantly share code, notes, and snippets.

@julian-klode
Created May 1, 2023 14:51
Show Gist options
  • Save julian-klode/caf473f7937c0e4fc6d755bf2e9b272e to your computer and use it in GitHub Desktop.
Save julian-klode/caf473f7937c0e4fc6d755bf2e9b272e to your computer and use it in GitHub Desktop.
#!/bin/sh
args=""
if [ $(id -u) -ne 0 ]; then
args=--user
fi
if echo $@ | grep update; then
args="$args -p ProtectSystem=strict -p ReadWritePaths=/var/lib/apt -p ReadWritePaths=/var/cache/apt -p PrivateTmp=yes -p PrivateDevices=yes"
fi
exec systemd-run $args -q --wait -G --unit apt.service -Pt -p ProtectHome=yes -p NoNewPrivileges=yes -p ProtectHostname=yes -p ProtectClock=yes -p ProtectKernelTunables=yes -p ProtectKernelModules=yes -p ProtectKernelLogs=yes -p ProtectControlGroups=yes -p RestrictRealtime=yes -p SystemCallFilter=@system-service /usr/bin/apt "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment