1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 03:25:31 +03:00
Commit Graph

19118 Commits

Author SHA1 Message Date
David Herrmann
50efadb0ae bus-proxy: don't pretend everyone is root
While it's a lovely scenario, it's probably not really useful. Fix our
GetConnectionUnixUser() to return the actual 'euid' which we asked for,
not the possible uninitialized 'uid'.
2015-01-18 21:34:33 +01:00
David Herrmann
607ff5f95a Revert "test-exec: do not skip all the tests"
This reverts commit 68e68ca810. We *need*
root access to create cgroups. The only exception is if it is run from
within a cgroup with "Delegate=yes". However, this is not always true and
we really shouldn't rely on this.

If your terminal runs from within a systemd --user instance, you're fine.
Everyone else is not (like running from ssh, VTs, and so on..).
2015-01-18 20:07:51 +01:00
David Herrmann
21fce57b26 bus: fix SD_BUS_CREDS_AUGMENT on kdbus queries
If we set SD_BUS_CREDS_AUGMENT, we *need* the PID from the kernel so we
can lookup further information from /proc. However, we *must* set
SD_BUS_CREDS_PIDS in "mask", otherwise, our creds-collector will never
actually copy the pid into "sd_bus_creds". Fix this, so
SD_BUS_CREDS_AUGMENT works even if SD_BUS_CREDS_PID is not specified by
the caller.
2015-01-18 19:37:34 +01:00
David Herrmann
eea0b59193 bus: fix typo
Fix comment typo and clarify that this is not about privileges but can
have rather arbitrary reasons.
2015-01-18 19:28:30 +01:00
David Herrmann
05bae4a60c bus: use EUID over UID and fix unix-creds
Whenever a process performs an action on an object, the kernel uses the
EUID of the process to do permission checks and to apply on any newly
created objects. The UID of a process is only used if someone *ELSE* acts
on the process. That is, the UID of a process defines who owns the
process, the EUID defines what privileges are used by this process when
performing an action.

Process limits, on the other hand, are always applied to the real UID, not
the effective UID. This is, because a process has a user object linked,
which always corresponds to its UID. A process never has a user object
linked for its EUID. Thus, accounting (and limits) is always done on the
real UID.

This commit fixes all sd-bus users to use the EUID when performing
privilege checks and alike. Furthermore, it fixes unix-creds to be parsed
as EUID, not UID (as the kernel always takes the EUID on UDS). Anyone
using UID (eg., to do user-accounting) has to fall back to the EUID as UDS
does not transmit the UID.
2015-01-18 13:55:55 +01:00
David Herrmann
e23f4bb525 bus-proxy: fake all UIDs/GIDs, not just the real UID/GID
Make sure we tell the kernel to fake all UIDs/GIDs. Otherwise, the remote
side has no chance of querying our effective UID (which is usually what
they're interested in).
2015-01-18 13:54:46 +01:00
David Herrmann
d340f82032 bus-proxy: fix bus-uid tracking
We need to implicitly allow HELLO from users with the same uid as the bus.
Fix the bus-uid tracking to use the original uid, not the uid after
privilege-dropping.
2015-01-18 13:07:21 +01:00
David Herrmann
ca56b0a683 logind: hide 'self' links if not available
If the caller does not run in a session/seat or has no tracked user, hide
the /org/freedesktop/login1/.../self links in introspection data.
Otherwise, "busctl tree org.freedesktop.login1" tries to query those nodes
even though it cant.
2015-01-18 12:59:39 +01:00
David Herrmann
7447362c53 bus-proxy: don't print error-messages if we check multiple dests
If we test the policy against multiple destination names, we really should
not print warnings if one of the names results in DENY. Instead, pass the
whole array of names to the policy and let it deal with it.
2015-01-17 21:18:52 +01:00
David Herrmann
0d620e5336 bus-proxy: implement org.freedesktop.DBus.ReloadConfig()
Make sure to reload our xml policy configuration if requested via the bus.
2015-01-17 19:06:34 +01:00
David Herrmann
bae8352c1d bus-proxy: fix indentation
Fix whitespace indentation.
2015-01-17 18:54:09 +01:00
David Herrmann
a80a3a7543 bus-proxy: drop privileges if run as root
We cannot use "User=" in unit-files if we want to retain privileges. So
make bus-proxy.c explicitly drop privileges. However, only do that if
we're root, as there is no need to drop it on the user-bus.
2015-01-17 18:27:23 +01:00
David Herrmann
c4bc1a8434 bus-proxy: share policy between threads
This implements a shared policy cache with read-write locks. We no longer
parse the XML policy in each thread.

This will allow us to easily implement ReloadConfig().
2015-01-17 18:27:23 +01:00
David Herrmann
b58d857136 build: move stdio-bridge into $PATH
Make sure stdio-bridge can be found in $PATH. Otherwise, "xyzctl -H"
fails.
2015-01-17 18:27:23 +01:00
Maxim Mikityanskiy
288026bda9 hwdb: restore comments about MSI devices
Some time ago 95-keymap.rules was replaced by
60-keyboard.hwdb. Original comments for MSI laptops (that were in
95-keymap.rules) were removed, but I think they are important for
understanding what's going on.

https://bugs.freedesktop.org/show_bug.cgi?id=88412
2015-01-17 11:27:33 -05:00
David Herrmann
d3394ff47c bus-proxy: set custom thread names
Set thread-names to "p$PIDu$UID" and suffix with '*' if truncated. This
helps debugging bus-proxy issues if we want to figure out which
connections are currently open.
2015-01-17 14:32:58 +01:00
David Herrmann
a8a1a43f48 bus-proxy: turn into multi-threaded daemon
Instead of using Accept=true and running one proxy for each connection, we
now run one proxy-daemon with a thread per connection. This will enable us
to share resources like policies in the future.
2015-01-17 14:00:19 +01:00
Michael Marineau
f4a53250ac missing: add macros for OFD locks 2015-01-17 12:45:38 +01:00
Cristian Rodríguez
ecdacd4b2f remove unneeded libgen.h includes 2015-01-17 12:26:20 +01:00
Chris Atkinson
2057124e79 Grammar changes to catalog 2015-01-17 12:22:19 +01:00
Colin Guthrie
352e209804 random-seed: avoid errors when we cannot write random-seed file
When we call 'systemd-random-seed load' with a read-only /var/lib/systemd,
the cleanup code (which rewrites the random-seed file) will fail and exit.

Arguably, if the filesystem is read-only and the random-seed file exists
then this will be possibly be quite bad for entroy on subsequent reboots
but it should still not make the unit fail.
2015-01-17 11:55:14 +01:00
David Herrmann
f299e3e430 bus-proxy: bring back systemd-stdio-bridge
Now that we want to make bus-proxy multi-threaded, we have to bring back
the systemd-stdio-bridge for our TCP use-cases.
2015-01-17 11:55:14 +01:00
David Herrmann
c0395aeb90 bus-proxy: extract proxy into Proxy object
Move all the proxy code into a "struct Proxy" object that can be used
from multiple binaries.

We now dropped SMACK as we have to refactor it to work properly. We can
introduce it later on.
2015-01-17 11:55:14 +01:00
David Herrmann
91fd0103cc bus-proxy: refactor bus-creation
Move local and destination bus creation into a helper function. This
further reduces the line count of main().
2015-01-17 11:55:14 +01:00
Lennart Poettering
2a2054a796 update TODO 2015-01-16 20:09:33 +01:00
Lennart Poettering
edce2aed3a import: support importing qcow2 images
With this change the import tool will now unpack qcow2 images into
normal raw disk images, suitable for usage with nspawn.

This allows has the benefit of also allowing importing Ubuntu Cloud
images for usage with nspawn.
2015-01-16 20:09:33 +01:00
Lennart Poettering
49bb233bb7 import: support downloading .xz compressed images
That way we can download fedora cloud raw images as-is and decompress
them on-the-fly.
2015-01-16 20:09:33 +01:00
Kay Sievers
6ca5708aa9 build-sys: add libsystemd-fw where needed 2015-01-16 15:35:42 +01:00
Kay Sievers
8d09b6deae build-sys: add missing HAVE_LIBIPTC 2015-01-16 15:22:16 +01:00
Peter Hutterer
b333117c78 hwbd: add click angle for the Logitech M325
This device has 18 stops per rotation == 20 degree angle. Advertised as
"Micro-precise scrolling"
2015-01-16 11:27:36 +10:00
Bastien Nocera
ed9e8bf66d os-release: Add PRIVACY_POLICY_URL 2015-01-15 16:36:24 +01:00
Susant Sahani
b3ff20978a LLDP: Support locally assigned port subtype
The Zyxel switch sends port subtype as Locally assigned (7).
Add LLDP_PORT_SUBTYPE_LOCALLY_ASSIGNED as supported type

reported by Mantas Mikulėnas <grawity@gmail.com>
2015-01-15 16:34:38 +01:00
David Herrmann
b96014fad5 TODO: update 2015-01-15 14:13:49 +01:00
David Herrmann
244477333a udev: merge evdev_id into input_id
There is no reason to keep both separated. We want to avoid API specific
tools and instead keep generic terms like 'input'.
2015-01-15 14:13:49 +01:00
David Herrmann
975a900782 udev: fix NULL-ptr deref
Make sure we properly validate the return value of
udev_device_get_sysattr_value(). It might be NULL for several reasons.
2015-01-15 14:13:49 +01:00
Daniel Mack
5e2de0eb1d bus-proxyd: move synthesize_name_acquired()
Move synthesize_name_acquired() to synthesize.c.
2015-01-15 14:10:28 +01:00
Daniel Mack
f3c4724635 bus-proxy: factor out code for driver handling and message synthesis
Move synthesize_*() into synthesize.c and bus_proxy_process_driver() into
driver.c for better code separation.
2015-01-15 14:08:05 +01:00
Jonathan Boulle
835214146b nspawn: fix log typos 2015-01-15 08:19:30 +01:00
Peter Hutterer
011c703495 hwdb: add MOUSE_WHEEL_CLICK_ANGLE as property
Most mice have a wheel click angle of 15 degrees, i.e. 24 clicks per full
wheel rotation. Some mice, like the Logitech M325 have a larger angle. To
allow userspace to make use of that knowledge, add a property to the hwdb.

This allows for better predictive scrolling. e.g. a mouse that has a smaller
click angle will scroll faster, with this value you can accommodate this
where needed. Likewise, using "half turn of the wheel" or "full turn of the
wheel" as a UI element becomes possible.

This addition is mainly driven by libinput 0.8, having the angle enables
libinput to provide an API that distinguishes between a physical distance
(like touchpad scrolling does) and discrete steps (wheel clicks).
Callers can choose what they prefer based on the device.
2015-01-15 13:29:15 +10:00
Lennart Poettering
6dcfca59fc update TODO 2015-01-15 01:47:21 +01:00
Lennart Poettering
5f129649b9 nspawn,machined: change default container image location from /var/lib/container to /var/lib/machines
Given that this is also the place to store raw disk images which are
very much bootable with qemu/kvm it sounds like a misnomer to call the
directory "container". Hence, let's change this sooner rather than
later, and use the generic name, in particular since we otherwise try to
use the generic "machine" preferably over the more specific "container"
or "vm".
2015-01-15 01:47:21 +01:00
Lennart Poettering
aceac2f0b6 import: rename "gpt" disk image type to "raw"
After all, nspawn can now dissect MBR partition levels, too, hence
".gpt" appears a misnomer. Moreover, the the .raw suffix for these files
is already pretty popular (the Fedora disk images use it for example),
hence sounds like an OK scheme to adopt.
2015-01-15 01:47:21 +01:00
Moez Bouhlel
d31f44e281 fix zsh completion typo
json-see => json-sse
2015-01-15 00:57:45 +01:00
Ronny Chevalier
78a8e158da test-path: do not skip tests if we are not root
We can properly run the tests without being root
2015-01-15 00:57:44 +01:00
Ronny Chevalier
68e68ca810 test-exec: do not skip all the tests
Only 5 tests cannot be executed if we are not root, so just skip them
but not the whole set.
2015-01-15 00:57:44 +01:00
Lennart Poettering
5e4074aa31 spawn: downgrade loopback detach errors to debug
Sometimes udev or some other background daemon might keep the loopback
devices busy while we already want to detach them. Downgrade the warning
about it.

Given that we use autodetach downgrading these messages should be with
little risk.
2015-01-15 00:51:56 +01:00
Lennart Poettering
ada4799ac5 nspawn: add support for limited dissecting of MBR disk images with nspawn
With this change nspawn's -i switch now can now make sense of MBR disk
images too - however only if there's only a single, bootable partition
of type 0x83 on the image. For all other cases we cannot really make
sense from the partition table alone.

The big benefit of this change is that upstream Fedora Cloud Images can
now be booted unmodified with systemd-nspawn:

 # wget http://download.fedoraproject.org/pub/fedora/linux/releases/21/Cloud/Images/x86_64/Fedora-Cloud-Base-20141203-21.x86_64.raw.xz
 # unxz Fedora-Cloud-Base-20141203-21.x86_64.raw.xz
 # systemd-nspawn -i Fedora-Cloud-Base-20141203-21.x86_64.raw -b

Next stop: teach the import logic to automatically download these
images, uncompress and verify them.
2015-01-15 00:47:10 +01:00
Lennart Poettering
733d15ac7a nspawn: pass the container's init PID out via sd_notify()
This is useful for nspawn managers that want to learn when nspawn is
finished with initialiuzation, as well what the PID of the init system
in the container is.
2015-01-14 23:29:01 +01:00
Lennart Poettering
435fdcef52 update TODO 2015-01-14 23:18:33 +01:00
Lennart Poettering
657bdca9e4 nspawn: fix an incorrect assert comparison 2015-01-14 23:18:33 +01:00