-
Notifications
You must be signed in to change notification settings - Fork 8k
engine: safer creation of rootlesskit apparmor profile #23642
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: David Karlsson <[email protected]>
✅ Deploy Preview for docsdocker ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
|
||
| ```console | ||
| $ filename=$(echo $HOME/bin/rootlesskit | sed -e s@^/@@ -e s@/@.@g) | ||
| $ export filename=$(echo $HOME/bin/rootlesskit | sed -e s@^/@@ -e s@/@.@g) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export is probably not needed here.
We should probably quote the sed commands just to be sure:
| $ export filename=$(echo $HOME/bin/rootlesskit | sed -e s@^/@@ -e s@/@.@g) | |
| $ filename=$(echo $HOME/bin/rootlesskit | sed -e 's@^/@@' -e 's@/@.@g') |
| $ cat <<EOF > ~/${filename} | ||
| abi <abi/4.0>, | ||
| include <tunables/global> | ||
|
|
||
| "$HOME/bin/rootlesskit" flags=(unconfined) { | ||
| userns, | ||
|
|
||
| include if exists <local/${filename}> | ||
| } | ||
| EOF | ||
| $ sudo mv ~/${filename} /etc/apparmor.d/${filename} | ||
| $ [ -f ~/"${filename}" ] && sudo mv ~/${filename} /etc/apparmor.d/${filename} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably write directly to the target file:
| $ [ -f ~/"${filename}" ] && sudo cat <<EOF > /etc/apparmor.d/${filename} | |
| abi <abi/4.0>, | |
| include <tunables/global> | |
| @@ -36,7 +36,7 @@ | |
| include if exists <local/${filename}> | |
| } | |
| EOF |
Signed-off-by: David Karlsson [email protected]
Description
The current instruction is technically incorrect since we are not exporting the
filenamevariable and the instruction suggests that users should run thisdiscretely. This PR adds an
exportstatement as well as a quick check to makesure the file exists before attempting to move it into the apparmor directory
(to prevent users from accidentally
sudo mving their home directory there incase
$filenameis unset)Related issues or tickets