Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

stage0: use rootfs image permissions with overlay #1607

Merged
merged 3 commits into from Oct 15, 2015

Conversation

iaguis
Copy link
Member

@iaguis iaguis commented Oct 14, 2015

When we use overlay, the permissions that end up in "rootfs/" are the
ones in the upper directory. To fix it, we need to set them as they are
in the image.

Fixes #1581

@steveej
Copy link
Contributor

steveej commented Oct 14, 2015

@krnowak can you explain the mentioned future changes in "We hardcode the permissions for now because this part of the code will be removed soon."?

We hardcode the permissions for now because this part of the code will
be removed soon as part of building multiple stage1 images
simultaneously (rkt#1420).
@alban
Copy link
Member

alban commented Oct 14, 2015

In tests/rkt_userns_test.go, there are a couple of "TODO #1581". Can you fix them as well?

When we use overlay, the permissions that end up in "rootfs/" are the
ones in the upper directory. To fix it, we need to set them as they are
in the image.
@iaguis
Copy link
Member Author

iaguis commented Oct 14, 2015

@krnowak can you explain the mentioned future changes in "We hardcode the permissions for now because this part of the code will be removed soon."?

It was actually me who wrote that :D. @krnowak told me that code will be gone with the fix for #1420. I'll add it to the commit message.

In tests/rkt_userns_test.go, there are a couple of "TODO #1581". Can you fix them as well?

Yes, I'll do that.

@iaguis iaguis force-pushed the fix-overlay-rootfs-permissions branch from a002132 to f6ad96c Compare October 14, 2015 10:35
@iaguis iaguis added this to the v0.10.0 milestone Oct 14, 2015
@iaguis iaguis self-assigned this Oct 14, 2015
@iaguis iaguis force-pushed the fix-overlay-rootfs-permissions branch 3 times, most recently from c80a1d3 to 1030e6f Compare October 14, 2015 14:38
@@ -29,7 +29,8 @@ FTST_EMPTY_IMAGE_MANIFEST := $(FTST_EMPTY_IMAGE_DIR)/manifest

TOPLEVEL_CHECK_STAMPS += $(FTST_FUNCTIONAL_TESTS_STAMP)
INSTALL_FILES += $(FTST_IMAGE_MANIFEST_SRC):$(FTST_IMAGE_MANIFEST):- $(FTST_INSPECT_BINARY):$(FTST_ACI_INSPECT):- $(FTST_EMPTY_IMAGE_MANIFEST_SRC):$(FTST_EMPTY_IMAGE_MANIFEST):- $(FTST_ACE_MAIN_IMAGE_MANIFEST_SRC):$(FTST_ACE_MAIN_IMAGE_MANIFEST):- $(FTST_ACE_SIDEKICK_IMAGE_MANIFEST_SRC):$(FTST_ACE_SIDEKICK_IMAGE_MANIFEST):- $(FTST_ECHO_SERVER_BINARY):$(FTST_ACI_ECHO_SERVER):-
CREATE_DIRS += $(FTST_IMAGE_DIR) $(FTST_IMAGE_ROOTFSDIR) $(FTST_EMPTY_IMAGE_DIR) $(FTST_EMPTY_IMAGE_ROOTFSDIR) $(FTST_IMAGE_TEST_DIRS) $(FTST_TEST_TMP)
CREATE_DIRS += $(FTST_IMAGE_DIR) $(FTST_EMPTY_IMAGE_DIR) $(FTST_EMPTY_IMAGE_ROOTFSDIR) $(FTST_IMAGE_TEST_DIRS) $(FTST_TEST_TMP)
INSTALL_DIRS += $(FTST_IMAGE_ROOTFSDIR):0755
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't 0755 a default for directories anyway?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on your umask

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, sounds like yet another reason for deprecating the CREATE_DIRS variable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking forward to it :P

@krnowak
Copy link
Collaborator

krnowak commented Oct 15, 2015

One question above.

The build system part is "ew!", but other parts LFAD.

@alban
Copy link
Member

alban commented Oct 15, 2015

In tests/rkt_userns_test.go, there are a couple of "TODO #1581". Can you fix them as well?

Yes, I'll do that.

I read tests/rkt_userns_test.go again and it actually only tests with --no-overlay. We would like to test this:

With userns Without userns
With overlay ❌ (not testable, see #1057) ⁉️ (if possible; Semaphore does not support overlay)
Without overlay ✅ (always) ✅ (always)

@iaguis
Copy link
Member Author

iaguis commented Oct 15, 2015

I tested with overlay enabled on my machine (removing the rkt group because of #1602) and the test passes.

It'd be great to run all the tests with and without overlay but Semaphore doesn't support overlay...

We create the rkt-inspect.aci with a rootfs with permissions 755 and
then check that those are 755 at execution time.

Also, we check stage1's rootfs permissions, they should always be 750.
@iaguis iaguis force-pushed the fix-overlay-rootfs-permissions branch from 1030e6f to b154431 Compare October 15, 2015 13:27
@iaguis
Copy link
Member Author

iaguis commented Oct 15, 2015

Added a comment about testing with overlay fs.

@alban
Copy link
Member

alban commented Oct 15, 2015

LGTM but can you add a follow-up issue/PR for the overlay fs test (even if it is skipped on Semaphore)?

@iaguis
Copy link
Member Author

iaguis commented Oct 15, 2015

#1613

@iaguis
Copy link
Member Author

iaguis commented Oct 15, 2015

Thanks!

iaguis added a commit that referenced this pull request Oct 15, 2015
stage0: use rootfs image permissions with overlay
@iaguis iaguis merged commit 8826d83 into rkt:master Oct 15, 2015
alban added a commit to alban/rkt that referenced this pull request Oct 21, 2015
Setting the group of the rootfs to 'rkt' causes problems with user
namespaces when the group is not mapped in the user namespace. It
prevents the container from doing a 'mkdir' or a 'lstat' on /proc. See
systemd/systemd#1585

Setting the group ownership of the rootfs to 'rkt' was done in
rkt#1452 so that the command 'rkt status'
could work as non-root. However, the rootfs should now be r+x by others
since rkt#1607 so setting the group is
not necessary anymore.

This patch reverts a part of rkt#1602,
therefore fixing the regression with user namespaces. 'rkt status' as
non-root still works.

Fixes rkt#1602
alban added a commit to alban/rkt that referenced this pull request Oct 21, 2015
Setting the group of the rootfs to 'rkt' causes problems with user
namespaces when the group is not mapped in the user namespace. It
prevents the container from doing a 'mkdir' or a 'lstat' on /proc. See
systemd/systemd#1585

Setting the group ownership of the rootfs to 'rkt' was done in
rkt#1452 so that the command 'rkt status'
could work as non-root. However, the rootfs should now be r+x by others
since rkt#1607 so setting the group is
not necessary anymore.

This patch reverts a part of rkt#1602,
therefore fixing the regression with user namespaces. 'rkt status' as
non-root still works.

Fixes rkt#1602
alban added a commit to alban/rkt that referenced this pull request Oct 21, 2015
Setting the group of the rootfs to 'rkt' causes problems with user
namespaces when the group is not mapped in the user namespace. It
prevents the container from doing a 'mkdir' or a 'lstat' on /proc. See
systemd/systemd#1585

Setting the group ownership of the rootfs to 'rkt' was done in
rkt#1452 so that the command 'rkt status'
could work as non-root. However, if the rootfs is r-x for others, setting
the group should not be necessary. r-x for others was removed by
rkt#1607 but I am adding it back.

This patch reverts a part of rkt#1602,
therefore fixing the regression with user namespaces. 'rkt status' as
non-root still works.

Fixes rkt#1602
alban added a commit to alban/rkt that referenced this pull request Oct 21, 2015
Setting the group of the rootfs to 'rkt' causes problems with user
namespaces when the group is not mapped in the user namespace. It
prevents the container from doing a 'mkdir' or a 'lstat' on /proc. See
systemd/systemd#1585

Setting the group ownership of the rootfs to 'rkt' was done in
rkt#1452 so that the command 'rkt status'
could work as non-root. However, if the rootfs is r-x for others, setting
the group should not be necessary. r-x for others was removed by
rkt#1607 but I am adding it back.

This patch reverts a part of rkt#1602,
therefore fixing the regression with user namespaces. 'rkt status' as
non-root still works.

Fixes rkt#1602
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--no-overlayfs changes the permissions of the rootfs
4 participants