Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create disable-proc.inc #4521

Merged
merged 3 commits into from
Oct 20, 2021
Merged

Conversation

rusty-snake
Copy link
Collaborator

@rusty-snake rusty-snake commented Sep 9, 2021

Any suggestions and testing welcome.

How to test

Add include disable-proc.inc to your globals.local:

mkdir -p ~/.config/firejail
wget https://raw.githubusercontent.com/rusty-snake/firejail/disable-proc.inc/etc/inc/disable-proc.inc -O ~/.config/firejail/disable-proc.inc
echo "include disable-proc.inc" >> ~/.config/firejail/globals.local

Is anything broken? Does journalctl --grep="blacklist violation" --reverse report any violations?

@rusty-snake rusty-snake added the help wanted Extra attention is needed label Sep 9, 2021
@topimiettinen
Copy link
Collaborator

Nice idea. I did something similar with systemd for all user apps (using InaccessiblePaths= in display-manager.service and [email protected]) and found that some apps want access to specific /proc files or they don't work otherwise. Here are my notes:

qps: /proc/loadavg /proc/stat
ps: /proc/meminfo /proc/uptime 
kscreenlocker: /proc/modules /proc/driver 
libreoffice: /proc/version 
gnome-system-monitor: /proc/cpuinfo /proc/vmstat 

But the baseline could (should) be tighter and it can then be relaxed for specific apps.

@rusty-snake
Copy link
Collaborator Author

Thanks for the input.

I use it for firefox for a while now (no issues) and added it to my globals.local yesterday.
My list so far (only reports by tracelog, no breakage)

  • meminfo & zoneinfo: accessed very frequently (~1s) (maybe in a loop until success) by newsflash
  • filesystems: WebKit*, gsettings, mpv, meld, gucharmap, ...
  • version: flameshot, keepassxc

@rusty-snake
Copy link
Collaborator Author

Worked fine for 1week. Let's move forward to /proc/sys. Current draft:

blacklist /proc/sys/abi
blacklist /proc/sys/crypto
blacklist /proc/sys/debug
blacklist /proc/sys/fs
blacklist /proc/sys/net
blacklist /proc/sys/user
blacklist /proc/sys/vm

noblacklist /proc/sys/kernel/osrelease
noblacklist /proc/sys/kernel/yama
blacklist /proc/sys/*/*

@topimiettinen
Copy link
Collaborator

What about /proc/sys/dev and /proc/sys/kernel?

@rusty-snake
Copy link
Collaborator Author

/proc/sys/dev

accidentally deleted

/proc/sys/kernel

  • libreoffice wants to fopen /proc/sys/kernel/osrelease. I didn't noticed anything broken.
  • chrom* (tested with brave) does not start if it can not read /proc/sys/kernel/yama/ptrace_scope.

Therefore I used blacklist /proc/sys/*/* except for /proc/sys/kernel/osrelease and /proc/sys/kernel/yama.

@topimiettinen
Copy link
Collaborator

I tried adding an audit rule to check for user's /proc/sys accesses like this

$ cat /etc/audit/rules.d/50-local-proc-sys.rules 
-a always,exit -S all -F dir=/proc/sys -F perm=rwxa -F uid=1000 -k proc-sys

but it does not seem to work.

@rusty-snake rusty-snake marked this pull request as ready for review October 9, 2021 10:45
@smitsohu
Copy link
Collaborator

Can this be merged?

@rusty-snake
Copy link
Collaborator Author

I've nothing to add from my side.

@smitsohu
Copy link
Collaborator

Let's merge.

@smitsohu smitsohu merged commit 72e9016 into netblue30:master Oct 20, 2021
@rusty-snake rusty-snake deleted the disable-proc.inc branch October 20, 2021 14:12
@kmk3 kmk3 added this to In progress in Release 0.9.68 via automation Feb 6, 2022
@kmk3 kmk3 moved this from In progress to To Document (RELNOTES/man) in Release 0.9.68 Feb 6, 2022
@kmk3 kmk3 moved this from To Document (RELNOTES/man) to Done (on RELNOTES) in Release 0.9.68 Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
No open projects
Release 0.9.68
  
Done (on RELNOTES)
Development

Successfully merging this pull request may close these issues.

None yet

3 participants