Commit Graph

30753 Commits

Author SHA1 Message Date
Samanta Navarro 5e2b0e1cfa man: fix typos 2020-10-03 11:56:50 +00:00
Samanta Navarro 7b121df640 seccomp-util: fix typo in help message 2020-10-03 11:56:40 +00:00
Lennart Poettering 3462d773d2 nspawn: don't chown() stdin/stdout passed in when --console=pipe is used
We should chown what we allocate ourselves, i.e. any pty we allocate
ourselves. But for stuff we propagate, let's avoid that: we shouldn't
make more changes than necessary.

Fixes: #17229
2020-10-02 12:05:08 +02:00
Lennart Poettering 781fa474d8 ptyfwd: reopen stdin/sdout before setting O_NONBLOCK
If we set O_NONBLOCK on stdin/stdout directly this means the flag is
left set when we abort abnormally, as we don't get the chance to reset
it again on exit. This might confuse progrms invoking us. Moreover, if
programs invoking us continue to write to the stdout passed to us, they
might be confused by non-blocking mode too.

Hence, let's avoid this if possible: let's reopen stdin/stdout and set
O_NONBLOCK only on the reopend fds, leaving the original fds as they
are.

Prompted-by: https://github.com/systemd/systemd/pull/17070#issuecomment-702304802
2020-10-02 12:04:20 +02:00
Lennart Poettering c14ebe07a9
Merge pull request #17172 from keszybz/read-login-defs
Read /etc/login.defs
2020-10-02 11:01:30 +02:00
Zbigniew Jędrzejewski-Szmek 4b6f9b202e sysusers: emit warnings about login.defs overrides on first user or group creation
*** Running /home/zbyszek/src/systemd-work/test/test-sysusers/test-14.input (with login.defs symlinked)
login.defs specifies UID allocation range 401–555 that is different than the built-in defaults (201–998)
login.defs specifies GID allocation range 405–666 that is different than the built-in defaults (201–990)
2020-10-01 19:53:45 +02:00
Zbigniew Jędrzejewski-Szmek a3709e3709 tests: when creating temp dirs, include test name in path
This makes it easier to figure out which directory we want to look at
when tests fail, and also which test left behind a directory when it
shouldn't.
2020-10-01 19:53:45 +02:00
Zbigniew Jędrzejewski-Szmek aa25270cb2 sysusers: look at login.defs when setting the default range to allocate users
Also, even if login.defs are not present, don't start allocating at 1, but at
SYSTEM_UID_MIN.

Fixes #9769.

The test is adjusted. Actually, it was busted before, because sysusers would
never use SYSTEM_GID_MIN, so if SYSTEM_GID_MIN was different than
SYSTEM_UID_MIN, the tests would fail. On all "normal" systems the two are
equal, so we didn't notice. Since sysusers now always uses the minimum of the
two, we only need to substitute one value.
2020-10-01 19:53:45 +02:00
Zbigniew Jędrzejewski-Szmek d338bfff4a basic/fileio: add chase_symlinks_and_fopen_unlocked() 2020-10-01 17:52:50 +02:00
Zbigniew Jędrzejewski-Szmek 196b596867 shared/uid-range: reduce scope of iterator variables 2020-10-01 17:52:50 +02:00
Zbigniew Jędrzejewski-Szmek fc1a5d1a70 Also parse the minimum uid/gid values
We don't (and shouldn't I think) look at them when determining the type of the
user, but they should be used during user/group allocation. (For example, an
admin may specify SYS_UID_MIN==200 to allow statically numbered users that are
shared with other systems in the range 1–199.)
2020-10-01 17:52:41 +02:00
Zbigniew Jędrzejewski-Szmek 53393c894d Look at /etc/login.defs for the system_max_[ug]id values
It makes little sense to make the boundary between systemd and user guids
configurable. Nevertheless, a completely fixed compile-time define is not
enough in two scenarios:
- the systemd_uid_max boundary has moved over time. The default used to be
  500 for a long time. Systems which are upgraded over time might have users
  in the wrong range, but changing existing systems is complicated and
  expensive (offline disks, backups, remote systems, read-only media, etc.)
- systems are used in a heterogenous enviornment, where some vendors pick
  one value and others another.
So let's make this boundary overridable using /etc/login.defs.

Fixes #3855, #10184.
2020-10-01 17:49:31 +02:00
Lennart Poettering 14eb3285ab execute: use empty_to_root() a bit more 2020-10-01 11:02:11 +02:00
Lennart Poettering 74e1252072 execute: add helper for checking if root_directory/root_image are set in ExecContext 2020-10-01 11:02:11 +02:00
Lennart Poettering 36296ae2ad
Merge pull request #17152 from keszybz/make-mountapivfs-default
Make MountAPIVFS=yes default
2020-10-01 11:00:02 +02:00
Franck Bui 8ce3de991b
Merge pull request #17214 from poettering/log-generator-fix
fix logging in generators
2020-10-01 10:51:19 +02:00
Lennart Poettering fabf877705
Merge pull request #17154 from keszybz/crypttab-commas
Allow escaping commas in crypttab
2020-10-01 10:26:24 +02:00
Lennart Poettering 7ea3024b50 bootspec: don't fail with EIO if searching for ESP and finding one without an enveloping partition table
If this happens this should just mean: we couldn't find the ESP.

Fixes: #17122
2020-10-01 10:21:02 +02:00
Lennart Poettering dee29aeb59 generator: use kmsg in system-level generators, journal otherwise
Fixes: #17129.
2020-09-30 16:28:34 +02:00
Lennart Poettering ef9bddb799 log: normalize log target condition check
THis doesn't change the condition's logic at all, but is an attempt to
make things a bit more readable: instead of checking log_target !=
LOG_TARGET_AUTO let's actually list the targets where we want to
consider journal/syslog/kmsg, to make things a bit less confusing. After
all the message here is not to avoid them if LOG_TARGET_AUTO is set, but
to definitely do them in the other cases.
2020-09-30 16:17:12 +02:00
Lennart Poettering 27ffec0831 log: update comment
The logic was changed in bc694c06e6, let's
update the comment accordingly.
2020-09-30 16:06:55 +02:00
Lennart Poettering d1f6e01e47 homed: explicitly deactivate all home directories on shutdown
Let's explicitly deactivate all home dirs on shutdown, in order to
properly synchronizing unmounting and avoiding blocking devices.

Previously, we'd rely on automatic deactivation when home directories
become unused. However, that scheme is asynchronous, and ongoing
deactviations might conflicts with attempts to unmount /home. Let's fix
that by providing an explicit service systemd-homed-activate.service
whose only job is to have a ExecStop= line that explicitly deactivates
all home directories on shutdown. This service can the be ordered after
home.mount and similar, ensuring that we'll first deactivate all homes
before deactivating /home itself during shutdown.

This is kept separate from systemd-homed.service so that it is possible
to restart systemd-homed.service without deactivating all home
directories.

