mirror of
https://github.com/Kicksecure/security-misc.git
synced 2025-06-21 17:14:11 -04:00
Add way to whitelist things
This commit is contained in:
parent
4b1b3b7d66
commit
6b78dbcd07
1 changed files with 44 additions and 1 deletions
|
@ -3,6 +3,33 @@
|
||||||
## Copyright (C) 2012 - 2018 ENCRYPTED SUPPORT LP <adrelanos@riseup.net>
|
## Copyright (C) 2012 - 2018 ENCRYPTED SUPPORT LP <adrelanos@riseup.net>
|
||||||
## See the file COPYING for copying conditions.
|
## See the file COPYING for copying conditions.
|
||||||
|
|
||||||
|
sysfs_whitelist=1
|
||||||
|
cpuinfo_whitelist=1
|
||||||
|
|
||||||
|
## Allows for disabling the whitelist.
|
||||||
|
for i in /etc/hide-hardware-info.d/*.conf
|
||||||
|
do
|
||||||
|
source "${i}"
|
||||||
|
done
|
||||||
|
|
||||||
|
create_whitelist() {
|
||||||
|
if [ "${1}" = "sysfs" ]; then
|
||||||
|
whitelist_path="/sys"
|
||||||
|
elif [ "${1}" = "cpuinfo" ]; then
|
||||||
|
whitelist_path="/proc/cpuinfo"
|
||||||
|
else
|
||||||
|
echo "ERROR: ${1} is not a correct parameter."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -q "${1}" /etc/group; then
|
||||||
|
chmod o-rwx "${whitelist_path}"
|
||||||
|
chgrp -fR "${1}" "${whitelist_path}"
|
||||||
|
else
|
||||||
|
echo "ERROR: The ${1} group does not exist, the ${1} whitelist was not created."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
## sysfs and debugfs expose a lot of information
|
## sysfs and debugfs expose a lot of information
|
||||||
## that should not be accessible by an unprivileged
|
## that should not be accessible by an unprivileged
|
||||||
## user which includes hardware info, debug info and
|
## user which includes hardware info, debug info and
|
||||||
|
@ -13,7 +40,23 @@
|
||||||
for i in /proc/cpuinfo /proc/bus /proc/scsi /sys
|
for i in /proc/cpuinfo /proc/bus /proc/scsi /sys
|
||||||
do
|
do
|
||||||
if [ -e "${i}" ]; then
|
if [ -e "${i}" ]; then
|
||||||
chmod og-rwx "${i}"
|
if [ "${i}" = "/sys" ]; then
|
||||||
|
## Whitelist for /sys.
|
||||||
|
if [ "${sysfs_whitelist}" = "1" ]; then
|
||||||
|
create_whitelist sysfs
|
||||||
|
else
|
||||||
|
echo "INFO: The sysfs whitelist is not enabled. Some things may not work properly."
|
||||||
|
fi
|
||||||
|
elif [ "${i}" = "/proc/cpuinfo" ]; then
|
||||||
|
## Whitelist for /proc/cpuinfo.
|
||||||
|
if [ "${cpuinfo_whitelist}" = "1" ]; then
|
||||||
|
create_whitelist cpuinfo
|
||||||
|
else
|
||||||
|
echo "INFO: The cpuinfo whitelist is not enabled. Some things may not work properly."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
chmod og-rwx "${i}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
## /proc/scsi doesn't exist on Debian so errors
|
## /proc/scsi doesn't exist on Debian so errors
|
||||||
## are expected here.
|
## are expected here.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue