Not exactly the most accurate way but, with hide-hardware-info.service disabled:
lshw | wc -l
151
With hide-hardware-info.service enabled:
lshw | wc -l
36
This hides a considerable amount of hardware information. You can only see the size of memory, some minor scsi information and network interfaces. Even then, this can be restricted further by restricting certain files in /proc and /dev.
I managed to nail down scsi information to /dev/sg* and network interface information to /proc/net/dev. ip a still shows network interfaces though.
Not sure if restricting /proc/net/dev and /dev/sg* should be part of the main script as it’d probably break a whole load more stuff. Maybe we can add an --extended flag to the script.
lshw now only really shows how much memory I have.
How would users pass such a flag? systemd drop-in file seems difficult.
Could be a status file if /etc/something exists, hide more or so.
Easier to have another systemd unit file?
Really cool!
Does hiding CPU capabilities from non-root users break any (compile time) security hardening? @HulaHoop
With the hardware info restrictions, I don’t get any error from TBB after starting it with the checks commented out. Firefox might think the CPU is recent enough if it can’t read /proc/cpuinfo.
Therefore, it’s better for users who don’t have SSE2 support to fail at startup rather than running it without any notifications and having it randomly break.
We’ll need to figure out another way to fix XFCE then. We can start by making a whole bunch of XFCE/Xorg/Dbus related binaries setgid and see if it works.
The user@1000.service systemd service fails when hide-hardware-info.service is enabled.
This can by fixed by creating a sysfs group, editing the hide-hardware-info script to make /sys owned by the sysfs group and creating the file /lib/systemd/system/user@.service.d/sysfs.conf with the contents:
[Service]
SupplementaryGroups=sysfs
This also fixes XFCE.
The problem with this though is that user@1000.service starts a bunch of processes that now have unrestricted access to /sys. This includes things like gpg, gvfs and pulseaudo.
Running chown root:sysfs -R /sys in the hide-hardware-info script also makes it fail with errors about not being permitted to change the ownership of /sys/kernel/tracing and /sys/fs/cgroup. So those will somehow need to be excluded or we can give the sysfs group only access to commonly accessed files in /sys instead of giving it total access.
Of no value on non mobile/Android devices becuase VMs don’t have IMEIs or a serial number (the only two things mentioned in that doc).
On Linux it does provide harmless info about traffic bytes and throughput when you cat the interface. I have no idea what that might break (yet) but it’s safe to say we don’t gain a whole lot from shutting it down.
It will but that’s really the entire point of it. Restricting access to /proc/net is to hide a bunch of network information from ordinary users. If ifconfig could easily display it anyway, it’d defeat the point of it.