Skip to content

Conversation

@dvdksn
Copy link
Contributor

@dvdksn dvdksn commented Nov 3, 2025

Signed-off-by: David Karlsson [email protected]

Description

The current instruction is technically incorrect since we are not exporting the
filename variable and the instruction suggests that users should run this
discretely. This PR adds an export statement as well as a quick check to make
sure the file exists before attempting to move it into the apparmor directory
(to prevent users from accidentally sudo mving their home directory there in
case $filename is unset)

Related issues or tickets

@netlify
Copy link

netlify bot commented Nov 3, 2025

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit eb9d593
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/690872dc9d866b0008de46f9
😎 Deploy Preview https://deploy-preview-23642--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added area/engine Issue affects Docker engine/daemon area/security labels Nov 3, 2025
@dvdksn dvdksn requested a review from thaJeztah November 3, 2025 09:16

```console
$ filename=$(echo $HOME/bin/rootlesskit | sed -e s@^/@@ -e s@/@.@g)
$ export filename=$(echo $HOME/bin/rootlesskit | sed -e s@^/@@ -e s@/@.@g)
Copy link
Contributor

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:

Suggested change
$ export filename=$(echo $HOME/bin/rootlesskit | sed -e s@^/@@ -e s@/@.@g)
$ filename=$(echo $HOME/bin/rootlesskit | sed -e 's@^/@@' -e 's@/@.@g')

Comment on lines 29 to 39
$ 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}
Copy link
Contributor

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:

Suggested change
$ [ -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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/engine Issue affects Docker engine/daemon area/security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dangerous instruction

2 participants