Commit graph

42533 commits

Author SHA1 Message Date
Lennart Poettering 086697094e cryptsetup: add native pkcs#11 support to cryptsetup
This adds a new crypttab option for volumes "pkcs11-uri=" which takes a
PKCS#11 URI. When used the key stored in the line's key file is
decrypted with the private key the PKCS#11 URI indiciates.

This means any smartcard that can store private RSA keys is usable for
unlocking LUKS devices.
2019-12-09 19:25:25 +01:00
Lennart Poettering f573629c0b udev: mark all ccid/security devices with a special tag
This adds a udev tag that is supposed to be attached to all devices
that might potentially expose a PKCS#11 slot, i.e. CCID smartcards and
similar. We can then use the appearance of devices of this type as
trigger to rescan PKCS#11 slots.
2019-12-09 19:25:25 +01:00
Lennart Poettering 839fddbe50 shared: add pkcs11-util.[ch] 2019-12-09 19:25:25 +01:00
Lennart Poettering 3f63701983 shared: add openssl helpers 2019-12-09 18:38:59 +01:00
Mike Gilbert fb4b0465ab seccomp: real syscall numbers are >= 0
Real syscall numbers start at 0. The fake seccomp values seem to be
strictly less than 0.

Fixes: 4df8fe8415
2019-12-09 11:29:06 +01:00
Yong Cong Sin 0cab1f1976 Add Cube iWork 11 Stylus 2019-12-09 11:28:15 +01:00
Yu Watanabe 8ee08dc564 test: do not fail if new device is plugged during enumeration 2019-12-09 08:45:25 +00:00
Yu Watanabe bc942f69aa test-network: make test_bind_carrier more stable 2019-12-08 19:52:01 +00:00
Yu Watanabe 84043bfd74
Merge pull request #14266 from topimiettinen/dont-resolve-user-if-not-root
resolved: don't resolve the user if not root
2019-12-09 00:15:31 +09:00
Yu Watanabe debda5a4e5
Merge pull request #14273 from ssahani/ifb
network: introduce IFB
2019-12-08 05:13:08 +09:00
Yu Watanabe 6d62ec61b9 network: fix copy and paste mistake 2019-12-08 05:11:26 +09:00
Topi Miettinen 07317d6e34
resolved, networkd: don't resolve the user if not root
If a daemon is not started as root, most likely it also can't create its
directory and let's not try to resolve the user in that case either.

Create /run/systemd/netif/lldp with tmpfiles.d like other netif directories.

This is also very helpful for preparing a RootImage for the daemons as NSS crud
is not needed.
2019-12-07 18:55:54 +02:00
Yu Watanabe b076d5d76d test-network: add test case for IFB 2019-12-08 00:03:29 +09:00
Susant Sahani 3295a461b3 network: introduce ifb (Intermediate Functional Block)
Intermediate Functional Block

The Intermediate Functional Block (ifb) pseudo network interface acts as a QoS concentrator for multiple different sources of traffic. Packets from or to other interfaces have to be redirected to it using the mirred action in order to be handled, regularly routed traffic will be dropped. This way, a single stack of qdiscs, classes and filters can be shared between multiple interfaces.

Here's a simple example to feed incoming traffic from multiple interfaces through a Stochastic Fairness Queue (sfq):

(1) # modprobe ifb
(2) # ip link set ifb0 up
(3) # tc qdisc add dev ifb0 root sfq
2019-12-07 15:29:50 +01:00
Susant Sahani cec1552ad4 sd-netlink: add support for ifb device 2019-12-07 14:35:23 +01:00
Yu Watanabe 43a20059a5
Merge pull request #14102 from ssahani/acd-duplicate-ip
network: introduce DAD for static IPV4 address
2019-12-07 14:11:44 +09:00
Anita Zhang 65ca546f06
Merge pull request #14265 from keszybz/seccomp-log-line-fix
shared/seccomp: avoid possibly writing bogus errno code in debug log
2019-12-06 11:02:56 -08:00
Yu Watanabe dc7d3c5fd4 test-network: add test case for IPv4 DAD 2019-12-06 23:29:28 +09:00
Susant Sahani 051e77cac1 network: introduce DAD for static address
Closes #2527.
2019-12-06 23:29:07 +09:00
Zbigniew Jędrzejewski-Szmek b069c2a3f2 shared/seccomp: avoid possibly writing bogus errno code in debug log
CID 1409488.

