summaryrefslogtreecommitdiffstats
path: root/src/shared/userdb.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* userdbd: also listen on a varlink socket io.systemd.DropInLennart Poettering2021-05-101-0/+1
| | | | | Let's explicitly support looking things up via dropin as a varlink service.
* userdb: optionally read user/group/membership "dropins", tooLennart Poettering2021-05-101-1/+10
|
* userdbd: simplify logic for generating NSS listingsLennart Poettering2021-05-071-0/+3
| | | | | | | | | | | | | | So far we basically had two ways to iterate through NSS records: one via the varlink IPC and one via the userdb.[ch] infra, with slightly different implementations. Let's clean this up, and always use userdb.[ch] also when resolving via userdbd. The different codepaths for the NameServiceSwitch and the Multiplexer varlink service now differ only in the different flags passed to the userdb lookup. Behaviour shouldn't change by this. This is mostly refactoring, reducing redundant codepaths.
* userdb: add new flag for excluding varlink data in lookupsLennart Poettering2021-05-071-0/+1
| | | | This is useful to later-on use the userdb infra for only some sources.
* userdb: rename userdb lookup flags a bitLennart Poettering2021-05-071-5/+8
| | | | | | | | | | | | | Let's use "exclude" for flags that really exclude records from our lookup. Let's use "avoid" referring to concepts that when flag is set we'll not use but we have a fallback path for that should yield the same result. Let' use "suppress" for suppressing partial info, even if we return the record otherwise. So far we used "avoid" for all these cases, which was confusing. Whiel we are at it, let's reassign the bits a bit, leaving some space for bits follow-up commits are going to add.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* userdb: replace recursion lockLennart Poettering2020-06-231-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we'd used the existance of a specific AF_UNIX socket in the abstract namespace as lock for disabling lookup recursions. (for breaking out of the loop: userdb synthesized from nss → nss synthesized from userdb → userdb synthesized from nss → …) I did it like that because it promised to work the same both in static and in dynmically linked environments and is accessible easily from any programming language. However, it has a weakness regarding reuse attacks: the socket is securely hashed (siphash) from the thread ID in combination with the AT_RANDOM secret. Thus it should not be guessable from an attacker in advance. That's only true if a thread takes the lock only once and keeps it forever. However, if a thread takes and releases it multiple times an attacker might monitor that and quickly take the lock after the first iteration for follow-up iterations. It's not a big issue given that userdb (as the primary user for this) never released the lock and we never made the concept a public interface, and it was only included in one release so far, but it's something that deserves fixing. (moreover it's a local DoS only, only permitting to disable native userdb lookups) With this rework the libnss_systemd.so.2 module will now export two additional symbols. These symbols are not used by glibc, but can be used by arbitrary programs: one can be used to disable nss-systemd, the other to check if it is currently disabled. The lock is per-thread. It's slightly less pretty, since it requires people to manually link against C code via dlopen()/dlsym(), but it should work safely without the aforementioned weakness.
* userdb: when doing client-side NSS look-ups optionally avoid shadow look-upsLennart Poettering2020-04-091-3/+4
|
* shared: add internal API for querying JSON user records via varlinkLennart Poettering2020-01-151-0/+41
This new API can be used in place of NSS by our own internal code if more than the classic UNIX records are needed.