-
Notifications
You must be signed in to change notification settings - Fork 240
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
Subids: support nsswitch #321
Conversation
8a640f6
to
b9c48ff
Compare
I'll address your feedback with appended patches (which I will squash in before merging) soon, but probably not today. |
Hi @hallyn, thank you for opening PR. Please see few inline comments. Besides that I think this PR should update It's even more prominent with Additionally, could you please clarify, if
|
Issue shadow-maint#297 reported seeing *** Warning: Linking the shared library libsubid.la against the *** static library ../libmisc/libmisc.a is not portable! which commit b5fb1b3 was supposed to fix. But a few commits later it's back. So try to fix it in the way the bug reporter suggested. This broke builds some other ways, namely a few missing library specifications, so add those. Signed-off-by: Serge Hallyn <[email protected]>
f3d619a
to
7615cad
Compare
Thanks @hallyn This looks good. |
I probably need to have configure.ac look for yacc+libtool (per my .travis.yaml update), then depending on the open thread it should be ready. |
Hi @hallyn, thanks for an update. Good progress. In the comments to
'owner' is described instead of 'id'. And what do you think about #321 (comment) ?
|
Yes, id_type before the output value uids makes sense. Sorry - if you've mentioned this before, I don't remember it. |
Yeah, I can rename those. I also was going to actually comment the api.h functions :) But maybe as a separate commit since technically that's libsubid, and nss support is a core shadow feature. |
BTW I do notice that it's a bit inconsistent that find_subid_owners returns uids while the others take a char *username. I'm loath to change that though - since we can have more than one name per uid, it seems sensible |
I've merged them into subid.h. Since you're already massaging the files in your package, can you verify that the way I have it will work for you? If so, then I'll merge. |
Closes shadow-maint#154 When starting any operation to do with subuid delegation, check nsswitch for a module to use. If none is specified, then use the traditional /etc/subuid and /etc/subgid files. Currently only one module is supported, and there is no fallback to the files on errors. Several possibilities could be considered: 1. in case of connection error, fall back to files 2. in case of unknown user, also fall back to files etc... When non-files nss module is used, functions to edit the range are not supported. It may make sense to support it, but it also may make sense to require another tool to be used. libsubordinateio also uses the nss_ helpers. This is how for instance lxc could easily be converted to supporting nsswitch. Add a set of test cases, including a dummy libsubid_zzz module. This hardcodes values such that: 'ubuntu' gets 200000 - 300000 'user1' gets 100000 - 165536 'error' emulates an nss module error 'unknown' emulates a user unknown to the nss module 'conn' emulates a connection error ot the nss module Changes to libsubid: Change the list_owner_ranges api: return a count instead of making the array null terminated. This is a breaking change, so bump the libsubid abi major number. Rename free_subuid_range and free_subgid_range to ungrant_subuid_range, because otherwise it's confusing with free_subid_ranges which frees memory. Run libsubid tests in jenkins Switch argument order in find_subid_owners Move the db locking into subordinateio.c Signed-off-by: Serge Hallyn <[email protected]>
Move libsubid/api.h into libsubid/subid.h, and document the api in subid.h Signed-off-by: Serge Hallyn <[email protected]>
with out also doing '-' Signed-off-by: Serge Hallyn <[email protected]>
Otherwise our su -p uses bash if that is what root was configured to use, and then fails to read /root/ for .bash_profile. This caused an unexpected error message in /tmp/err, failing the test. Signed-off-by: Serge Hallyn <[email protected]>
HOME has to start as /root since we are testing that su didn't change it. Signed-off-by: Serge Hallyn <[email protected]>
Thank you, @hallyn. |
@alexey-tikhonov @giuseppe @AkihiroSuda @ikerexxe @rhatdan Thanks for all your helpful comments. |
@hallyn thanks to you for your work.
Yes, that's perfectly fine. |
Hi, not sure if this is a best place, but I'd like to discuss one thing. Currently That's ok for @hallyn , what do you think? |
Thanks, good point. We shouldn't do that. Do you mind opening a new issue for that? If so (if you mind :) I'll open one later. |
one potential issue I've found is that $ make install DESTDIR=$(pwd)/dest >/dev/null && find dest -name subid.h
libtool: warning: remember to run 'libtool --finish /lib'
$ |
Hi @hallyn , looking at the usage of
|
Btw, if we suppose that a given subid can be used by multiple users (uids), then probably usage of |
Another one question about UPD: it seems grant/ungrant rely on this field. |
So maybe we should have something like: struct subordinate_id_range { struct subordinate_delegated { ? Although simply saying that it's ok to leave the subordinate_range->owner So if you like we can add a comment in these function descriptions saying |
Should be fixed with #330 |
Would you mind creating a new issue for these as well? It'll be very hard to track conversation in this issue. I don't mind dropping has_any_range(), I think I thought something like lxc-usernsexec could use it, but it can just as well just ask for the ranges and get back -ENOENT. For the second, I think you're saying that useradd should ignore the failure to add subids? |
Ok: #331. Just wasn't sure if you see this as an issue.
No, I meant a little bit different thing. |
I think my preference would be a solution with two structs (this is very similar to what I have in SSSD's plugin now). |
When starting any operation to do with subuid delegation, check
nsswitch for a module to use. If none is specified, then use
the traditional /etc/subuid and /etc/subgid files.
Currently only one module is supported, and there is no fallback
to the files on errors. Several possibilities could be considered:
etc...
When non-files nss module is used, functions to edit the range
are not supported. It may make sense to support it, but it also
may make sense to require another tool to be used.
libsubordinateio also uses the nss_ helpers. This is how for instance
lxc could easily be converted to supporting nsswitch.
Add a set of test cases, including a dummy libsubid_zzz module. This
hardcodes values such that:
'ubuntu' gets 200000 - 300000
'user1' gets 100000 - 165536
'error' emulates an nss module error
'unknown' emulates a user unknown to the nss module
'conn' emulates a connection error ot the nss module