This code was added in 903659e7b2. The change
that is done here is a simple fix to avoid use of a
unitialized/wrongly-initialized variable, but the bigger issue is that nothing
looks at the returned result to distinguish between 0 and a positive return
value.
2019-12-06 15:12:40 +01:00
Zbigniew Jędrzejewski-Szmek 36f43076b9
Merge pull request #14235 from fbuihuu/cryptsetup-fixes
Cryptsetup fixes
2019-12-06 12:46:42 +01:00
Yu Watanabe 2c7b826ddf network: do not drop foreign config if interface is in initialized state
If the interface is in initialized state, no network file is assigned to
the interface. If an interface is not managed by networkd, previously,
the foreign configs of the interface was dropped.

Fixes #14250.
2019-12-06 12:27:47 +01:00
Lennart Poettering 9929fe8c95
Merge pull request #14252 from keszybz/growfs-port-resizefs
Port growfs over to resizefs
2019-12-06 08:55:30 +01:00
Lennart Poettering 5391dd7bc0
Merge pull request #14253 from keszybz/cleanups
Cleanups
2019-12-06 08:55:15 +01:00
Lennart Poettering 5face5a50a
Merge pull request #14167 from cpaelzer/fix-MemoryDenyWriteExecute-x86-s390-bug-1853852-UPSTREAM
Fix memory_deny_write_execute on x86 and s390 with libseccomp 2.4.2
2019-12-06 08:54:54 +01:00
Anita Zhang a0b7f19876
Merge pull request #14258 from TimoWilken/patch-1
Fix typo (duplicate "or")
2019-12-05 10:55:20 -08:00
Timo Wilken ab4fae0c8c
Fix typo (duplicate "or")
This fixes a double "or" in the text of `systemctl --help`.
2019-12-05 18:36:57 +00:00
Franck Bui 362c378291 cryptsetup: umount encrypted devices before detaching it during shutdown
This is done by ordering local-fs-pre.target and remote-fs-pre.target after
cryptsetup.target and remote-cryptsetup.target respectively.

Fixes: #8472
2019-12-05 11:43:05 +01:00
Franck Bui 1dc85eff1d crypsetup: introduce x-initrd.attach option
This option is an indication for PID1 that the entry in crypttab is handled by
initrd only and therefore it shouldn't interfer during the usual start-up and
shutdown process.

It should be primarily used with the encrypted device containing the root FS as
we want to keep it (and thus its encrypted device) until the very end of the
shutdown process, i.e. when initrd takes over.

This option is the counterpart of "x-initrd.mount" used in fstab.

Note that the slice containing the cryptsetup services also needs to drop the
usual shutdown dependencies as it's required by the cryptsetup services.

Fixes: #14224
2019-12-05 11:43:02 +01:00
Zbigniew Jędrzejewski-Szmek 5ebbb45bde TODO: remove obsolete entries
"introspect" is well established and OK. We shouldn't change it at this point.
2019-12-05 10:35:32 +01:00
Zbigniew Jędrzejewski-Szmek bddeb54cbb Fix use of unitialized variable in error path
CID 1408478.
2019-12-05 10:31:34 +01:00
Zbigniew Jędrzejewski-Szmek 9142bbd19c
Merge pull request #14209 from poettering/sd-bus-sensitive
sd-bus bits from homed PR
2019-12-05 10:22:01 +01:00
Zbigniew Jędrzejewski-Szmek 68296b8b83
Merge pull request #14221 from poettering/homed-preparatory-resizefs
preparatory fs resizing support split out of homed PR
2019-12-05 10:17:10 +01:00
Zbigniew Jędrzejewski-Szmek d6f1e66076 growfs: port over to resize_fs() 2019-12-05 10:15:49 +01:00
Zbigniew Jędrzejewski-Szmek 2b82a99fe0 growfs: define main function through macro 2019-12-05 09:22:13 +01:00
Yu Watanabe ec34e7d1ab
Merge pull request #14229 from yuwata/nspawn-network-interface-14223
nspawn: do not fail if udev is not running
2019-12-05 16:10:29 +09:00
Christian Ehrhardt 49219b5c2a
seccomp: mmap test results depend on kernel/libseccomp/glibc
Like with shmat already the actual results of the test
test_memory_deny_write_execute_mmap depend on kernel/libseccomp/glibc
of the platform it is running on.

There are known-good platforms, but on the others do not assert success
(which implies test has actually failed as no seccomp blocking was achieved),
but instead make the check dependent to the success of the mmap call
on that platforms.

Finally the assert of the munmap on that valid pointer should return ==0,
so that is what the check should be for in case of p != MAP_FAILED.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2019-12-05 07:19:12 +01:00
Christian Ehrhardt 5ef3ed97e3
seccomp: use per arch shmat_syscall
At the beginning of seccomp_memory_deny_write_execute architectures
can set individual filter_syscall, block_syscall, shmat_syscall values.
The former two are then used in the call to add_seccomp_syscall_filter
but shmat_syscall is not.

Right now all shmat_syscall values are the same, so the change is a
no-op, but if ever an architecture is added/modified this would be a
subtle source for a mistake so fix it by using shmat_syscall later.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2019-12-05 07:19:12 +01:00
Christian Ehrhardt 903659e7b2
seccomp: ensure rules are loaded in seccomp_memory_deny_write_execute
If seccomp_memory_deny_write_execute was fatally failing to load rules it
already returned a bad retval.
But if any adding filters failed it skipped the subsequent seccomp_load and
always returned an rc of 0 even if no rule was loaded at all.

Lets fix this requiring to (non fatally-failing) load at least one rule set.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2019-12-05 07:19:12 +01:00
Christian Ehrhardt bed4668d1d
seccomp: fix multiplexed system calls
Since libseccomp 2.4.2 more architectures have shmat handled as multiplexed
call. Those will fail to be added due to seccomp_rule_add_exact failing
on them since they'd need to add multiple rules [1].
See the discussion at https://github.com/seccomp/libseccomp/issues/193

After discussions about the options rejected [2][3] the initial thought of
a fallback to the non '_exact' version of the seccomp rule adding the next
option is to handle those now affected (i386, s390, s390x) the same way as
ppc which ignores and does not block shmat.

[1]: https://github.com/seccomp/libseccomp/issues/193
[2]: https://github.com/systemd/systemd/pull/14167#issuecomment-559136906
[3]: https://github.com/systemd/systemd/commit/469830d1
2019-12-05 07:19:07 +01:00
Anita Zhang da4dd97405
Merge pull request #14173 from ssahani/tc-sfq
network: tc: introduce sfq and tbf
2019-12-04 16:14:11 -08:00
Anita Zhang adae5eb977
Merge pull request #14219 from poettering/homed-preparatory-loop
preparatory /dev/loopN support split out of homed PR
2019-12-04 16:07:41 -08:00
Yu Watanabe bf331d8717 network: if /sys is rw, then udev should be around
This switches detect_container() to path_is_read_only_rw("/sys"), as if
systemd-udevd.service is conditionalized with that way.

This also updates the log message.
2019-12-05 08:22:52 +09:00
Yu Watanabe 26208d5b96 nspawn: do not fail if udev is not running
If /sys is read only filesystem, e.g., nspawn is running in container,
then usually udev is not running. In such a case, let's assume that
the interface is already initialized. Also, this makes nspawn refuse
to use the network interface which is under renaming.

Fixes #14223.
2019-12-05 08:22:16 +09:00
Guilhem Lettron 2e22a54f4e Implement SNI when using DNS-over-TLS
Some DNS providers need SNI to identify client.

This can be used by adding #name to a DNS.
Example:
[Resolve]
DNS=192.168.1.1#example.com
2019-12-04 23:24:06 +09:00
Lennart Poettering b7aa08ca15
Merge pull request #14111 from keszybz/unknown-section-warning
Warn about unknown sections
2019-12-04 14:12:24 +01:00
Lennart Poettering 6f0245b342 sd-bus: don't include properties maked as "emit-invalidation" in InterfacesAdded signals
Properties marked this way really shouldn't be sent around willy-nilly,
that's what the flag is about, hence exclude it from InterfacesAdded
signals (and in fact anything that is a signal).
2019-12-04 13:46:23 +01:00
Lennart Poettering 7a77d2a41c sd-bus: add new call sd_bus_message_sensitive() and SD_BUS_VTABLE_SENSITIVE
This allows marking messages that contain "sensitive" data with a flag.
If it's set then the messages are erased from memory when the message is
freed.

Similar, a flag may be set on vtable entries: incoming/outgoing message
matching the entry will then automatically be flagged this way.

This is supposed to be an easy method to mark messages containing
potentially sensitive data (such as passwords) for proper destruction.

(Note that this of course is only is as safe as the broker in between is
doing something similar. But let's at least not be the ones at fault
here.)
2019-12-04 13:46:23 +01:00
Zbigniew Jędrzejewski-Szmek 41ab3b7a85
Merge pull request #13953 from SpencerMichaels/systemd-boot-efistub-id-fix
boot: Fix default/oneshot selection for EFISTUB entries
2019-12-04 13:30:52 +01:00
Lennart Poettering f9f8268ac6
Merge pull request #14218 from poettering/homed-preparatory-small-stuff
Assorted smaller stuff split out from homed PR
2019-12-04 13:13:38 +01:00