-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
user namespace bugfixes and features #6865
Closed
Closed
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5a3a6e8
Take user namespaces into account in policy checks
Blub d945593
Add user_ns_exec helper for the test suite
Blub 93d641c
Add regression test for user namespaces.
Blub 35accc8
Support mounting from user namespaces
Blub c0781ed
Support numeric ids in zfs allow
Blub f8e6711
Add tests for mounting in user namespaces
Blub 6644317
User namespace support for ZFS_IOC_GET/SET_FSACL
Blub c82eda6
Honor user namespace privileges with zfs unallow
Blub File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -697,7 +697,7 @@ tags = ['functional', 'upgrade'] | |
|
||
# user_namespace_001 - https://github.com/zfsonlinux/zfs/issues/6800 | ||
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. We shouldn't need to link to the issue once this functionality works and has test coverage. So this can be dropped. |
||
[tests/functional/user_namespace] | ||
tests = ['user_namespace_001', 'user_namespace_002'] | ||
tests = ['user_namespace_001', 'user_namespace_002', 'user_namespace_003'] | ||
tags = ['functional', 'user_namespace'] | ||
|
||
[tests/functional/userquota] | ||
|
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
70 changes: 70 additions & 0 deletions
70
tests/zfs-tests/tests/functional/user_namespace/user_namespace_003.ksh
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,70 @@ | ||
#!/bin/ksh -p | ||
# | ||
# CDDL HEADER START | ||
# | ||
# The contents of this file are subject to the terms of the | ||
# Common Development and Distribution License (the "License"). | ||
# You may not use this file except in compliance with the License. | ||
# | ||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | ||
# or http://www.opensolaris.org/os/licensing. | ||
# See the License for the specific language governing permissions | ||
# and limitations under the License. | ||
# | ||
# When distributing Covered Code, include this CDDL HEADER in each | ||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. | ||
# If applicable, add the following below this CDDL HEADER, with the | ||
# fields enclosed by brackets "[]" replaced with your own identifying | ||
# information: Portions Copyright [yyyy] [name of copyright owner] | ||
# | ||
# CDDL HEADER END | ||
# | ||
|
||
. $STF_SUITE/tests/functional/user_namespace/user_namespace_common.kshlib | ||
|
||
# | ||
# | ||
# DESCRIPTION: | ||
# Test mapping of users when using 'zfs allow'. | ||
# | ||
# | ||
# STRATEGY: | ||
# 1. Create datasets for users. | ||
# 2. Delegate permissions to the unprivileged root user. | ||
# 3. Verify 'zfs allow' that inside the namespace shows the correct user. | ||
# 4. Verify that running 'zfs allow' inside a user namespace maps uids. | ||
# | ||
|
||
verify_runnable "both" | ||
|
||
log_must add_group $STAFF_GROUP | ||
log_must add_user $STAFF_GROUP $STAFF_USER | ||
function cleanup | ||
{ | ||
log_must del_user $STAFF_USER | ||
log_must del_group $STAFF_GROUP | ||
} | ||
log_onexit cleanup | ||
|
||
log_assert "Check user mapping in user namespaces" | ||
|
||
# Test with a permission which needs no extra capabilities such as mounting... | ||
typeset perm="snapshot_limit" | ||
typeset perm_state_1="none" | ||
typeset perm_state_2="3" | ||
|
||
log_must zfs create -o ${perm}=${perm_state_1} $USER_TESTFS | ||
log_must chown $ROOT_UID:$ROOT_UID $USER_TESTDIR | ||
|
||
# allow the unprivileged root to pass on permissions | ||
log_must zfs allow -u $ROOT_UID ${perm},allow $USER_TESTFS | ||
# from within the user namespace, allow $STAFF_USER to create a dataset | ||
log_must user_ns_exec zfs allow $STAFF_USER ${perm} $USER_TESTFS | ||
# make sure the staff user *outside* the user namespace is not affected | ||
log_mustnot chg_usr_exec $STAFF_USER zfs set ${perm}=${perm_state_2} $USER_TESTFS | ||
# make sure the staff user *inside* the user namespace functions as expected | ||
log_must user_ns_exec chg_usr_exec $STAFF_USER zfs set ${perm}=${perm_state_2} $USER_TESTFS | ||
|
||
log_must zfs destroy -r $USER_TESTFS | ||
|
||
log_pass "Check user mapping in user namespaces" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 need this
put_nvlist
in the !CONFIG_USER_NS case as well.