mirror of
https://github.com/Kicksecure/security-misc.git
synced 2024-12-25 21:39:25 -05:00
do not remove suid from whitelisted binaries ever
https://forums.whonix.org/t/permission-hardening/8655/13
This commit is contained in:
parent
d5f1bd8dd2
commit
6d30e3b4a2
@ -13,6 +13,15 @@
|
||||
## To remove all SUID/SGID binaries in a directory, you can use the "nosuid"
|
||||
## argument.
|
||||
|
||||
## SUID whitelist.
|
||||
/usr/bin/sudo whitelist
|
||||
/usr/bin/bwrap whitelist
|
||||
/usr/lib/policykit-1/polkit-agent-helper-1 whitelist
|
||||
/usr/lib/dbus-1.0/dbus-daemon-launch-helper whitelist
|
||||
/usr/lib/spice-gtk/spice-client-glib-usb-acl-helper whitelist
|
||||
/usr/lib/x86_64-linux-gnu/utempter/utempter whitelist
|
||||
|
||||
## Permission hardening.
|
||||
/home/ 0755 root root
|
||||
/home/user/ 0700 user user
|
||||
/root/ 0700 root root
|
||||
@ -41,11 +50,3 @@
|
||||
/usr/local/lib/ nosuid
|
||||
/usr/local/lib32/ nosuid
|
||||
/usr/local/lib64/ nosuid
|
||||
|
||||
## SUID whitelist.
|
||||
/usr/bin/sudo 4755 root root
|
||||
/usr/bin/bwrap 4755 root root
|
||||
/usr/lib/policykit-1/polkit-agent-helper-1 4755 root root
|
||||
/usr/lib/dbus-1.0/dbus-daemon-launch-helper 4754 root messagebus
|
||||
/usr/lib/spice-gtk/spice-client-glib-usb-acl-helper 4755 root root
|
||||
/usr/lib/x86_64-linux-gnu/utempter/utempter 2755 root utmp
|
||||
|
@ -69,6 +69,20 @@ add_nosuid_statoverride_entry() {
|
||||
|
||||
echo "INFO: $setuid_output $setguid_output found - file_name: '$file_name' | existing_mode: '$existing_mode' | new_mode: '$new_mode'"
|
||||
|
||||
is_whitelisted=""
|
||||
for white_list_entry in $whitelist ; do
|
||||
if [ "$file_name" = "$white_list_entry" ]; then
|
||||
is_whitelisted="true"
|
||||
## Stop looping through the whitelist.
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$is_whitelisted" = "true" ]; then
|
||||
echo "INFO: skip whitelisted: '$file_name'"
|
||||
continue
|
||||
fi
|
||||
|
||||
if dpkg-statoverride --list | grep -q "$file_name"; then
|
||||
if ! dpkg-statoverride --list | grep -q "$owner $group $new_mode $file_name"; then
|
||||
echo_wrapper dpkg-statoverride --remove "$file_name"
|
||||
@ -115,6 +129,11 @@ set_file_perms() {
|
||||
|
||||
fso_without_trailing_slash="${fso%/}"
|
||||
|
||||
if [ "$mode_from_config" = "whitelist" ]; then
|
||||
whitelist+="$fso_without_trailing_slash "
|
||||
continue
|
||||
fi
|
||||
|
||||
## Use dpkg-statoverride so permissions are not reset during upgrades.
|
||||
|
||||
nosuid=""
|
||||
|
Loading…
Reference in New Issue
Block a user