Fixes: #16842
2020-09-30 14:37:52 +02:00
Lennart Poettering 626fb9f301
Merge pull request #17203 from poettering/resolv-conf-mode
expose resolv.conf mode bus property
2020-09-30 14:37:24 +02:00
Lennart Poettering 24d86fdb2f
Merge pull request #17087 from yuwata/man-initial-congestion-window
man: update InitialCongestionWindow= and InitialAdvertisedReceiveWindow=
2020-09-30 10:55:18 +02:00
Lennart Poettering b3ffa2b5f3 resolved: turn off that a search domain is derived from the host's fqdn
If the hostname of a system is set to an fqdn, glibc traditionally
derives a search domain from it if none is explicitly configured.

This is a bit weird, and we currently don't do that in our own search
path logic.

Following #17193 let's turn this behaviour off for now.

Yes, this has a slight chance of pissing people off who think this
behaviour is good. If this is indeed an issue, we can revisit the issue
but in that case if we readd the concept we should do it properly:
derive the search domain from the fqdn in our codebase too and report it
in resolvectl, and in our generated stub files. But I have the suspicion
most people who set the hostname to an fqdn aren#t even aware of this
behaviour nor want it, so let's wait until people complain.

Fixes: #17193
2020-09-30 10:37:59 +02:00
Zbigniew Jędrzejewski-Szmek 5ced292d10
Merge pull request #17199 from poettering/log-tid
include thread ID in log output
2020-09-30 10:28:51 +02:00
Lennart Poettering 147a5046aa resolvectl: show resolv.conf mode in resolvectl output 2020-09-30 10:27:51 +02:00
Lennart Poettering 4261ab654c resolved: expose a new bus property that informs about the /etc/resolv.conf mode
It can be one of "foreign", "missing", "stub", "static", "uplink",
depending on how /etc/resolv.conf is set up:

foreign → someone/something else manages /etc/resolv.conf,
    systemd-resolved is just the consumer

missing → /etc/resolv.conf is missing altogether

stub/static/uplink → the file is managed by resolved, with the
    well-known modes

Fixes: #17159
2020-09-30 10:27:50 +02:00
Ronan Pigott 60b254ca1a loginctl: add -P as short for --value --property= 2020-09-30 10:25:06 +02:00
nl6720 bbbfe49b5e sysusers: use "!*" instead of "!!" as an invalid group password
This basically implements fc58c0c7bf for gshadow.
gpasswd may not have a lock/unlock that behaves the same as passwd, but
according to gshadow(5) the logic of the password field is the same.
2020-09-30 10:21:40 +02:00
Lennart Poettering 8e24b1d23f seccomp-util: add cacheflush() syscall to @default syscall set
This is like membarrier() I guess and basically just exposes CPU
functionality via kernel syscall on some archs. Let's whitelist it for
everyone.

Fixes: #17197
2020-09-30 10:08:15 +02:00
Pass Automated Testing Suite e3820eeaf1 path-lookup: Correct order of XDG_CONFIG_HOME and XDG_CONFIG_DIRS
According to the XDG Base Directory Specification [1] XDG_CONFIG_HOME
should take precedence over XDG_CONFIG_DIRS.

Fixes: https://github.com/systemd/systemd/issues/16095

[1]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
2020-09-29 21:47:01 +02:00
Yu Watanabe 88da55e28b udevadm: do not ignroe error caused by unpriviledged user invoking the command
This effectively reverts commit 67acde4869.

After commits 569ad251ad and
67acde4869, -EACCES errors are ignored,
and thus 'udevadm trigger' succeeds even when it is invoked by non-root
users. Moreover, on -EACCES error, log messages are shown in debug
level, so usually we see no message, and users are easily confused
why uevents for devices are not triggered.
2020-09-29 21:44:10 +02:00
Lennart Poettering 38ffc7d18a log: include TID= field in structred log output
It always was the intention to expose this as trusted field _TID=, i.e.
automatically determine it from journald via some SCM_xyz field or so,
but this is never happened, and it's unlikely this will be added anytime
soon to the kernel either, hence let's just generate this sender side,
even if it means it's untrusted.
2020-09-29 15:51:53 +02:00
Lennart Poettering 9ee806d1a8 log: optionally display thread ID in log output to tty
This is very useful when playing around with threaded tests, but should
be useful in other cases too.
2020-09-29 15:51:53 +02:00
Lennart Poettering a182fa895b
Merge pull request #17194 from poettering/dot-suffix
resolved: turn off search domain logic for queries for dot-suffixed domains
2020-09-29 15:50:06 +02:00
Lennart Poettering 3354f5003c resolved: imply SD_RESOLVED_NO_SEARCH when looking up trailing dot domains
Let's turn off the search domain logic if a trailing dot is specified
when looking up hostnames and RRs via the Varlink + D-Bus APIs (and thus
also when doing so via nss-resolve). (This doesn't affect lookups via
the stub, since for the any search path logic is done client side
anyway)

It might make sense to force the DNS protocol in this case too (and
disable LLMR + mDNS), but we'll leave that for a different PR — if it
even makes sense. It might also make sense to disable the logic of never
routing single-label lookups to the Internet if a trailing to is
specified, but this needs more discussion too.
2020-09-29 12:12:03 +02:00
Lennart Poettering 64c82c25ab dns-domain: add helper that checks whether domain is dot suffixed 2020-09-29 12:09:16 +02:00
Yu Watanabe fef160b5ab network: limit InitialCongestionWindow= and InitialAdvertisedReceiveWindow= value
Strivtly speaking, this breaks backward compatibility. But setting
too large value into them, then their networking easily breaks.
Note that typically 100 for them is event too large. So, ommiting the
values equal or higher than 1024, and dropping support of k, M, and G
suffixes is OK for normal appropriate use cases.

See discussion in #16643.
2020-09-29 13:55:17 +09:00
Lennart Poettering a7fdc6cbd3 udev: apply access mode/ownership to device nodes with O_PATH
Let's open the device node to modify with O_PATH, and then adjust it
only after verifying everything is in order. This fixes a race where the
a device appears, disappears and quickly reappers, while we are still
running the rules for the first appearance: when going by path we'd
possibly adjust half of the old and half of the new node. By O_PATH we
can pin the node while we operate on it, thus removing the race.

Previously, we'd do a superficial racey check if the device node changed
undearneath us, and would propagate EEXIST in that case, failing the
rule set. With this change we'll instead gracefully handle this, exactly
like in the pre-existing case when the device node disappeared in the
meantime.
2020-09-28 18:45:54 +02:00
Lennart Poettering f25bff5eaf fs-util: add new futimens_opath() helper
futimens() that works for O_PATH fds.
2020-09-28 18:45:54 +02:00
Lennart Poettering 9271daeed7 selinux: add apis to set labels/fix labels per fd instead of path 2020-09-28 18:45:54 +02:00
Lennart Poettering b9daaedbb9 udev-util: simplify device_is_renaming() error handling 2020-09-28 18:45:54 +02:00
Anita Zhang 7d9eea2bd3 core: move reset_arguments() to the end of main's finish
Fixes #16991

fb39af4ce4 replaced `free_arguments()` with
`reset_arguments()`, which frees arg_* variables as before, but also resets all
of them to the default values. `reset_arguments()` was positioned
in such a way that it overrode some arg_* values still in use at shutdown.

To avoid further unintentional resets, I moved `reset_arguments()`
right before the return, when nothing else will be using the arg_* variables.
2020-09-28 12:39:30 +02:00
bauen1 19cd4e1967 core: ensure that namespace tmp directories always get the correct label
If a namespace with PrivateTmp=true is constructed we need to restore
the context of the namespaces /tmp directory (i.e.
/tmp/systemd-private-XXXXX/tmp) to the (default) context of /tmp .
Otherwise filetransitions might result in the namespaces tmp directory
having the wrong context.
2020-09-28 12:36:07 +02:00
Samuel BF d99d1aaa21 Removing unused n_fields in journal-gatewayd 2020-09-28 12:18:17 +02:00
Luca Boccassi feee7f6288 libcrypt-util: use build-time check for crypt_preferred_method
After https://github.com/systemd/systemd/pull/16981 only the presence of crypt_gensalt_ra
is checked, but there are cases where that function is available but crypt_preferred_method
is not, and they are used in the same ifdef.
Add a check for the latter as well.
2020-09-28 10:23:48 +02:00
Lennart Poettering 911ba62408 repart: use proper API to check if block device can do partition scanning
We have the API wrapper already, hence use it, instead of using a
limited version of it that only works for loopback devices.
2020-09-26 18:31:48 +02:00
Lennart Poettering 3b493d94ae mount-util: show mount source in mount_verbose_full() debug output 2020-09-25 17:55:39 +02:00
Zbigniew Jędrzejewski-Szmek 28add648a8 coredump: use uid_is_system() when appropriate 2020-09-25 17:18:56 +02:00
Zbigniew Jędrzejewski-Szmek 98dcb8f4c7 Move {uid,gid}_is_*() from basic to shared
Those are functions that express policy, and nothing in basic/ uses
(or should use) them.
2020-09-25 17:18:56 +02:00
Lennart Poettering 77ad674b51 loop-util: apparently opening a loop device sometimes results in ENXIO, handle this 2020-09-25 16:03:05 +02:00
Lennart Poettering 0950526afd loop-util: use right flags field 2020-09-25 16:02:56 +02:00
Lennart Poettering ea223d3d3e
Merge pull request #17148 from jlebon/pr/crypt-source
cryptsetup-generator: use "/proc/cmdline" as source when appropriate
2020-09-25 15:50:15 +02:00
Zbigniew Jędrzejewski-Szmek 581b2c7359
Merge pull request #17132 from keszybz/test-suite-update
Test suite updates
2020-09-25 13:39:24 +02:00
Zbigniew Jędrzejewski-Szmek 7bb553bb98 fstab,crypttab: allow escaping of commas
Fixes #17035. We use "," as the separator between arguments in fstab and crypttab
options field, but the kernel started using "," within arguments. Users will need
to escape those nested commas.
2020-09-25 13:36:34 +02:00
Zbigniew Jędrzejewski-Szmek 48904c8bfd core/execute: escape the separator in exported paths
Our paths shouldn't even contain ":", but let's escape it if one somehow sneaks
in.
2020-09-25 13:36:34 +02:00
Zbigniew Jędrzejewski-Szmek d4d9f034b1 basic/strv: allow escaping the separator in strv_join()
The new parameter is false everywhere except for tests, so no functional change
is expected.
2020-09-25 13:36:34 +02:00
Jonathan Lebon 263a79642b cryptsetup-generator: avoid magic value in ternary
`startswith` already returns the string with the prefix skipped, so we
can simplify this further and avoid using a magic value.

Noticed in passing.

Co-authored-by: Lennart Poettering <lennart@poettering.net>
2020-09-24 11:19:40 -04:00
mog422 26a63b8132
sd-dhcp6-client: Fix sending prefix delegation request (#17136)
SD_DHCP6_OPTION_IA_NA does not exist in DHCP6_ADVERTISE packet if DHCP server only provides prefix delegation. So the attempt to send the DHCP6_REQUEST packet fails on r = dhcp6_option_append_ia(&opt, &optlen, &client->lease->ia); forever.
2020-09-24 17:04:52 +02:00
Zbigniew Jędrzejewski-Szmek 0af05e485a test-seccomp: accept ENOSYS from sysctl(2) too
It seems that kernel 5.9 started returning that.
2020-09-24 17:02:20 +02:00
Zbigniew Jędrzejewski-Szmek be36bc1e14 cryptsetup: upgrade log line for option parsing error
If we failed here, we would exit with only a debug message.
2020-09-24 16:36:51 +02:00
Zbigniew Jędrzejewski-Szmek 115a7fb624 cryptsetup-generator: drop unused fstat()
The result stopped being used in 71e4e12584.
2020-09-24 16:36:51 +02:00
Zbigniew Jędrzejewski-Szmek 38ee19c04b nspawn: give better message when invoked as non-root without arguments
When invoked as non-root, we would suggest re-running as root without any
further hint. But this immediately spawns a machine from the local directory,
which can be rather surprising. So let's give a better hint.

(In general, I don't think commandline programs should do "significant" things
when invoked without any arguments. In this regard it would be better if
systemd-nspawn would not spawn a machine from the current directory if called
with no arguments and at least "-D ." would be required.)
2020-09-24 16:36:51 +02:00
Zbigniew Jędrzejewski-Szmek fe79f107ef tree-wide: drop assignments to r when we only need errno
If the whole call is simple and we don't need to look at the return value
apart from the conditional, let's use a form without assignment of the return
value. When the function call is more complicated, it still makes sense to
use a temporary variable.
2020-09-24 16:36:43 +02:00
Zbigniew Jędrzejewski-Szmek 6119878480 core: turn on MountAPIVFS=true when RootImage or RootDirectory are specified
Lennart wanted to do this back in
01c33c1eff.
For better or worse, this wasn't done because I thought that turning on MountAPIVFS
is a compat break for RootDirectory and people might be negatively surprised by it.
Without this, search for binaries doesn't work (access_fd() requires /proc).
Let's turn it on, but still allow overriding to "no".

When RootDirectory=/, MountAPIVFS=1 doesn't work. This might be a buglet on its
own, but this patch doesn't change the situation.
2020-09-24 10:03:18 +02:00
Zbigniew Jędrzejewski-Szmek 5e98086d16 core: remember when we set ExecContext.mount_apivfs
No functional change intended so far.
2020-09-24 10:03:18 +02:00
Zbigniew Jędrzejewski-Szmek 960b585ba1
Merge pull request #17145 from poettering/kill-chmod-and-chown-unsafe
remove chmod_and_chown_unsafe()
2020-09-24 09:40:56 +02:00
Lennart Poettering bcaf20dc38
Merge pull request #17143 from keszybz/late-exec-resolution-alt
Late exec resolution (subset)
2020-09-24 09:38:36 +02:00
Kyle Huey fbccb980e5 random-util: Add an environment variable to disable RDRAND.
SYSTEMD_RDRAND=0 will prevent using RDRAND even on systems whose CPUID claims
to support it. All other values have no effect.

Fixes: #17112
2020-09-24 09:22:45 +02:00
Anita Zhang 8f4946dc8b
Merge pull request #17146 from poettering/use-more-proc-mounted
use proc_mounted() more
2020-09-23 23:39:20 -07:00
Lennart Poettering c7828862b3
Merge pull request #17118 from poettering/sync-shutdown-loop
fsync() block devices before detaching them during shutdown
2020-09-23 21:47:03 +02:00
Jonathan Lebon 62ca7d3b38 cryptsetup-generator: use "/proc/cmdline" as source when appropriate
Right now, we always say `/etc/crypttab` even if the source was fully
derived from the kargs.

Let's match what `systemd-fstab-generator` does and use `/proc/cmdline`
when that's the case.
2020-09-23 15:31:31 -04:00
Lennart Poettering 890084db03 tree-wide: port remaining umount() calls to umount_verbose() 2020-09-23 18:57:37 +02:00
Lennart Poettering 21935150a0 tree-wide: switch remaining mount() invocations over to mount_nofollow_verbose()
(Well, at least the ones where that makes sense. Where it does't make
sense are the ones that re invoked on the root path, which cannot
possibly be a symlink.)
2020-09-23 18:57:37 +02:00
Lennart Poettering 30f5d10421 mount-util: rework umount_verbose() to take log level and flags arg
Let's make umount_verbose() more like mount_verbose_xyz(), i.e. take log
level and flags param. In particular the latter matters, since we
typically don't actually want to follow symlinks when unmounting.
2020-09-23 18:57:36 +02:00
Lennart Poettering 511a8cfe30 mount-util: switch most mount_verbose() code over to not follow symlinks 2020-09-23 18:57:36 +02:00
Lennart Poettering 5012d567a8 mount-util: make sure get_mount_flags() ever follows symlinks
It doesn't follow symlinks when we check for the mount flags via
libmount, hence it shouldn't do either when we go via statvfs().
2020-09-23 18:57:36 +02:00
Lennart Poettering 28126409b2 mount-util: add helpers for mount() without following symlinks 2020-09-23 18:57:36 +02:00
Lennart Poettering e55299da4d shutdown: also fsync() DM devices before going down
Similar reasons as the previous patch.
2020-09-23 18:33:48 +02:00
Lennart Poettering 32c4626c4c shutdown: also fsync() MD devices when going down
Let's make this explicit, just in case this suffers by the same issues
as the loopback devices, and drops in-flight IO when we disassemble it.
2020-09-23 18:33:48 +02:00
Lennart Poettering 1a269c4ee3 shutdown: don't compare pointers with 0 2020-09-23 18:33:48 +02:00
Lennart Poettering 4534b32c73 shutdown: fsync() before detaching loopback devices
This is a follow-up for cae1e8fb88c5a6b0960a2d0be3df8755f0c78462: we
also call the detach ioctls in the shutdown code, hence add the fsync()s
there too, just to be safe.
2020-09-23 18:33:48 +02:00
Lennart Poettering 4265a66a5e fs-util: check for /proc mounted in access_fd()
It's a very basic function very similar to other cases where we go via
/proc/self/fd/, hence do the explicit proc_mounted() check here too.
2020-09-23 18:20:38 +02:00
Lennart Poettering 48d837cd92 fs-util: use strna() on returned strings of fd_get_path() if we don't check its return value
Let's make sure to use strna() on the strings returned by fd_get_path()
where we knowingly ignore any failures. We got this right in most cases,
but two were missing.
2020-09-23 18:20:38 +02:00
Lennart Poettering 8fe8f3aaba basic: update fd_get_path() to use proc_mounted() helper
We use it pretty much everywhere else, hence use it here too.

This also changes the error generated from EOPNOTSUPP to ENOSYS, to
match the other cases where we do such a check. One user checked for
EOPNOTSUPP which is updated to check for ENOSYS instead.
2020-09-23 18:20:38 +02:00
Lennart Poettering 1e5bfa2ac8 fs-util: drop chmod_and_chown_unsafe() which is unused now 2020-09-23 18:00:19 +02:00
Lennart Poettering 62c03398ba sysusers: modernize file backup logic a bit
Let's use _cleanup_ magic to clean up files, let's fully operate by fds
whenever we can.
2020-09-23 18:00:19 +02:00
Zbigniew Jędrzejewski-Szmek 8038b99d0d run: let systemd resolve the path with RootDirectory=/RootImage=
Fixes #13338.
2020-09-23 14:49:37 +02:00
Zbigniew Jędrzejewski-Szmek 526e3cbbdd core: don't try to load units from non-absolute paths
The error message disagreed with the check that was actually performed. Adjust the check.
2020-09-23 14:49:37 +02:00
Lennart Poettering 6333aa9d46 sd-radv: fix indentation
Fix-up for 97efde65d8
2020-09-23 13:44:26 +02:00
Lennart Poettering d5bc4e6898 machine: fix error code propagation in two cases 2020-09-23 13:24:25 +02:00
Lennart Poettering 6b6737119a
Merge pull request #17130 from keszybz/static-analyzer-cleanups
Trivial cleanups based on static analysis
2020-09-23 13:23:56 +02:00
Ronan Pigott 1f0541dace sd-path: include 'search' in search pathnames 2020-09-23 10:08:44 +02:00
Lennart Poettering 2d52f8c46c
Merge pull request #17124 from bluca/copypasta
dissect-image: use correct path variable when reading verity signatures, do not refuse verity GPT without /usr partition
2020-09-23 09:43:39 +02:00
Lennart Poettering 3cbf74652b
Merge pull request #17127 from poettering/errno-fixup
make more use of errno-util.h macros
2020-09-23 09:43:18 +02:00
Zbigniew Jędrzejewski-Szmek a5d815bb7f
Merge pull request #16938 from poettering/homed-rtc-wrong
homed: don't refuse logins when RTC is wrong
2020-09-22 20:51:39 +02:00
Zbigniew Jędrzejewski-Szmek 2b2919a5ff
Merge pull request #17109 from fbuihuu/udev-opts-tweaks
Udev opts tweaks
2020-09-22 18:54:48 +02:00
Zbigniew Jędrzejewski-Szmek fec5929f8b shared/conf-parser: drop redundant cast to boolean
parse_boolean returns either 0 or 1 or error, and we checked for errors
earlier already.
2020-09-22 18:00:44 +02:00
Zbigniew Jędrzejewski-Szmek 0a9bf7fa59 logind: use _cleanup_ in one more place 2020-09-22 18:00:44 +02:00
Zbigniew Jędrzejewski-Szmek d52e1c420c sd-{login,netlink,network}: use TAKE_FD() in more places 2020-09-22 18:00:44 +02:00
Zbigniew Jędrzejewski-Szmek 90e207e41f test-bus-chat: add missing return value in check 2020-09-22 17:58:11 +02:00
Zbigniew Jędrzejewski-Szmek afa8ffae99 various: remove assignments of unread variables 2020-09-22 17:58:11 +02:00
Zbigniew Jędrzejewski-Szmek 4ffd4705fb activate: reduce scope of iterator variable 2020-09-22 17:58:11 +02:00
Zbigniew Jędrzejewski-Szmek 89de370edd core/namespace: drop bitfield annotations from boolean fields
Such microoptimization makes sense when the structure is used in many many copies,
but here's it's not, and the few bytes we save are not worth the extra code the
compiler has to generate:

    return  ns_info->mount_apivfs ||
            ns_info->protect_control_groups ||
            ns_info->protect_kernel_tunables ||
            ...
before:
  49b187:       48 8b 45 f8             mov    -0x8(%rbp),%rax
  49b18b:       0f b6 00                movzbl (%rax),%eax
  49b18e:       83 e0 80                and    $0xffffff80,%eax
  49b191:       84 c0                   test   %al,%al
  49b193:       75 32                   jne    49b1c7 <namespace_info_mount_apivfs+0x80>
  49b195:       48 8b 45 f8             mov    -0x8(%rbp),%rax
  49b199:       0f b6 00                movzbl (%rax),%eax
  49b19c:       83 e0 08                and    $0x8,%eax
  49b19f:       84 c0                   test   %al,%al
  49b1a1:       75 24                   jne    49b1c7 <namespace_info_mount_apivfs+0x80>
  49b1a3:       48 8b 45 f8             mov    -0x8(%rbp),%rax
  49b1a7:       0f b6 00                movzbl (%rax),%eax
  49b1aa:       83 e0 10                and    $0x10,%eax
  49b1ad:       84 c0                   test   %al,%al
  49b1af:       75 16                   jne    49b1c7 <namespace_info_mount_apivfs+0x80>

after:
  49b024:       48 8b 45 f8             mov    -0x8(%rbp),%rax
  49b028:       0f b6 40 07             movzbl 0x7(%rax),%eax
  49b02c:       84 c0                   test   %al,%al
  49b02e:       75 2e                   jne    49b05e <namespace_info_mount_apivfs+0x7a>
  49b030:       48 8b 45 f8             mov    -0x8(%rbp),%rax
  49b034:       0f b6 40 03             movzbl 0x3(%rax),%eax
  49b038:       84 c0                   test   %al,%al
  49b03a:       75 22                   jne    49b05e <namespace_info_mount_apivfs+0x7a>
  49b03c:       48 8b 45 f8             mov    -0x8(%rbp),%rax
  49b040:       0f b6 40 04             movzbl 0x4(%rax),%eax
  49b044:       84 c0                   test   %al,%al
  49b046:       75 16                   jne    49b05e <namespace_info_mount_apivfs+0x7a>
2020-09-22 17:58:11 +02:00
Lennart Poettering fce93d7aa3 ptyfwd: use ERRNO_IS_DISCONNECT() when checking for disconnection on foreign fds 2020-09-22 16:25:22 +02:00
Lennart Poettering 065b47749d tree-wide: use ERRNO_IS_PRIVILEGE() whereever appropriate 2020-09-22 16:25:22 +02:00
Luca Boccassi c848516f3f dissect-image: do not refuse verity GPT without /usr partition
Only enforce that /usr verity partition is present if a /usr
partition is there
2020-09-22 15:24:59 +01:00
Luca Boccassi 7025fa8b1a dissect-image: use correct path variable when reading verity signatures
Copypasta slipped in via https://github.com/systemd/systemd/pull/17101
2020-09-22 13:19:19 +01:00
Hubert Kario 0b220a5f2a Try stopping MD RAID devices in shutdown too
Currently the systemd-shutdown command attempts to stop swaps, DM
(crypt, LVM2) and loop devices, but it doesn't attempt to stop MD
RAID devices, which means that if the RAID is set up on crypt,
loop, etc. device, it won't be able to stop those underlying devices.

This code extends the shutdown application to also attempt stopping
the MD RAID devices.

Signed-off-by: Hubert Kario <hubert@kario.pl>
2020-09-22 10:41:59 +02:00
Franck Bui 027f96c851 udevadm: rename option '--log-priority' into '--log-level'
Let's be consistent with systemctl(1).

'--log-priority' i still kept only for backward compatibility.
2020-09-22 09:05:57 +02:00
Franck Bui 64a3494c3d udev: rename kernel option 'log_priority' into 'log_level'
Let's be consistent with the rest of the project.

'log_priority' is still supported for backward compatibility.
2020-09-22 09:05:57 +02:00
Lennart Poettering a512e330ce homed: in images that lack mkfs.btrfs automatically fall back to ext4
It's better to tweak suboptimal defaults than to just fail with
compiled-in defaults.
2020-09-21 18:02:35 +02:00
Lennart Poettering f2ba663ea5 homed: show actual file system in messages about file systems 2020-09-21 18:02:35 +02:00
Lennart Poettering 3e0b54867e user-record: don't refuse login when last pw change time is in the future
The RTC is like just off, it's a weird system state, let's continue
without requiring pw change.
2020-09-21 18:02:35 +02:00
Lennart Poettering 61a29a020c homed: ignore ratelimiting counters when timestamp is from future
This likely indicates that the system clock is simply wrong, hence allow
access in this case.

Fixes: #15917
2020-09-21 18:02:35 +02:00
Lennart Poettering 51a95db6dc homed: don't block logins into accounts with future change time
This might happen if the system clock is wrong, and we should allow
access in this case (though certainly log about it).
2020-09-21 18:02:31 +02:00
Lennart Poettering aee36b4ea2 dissect-image: process /usr/ GPT partition type 2020-09-19 21:19:51 +02:00
Lennart Poettering 2bc181dae7 gpt: add new GPT partition types of /usr partitions 2020-09-19 21:19:23 +02:00
Zbigniew Jędrzejewski-Szmek 8a4024120f
Merge pull request #17100 from poettering/homed-fixes
various homed fixes
2020-09-19 18:17:56 +02:00
Anita Zhang d2841d563e
Merge pull request #17082 from poettering/nspawn-ctty-tweaks
nspawn controlling tty tweaks
2020-09-18 14:26:14 -07:00
Lennart Poettering f9d525ae55 homed: make clean that --storage=directory --image-path=/dev/some-block-device is not supported
The directory backend needs a file system path, and not a raw block
device. That's only supported for the LUKS2 backend.

Let's make this clearer in the man page and also generate a better error
message if attempted anyway.

Fixes: #17068
2020-09-18 22:35:36 +02:00
Lennart Poettering 9796a9fbad homed: make sure our worker processes finish before we exit
When exiting, let's explicitly wait for our worker processes to finish
first. That's useful if unmounting of /home/ is scheduled to happen
right after homed is down, as we then can be sure that the home
directories are properly unmounted and detached by the time homed is
fully terminated (otherwise it might happen that our worker gets killed
by the service manager, thus leaving the home directory and its backing
devices up/left for auto-clean which might be async).

Likely fixes #16842
2020-09-18 22:35:36 +02:00
Lennart Poettering cc9886bc20 homed: make it easier to run multiple instances of homed
When debugging homed while being logged into a user account manged by
homed it is a good idea to be able to run a second copy of homed. In
order to not collide with its AF_UNIX socket and bus name use, let's add
a new env var $SYSTEMD_HOME_DEBUG_SUFFIX, when set the busnames/socket
names are suffixed by it. When setting this while debugging one can
invoke an additional copy without interfering with the host one.
2020-09-18 22:35:36 +02:00
Lennart Poettering 79a6b4cc55 homed-bus: add missing spdx header 2020-09-18 22:35:36 +02:00
Lennart Poettering 3f440b13b7
Merge pull request #16981 from keszybz/use-crypt_ra
Use crypt_ra to allocate scratch area for password hashing
2020-09-18 19:46:08 +02:00
Zbigniew Jędrzejewski-Szmek 0af07108e4 core/execute: reduce indentation level a bit 2020-09-18 15:28:48 +02:00
Zbigniew Jędrzejewski-Szmek 9f71ba8d95 core: resolve binary names immediately before execution
This has two advantages:
- we save a bit of IO in early boot because we don't look for executables
  which we might never call
- if the executable is in a different place and it was specified as a
  non-absolute path, it is OK if it moves to a different place. This should
  solve the case paths are different in the initramfs.

Since the executable path is only available quite late, the call to
mac_selinux_get_child_mls_label() which uses the path needs to be moved down
too.

Fixes #16076.
2020-09-18 15:28:48 +02:00
Zbigniew Jędrzejewski-Szmek 92673045b5 basic/path-util: enhance find_executable() for the fixed path case 2020-09-18 15:28:48 +02:00
Zbigniew Jędrzejewski-Szmek cd4ff5aa11 basic/path-util: inline two trivial functions
While at it, add assert() for the argument.
2020-09-18 15:28:48 +02:00
Zbigniew Jędrzejewski-Szmek f7bc0c324a Rename find_binary to find_executable
"executable" is more correct than "binary", since scripts are OK too.
2020-09-18 15:28:48 +02:00
Zbigniew Jędrzejewski-Szmek 0706c01259 Add CLOSE_AND_REPLACE helper
Similar to free_and_replace. I think this should be uppercase to make it
clear that this is a macro. free_and_replace should probably be uppercased
too.
2020-09-18 15:28:48 +02:00
Zbigniew Jędrzejewski-Szmek 831d57953e core: use X_OK when looking for executables
Other tools silently ignore non-executable names found in path. By checking
F_OK, we would could pick non-executable path even though there is an executable
one later.
2020-09-18 15:28:48 +02:00
Zbigniew Jędrzejewski-Szmek 598c47c86e core/load-fragment: don't treat "; ;" as "/usr/bin/;"
We had a special test case that the second semicolon would be interpreted
as an executable name. We would then try to find the executable and rely
on ";" not being found to cause ENOEXEC to be returned. I think that's just
crazy. Let's treat the second semicolon as a separator and ignore the
whole thing as we would whitespace.
2020-09-18 15:28:48 +02:00
Zbigniew Jędrzejewski-Szmek fe65d69243 test-execute: include test location in error output
test-execute is quite long and even with the test name it takes a moment
to find the relevant spot when something fails. Let's make things easier
by printing the exact location.
2020-09-18 15:28:48 +02:00
Zbigniew Jędrzejewski-Szmek 1c32257147 test-path-util: also check filename_is_valid() with paths with slashes 2020-09-18 15:27:11 +02:00
Yu Watanabe e4c01fe6af test: add test cases for RuntimeDirectoryPreserve=yes 2020-09-18 13:11:39 +02:00
Zbigniew Jędrzejewski-Szmek 05d418fed9
Merge pull request #17085 from yuwata/network-configure-mdb-entries-on-bridge-master
network: allow to configure mdb entries on bridge master
2020-09-18 13:06:44 +02:00
Lennart Poettering 50406dc7f1
Merge pull request #17093 from poettering/dissect-tweaks2
dissect: some more tweaks
2020-09-18 10:13:31 +02:00
Yu Watanabe 1034044260
Merge pull request #15050 from ssahani/fq-pie
network: tc: add support for FQ-PIE packet scheduler
2020-09-18 03:50:02 +09:00
Lennart Poettering 4f309abb3e dissect: show partition output even if os-release is missing
It's just too useful to immediately see with "systemd-dissect" what
"systemd-repart" generated for us without having to populate it with
/etc/os-release. Hence let's log a message if /etc/os-release is
missing, but proceed otherwise and show the partition table.
2020-09-17 18:02:49 +02:00
Lennart Poettering 9434438543 dissect: use structured initialization, it's prettier 2020-09-17 18:02:45 +02:00
Lennart Poettering 3afda7c797 dissect: is_loop_device() returns negative on error, don't mistake that is true 2020-09-17 18:02:41 +02:00
Lennart Poettering 74cb2db9f4 dissect: always invalidate secondary arch partitions if we found primary arch
Let's suppress the secondary arch data, since we never ever want to
mount it if we found the primary arch.

Previously we only suppressed in the Verity case, but there's little
reason to entertain the idea of a secondary arch in non-Verity
environments either, we are not going to use them, and should not do
decryption or anything like that.
2020-09-17 18:02:37 +02:00
Lennart Poettering 220431724b dissect: three trivial fixes
Uppercase first char of log message, and indicate correct program name.

Reindent comment table at one place.

Use correct, specific, enum type at one more place.
2020-09-17 18:02:33 +02:00
Lennart Poettering 10e8a60baa nspawn: add --console=autopipe mode
By default we'll run a container in --console=interactive and
--console=read-only mode depending if we are invoked on a tty or not so
that the container always gets a /dev/console allocated, i.e is always
suitable to run a full init system /as those typically expect a
/dev/console to exist).

With the new --console=autopipe mode we do something similar, but
slightly different: when not invoked on a tty we'll use --console=pipe.
This means, if you invoke some tool in a container with this you'll get
full inetractivity if you invoke it on a tty but things will also be
very nicely pipeable. OTOH you cannot invoke a full init system like
this, because you might or might not become a /dev/console this way...

Prompted-by: #17070

(I named this "autopipe" rather than "auto" or so, since the default
mode probably should be named "auto" one day if we add a name for it,
and this is so similar to "auto" except that it uses pipes in the
non-tty case).
2020-09-17 16:39:27 +02:00
Lennart Poettering 335d2eadca nspawn: don't become TTY controller just to undo it later again
Instead of first becoming a controlling process of the payload pty
as side effect of opening it (without O_NOCTTY), and then possibly
dropping it again, let's do it cleanly an reverse the logic: let's open
the pty without becoming its controller first. Only after everything
went the way we wanted it to go become the controller explicitly.

This has the benefit that the PID 1 stub process we run (as effect of
--as-pid2) doesn't have to lose the tty explicitly, but can just
continue running with things. And we explicitly make the tty controlling
right before invoking actual payload.

In order to make sure everything works as expected validate that the
stub PID 1 in the container really has no conrolling tty by issuing the
TIOCNOTTY tty and expecting ENOTTY, and log about it.

This shouldn't change behaviour much, it just makes thins a bit cleaner,
in particular as we'll not trigger SIGHUP on ourselves (since we are
controller and session leader) due to TIOCNOTTY which we then have to
explicitly ignore.
2020-09-17 16:39:23 +02:00
Lennart Poettering 2fef50cd9e nspawn: fix fd leak on failure path 2020-09-17 16:39:19 +02:00
Lennart Poettering 554c4beb47 nspawn: print log notice when we are invoked from a tty but in "pipe" mode
If people do this then things are weird, and they should probably use
--console=interactive (i.e. the default) instead.

Prompted-by: #17070
2020-09-17 16:39:16 +02:00
Lennart Poettering efe4266240 nspawn: check return of setsid()
Let's verify that everything works the way we expect it to work, hence
check setsid() return code.
2020-09-17 16:38:58 +02:00
Lennart Poettering 89e62e0bd3 dissect: wrap verity settings in new VeritySettings structure
Just some refactoring: let's place the various verity related parameters
in a common structure, and pass that around instead of the individual
parameters.

Also, let's load the PKCS#7 signature data when finding metadata
right-away, instead of delaying this until we need it. In all cases we
call this there's not much time difference between the metdata finding
and the loading, hence this simplifies things and makes sure root hash
data and its signature is now always acquired together.
2020-09-17 20:36:23 +09:00
Yu Watanabe dc0e90d2e0
Merge pull request #16929 from ssahani/network-bare-udp
network: introduce Bare UDP Tunnelling
2020-09-17 20:34:15 +09:00
Yu Watanabe dd3b0e2232
Merge pull request #17073 from ssahani/vxlan
network: Allow vxlan to be created without .network file
2020-09-17 20:33:14 +09:00
Yu Watanabe 1797240104 network: old kernel may not support to configure bridge MDB entries on bridge master 2020-09-17 18:15:22 +09:00
Yu Watanabe a55100e66c network: allow to configure bridge MDB entries on bridge master 2020-09-17 18:12:40 +09:00
Yu Watanabe fdeecf7bba network: tc: refuse to set 0 for FlowQueuePIE.PacketLimit= 2020-09-17 17:16:49 +09:00
Peter Hutterer 9aa5c97158 udev: if a tablet has BTN_0, label it as ID_INPUT_TABLET_PAD
Graphics tablet devices comprise multiple event nodes, usually a Pen, Finger
and Pad node (that's how the kernel postfixes them). Pen and Pad are labeled
as ID_INPUT_TABLET but the pad doesn't actually send stylus events - it
doesn't usually have BTN_TOOL_PEN, merely BTN_STYLUS.

For the last several years, libwacom has set ID_INPUT_TABLET_PAD for all pad
devices known to it based on vid/pid and a "* Pad" name match. That does not
cover devices not in libwacom. libinput relies on ID_INPUT_TABLET_PAD to
initialize the pad backend.

We can't drop ID_INPUT_TABLET without breaking userspace, but we can add
ID_INPUT_TABLET_PAD ourselves - where a device has BTN_0 in addition to
BTN_STYLUS, let's add it as a pad.

There are some devices (notably: bamboos) that use BTN_LEFT instead of BTN_0
but they are relatively rare and there's a risk of mislabeling those devices,
so let's just stick with BTN_0 only.
2020-09-17 10:14:25 +02:00
Susant Sahani 8f6b6d7091 network: TC - introduce fq pie
see https://patchwork.ozlabs.org/patch/1233253/
2020-09-17 17:12:07 +09:00
Susant Sahani 3428b32a04 sd-netlink: add fq pie options 2020-09-17 17:06:47 +09:00
masmullin2000 3dd8ae5c70
Fix compilation without libcryptsetup (#17071) 2020-09-17 09:07:03 +02:00
Susant Sahani a9b8450bd4 network: Allow vxlan to be created without .network file 2020-09-17 15:49:36 +09:00
Yu Watanabe b0486c732a network: refuse to configure IPv4LL for bareudp netdev 2020-09-17 15:18:18 +09:00
Susant Sahani e6980c7270 network: Introduce bare UDP 2020-09-17 15:05:58 +09:00
Susant Sahani af818d0344 sd-netlink: Add support for bare UDP 2020-09-17 14:51:47 +09:00
Yu Watanabe ed2c2d3655 util: update kernel headers (v5.9-rc5) 2020-09-17 14:51:47 +09:00
Yu Watanabe e29e5db7df util: wireguard is merged into upstream kernel 2020-09-17 14:51:47 +09:00
Yu Watanabe e834509760
Merge pull request #17059 from yuwata/network-mdb-follow-ups
network: follow ups for bridge MDB support
2020-09-17 13:52:44 +09:00
Anita Zhang bded6ff0d0
Merge pull request #17080 from poettering/repart-umask-fix
repart: don't mark image files generated with --empty=create executable
2020-09-16 16:58:19 -07:00
Zbigniew Jędrzejewski-Szmek a7ddeea15d
Merge pull request #17067 from keszybz/rc-local-path
Expose the path to rc.local in the man page
2020-09-16 22:59:53 +02:00
Lennart Poettering 5332d7c6ff repart: don't mark image files generated with --empty=create executable 2020-09-16 18:48:36 +02:00
Lennart Poettering eb5e26112e
Merge pull request #17076 from poettering/dissect-cleanup
minor cleanups to the dissector code
2020-09-16 18:42:12 +02:00
Topi Miettinen f593965161 test-execute: kill Waldo and Quux
Retire /var/lib{,/private}/{quux,waldo} after they have served their purpose.
2020-09-17 00:06:02 +09:00
Yu Watanabe 8e412d64ce network: add debug message for configuring MDB entries 2020-09-17 00:04:22 +09:00
Yu Watanabe 1f24158971 network: configure bridge MDB entries after bridge has carrier 2020-09-17 00:04:22 +09:00
Yu Watanabe 46205ffcdf network: drop [BridgeMDB] entries if Bridge= is not set 2020-09-17 00:04:22 +09:00
Yu Watanabe 03ae449015 network: check MulticastGroupAddress= is neither a local multicast address nor all nodes address 2020-09-17 00:04:22 +09:00
Yu Watanabe ccea244865 in-addr-util: introduce in4_addr_is_local_multicast() 2020-09-17 00:04:22 +09:00
Yu Watanabe 5643cfc0d9 in-addr-util: introduce in6_addr_is_link_local_all_nodes() 2020-09-17 00:04:22 +09:00
Yu Watanabe 5fb16c7c77 network: drop unnecessary headers 2020-09-17 00:04:22 +09:00
Yu Watanabe 6c9ebb7a90 network: move functions in networkd-mdb.c 2020-09-17 00:04:22 +09:00
Yu Watanabe 6234712ec6
Merge pull request #17066 from keszybz/allow-loopback-addresses
Allow loopback addresses
2020-09-17 00:02:08 +09:00
Lennart Poettering c796b91d2b
Merge pull request #16675 from topimiettinen/exec-syscall-error-action
SystemCallFilter, SystemCallErrorAction error actions kill and log
2020-09-16 17:01:44 +02:00
Lennart Poettering aa088f62d1 gpt: move GPT_LINUX_GENERIC definition next to the user GPT partition types
No code changes, just some reordering.
2020-09-16 16:31:16 +02:00
Lennart Poettering 569a0e42ec dissect: introduce PartitionDesignator as real type 2020-09-16 16:14:01 +02:00
Lennart Poettering f5215bc8d3 dissect: rename mount_options_from_part() → mount_options_from_designator()
After all, it actually takes a designator argument, not a partition
index or so.
2020-09-15 22:23:22 +02:00
Lennart Poettering 80dd1125c8 test: remove test-dissect-image
It does pretty much exactly what systemd-dissect does and is a manual
test, hence let's remove it as redundant code.
2020-09-15 17:53:32 +02:00
Zbigniew Jędrzejewski-Szmek 452d2dfd52 meson: RC_LOCAL_SCRIPT_PATH_START to RC_LOCAL_PATH
RC_LOCAL_SCRIPT_PATH_START and RC_LOCAL_SCRIPT_PATH_STOP were was originally
added in the conversion to meson based on the autotools name. In
4450894653 RC_LOCAL_SCRIPT_PATH_STOP was dropped.
We don't need to use such a long name.
2020-09-15 17:44:26 +02:00
Zbigniew Jędrzejewski-Szmek 7e5f1d4b3f socket-proxy: allow localhost addresses
With this change, only manager_connect() in timesync.d uses AI_ADDRCONFIG. There
we are connecting to a remove server, so the flag is appropriate.
2020-09-15 16:45:39 +02:00
Zbigniew Jędrzejewski-Szmek d0e5db44d9 sd-bus: allow localhost addresses
By settings AI_ADDRCONFIG in hints we cannot for example resolve "localhost"
when the local machine only has a loopback interface. This seems like an
unnecessary restriction, drop it.

Inspired by https://bugzilla.redhat.com/show_bug.cgi?id=1839007.
2020-09-15 16:45:03 +02:00
Franck Bui e66d2eeeeb fstab-generator: add 'nofail' when NFS 'bg' option is used
Otherwise a 'Before=remote-fs.target' dependency is added to the mount unit
which defeats the purpose of 'bg' option.
2020-09-15 16:24:01 +02:00
Lennart Poettering b7b7ace4ea tests: try to allocate a delegated scope unit for our cgroup tests
Prompted-by: #16632
2020-09-15 13:32:15 +02:00
Topi Miettinen 9df2cdd8ec exec: SystemCallLog= directive
With new directive SystemCallLog= it's possible to list system calls to be
logged. This can be used for auditing or temporarily when constructing system
call filters.

---
v5: drop intermediary, update HASHMAP_FOREACH_KEY() use
v4: skip useless debug messages, actually parse directive
v3: don't declare unused variables with old libseccomp
v2: fix build without seccomp or old libseccomp
2020-09-15 12:54:17 +03:00
Topi Miettinen 005bfaf118 exec: Add kill action to system call filters
Define explicit action "kill" for SystemCallErrorNumber=.

In addition to errno code, allow specifying "kill" as action for
SystemCallFilter=.

---
v7: seccomp_parse_errno_or_action() returns -EINVAL if !HAVE_SECCOMP
v6: use streq_ptr(), let errno_to_name() handle bad values, kill processes,
 init syscall_errno
v5: actually use seccomp_errno_or_action_to_string(), don't fail bus unit
parsing without seccomp
v4: fix build without seccomp
v3: drop log action
v2: action -> number
2020-09-15 12:54:17 +03:00
Zbigniew Jędrzejewski-Szmek 5d3fe6f78d test-libcrypt-util: before doing anything check what methods are available
On centos7 ci:

--- test-libcrypt-util begin ---
Found container virtualization none.
/* test_hash_password */
ew3bU1.hoKk4o: yes
$1$gc5rWpTB$wK1aul1PyBn9AX1z93stk1: no
$2b$12$BlqcGkB/7BFvNMXKGxDea.5/8D6FTny.cbNcHW/tqcrcyo6ZJd8u2: no
$5$lGhDrcrao9zb5oIK$05KlOVG3ocknx/ThreqXE/gk.XzFFBMTksc4t2CPDUD: no
$6$c7wB/3GiRk0VHf7e$zXJ7hN0aLZapE.iO4mn/oHu6.prsXTUG/5k1AxpgR85ELolyAcaIGRgzfwJs3isTChMDBjnthZyaMCfCNxo9I.: no
$y$j9T$$9cKOWsAm4m97WiYk61lPPibZpy3oaGPIbsL4koRe/XD: no
2020-09-15 11:52:30 +02:00
Zbigniew Jędrzejewski-Szmek bd99297bd3 test-libcrypt-util: skip test on ppc64 with no xcrypt
I'm tired of trying to figure this out.
2020-09-15 11:52:30 +02:00
Zbigniew Jędrzejewski-Szmek 35e22827a9 shared/libcrypt-util: do not refuse passwords if some other hash is unsupported 2020-09-15 11:52:30 +02:00
Zbigniew Jędrzejewski-Szmek 9de324c3c9 shared/libcrypt-util: add fallback for crypt_ra()
Following the style in missing_syscall.h, we use a non-conflicting name
for the function and use a macro to map to the real name to the replacement.
2020-09-15 11:52:30 +02:00
Zbigniew Jędrzejewski-Szmek 2b49f0ca83 Check for crypt_gensalt_ra() instead of relying on libxcrypt presence
Since the loop to check various xcrypt functions is already in place,
adding one more is cheap. And it is nicer to check for the function
directly. People like to backport things, so we might get lucky even
without having libxcrypt.
2020-09-15 11:52:30 +02:00
Zbigniew Jędrzejewski-Szmek 83764f8d00 shared/libcrypt-util: include fewer headers
Now that we wrap crypt_r/ra uses, we can include the header only in libcrypt-util.c.
2020-09-15 11:52:30 +02:00
Zbigniew Jędrzejewski-Szmek 999b49c818 Make test_password_{one,many} also use crypt_ra() 2020-09-15 11:52:30 +02:00