-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pebble): /var/lib/pebble/default has mode 0777 (#473)
This commit ensures that the PEBBLE default directory /var/lib/pebble/default always has the mode 0777. Previously, the mode of the PEBBLE dir was only set to 0777 if there were services or checks specified in the rockcraft.yaml. Otherwise, it used to be 0755 with user=root group=root. This meant that if pebble was being run as some user other than root, using the `run-user` directive or some other way, the pebble run would fail. It would fail because pebble could not create the necessary files (socket) inside that directory. This bug is reported in issue #461. Fixes #461
- Loading branch information
1 parent
96d2392
commit 72c1af5
Showing
5 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: run-user-minimal-test | ||
version: latest | ||
summary: A minimal rock with a non-root user | ||
description: A minimal rock that has a non-root default user | ||
license: GPL-3.0 | ||
|
||
base: [email protected] | ||
|
||
platforms: | ||
amd64: | ||
|
||
run-user: _daemon_ | ||
|
||
parts: | ||
my-part: | ||
plugin: nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
summary: non-root run-user minimal test | ||
|
||
execute: | | ||
run_rockcraft pack | ||
test -f run-user-minimal-test_latest_amd64.rock | ||
test ! -d work | ||
# Ensure docker does not have this container image | ||
docker rmi --force run-user-minimal-test | ||
# Install container | ||
sudo /snap/rockcraft/current/bin/skopeo --insecure-policy copy \ | ||
oci-archive:run-user-minimal-test_latest_amd64.rock \ | ||
docker-daemon:run-user-minimal-test:latest | ||
# Ensure container exists | ||
docker images run-user-minimal-test | MATCH "run-user-minimal-test" | ||
docker inspect run-user-minimal-test --format '{{.Config.User}}' | \ | ||
MATCH "_daemon_" | ||
# ensure username | ||
docker run --rm --entrypoint /bin/sh run-user-minimal-test \ | ||
-c 'whoami' | MATCH "_daemon_" | ||
docker run --rm run-user-minimal-test exec whoami | MATCH "_daemon_" | ||
# check $HOME = /var/lib/pebble/default for non-root user | ||
docker run --rm run-user-minimal-test exec \ | ||
env | MATCH "HOME=/var/lib/pebble/default" | ||
docker run --rm run-user-minimal-test exec \ | ||
pwd | MATCH "/var/lib/pebble/default" | ||
# check permission of /var/lib/pebble/default directory | ||
docker run --rm run-user-minimal-test exec \ | ||
stat --format="%a" /var/lib/pebble/default | MATCH "777" | ||
# check file creation capability of non-root user | ||
docker run --rm run-user-minimal-test exec \ | ||
/bin/sh -c 'touch foo; ls' | MATCH foo | ||
restore: | | ||
rm -f run-user-minimal-test_latest_amd64.rock | ||
docker rmi -f run-user-minimal-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters