Commit graph

26475 commits

Author SHA1 Message Date
Lennart Poettering 409093fe10 nss: add new "nss-systemd" NSS module for mapping dynamic users
With this NSS module all dynamic service users will be resolvable via NSS like
any real user.
2016-07-22 15:53:45 +02:00
Lennart Poettering 6f3e79859d core: enforce user/group name validity also when creating transient units 2016-07-22 15:53:45 +02:00
Lennart Poettering 29206d4619 core: add a concept of "dynamic" user ids, that are allocated as long as a service is running
This adds a new boolean setting DynamicUser= to service files. If set, a new
user will be allocated dynamically when the unit is started, and released when
it is stopped. The user ID is allocated from the range 61184..65519. The user
will not be added to /etc/passwd (but an NSS module to be added later should
make it show up in getent passwd).

For now, care should be taken that the service writes no files to disk, since
this might result in files owned by UIDs that might get assigned dynamically to
a different service later on. Later patches will tighten sandboxing in order to
ensure that this cannot happen, except for a few selected directories.

A simple way to test this is:

        systemd-run -p DynamicUser=1 /bin/sleep 99999
2016-07-22 15:53:45 +02:00
Lennart Poettering 66dccd8d85 core: be stricter when parsing User=/Group= fields
Let's verify the validity of the syntax of the user/group names set.
2016-07-22 15:53:45 +02:00
Lennart Poettering e4631b48e1 sysusers: move various user credential validity checks to src/basic/
This way we can reuse them for validating User=/Group= settings in unit files
(to be added in a later commit).

Also, add some tests for them.
2016-07-22 15:53:45 +02:00
Martin Pitt bf3dd08a81 Merge pull request #3762 from poettering/sigkill-log
log about all processes we forcibly kill
2016-07-22 09:18:30 +02:00
Martin Pitt 5c3c778014 Merge pull request #3764 from poettering/assorted-stuff-2
Assorted fixes
2016-07-22 09:10:04 +02:00
Alessandro Puccetti 31d28eabc1 nspawn: enable major=0/minor=0 devices inside the container (#3773)
https://github.com/systemd/systemd/pull/3685 introduced
/run/systemd/inaccessible/{chr,blk} to map inacessible devices,
this patch allows systemd running inside a nspawn container to create
/run/systemd/inaccessible/{chr,blk}.
2016-07-21 17:39:38 +02:00
Alessio Igor Bogani 4d07c8d386 missing_syscall: add __NR_copy_file_range for powerpc architecture (#3772) 2016-07-21 11:40:35 +02:00
Lennart Poettering 36376e0b71 update TODO 2016-07-21 11:09:24 +02:00
Peter Hutterer 1d6a2375f4 hwdb: axis resolution override for the Lenovo Y700 (#3769)
https://bugs.freedesktop.org/show_bug.cgi?id=97011
2016-07-21 10:55:36 +02:00
Lennart Poettering 1f5dc27b66 Merge pull request #3770 from AlexanderKurtz/master
bootctl: Always use upper case for "/EFI/BOOT" and "/EFI/BOOT/BOOT*.EFI".
2016-07-21 10:55:05 +02:00
Thomas H. P. Andersen f8298f7be3 core: remove duplicate includes (#3771) 2016-07-21 10:52:07 +02:00
Zbigniew Jędrzejewski-Szmek be1354d8df Merge pull request #3760 from poettering/rfkill-fix
rfkill dead-lock fix
2016-07-20 22:19:05 -04:00
Lennart Poettering e4a3e122b2 documentation: add a short document describing how to test your systemd build tree (#3763) 2016-07-20 22:15:54 -04:00
Alexander Kurtz 00f69504a2 bootctl: Always use upper case for "/EFI/BOOT" and "/EFI/BOOT/BOOT*.EFI".
If the ESP is not mounted with "iocharset=ascii", but with "iocharset=utf8"
(which is for example the default in Debian), the file system becomes case
sensitive. This means that a file created as "FooBarBaz" cannot be accessed as
"foobarbaz" since those are then considered different files.

Moreover, a file created as "FooBar" can then also not be accessed as "foobar",
and it also prevents such a file from being created, as both would use the same
8.3 short name "FOOBAR".

Even though the UEFI specification [0] does give the canonical spelling for
the files mentioned above, not all implementations completely conform to that,
so it's possible that those files would already exist, but with a different
spelling, causing subtle bugs when scanning or modifying the ESP.

While the proper fix would of course be that everybody conformed to the
standard, we can work around this problem by just referencing the files by
their 8.3 short names, i.e. using upper case.

Fixes: #3740

[0] <http://www.uefi.org/specifications>, version 2.6, section 3.5.1.1
2016-07-21 03:02:15 +02:00
Alexander Kurtz b7536c45ef bootctl: Use lower case string constants in case-insensitive comparisons. 2016-07-21 02:20:12 +02:00
Topi Miettinen 176e51b710 namespace: fix wrong return value from mount(2) (#3758)
Fix bug introduced by #3263: mount(2) return value is 0 or -1, not errno.

Thanks to Evgeny Vereshchagin (@evverx) for reporting.
2016-07-20 17:43:21 +03:00
Lennart Poettering c0f81393d1 basic: fix macro definition in nss-util.h
Fix a copy/paste mistake.
2016-07-20 14:53:15 +02:00
Lennart Poettering 33df919d5c execute: make sure JoinsNamespaceOf= doesn't leak ns fds to executed processes 2016-07-20 14:53:15 +02:00
Lennart Poettering fe048ce56a namespace: add a (void) cast 2016-07-20 14:53:15 +02:00
Lennart Poettering 1ddc1272e7 nspawn: when netns is on, mount /proc/sys/net writable
Normally we make all of /proc/sys read-only in a container, but if we do have
netns enabled we can make /proc/sys/net writable, as things are virtualized
then.
2016-07-20 14:53:15 +02:00
Lennart Poettering 065d31c360 nspawn: document why the uid shift range is the way it is 2016-07-20 14:53:15 +02:00
Lennart Poettering 00d0fd0619 conf-parser: minor coding style improvements 2016-07-20 14:53:15 +02:00
Lennart Poettering 8d36b53a2d units: fix TasksMax=16384 for systemd-nspawn@.service
When a container scope is allocated via machined it gets 16K set already since
cf7d1a30e4. Make sure when a container is run as
system service it gets the same values.
2016-07-20 14:53:15 +02:00
Lennart Poettering 9ce9347880 core: normalize header inclusion in execute.h a bit
We don't actually need any functionality from cgroup.h in execute.h, hence
don't include that. However, we do need the Unit structure from unit.h, hence
include that, and move it as late as possible, since it needs the definitions
from execute.h.
2016-07-20 14:53:15 +02:00
Lennart Poettering 7a1ab780c4 execute: normalize connect_logger_as() parameters slightly
All other functions in execute.c that need the unit id take a Unit* parameter
as first argument. Let's change connect_logger_as() to follow a similar logic.
2016-07-20 14:53:15 +02:00
Lennart Poettering 756ed0e238 logind: always abandon session scopes before killing them
This way systemd is informed that we consider everything inside the scope as
"left-over", and systemd can log about killing it.

With this change systemd will log about all processes killed due to the session
clean-up on KillUserProcesses=yes.
2016-07-20 14:35:15 +02:00
Lennart Poettering 3862e809d0 core: when a scope was abandoned, always log about processes we kill
After all, if a unit is abandoned, all processes inside of it may be considered
"left over" and are something we should better log about.
2016-07-20 14:35:15 +02:00
Lennart Poettering f4b0fb236b core: make sure RequestStop signal is send directed
This was accidentally left commented out for debugging purposes, let's fix that
and make the signal directed again.
2016-07-20 14:35:15 +02:00
Lennart Poettering 0d5b481092 cgroup: suppress sending follow-up SIGCONT after sending SIGCONT/SIGKILL anyway 2016-07-20 14:35:15 +02:00
Lennart Poettering 1d98fef17d core: when forcibly killing/aborting left-over unit processes log about it
Let's lot at LOG_NOTICE about any processes that we are going to
SIGKILL/SIGABRT because clean termination of them didn't work.

This turns the various boolean flag parameters to cg_kill(), cg_migrate() and
related calls into a single binary flags parameter, simply because the function
now gained even more parameters and the parameter listed shouldn't get too
long.

Logging for killing processes is done either when the kill signal is SIGABRT or
SIGKILL, or on explicit request if KILL_TERMINATE_AND_LOG instead of LOG_TERMINATE
is passed. This isn't used yet in this patch, but is made use of in a later
patch.
2016-07-20 14:35:15 +02:00
Daniele Medri 01a326affd PO: italian updates (#3761) 2016-07-20 13:02:28 +02:00
Lennart Poettering 26f417d3e8 util: don't send SIGCONT following a SIGCONT or SIGKILL in kill_and_sigcont() 2016-07-20 11:14:48 +02:00
Lennart Poettering 801a884d1e logind: minor coding style improvements 2016-07-20 11:14:18 +02:00
Lennart Poettering 42c32d6ff4 Merge pull request #3759 from poettering/namespace-fixup
minor follow-up fixes for #3685
2016-07-20 09:22:40 +02:00
Lennart Poettering 32eae3c2a8 rules: make sure always set at least one property on rfkill devices
The rfkill service waits for rfkill device initialization as reported by
udev_device_is_initialized(), and if that is never reported it might dead-lock.

However, udev never reports completed initialization for devices that have no
properties or tags set. For some rfkill devices this might be the case, in
particular those which are connected to exotic busses, where path_id returns
nothing.

This patch simply sets the SYSTEM_RFKILL property on all rfkill devices, to
ensure that udev_device_is_initialized() always reports something useful and we
don't dead-lock.

Fixes: #2745
2016-07-20 09:17:57 +02:00
Lennart Poettering 891a15cab2 man: document a tiny bit better what udev_device_get_is_initialized() actually returns 2016-07-20 09:17:33 +02:00
Lennart Poettering 5fd7cf6fe2 namespace: minor improvements
We generally try to avoid strerror(), due to its threads-unsafety, let's do
this here, too.

Also, let's be tiny bit more explanatory with the log messages, and let's
shorten a few things.
2016-07-20 08:57:25 +02:00
Lennart Poettering d724118e20 core: hide legacy bus properties
We usually hide legacy bus properties from introspection. Let's do that for the
InaccessibleDirectories= properties too.

The properties stay accessible if requested, but they won't be listed anymore
if people introspect the unit.
2016-07-20 08:55:50 +02:00
mulkieran 13317a22e5 man: revise entry about specifying a file path (#3739)
* Specifying a device node has an effect much larger than a simple shortcut
for a field/value match, so the original sentence is no longer a good way
to start the paragraph.
* Specifying a device node causes matches to be generated for all ancestor
devices of the device specified, not just its parents.
* Indicates that the path must be absolute, but that it may be a link.
* Eliminates a few typos.
2016-07-19 23:15:22 -04:00
Zbigniew Jędrzejewski-Szmek dfc6109fcd man: mention that locale changes might require initramfs to be rebuilt (#3754)
https://bugzilla.redhat.com/show_bug.cgi?id=1151651

Also explain what localectl does a bit better:
https://bugzilla.redhat.com/show_bug.cgi?id=1357861
2016-07-19 21:24:23 +02:00
Lennart Poettering 069a92c658 Merge pull request #3685 from kinvolk/alessandro/inaccessible-paths
namespace: unify limit behavior on non-directory paths
2016-07-19 21:17:49 +02:00
Evgeny Vereshchagin 4526e15d06 Merge pull request #3636 from poettering/logs-show-utf8
improve handling of trailing newline in journal logging
2016-07-19 21:11:41 +03:00
Lennart Poettering 0d23bc57da sd-journal: suppress empty lines
Let's make sure our logging APIs is in sync with how stdout/stderr logging
works.
2016-07-19 17:51:20 +02:00
Alessandro Puccetti 2a624c36e6 doc,core: Read{Write,Only}Paths= and InaccessiblePaths=
This patch renames Read{Write,Only}Directories= and InaccessibleDirectories=
to Read{Write,Only}Paths= and InaccessiblePaths=, previous names are kept
as aliases but they are not advertised in the documentation.

Renamed variables:
`read_write_dirs` --> `read_write_paths`
`read_only_dirs` --> `read_only_paths`
`inaccessible_dirs` --> `inaccessible_paths`
2016-07-19 17:22:02 +02:00
Alessandro Puccetti c4b4170746 namespace: unify limit behavior on non-directory paths
Despite the name, `Read{Write,Only}Directories=` already allows for
regular file paths to be masked. This commit adds the same behavior
to `InaccessibleDirectories=` and makes it explicit in the doc.
This patch introduces `/run/systemd/inaccessible/{reg,dir,chr,blk,fifo,sock}`
{dile,device}nodes and mounts on the appropriate one the paths specified
in `InacessibleDirectories=`.

Based on Luca's patch from https://github.com/systemd/systemd/pull/3327
2016-07-19 17:22:02 +02:00
Lennart Poettering 4c5db93f8a man: document that sd_journal_print() strips trailing whitespace 2016-07-19 14:21:49 +02:00
Lennart Poettering 8980058a37 journalctl: make sure that journalctl's --all switch also has an effect on json output
With this change, binary record data is formatted as string if --all is
specified when using json output. This is inline with the effect of --all on
the other available output modes.

Fixes: #3416
2016-07-19 14:21:49 +02:00
Lennart Poettering c24f1f9df1 sd-journal: when formatting log messages, implicitly strip trailing whitespace
When converting log messages from human readable text into binary records to
send off to journald in sd_journal_print(), strip trailing whitespace in the
log message. This way, handling of logs made via syslog(), stdout/stderr and
sd_journal_print() are treated the same way: trailing (but not leading)
whitespace is automatically removed, in particular \n and \r. Note that in case
of syslog() and stdout/stderr based logging the stripping takes place
server-side though, while for the native protocol based transport this takes
place client-side. This is because in the former cases conversion from
free-form human-readable strings into structured, binary log records takes
place on the server-side while for journal-native logging it happens on the
client side, and after conversion into binary records we probably shouldn't
alter the data anymore.

See: #3416
2016-07-19 14:21:49 +02:00