We are required to use fapolicyd on our linux servers. This prevents running code from our home directory. We do not want to exempt the entire home directory from fapolicyd, but I'm having trouble finding a flexible way to allow just vscode and a few extensions.
I tried using a shared read-only vscode-server directory to limit the scope, but every user needs write access, which makes this no better than exempting the entire home directory.
I cannot use globs in the fapolicyd rules, so I can't add /home//.vscode-server/code- (et. al).
We have many potential users, and that number fluctuates, so I really don't want to enumerate /home/user1/..., /home/user2/..., etc.
Is there a better solution for this?
I've found the lack of glob or regexp support in fapolicyd frustrating as well for exactly the same reason. I've succeeded as follows. The first bit is fairly clean but the second part is a bit of a hack. I'd love to know if someone else has come up with a more elegant solution
Enable the downloaded executable to be run. I add the following rule to 06-custom_allow.rules (where $gituserid is the user id of the developer and $username is the username):
allow_audit perm=execute gid=$gituserid exe=/usr/bin/bash : ftype=application/x-executable dir=/home/$username/.vscode-server/
Enable VS Code Server to run. This is harder because the create a whole new directory and set of files whenever the extension is updated. To get round this I run the following script every time it stops working due to an extension update
Every now and then you probably need to clean up the .vscode-server/bin directory or it will accumulate different versions and making the vscode-server trust file long