-
Notifications
You must be signed in to change notification settings - Fork 36
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
RFE: Allow for generic "subject" kinds with arbitrary metadata attributes #22
Comments
In gitlab.freedesktop.org by bugzilla-migration on Apr 26, 2013, 16:36 💬 Miloslav Trmac said: (All IMHO, and without spending that much time thinking about it.) For handling remote subjects, and for the polkit configuration to make sense, subject identity should have meaning within the whole system without referring to a particular application (for example, an X.509 DN is suspect because it depends on what CA the application accepts). I can't see much value in moving application-specific authorization rules for application-specific subjects to the system-wide polkit service. Yes, there'd be a single place to configure "everything", but every application would still be configured differently. Having a "domain" system that is configured system-wide and an uniform way to refer to subjects within that domain would be very vaulable (and it might allow us to start escaping the limitations of integer UIDs). For local clients, I don't think applications are expected to do their own authentication, the IPC system together with polkit should handle it mostly transparently (as it does when the subject is a D-Bus endpoint). Would I be wrong in viewing SASL over AF_UNIX as a case of a "remote" subject that is only using a more optimized socket type? (Sure, without having support for remote subjects and SASL it doesn't help libvirt at this point.) Having alternative subject identifications for a single connection has problematic semantics - what if the x509 cert (or local user account) is allowed but the SASL username is prohibited? I'd much prefer a "domain" model where the subject's identity is unambiguous and unique, possibly supporting several alternative ways to authenticate that identity, e.g. SASL, x.509, SCM_CREDS - but the result should be a single identity. Arbitrary (key valure) pairs are generally a poor way to write an API. It is structurally non-ABI-breaking, fully compatible and fully extensible, but actually it tends to only move the ABI, compatibility and extensibility concerns from the language level (where we have automated tools to help) to the semantic level (where we don't and can't have such tools). |
In gitlab.freedesktop.org by bugzilla-migration on Apr 26, 2013, 17:38 💬 Daniel P. Berrange said: (In reply to comment 1)
It is easy to provide the x509 DN of the CA, alongside the DN of
I think you're understating the benefits of having a single place to Furthermore, the point of using a library/protocol like SASL for the
I think you're trying to make a distinction that doesn't need to/shouldn't NB DBus itself could provide a SASL username, if someone defines an authorization
You already have that problem today. A client process can be associated
This is pretty much irrelevant FUD. |
In gitlab.freedesktop.org by bugzilla-migration on Apr 26, 2013, 18:20 💬 Miloslav Trmac said: (In reply to comment 2)
I agree with that, however I'd like this to be simplified even more to the "domain" concept or something similar. I'd like not to end up with a authorization meta-framework (running arbitrary JavaScript) connecting other meta-frameworks (like SASL)...
Yes, polkit is separate from authentication shouldn't need to care about who has done the authentication. The result of authentication should be a "subject" that identifies a principal, not a set of values that describe in detail the authentication. In the ideal split, authentication has happened "satisfactorily" (whatever that means) before polkit comes into play and polkit does not need to care about who did the authentication or how it happened. (There is probably a gap in the platform for defining the authorization policy; PAM, and especially its use in polkit, is not a good fit for network protocols.)
The "default" for other AF_UNIX-using IPCs is to use SO_PEERCRED or similar to get a PID, and use that as a subject. Other applications can use any other way to identify the local user - but if it is a local user that is being identified, the subject should say which local user, and not describe SASL or whatever has been used.
I'm conflicted about the concept of letting a principal use the system, and then restrict authorization for some operations depending on how they were authenticated. It makes it much more difficult to reason about the provided protection (e.g. I can login using a password only, modify ~/.bashrc, and then wait for the user to login using a smard card). OTOH the password prompts that we have now are exactly that kind of mechanism.
Sure, it's separate from the question of whether to support the concept at all. It's my implementation preference, other comaintainers may well have different opinions. |
In gitlab.freedesktop.org by bugzilla-migration on Apr 29, 2013, 20:51 💬 Tomas Mraz said: IMHO there is missing step of mapping user credentials that are produced by authentication to uniquely identified principal (eventually with @Domain part) that could be passed to polkit. It would be nothing but a hack to pass to polkit for example raw DN from a client certificate obtained from TLS or other arbitrary name/value pairs. See for example pam_pkcs11 how it handles mapping from the certificate DN to user names. Eventual auxilliary data that could be useful for authorization decisions might be remote hostname and the authentication mechanism used. |
In gitlab.freedesktop.org by bugzilla-migration on Apr 29, 2013, 20:54 💬 Miloslav Trmac said: Stef, Tomas, others... this seems as good a place as any to try to form a plan for handling network users within polkit. (Focusing on the supported concept of user identity, not on the authorization rule mechanism.) It needs to be consistent with the rest of the system (sssd/realmd, other components?), and I'm not quite sure what to do about application-specific concepts of "users". I'd much prefer not supporting them at all in polkit, because once they become supported, we won't be able to get rid of them. OTOH perhaps a generic "network user: (realm, name)" concept would make sense? If we need to support users from several realms within a single computer (do we?), adding "virtual realms" to be able to express applicaton-specific identity concepts would perhaps not hurt. |
In gitlab.freedesktop.org by bugzilla-migration on Jun 18, 2013, 16:20 💬 Stef Walter said: (In reply to comment 5)
The problem here is that many realms have trust relationships. So you sorta have to define the user not only by the realm, but which realm it is transiently trusted by. Such a mess. This is when the SID stuff in Windows is really quite nice :) |
In gitlab.freedesktop.org by bugzilla-migration on Jun 18, 2013, 22:40 💬 Miloslav Trmac said: (In reply to comment 6)
I'm not sure I understand - are you saying that the path matters, and that that e.g. "mitr@RedHatRealm trusted by MicrosoftRealm trusted by FreeDesktopRealm" and "mitr@RedHatRealm trusted by FreeDesktopRealm" would have different security properties? Or just that having a "FreeDesktopRealm" configured might mean we might see users from RedHatRealm without having local information about RedHatRealm? |
Otherwise it gets leaked: [356645.511913] systemd[1]: Stopping polkit.service - Authorization Manager... [356645.514024] polkitd[15468]: Handling SIGTERM [356645.514024] polkitd[15468]: Shutting down [356645.519238] polkitd[15468]: Exiting with code 0 [356645.618456] polkitd[15468]: ================================================================= [356645.618456] polkitd[15468]: ==15468==ERROR: LeakSanitizer: detected memory leaks [356645.618456] polkitd[15468]: Direct leak of 4000 byte(s) in 50 object(s) allocated from: [356645.619128] polkitd[15468]: #0 0x0000004a1a33 in malloc (/usr/lib/polkit-1/polkitd+0x4a1a33) (BuildId: a927b98f2ddc1b57773bec4e0f8a537fe46632b1) [356645.619128] polkitd[15468]: #1 0x7f1b20324039 in g_malloc (/lib64/libglib-2.0.so.0+0x47039) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #2 0x7f1b2033d4d4 in g_slice_alloc (/lib64/libglib-2.0.so.0+0x604d4) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #3 0x7f1b2036b547 in g_variant_iter_new (/lib64/libglib-2.0.so.0+0x8e547) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: polkit-org#4 0x7f1b2036dc5d (/lib64/libglib-2.0.so.0+0x90c5d) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: polkit-org#5 0x7f1b2036d8b7 (/lib64/libglib-2.0.so.0+0x908b7) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: polkit-org#6 0x7f1b2036de0f in g_variant_get_va (/lib64/libglib-2.0.so.0+0x90e0f) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: polkit-org#7 0x7f1b2036df88 in g_variant_get (/lib64/libglib-2.0.so.0+0x90f88) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: polkit-org#8 0x7f1b2067ce85 in polkit_system_bus_name_get_creds_sync /root/polkit/build/../src/polkit/polkitsystembusname.c:542:3 [356645.619128] polkitd[15468]: polkit-org#9 0x7f1b2067c997 in polkit_system_bus_name_get_process_sync /root/polkit/build/../src/polkit/polkitsystembusname.c:629:8 [356645.619128] polkitd[15468]: polkit-org#10 0x0000005069af in polkit_backend_session_monitor_get_session_for_subject /root/polkit/build/../src/polkitbackend/polkitbackendsessionmonitor-systemd.c:365:41 [356645.619128] polkitd[15468]: polkit-org#11 0x0000004f11b5 in polkit_backend_interactive_authority_revoke_temporary_authorization_by_id /root/polkit/build/../src/polkitbackend/polkitbackendinteractiveauthority.c:3567:24 [356645.619128] polkitd[15468]: polkit-org#12 0x0000004ea2c8 in server_handle_revoke_temporary_authorization_by_id /root/polkit/build/../src/polkitbackend/polkitbackendauthority.c:1292:8 [356645.619128] polkitd[15468]: polkit-org#13 0x0000004e805c in server_handle_method_call /root/polkit/build/../src/polkitbackend/polkitbackendauthority.c:1346:5 [356645.619128] polkitd[15468]: polkit-org#14 0x7f1b20565195 (/lib64/libgio-2.0.so.0+0xd9195) (BuildId: d06dc1cc6f8ddbb3cda89ef05ecf83d6fe037ae7) [356645.619332] polkitd[15468]: polkit-org#15 0x7f1b20323e5c (/lib64/libglib-2.0.so.0+0x46e5c) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: polkit-org#16 0x7f1b2031d60b (/lib64/libglib-2.0.so.0+0x4060b) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: polkit-org#17 0x7f1b2037db37 (/lib64/libglib-2.0.so.0+0xa0b37) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: polkit-org#18 0x7f1b203236f6 in g_main_loop_run (/lib64/libglib-2.0.so.0+0x466f6) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: polkit-org#19 0x0000004e3619 in main /root/polkit/build/../src/polkitbackend/polkitd.c:298:3 [356645.619332] polkitd[15468]: polkit-org#20 0x7f1b1fe59447 in __libc_start_call_main (/lib64/libc.so.6+0x3447) (BuildId: f3ac204eaa4ceed81438c80e80998209f828bb1a) [356645.619332] polkitd[15468]: polkit-org#21 0x7f1b1fe5950a in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x350a) (BuildId: f3ac204eaa4ceed81438c80e80998209f828bb1a) [356645.619332] polkitd[15468]: polkit-org#22 0x000000401c04 in _start (/usr/lib/polkit-1/polkitd+0x401c04) (BuildId: a927b98f2ddc1b57773bec4e0f8a537fe46632b1) ... Follow-up for 8cabb11.
Otherwise it gets leaked: [356645.511913] systemd[1]: Stopping polkit.service - Authorization Manager... [356645.514024] polkitd[15468]: Handling SIGTERM [356645.514024] polkitd[15468]: Shutting down [356645.519238] polkitd[15468]: Exiting with code 0 [356645.618456] polkitd[15468]: ================================================================= [356645.618456] polkitd[15468]: ==15468==ERROR: LeakSanitizer: detected memory leaks [356645.618456] polkitd[15468]: Direct leak of 4000 byte(s) in 50 object(s) allocated from: [356645.619128] polkitd[15468]: #0 0x0000004a1a33 in malloc (/usr/lib/polkit-1/polkitd+0x4a1a33) (BuildId: a927b98f2ddc1b57773bec4e0f8a537fe46632b1) [356645.619128] polkitd[15468]: #1 0x7f1b20324039 in g_malloc (/lib64/libglib-2.0.so.0+0x47039) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #2 0x7f1b2033d4d4 in g_slice_alloc (/lib64/libglib-2.0.so.0+0x604d4) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #3 0x7f1b2036b547 in g_variant_iter_new (/lib64/libglib-2.0.so.0+0x8e547) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #4 0x7f1b2036dc5d (/lib64/libglib-2.0.so.0+0x90c5d) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #5 0x7f1b2036d8b7 (/lib64/libglib-2.0.so.0+0x908b7) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #6 0x7f1b2036de0f in g_variant_get_va (/lib64/libglib-2.0.so.0+0x90e0f) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #7 0x7f1b2036df88 in g_variant_get (/lib64/libglib-2.0.so.0+0x90f88) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619128] polkitd[15468]: #8 0x7f1b2067ce85 in polkit_system_bus_name_get_creds_sync /root/polkit/build/../src/polkit/polkitsystembusname.c:542:3 [356645.619128] polkitd[15468]: #9 0x7f1b2067c997 in polkit_system_bus_name_get_process_sync /root/polkit/build/../src/polkit/polkitsystembusname.c:629:8 [356645.619128] polkitd[15468]: #10 0x0000005069af in polkit_backend_session_monitor_get_session_for_subject /root/polkit/build/../src/polkitbackend/polkitbackendsessionmonitor-systemd.c:365:41 [356645.619128] polkitd[15468]: #11 0x0000004f11b5 in polkit_backend_interactive_authority_revoke_temporary_authorization_by_id /root/polkit/build/../src/polkitbackend/polkitbackendinteractiveauthority.c:3567:24 [356645.619128] polkitd[15468]: #12 0x0000004ea2c8 in server_handle_revoke_temporary_authorization_by_id /root/polkit/build/../src/polkitbackend/polkitbackendauthority.c:1292:8 [356645.619128] polkitd[15468]: #13 0x0000004e805c in server_handle_method_call /root/polkit/build/../src/polkitbackend/polkitbackendauthority.c:1346:5 [356645.619128] polkitd[15468]: #14 0x7f1b20565195 (/lib64/libgio-2.0.so.0+0xd9195) (BuildId: d06dc1cc6f8ddbb3cda89ef05ecf83d6fe037ae7) [356645.619332] polkitd[15468]: #15 0x7f1b20323e5c (/lib64/libglib-2.0.so.0+0x46e5c) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: #16 0x7f1b2031d60b (/lib64/libglib-2.0.so.0+0x4060b) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: #17 0x7f1b2037db37 (/lib64/libglib-2.0.so.0+0xa0b37) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: #18 0x7f1b203236f6 in g_main_loop_run (/lib64/libglib-2.0.so.0+0x466f6) (BuildId: c18bb9dc5295ff894f6098fa33e9ba39341c5bc1) [356645.619332] polkitd[15468]: #19 0x0000004e3619 in main /root/polkit/build/../src/polkitbackend/polkitd.c:298:3 [356645.619332] polkitd[15468]: #20 0x7f1b1fe59447 in __libc_start_call_main (/lib64/libc.so.6+0x3447) (BuildId: f3ac204eaa4ceed81438c80e80998209f828bb1a) [356645.619332] polkitd[15468]: #21 0x7f1b1fe5950a in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x350a) (BuildId: f3ac204eaa4ceed81438c80e80998209f828bb1a) [356645.619332] polkitd[15468]: #22 0x000000401c04 in _start (/usr/lib/polkit-1/polkitd+0x401c04) (BuildId: a927b98f2ddc1b57773bec4e0f8a537fe46632b1) ... Follow-up for 8cabb11.
In gitlab.freedesktop.org by bugzilla-migration on Apr 26, 2013, 16:02
Link to the original issue: https://gitlab.freedesktop.org/polkit/polkit/-/issues/21
Submitted by Daniel P. Berrange
Assigned to David Zeuthen
@david
Link to original bug (#63961)
Description
If there is no local UNIX user, session or DBus bus name available, then polkit can't be used for authorization, because no subject data can be provided to polkit. For example when libvirtd daemon accepts clients over a TCP connection, none of the 3 subject kinds is usable. The TCP clients do, however, have plenty of metadata that can used to form a subject identity. For example a kerberos principal name (negotiated via SASL), or some other SASL username, or a TLS x509 distinguished name, or some arbitrary combination of all of these.
Even when authorizing local clients, the fixed subject kinds is unhelpful. For example, when libvirt runs SASL over its UNIX sockets, the subject can be identified both by its PID and a kerberos principal name / SASL username.
Rather than adding more specialized subject classes, it would be desirable to have a generic subject class which accepted arbitrary (key,value) attributes. Then standardize the names of attributes for various pieces of information such as PID, PID start time, session name, SASL username, etc. This allows an application using polkit to pass all identifying attributes it has for a subject, rather than having to decide between passing a PID vs a session name vs a SASL username, or something else.
The text was updated successfully, but these errors were encountered: