-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
--read-write-tmpfs=false should set /dev/* tmpfs to readonly #12954
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
####> This option file is used in: | ||
####> podman create, run | ||
####> If you edit this file, make sure your changes | ||
####> are applicable to all of those. | ||
#### **--read-write-tmpfs** | ||
|
||
If container is running in --read-only mode, when true Podman mounts a | ||
read-write tmpfs on _/run_, _/tmp_, and _/var/tmp_. When false, Podman sets | ||
the entire container such that no tmpfs can be written to unless specified on | ||
the command line. Podman mounts _/dev_, _/dev/mqueue_, _/dev/pts_, _/dev/shm_ | ||
as read only. The default is *true* | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -329,7 +329,7 @@ Suppress output information when pulling images | |
|
||
@@option read-only | ||
|
||
@@option read-only-tmpfs | ||
@@option read-write-tmpfs | ||
|
||
@@option replace | ||
|
||
|
@@ -455,12 +455,12 @@ made more secure by running them in read-only mode using the **--read-only** swi | |
This protects the container's image from modification. By default read-only | ||
containers can write to temporary data. Podman mounts a tmpfs on _/run_ and | ||
_/tmp_ within the container. If the container should not write to any file | ||
system within the container, including tmpfs, set --read-only-tmpfs=false. | ||
system within the container, including tmpfs, set --read-write-tmpfs=false. | ||
|
||
``` | ||
$ podman run --read-only -i -t fedora /bin/bash | ||
|
||
$ podman run --read-only --read-only-tmpfs=false --tmpfs /run -i -t fedora /bin/bash | ||
$ podman run --read-only --read-write-tmpfs=false --tmpfs /run -i -t fedora /bin/bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (commenting on code that github does not show by default, so please click the uparrow-on-bar to see lines 473-475). Those lines read:
This looks like a holdover from a previous age: the implication is that
(Idea only. That reads horribly. My documentation-writing brain is not fully engaged yet). |
||
``` | ||
|
||
### Exposing log messages from the container to the host's log | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -836,6 +836,25 @@ EOF | |
is "${lines[0]}" ".*${HOST}.*" | ||
} | ||
|
||
@test "podman run --read-write-tmpfs" { | ||
# FIXME once ubuntu gets a newer crun | ||
if is_ubuntu; then | ||
if [ $(podman_runtime) == "crun" ]; then | ||
skip "The version of crun shipped by ubuntu is too old. Needs crun-1.4.2 or greater" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have a |
||
fi | ||
fi | ||
HOST=$(random_string 25) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. leftover from copy/paste (hence misleading, because it's never used). Please remove. |
||
run_podman 1 run --rm --read-only $IMAGE touch /foo | ||
is "$output" "touch: /foo: Read-only file system" "Should fail with read only file system" | ||
|
||
for rwdir in /run /tmp /var/tmp /dev /dev/shm; do | ||
run_podman run --rm --read-only $IMAGE touch ${rwdir}/foo | ||
run_podman run --rm --read-only --read-write-tmpfs=true $IMAGE touch ${rwdir}/foo | ||
run_podman 1 run --rm --read-only --read-write-tmpfs=false $IMAGE touch ${rwdir}/foo | ||
is "$output" "touch: ${rwdir}/foo: Read-only file system" "Should fail with ${rwdir}/foo read only file system" | ||
Comment on lines
+851
to
+854
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent indentation: some of these are tabs, some are eight spaces. |
||
done | ||
} | ||
|
||
@test "podman run doesn't override oom-score-adj" { | ||
current_oom_score_adj=$(cat /proc/self/oom_score_adj) | ||
run_podman run --rm $IMAGE cat /proc/self/oom_score_adj | ||
|
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.
I find this hard to parse, and am really confused by the discrepancies between the first list of "these are tmpfs" and the second. I'm just going to hope that @TomSweeneyRedHat will offer his always-helpful input. Otherwise my (much less refined) thinking goes something like: