Commit Graph

37074 Commits

Author SHA1 Message Date
Lennart Poettering 8f2eb7302d update TODO 2018-11-29 20:54:31 +01:00
Lennart Poettering 30874dda3a dev-setup: generalize logic we use to create "inaccessible" device nodes
Let's generalize this, so that we can use this in nspawn later on, which
is pretty useful as we need to be able to mask files from the inner
child of nspawn too, where the host's /run/systemd/inaccessible
directory is not visible anymore. Moreover, if nspawn can create these
nodes on its own before the payload this means the payload can run with
fewer privileges.
2018-11-29 20:21:40 +01:00
Lennart Poettering 17c58ba97b nspawn: let's also pre-mount /dev/mqueue 2018-11-29 20:21:40 +01:00
Lennart Poettering d435a18244 ptyfwd: optionally override terminal width/height 2018-11-29 20:21:39 +01:00
Lennart Poettering de321f5228 fs-util: beef up chmod_and_chown() a bit 2018-11-29 20:21:39 +01:00
Lennart Poettering d739169804 capability: add new type for maintaining all five cap sets as one 2018-11-29 20:21:39 +01:00
Lennart Poettering d5aecba6e0 cgroup: use device_path_parse_major_minor() also for block device paths
Not only when we populate the "devices" cgroup controller we need
major/minor numbers, but for the io/blkio one it's the same, hence let's
use the same logic for both.
2018-11-29 20:21:39 +01:00
Lennart Poettering 54b22b2643 tree-wide: port various parts of the code over to the new device_major_minor_path() calls 2018-11-29 20:21:39 +01:00
Lennart Poettering 846b3bd61e stat-util: add new APIs device_path_make_{major_minor|canonical}() and device_path_parse_major_minor()
device_path_make_{major_minor|canonical)  generate device node paths
given a mode_t and a dev_t. We have similar code all over the place,
let's unify this in one place. The former will generate a "/dev/char/"
or "/dev/block" path, and never go to disk. The latter then goes to disk
and resolves that path to the actual path of the device node.

device_path_parse_major_minor() reverses device_path_make_major_minor(),
also withozut going to disk.

We have similar code doing something like this at various places, let's
unify this in a single set of functions. This also allows us to teach
them special tricks, for example handling of the
/run/systemd/inaccessible/{blk|chr} device nodes, which we use for
masking device nodes, and which do not exist in /dev/char/* and
/dev/block/*
2018-11-29 20:21:39 +01:00
Lennart Poettering 8e8b5d2e6d cgroups: beef up DeviceAllow= syntax a bit
Previously we'd allow pattern expressions such as "char-input" to match
all input devices. Internally, this would look up the right major to
test in /proc/devices. With this commit the syntax is slightly extended:

- "char-*" can be used to match any kind of character device, and
  similar "block-*. This expression would work previously already, but
  instead of actually installing a wildcard match it would install many
  individual matches for everything listed in /proc/devices.

- "char-<MAJOR>" with "<MAJOR>" being a numerical parameter works now
  too. This allows clients to install whitelist items by specifying the
  major directly.

The main reason to add these is to provide limited compat support for
clients that for some reason contain whitelists with major/minor numbers
(such as OCI containers).
2018-11-29 20:21:39 +01:00
Lennart Poettering 74c48bf5a8 core: add special handling for devices cgroup allow lists for /dev/block/* and /dev/char/* device nodes
This adds some code to hanlde /dev/block/* and /dev/char/* device node
paths specially: instead of actually stat()ing them we'll just parse the
major/minor name from the name. This is useful 'hack' to allow clients
to install whitelists for devices that don't actually have to exist.

Also, let's similarly handle /run/systemd/inaccessible/{blk|chr}. This
allows us to simplify our built-in default whitelist to not require a
"ignore_enoent" mode for these nodes.

In general we should be careful with hardcoding major/minor numbers, but
in this case this should safe.
2018-11-29 20:03:56 +01:00
Lennart Poettering 3a47c40d97 tree-wide: port various parts of the code to use parse_dev() 2018-11-29 20:03:56 +01:00
Lennart Poettering 61e0111df9 path-util: port path_join() over to path_join_many()
We should probably drop path_join() entirely in the long run (and
then rename path_join_many() to it?), but for now let's make one a
wrapper for the other.
2018-11-29 20:03:56 +01:00
Lennart Poettering cd8194a389 path-util: add new path_join_many() API 2018-11-29 20:03:56 +01:00
Lennart Poettering de06c0cf77 parse-util: rework parse_dev() based on safe_atou() and DEVICE_MAJOR_VALID()/DEVICE_MINOR_VALID()
Let's be a bit more careful when parsing major/minor pairs, and filter
out more corner cases. This also means using safe_atou() rather than
sscanf() to avoid weird negative unsigned handling and such.
2018-11-29 20:02:39 +01:00
Lennart Poettering fa583ab176 logind: validate majors/minors we receieve via the bus 2018-11-29 20:02:39 +01:00
Lennart Poettering fb2430c6e5 stat-util: add macros for checking whether major and minor values are in range
As it turns out glibc and the Linux kernel have different ideas about
the size of dev_t and how many bits exist for the major and the minor.
When validating major/minor numbers we should check against the kernel's
actual sizes, hence add macros for this.
2018-11-29 20:02:39 +01:00
Lennart Poettering 192b89368e
Merge pull request #10987 from poettering/index-md-work-around
docs: work around GitHub pages weirdness
2018-11-29 19:29:02 +01:00
Lennart Poettering 6740028516
Merge pull request #10989 from keszybz/nss-man
Add example to nss-mymachines(8)
2018-11-29 19:28:39 +01:00
Lennart Poettering f7db73528f docs: work around GitHub pages weirdness
Fixes: #10546
2018-11-29 19:09:09 +01:00
Zbigniew Jędrzejewski-Szmek 401faa3533
Merge pull request #10357 from poettering/import-fs
machinectl import-fs command and other fixes
2018-11-29 16:38:46 +01:00
Zbigniew Jędrzejewski-Szmek f2cca38e46 man: add an extensive example to nss-mymachines(8)
The man page didn't really say what we are mapping and with what
patterns. Let's fix that.
2018-11-29 15:47:21 +01:00
Zbigniew Jędrzejewski-Szmek f781c8fe78
Merge pull request #10959 from poettering/systemctl-edit-fixo
Fix "systemctl edit" for non-loadable units
2018-11-29 15:35:07 +01:00
Lennart Poettering edc8e7b81f docs: fix typo 2018-11-29 15:29:47 +01:00
Lennart Poettering c1d3483d47 docs: uppercase the title of our Markdown docs 2018-11-29 15:29:47 +01:00
Susant Sahani 173a6e29be networkd: vxlan make use of parse_ip_port_range
Use parse_ip_port_range
2018-11-29 14:04:26 +01:00
Zbigniew Jędrzejewski-Szmek 3bfb1010b2 machinectl: fix printing of multiple addresses
We'd print everything jumbled together:
$ machinectl --max-addresses=3
MACHINE CLASS     SERVICE        OS     VERSION ADDRESSES
rawhide container systemd-nspawn fedora 30      169.254.40.164fe80::94aa:3aff:fe7b:d4b9
2018-11-29 13:04:50 +01:00
Zbigniew Jędrzejewski-Szmek 4527a83bc7 machinectl: drop helper function
It only serves to forward some arguments without modification and is only
used in one place anyway.
2018-11-29 13:04:50 +01:00
Lennart Poettering 02a126a33d systemctl: if service manager couldn't load unit file, don't rely on it to tell us the fragment path
Previously, "systemctl edit" exclusively used the service manager's
per-unit FragmentPath property to figure out which file to edit, when
operating on a non-template unit. If for some reason loading the unit
file failed entirely though (LoadState=error), then FragmentPath would
be empty, and thus the unit not editable.

Let's fix this, by falling back to client-side unit file searching in
this case.

(Also, various other clean-ups to make the relevant functions follow our
coding style)

Fixes: #9561
2018-11-29 11:25:32 +01:00
Lennart Poettering 85163756da systemctl: rework message suggesting how to create a new unit file
We need to specifiy --full for creating full unit files.

Also, this is an explanatory hint, hence shouldn't be logged on LOG_ERR
level.
2018-11-29 11:25:32 +01:00
Lennart Poettering df79fdab21 systemctl: shorten code a bit 2018-11-29 11:25:32 +01:00
Lennart Poettering 5daacba233 systemctl: improve message when we skip a unit for editing a bit 2018-11-29 11:25:32 +01:00
Lennart Poettering 92d6b0bfdc systemctl: use _cleanup_ logic for error paths in unit_file_create_copy(), too 2018-11-29 11:25:32 +01:00
Lennart Poettering 919d272085 systemctl: rework error paths in unit_file_create_new()
Let's use _cleanup_ to clean up stuff for us.
2018-11-29 11:25:32 +01:00
Lennart Poettering b03677e2da systemctl: rework unit_find_template_path() to follow coding style
This makes sure that we don't clobber return values on failure and reset
all return values on success.
2018-11-29 11:25:32 +01:00
Lennart Poettering f67cb27060 systemctl: make sure we initialize return parameters in unit_file_find_path() on success
According to our coding style return values should be initialized when
we return any form of success, do so here too.
2018-11-29 11:21:55 +01:00
Lennart Poettering c45e7e0cbf systemctl: rename unit_file_find_path()'s return paramete to indicate that it is one 2018-11-29 11:15:45 +01:00
Lennart Poettering ecb1a44cc9 docs: add brief docs explaing udev's flock() block device node synchronization 2018-11-29 10:48:30 +01:00
Lennart Poettering 0abf94923b NEWS: extend docs on RLIMIT_NOFILE
We now settled on 512K, and forgot to update NEWS.

Moreover, explain why 512K was chosen.
2018-11-29 14:55:31 +09:00
Evgeny Vereshchagin c90c39ff7b catalog: reject entries where the language is too short early
Closes https://oss-fuzz.com/testcase-detail/5674475278827520
2018-11-29 13:41:40 +09:00
Lennart Poettering bf61b05a06 networkd: slightly rework route establishment logic
Use a for() loop to merge the two very similar loops into one, and add
more comments explaining the logic behing this.

Follow-up for 0d34228fc0
2018-11-29 13:38:54 +09:00
Yu Watanabe 636a13d1ec
Merge pull request #10977 from yuwata/test-network-remove-state-file
test-network: optionally remove state file of networkd
2018-11-29 13:38:08 +09:00
Zbigniew Jędrzejewski-Szmek 8b4e51a60e
Merge pull request #10797 from poettering/run-generator
add new "systemd-run-generator" for running arbitrary commands from the kernel command line as system services using the "systemd.run=" kernel command line switch
2018-11-28 22:40:55 +01:00
Yu Watanabe c0bf673376 test-network: stop systemd-networkd.socket during testing
To suppress noisy warning messages.
2018-11-28 22:00:40 +01:00
Yu Watanabe bad4969bba test-network: clear state file before starting networkd
Otherwise, some tests may disturb others, e.g.,
NetworkdNetWorkTests.test_routing_policy_rule_port_range and
NetworkdNetWorkTests.test_routing_policy_rule.
2018-11-28 21:40:57 +01:00
Yu Watanabe d486a2d0c1 test-network: use /run instead of legacy /var/run 2018-11-28 19:55:01 +01:00
Yu Watanabe 50ae773f85
Merge pull request #10970 from yuwata/from-name-return-negative-errno
util: make *_from_name() returns negative errno on error
2018-11-29 03:18:03 +09:00
Yu Watanabe fab57f7f13
Merge pull request #10948 from ssahani/iprule-port-proto
networkd: add support to configure ip rule port range and protocol.
2018-11-29 03:17:36 +09:00
Lennart Poettering 09dad04c49 meson: let's bump RLIMIT_NOFILE hard limit to 512K
Prompted by:

https://lists.freedesktop.org/archives/systemd-devel/2018-October/041578.html
2018-11-28 17:08:27 +01:00
Lubomir Rintel 230450d4e4 sysctl.d: switch net.ipv4.conf.all.rp_filter from 1 to 2
This switches the RFC3704 Reverse Path filtering from Strict mode to Loose
mode. The Strict mode breaks some pretty common and reasonable use cases,
such as keeping connections via one default route alive after another one
appears (e.g. plugging an Ethernet cable when connected via Wi-Fi).

The strict filter also makes it impossible for NetworkManager to do
connectivity check on a newly arriving default route (it starts with a
higher metric and is bumped lower if there's connectivity).

Kernel's default is 0 (no filter), but a Loose filter is good enough. The
few use cases where a Strict mode could make sense can easily override
this.

The distributions that don't care about the client use cases and prefer a
strict filter could just ship a custom configuration in
/usr/lib/sysctl.d/ to override this.
2018-11-28 16:29:01 +01:00