You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
improve hide-hardware-info.service, make /sys hiding optional #172
A systemd service restricts /proc/cpuinfo, /proc/bus, /proc/scsi and /sys to the root user. This hides a lot of hardware identifiers from unprivileged users and increases security as /sys exposes a lot of information that shouldn't be accessible to unprivileged users. As this will break many things, it is disabled by default and can optionally be enabled by executing systemctl enable hide-hardware-info.service as root.
Ok.
Although not tested, I am almost 100% sure practically all the breakage is caused by restricting /sys. My recommendation is, we leave this one out. Add /proc/kallsyms to the list as well, as this contains all the memory addresses for each kernel symbol. And enable what we already have, restricting the sub-directories under proc.
Actually we do not even need that service I think. We can set the permissions using the permission hardener service. We are just going to do these with the already existing permission hardener service.
That's an interesting idea to get rid of the extra service. Nice in theory, but...
Could you check please what other features the current implementation has?
Nice idea but permission-hardener no longer runs at boot time. Only at package install time or when run manually. This was changed to fix the slow/broken boot issues. But changes to /proc (or /sys) need to be done at boot time since these are virtual file systems which are created during boot.
changed the title [-]Opt-in Hardening | Time to enable[/-][+]improve hide-hardware-info.service, make `/sys` hiding optional and enable by default[/+]on Jan 10, 2024
While debugging another issue, I figured out that /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 is trying to stat /sys/fs/cgroup/ but failing and then exiting because of it. When I allow access to this path, the polkit agent is running and the password prompt working. To address this, we would need to allow access to /sys, but can block anything under /sys/* except for /sys/fs/ which needs to be accessible by the polkit agent. Then we can again block access to anything under /sys/fs/*
With those changes polkit is working as expected.
But for sensitive proc, I think I found a better way. We can modify the mount options. Procfs has the mount option subset. We can set this to the subsets that we want to be available. If we set the option subset=pid, then pid is visible to everyone (the default), but everything else invisible, including /proc/dma/proc/consoles/proc/cmdline/proc/iomem and like a billion other things you can check them with ls /proc. I know for a fact that hiding memory access and device stuff and kernel arguments is good and does not break anything. i am not sure what can be hidden here without breakage, but I will test and find out the optimal mount options for proc.
changed the title [-]improve hide-hardware-info.service, make `/sys` hiding optional and enable by default[/-][+]improve hide-hardware-info.service, make `/sys` hiding optional[/+]on Mar 11, 2024
For enable hide-hardware-information.service by default, please open a separate ticket if you wish to suggest that.
All was implemented what has been discussed in this ticket or follow-up tickets have been created. If something has been forgotten, I guess small, actionable follow-up tickets would be the most productive.
Activity
adrelanos commentedon Nov 20, 2023
I am not sure how that PR would look but I guess rather small.
Since this is not enabled by default and for extra security, I tend to add what you suggested here.
Worth trying.
adrelanos commentedon Nov 21, 2023
hide-hardware-info.serviceissues:flatpak run org.chromium.Chromium)But these are all probably related to
/sys.Could you test please if these work?
related:
https://www.kicksecure.com/wiki/Security-misc#Restrict_Hardware_Information_to_Root
adrelanos commentedon Nov 21, 2023
That's an interesting idea to get rid of the extra service. Nice in theory, but...
Could you check please what other features the current implementation has?
Nice idea but permission-hardener no longer runs at boot time. Only at package install time or when run manually. This was changed to fix the slow/broken boot issues. But changes to /proc (or /sys) need to be done at boot time since these are virtual file systems which are created during boot.
Even only
hide-hardware-info.servicewas reported to slow down the boot process.So I guess the best way here is to improve
hide-hardware-info.service?adrelanos commentedon Nov 23, 2023
Ok.
PR to update the script run by hide-hardware-info.service would be welcome.
sysinit-post.target(Similar toremount-secure.service.)[-]Opt-in Hardening | Time to enable[/-][+]improve hide-hardware-info.service, make `/sys` hiding optional and enable by default[/+]adrelanos commentedon Jan 10, 2024
This one seems really cool and doable.
Ping @monsieuremre
adrelanos commentedon Feb 18, 2024
Created
for it.
DanWin commentedon Feb 18, 2024
While debugging another issue, I figured out that
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1is trying to stat/sys/fs/cgroup/but failing and then exiting because of it. When I allow access to this path, the polkit agent is running and the password prompt working. To address this, we would need to allow access to/sys, but can block anything under/sys/*except for/sys/fs/which needs to be accessible by the polkit agent. Then we can again block access to anything under/sys/fs/*With those changes polkit is working as expected.
adrelanos commentedon Feb 19, 2024
related to flatpak:
2 remaining items
adrelanos commentedon Feb 21, 2024
A smaller change only required here, not mixed with remounting.
adrelanos commentedon Feb 22, 2024
#202 had interesting suggestions.
mount --make-private
improve output
adrelanos commentedon Feb 26, 2024
This is what's happening after merging #204.
Needs testing.
improve output
improve output
use long options
adrelanos commentedon Feb 26, 2024
Created,
remount-secure: useprocfsmount optionsubset(hide-hardware-info.service) #205for it.
adrelanos commentedon Feb 26, 2024
flatpak: thanks to #204 this is now fixed.
These are all covered by default.
Created,
hide-hardware-info.service: hide/proc/kallsyms#206for it.
[-]improve hide-hardware-info.service, make `/sys` hiding optional and enable by default[/-][+]improve hide-hardware-info.service, make `/sys` hiding optional[/+]adrelanos commentedon Mar 11, 2024
For enable hide-hardware-information.service by default, please open a separate ticket if you wish to suggest that.
All was implemented what has been discussed in this ticket or follow-up tickets have been created. If something has been forgotten, I guess small, actionable follow-up tickets would be the most productive.
hide-hardware-information.service known issues:
https://www.kicksecure.com/wiki/Security-misc#Reduce_Kernel_Information_Leaks_-_Known_Issues