mirror of
https://github.com/Kicksecure/security-misc.git
synced 2025-01-25 02:25:33 +07:00
Merge remote-tracking branch 'github-kicksecure/master'
This commit is contained in:
commit
8bf5ff82be
@ -32,35 +32,17 @@
|
|||||||
# /usr/libexec/security-misc/permission-lockdown: user: geoclue | chmod o-rwx "/var/lib/geoclue"
|
# /usr/libexec/security-misc/permission-lockdown: user: geoclue | chmod o-rwx "/var/lib/geoclue"
|
||||||
|
|
||||||
home_folder_access_rights_lockdown() {
|
home_folder_access_rights_lockdown() {
|
||||||
shopt -s nullglob
|
# Each users home directory to himself
|
||||||
|
for user in $(dir /home); do # lists directories only
|
||||||
## Not using dotglob.
|
if [ -f /var/cache/security-misc/state-files/$user ]; then
|
||||||
## touch /var/cache/security-misc/state-files//home/.Trash
|
|
||||||
## touch: cannot touch '/var/cache/security-misc/state-files//home/.Trash': No such file or directory
|
|
||||||
|
|
||||||
local folder_name base_name
|
|
||||||
|
|
||||||
for folder_name in /home/* ; do
|
|
||||||
base_name="$(basename "$folder_name")"
|
|
||||||
if [ -f "/var/cache/security-misc/state-files/$base_name" ]; then
|
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if [ ! -d "$folder_name" ]; then
|
if [ $(id --user $user) ]; then # check if user actually exists, and this is not some random directory
|
||||||
continue
|
dpkg-statoverride --add --update $user $user 0700 /home/$user # home directory of the user
|
||||||
|
echo "Permission updated: chmod go-rwx /home/$user"
|
||||||
|
touch /var/cache/security-misc/state-files/$user # so that we know we did this one
|
||||||
fi
|
fi
|
||||||
if [ "$folder_name" = "/home/" ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
mkdir -p /var/cache/security-misc/state-files
|
|
||||||
echo "$0: chmod o-rwx \"$folder_name\""
|
|
||||||
chmod o-rwx "$folder_name"
|
|
||||||
## Create a state-file so we do this only once.
|
|
||||||
## Therefore a user who will manually undo this, will not get
|
|
||||||
## annoyed by this being done over and over again.
|
|
||||||
touch "/var/cache/security-misc/state-files/$base_name"
|
|
||||||
done
|
done
|
||||||
|
|
||||||
shopt -u nullglob
|
|
||||||
}
|
}
|
||||||
|
|
||||||
home_folder_access_rights_lockdown
|
home_folder_access_rights_lockdown
|
||||||
|
Loading…
Reference in New Issue
Block a user