summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Disable reading SystemdOptions EFI Var when in SecureBoot modeArian van Putten2020-01-165-51/+66
| | | | | | | | | In SecureBoot mode this is probably not what you want. As your cmdline is cryptographically signed like when using Type #2 EFI Unified Kernel Images (https://systemd.io/BOOT_LOADER_SPECIFICATION/) The user's intention is then that the cmdline should not be modified. You want to make sure that the system starts up as exactly specified in the signed artifact.
* sysctl: downgrade message when we have no permissionZbigniew Jędrzejewski-Szmek2020-01-161-7/+10
| | | | | | | | | | | | | We need to run sysctl also in containers, because the network subtree is namespaces and may legitimately be writable. But logging all "errors" at notice level creates unwanted noise. Also downgrade message about missing sysctls to log_info. This might also be relatively common when configuration is targeted at different kernel versions. With log_debug it'll still end up in the logs, but isn't really worth of "notice" most of the time. https://bugzilla.redhat.com/show_bug.cgi?id=1609806
* sysctl: move hashmap allocation out of main functionZbigniew Jędrzejewski-Szmek2020-01-161-10/+9
| | | | | This allocation is a low level detail, and it seems nicer to keep it out of run().
* Merge pull request #14581 from poettering/setcred-alternative-fixZbigniew Jędrzejewski-Szmek2020-01-161-3/+3
|\ | | | | alternative pam_setcred() fix
| * execute: allow pam_setcred() to fail, ignore errorsLennart Poettering2020-01-151-1/+1
| | | | | | | | | | Fixes: #14567 Alternative-To: #14569
| * execute: add const to array parameters, where possibleLennart Poettering2020-01-151-2/+2
| |
* | core: on each iteration processing /proc/self/mountinfo merge all discovery ↵Lennart Poettering2020-01-151-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | flags for each path This extends on d253a45e1c147f5174265d71d7419da7bd52a88b, and instead of merging just a single flag from previous mount entries of /proc/self/mountinfo for the same path we merge all three. This shouldn't change behaviour, but I think make things more readable. Previously we'd set MOUNT_PROC_IS_MOUNTED unconditionally, we still do. Previously we'd inherit MOUNT_PROC_JUST_MOUNTED from a previous entry on the same line, we still do. MOUNT_PROC_JUST_CHANGED should generally stay set too. Why that? If we have two mount entries on the same mount point we'd first process one and then the other, and the almost certainly different mount parameters of the two would mean we'd set MOUNT_PROC_JUST_CHANGED for the second. And with this we'll definitely do that still. This also adds a comment explaining the situation a bit, and why we get into this situation.
* | pam-systemd: apply user record properties to sessionLennart Poettering2020-01-151-2/+145
| | | | | | | | | | This way any component providing us with JSON user record data can use this for automatic resource management and other session properties.
* | pam-systemd: normalize return values of append_session_xyz()Lennart Poettering2020-01-151-25/+23
| | | | | | | | Let's propagate the PAM errors we got.
* | pam-systemd: port over to use a UserRecord structureLennart Poettering2020-01-151-25/+82
| | | | | | | | | | Later on this allows us to set various session properties from user record.
* | pam-systemd: share bus connection with pam_systemd_home if we canLennart Poettering2020-01-151-21/+17
| | | | | | | | Let's use the pam-util.h provided helpers to acquire them.
* | pam-systemd: port to pam_bus_log_{create|parse}_error() and pam_log_oom()Lennart Poettering2020-01-151-61/+46
| |
* | shared: add pam utility helpersLennart Poettering2020-01-153-0/+104
| |
* | logind: honour per-user stopDelayUSec propertyLennart Poettering2020-01-151-6/+24
| |
* | logind: honour killProcesses field of user recordLennart Poettering2020-01-151-1/+4
| |
* | logind: enforce user record resource settings when user logs inLennart Poettering2020-01-151-0/+97
| |
* | logind: port to UserRecord objectLennart Poettering2020-01-159-96/+144
| | | | | | | | | | | | | | This changes the user tracking of logind to use the new-style UserRecord object. In a later commit this enables us to do per-user resource management.
* | nss: hook up nss-systemd with userdb varlink bitsLennart Poettering2020-01-154-566/+741
| | | | | | | | | | | | | | | | | | | | | | This changes nss-systemd to use the new varlink user/group APIs for looking up everything. (This also changes the factory /etc/nsswitch.conf line to use for hooking up nss-system to use glibc's [SUCCESS=merge] feature so that we can properly merge group membership lists). Fixes: #12492
* | core: add user/group resolution varlink interface to PID 1Lennart Poettering2020-01-155-1/+329
| |
* | core: make return parameter of dynamic_user_lookup_name() optionalLennart Poettering2020-01-151-3/+3
| |
* | userdbd: add userdbctl tool as client for userdbdLennart Poettering2020-01-152-0/+794
| |
* | userdbd: add new service that can merge userdb queries from multiple clientsLennart Poettering2020-01-155-0/+1181
| |
* | shared: add helpers for displaying new-style user/group records to usersLennart Poettering2020-01-155-0/+560
| |
* | shared: add internal API for querying JSON user records via varlinkLennart Poettering2020-01-153-0/+1390
| | | | | | | | | | This new API can be used in place of NSS by our own internal code if more than the classic UNIX records are needed.
* | shared: add helpers for converting NSS passwd/group structures to new JSON ↵Lennart Poettering2020-01-155-0/+525
| | | | | | | | | | | | | | | | objects These new calls may be used to convert classic UNIX/glibc NSS struct passwd and struct group records into new-style JSON-based user/group objects.
* | shared: add generic user/group record structures and JSON parsersLennart Poettering2020-01-155-0/+2652
| |
* | libcrypt-util: add superficial validator for UNIX hashed password stringsLennart Poettering2020-01-152-0/+13
| |
* | shared: split out crypt() specific helpers into its own .c/.h in src/shared/Lennart Poettering2020-01-157-52/+100
| | | | | | | | | | | | | | | | | | | | This way we can use libxcrypt specific functionality such as crypt_gensalt() and thus take benefit of the newer algorithms libxcrypt implements. (Also adds support for a new env var $SYSTEMD_CRYPT_PREFIX which may be used to select the hash algorithm to use for libxcrypt.) Also, let's move the weird crypt.h inclusion into libcrypt.h so that there's a single place for it.
* | nss-util: add macros for generating getpwent()/getgrent() prototypesLennart Poettering2020-01-151-0/+32
|/ | | | | We have similar macros already for getpwuid()/getpwnam(), let's add more of this.
* Merge pull request #14562 from yuwata/table-strvZbigniew Jędrzejewski-Szmek2020-01-158-213/+418
|\ | | | | introduce TABLE_STRV and use it in networkctl and resolvectl
| * test-format-table: add tests for TABLE_STRVYu Watanabe2020-01-151-0/+114
| |
| * resolvectl: use format-table.[ch]Yu Watanabe2020-01-151-104/+181
| |
| * networkctl: use TABLE_STRVYu Watanabe2020-01-151-87/+50
| |
| * format-table: introduce TABLE_STRVYu Watanabe2020-01-152-3/+38
| |
| * strv: introduce strv_compare()Yu Watanabe2020-01-153-19/+35
| |
* | Merge pull request #14424 from poettering/watch-bus-name-reworkLennart Poettering2020-01-157-174/+43
|\ \ | | | | | | pid1: simplify drastically how we watch bus names for service's BusName= setting
| * | core: drop initial ListNames() bus call from PID 1Lennart Poettering2020-01-067-144/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, when first connecting to the bus after connecting to it we'd issue a ListNames() bus call to the driver to figure out which bus names are currently active. This information was then used to initialize the initial state for services that use BusName=. This change removes the whole code for this and replaces it with something vastly simpler. First of all, the ListNames() call was issues synchronosuly, which meant if dbus was for some reason synchronously calling into PID1 for some reason we'd deadlock. As it turns out there's now a good chance it does: the nss-systemd userdb hookup means that any user dbus-daemon resolves might result in a varlink call into PID 1, and dbus resolves quite a lot of users while parsing its policy. My original goal was to fix this deadlock. But as it turns out we don't need the ListNames() call at all anymore, since #12957 has been merged. That PR was supposed to fix a race where asynchronous installation of bus matches would cause us missing the initial owner of a bus name when a service is first started. It fixed it (correctly) by enquiring with GetOwnerName() who currently owns the name, right after installing the match. But this means whenever we start watching a bus name we anyway issue a GetOwnerName() for it, and that means also when first connecting to the bus we don't need to issue ListNames() anymore since that just tells us the same info: which names are currently owned. hence, let's drop ListNames() and instead make better use of the GetOwnerName() result: if it failed the name is not owned. Also, while we are at it, let's simplify the unit's owner_name_changed() callback(): let's drop the "old_owner" argument. We never used that besides logging, and it's hard to synthesize from just the return of a GetOwnerName(), hence don't bother.
| * | core: create/remove unit bus name slots always togetherLennart Poettering2020-01-062-18/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a service unit watches a bus name (i.e. because of BusName= being set), then we do two things: we install a match slot to watch how its ownership changes, and we inquire about the current owner. Make sure we always do both together or neither. This in particular fixes a corner-case memleak when destroying bus connections, since we never freed the GetNameOwner() bus slots when destroying a bus when they were still ongoing.
| * | core: no need to eat up errorLennart Poettering2020-01-061-4/+2
| | | | | | | | | | | | | | | This is a method call reply. We might as well propagate the error. The worst that happens is that sd-bus logs about it.
| * | core: shorten code a bitLennart Poettering2020-01-061-2/+0
| | | | | | | | | | | | | | | The return parameter here cannot be NULL, the bus call either succeeds or fails but will never uceed and return an empty owner.
| * | core: don't check potentially NULL error, it's not gonna work anywayLennart Poettering2020-01-061-4/+3
| | |
| * | core: don't check error parameter of get_name_owner_handler()Lennart Poettering2020-01-061-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | It's a *return* parameter, not an input parameter. Yes, this is a bit confusing for method call replies, but we try to use the same message handler for all incoming messages, hence the parameter. We are supposed to write any error into it we encounter, if we want, and our caller will log it, but that's it.
* | | Merge pull request #14547 from keszybz/networkctl-matchingYu Watanabe2020-01-157-22/+59
|\ \ \ | |_|/ |/| | networkctl: return error or warning when interfaces are not matched
| * | basic/strv: drop flags argument from strv_fnmatch()Zbigniew Jędrzejewski-Szmek2020-01-145-11/+11
| | |
| * | networkctl: return error or warning when interfaces are not matchedZbigniew Jędrzejewski-Szmek2020-01-144-13/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We'd just print nothing and exit with 0. If the user gave an explicit name, we should fail. If a pattern didn't match, we should at least warn. $ networkctl status enx54ee75cb1dc0a* --no-pager && echo $? No interfaces matched. 0 $ networkctl status enx54ee75cb1dc0a --no-pager Interface "enx54ee75cb1dc0a" not found. 1
* | | cgroup: minor comment improvementLennart Poettering2020-01-141-7/+7
| | | | | | | | | | | | | | | | | | As pointed out here: https://github.com/systemd/systemd/pull/14564#discussion_r366305882
* | | logind: refuse overriding idle hint on tty sessionsLennart Poettering2020-01-143-23/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we'd allow marking TTY sessions as idle, but when the user tried to unmark it as idle again it we'd just revert to automatic TTY atime idle detection, thus making it impossible to mark the session as non-idle, unless its TTY is atime-touched all the time. But of course, marking a session as idle is pretty much fatal if you never can mark it as non-idle again. This change is triggred by bug reports such as this: https://github.com/systemd/systemd/issues/14053 With this patch we will now output a clean, clear error message if a client tries to manipulate the idle state of a non-graphical session. This means we now have clear rules: "manual" idle logic for graphical sessions, and TTY based ones for all others that have a TTY of some form. I considered allowing the idle state to be overriden both ways for tty sessions but that's problematic: for sessions that are temporarily upgraded from tty to graphical and thus suddenly want to manage their own idle state we'd need to a way to detect when the upgrade goes away and thus we should revert to old behaviour. Without reverting to the previous TTY idle auto-magic we'd otherwise be stuck in an eternally idle or eternally non-idle state, with really bad effects in case auto-suspend is used. Thus, let's instead generate a proper error message, saying clearly we don't support it. (Also includes some other fixes and clean-ups in related code) Closes: #14053
* | | Merge pull request #14564 from poettering/cgroup-realize-fixZbigniew Jędrzejewski-Szmek2020-01-141-18/+32
|\ \ \ | | | | | | | | pid1: cgroup realization fix
| * | | cgroup: drop redundant if checkLennart Poettering2020-01-141-2/+2
| | | |
| * | | cgroup: update only siblings that got realized onceLennart Poettering2020-01-141-1/+16
| | | | | | | | | | | | | | | | | | | | Fixes: #14475 Replaces: #14554