Skip to content

Instantly share code, notes, and snippets.

@julian-klode
Created May 1, 2023 14:48
Show Gist options
  • Save julian-klode/47d9752bc107768ff8a6ca4b850f2a3f to your computer and use it in GitHub Desktop.
Save julian-klode/47d9752bc107768ff8a6ca4b850f2a3f 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 -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