Commit graph

5837 commits

Author SHA1 Message Date
Chris Morin
1995fb8bb4 doc: replace dbus-send's --address with --peer and --bus
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48816
2019-06-13 20:51:10 -07:00
Simon McVittie
0b8878133f Start spec 0.36 development
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-06-11 16:28:34 +01:00
Simon McVittie
942bb14708 Start 1.13.14 development
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-06-11 16:28:25 +01:00
Simon McVittie
df9dabe521 Prepare version 1.13.12
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-06-09 13:09:15 +01:00
Simon McVittie
6231e7d75f test: Add basic test coverage for DBUS_COOKIE_SHA1
We don't actually complete successful authentication, because that
would require us to generate a cookie and compute the correct SHA1,
which is difficult to do in a deterministic authentication script.
However, we do assert that dbus#269 (CVE-2019-12749) has been fixed.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-06-09 13:08:53 +01:00
Simon McVittie
2a11ab9bbd auth: Reject DBUS_COOKIE_SHA1 for users other than the server owner
The DBUS_COOKIE_SHA1 authentication mechanism aims to prove ownership
of a shared home directory by having the server write a secret "cookie"
into a .dbus-keyrings subdirectory of the desired identity's home
directory with 0700 permissions, and having the client prove that it can
read the cookie. This never actually worked for non-malicious clients in
the case where server uid != client uid (unless the server and client
both have privileges, such as Linux CAP_DAC_OVERRIDE or traditional
Unix uid 0) because an unprivileged server would fail to write out the
cookie, and an unprivileged client would be unable to read the resulting
file owned by the server.

Additionally, since dbus 1.7.10 we have checked that ~/.dbus-keyrings
is owned by the uid of the server (a side-effect of a check added to
harden our use of XDG_RUNTIME_DIR), further ruling out successful use
by a non-malicious client with a uid differing from the server's.

Joe Vennix of Apple Information Security discovered that the
implementation of DBUS_COOKIE_SHA1 was susceptible to a symbolic link
attack: a malicious client with write access to its own home directory
could manipulate a ~/.dbus-keyrings symlink to cause the DBusServer to
read and write in unintended locations. In the worst case this could
result in the DBusServer reusing a cookie that is known to the
malicious client, and treating that cookie as evidence that a subsequent
client connection came from an attacker-chosen uid, allowing
authentication bypass.

This is mitigated by the fact that by default, the well-known system
dbus-daemon (since 2003) and the well-known session dbus-daemon (in
stable releases since dbus 1.10.0 in 2015) only accept the EXTERNAL
authentication mechanism, and as a result will reject DBUS_COOKIE_SHA1
at an early stage, before manipulating cookies. As a result, this
vulnerability only applies to:

* system or session dbus-daemons with non-standard configuration
* third-party dbus-daemon invocations such as at-spi2-core (although
  in practice at-spi2-core also only accepts EXTERNAL by default)
* third-party uses of DBusServer such as the one in Upstart

Avoiding symlink attacks in a portable way is difficult, because APIs
like openat() and Linux /proc/self/fd are not universally available.
However, because DBUS_COOKIE_SHA1 already doesn't work in practice for
a non-matching uid, we can solve this vulnerability in an easier way
without regressions, by rejecting it early (before looking at
~/.dbus-keyrings) whenever the requested identity doesn't match the
identity of the process hosting the DBusServer.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Closes: https://gitlab.freedesktop.org/dbus/dbus/issues/269
Closes: CVE-2019-12749
2019-06-09 13:08:22 +01:00
Simon McVittie
00099d5dca Revert "Start spec 0.36 development"
This reverts commit edece0274b.
No spec changes have happened since 0.35.
2019-06-09 12:09:04 +01:00
Simon McVittie
fc28ea9959 Merge branch 'issue270' into 'master'
bus: Clarify names of methods that query owned names

Closes #270

See merge request dbus/dbus!114

Reviewed-by: @pwithnall
2019-05-31 10:55:56 +00:00
Simon McVittie
3b2217821b bus: Clarify names of methods that query owned names
It wasn't immediately clear from the names of these method whether they
should return TRUE or FALSE for queued owners other than the primary
owner. Renaming them makes it obvious that the answer should be TRUE.

While I'm there, make the corresponding _dbus_verbose() messages more
precise.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: https://gitlab.freedesktop.org/dbus/dbus/issues/270
2019-05-30 15:59:10 +01:00
Simon McVittie
463ecfb4fd Merge branch 'send_destination_prefix' into 'master'
Send destination prefix

See merge request dbus/dbus!85
2019-05-30 14:49:09 +00:00
Simon McVittie
edece0274b Start spec 0.36 development
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-05-17 15:47:38 +01:00
Simon McVittie
f79aa63045 Start dbus 1.13.12 development
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-05-17 15:47:29 +01:00
Adrian Szyndela
dcbab02613 doc: described send_destination_prefix in manual
This adds a description of send_destination_prefix to the dbus-daemon manual.

Signed-off-by: Adrian Szyndela <adrian.s@samsung.com>
Change-Id: I46e6fa54ee34095c3ac83ec2c06cb91cf5669c7f
2019-05-14 10:31:13 +02:00
Adrian Szyndela
8fcc1f9a8a test: activation tests for send_destination_prefix
This adds a few tests for checking if activation is allowed
for names specified within send_destination_prefix namespaces.

Signed-off-by: Adrian Szyndela <adrian.s@samsung.com>
Change-Id: I7a5a66f82fc08ce6cb46e37de2c3dfae24d9ea67
2019-05-14 10:31:13 +02:00
Adrian Szyndela
7b7c572434 test: send_destination(_prefix) tests
This adds tests for mostly "send_destination_prefix" cases
and some "send_destination" cases.

The general test case is:
- addressed recipient is running and owns a name;
- a message is sent to the name owner;
- the response is checked for allow/deny (method return/error).
Each test case is executed both for primary and queued ownership.

The tests include:
- checking send allow/deny for names and namespaces, including nesting;
- checking send allow/deny for neighbour names;
- checking send allow/deny for names/namespaces+interface+member.

Signed-off-by: Adrian Szyndela <adrian.s@samsung.com>
Change-Id: If5fcada01601355e7aadefadad79c0b24f8c397f
2019-05-14 10:31:12 +02:00
Simon McVittie
99f0821bfb Prepare release v1.13.10 and Specification v0.35
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-05-13 14:24:06 +01:00
Simon McVittie
e6b69092f4 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-05-13 12:41:53 +01:00
Simon McVittie
6884f63e0e Merge branch 'unix-gids' into 'master'
Add UnixGroupIDs to connection credentials

See merge request dbus/dbus!105

Fixes: dbus/dbus#196
2019-05-13 11:32:24 +00:00
Simon McVittie
5619f03984 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-05-13 11:49:41 +01:00
Ralf Habacker
f72adabbd9 Merge branch 'cmake-mkdir' into 'master'
cmake: Create all output directories for Doxygen

Closes #266

See merge request dbus/dbus!113
2019-04-26 21:48:54 +00:00
Adrian Szyndela
055ff9e64a dbus-daemon: add send_destination_prefix support
This extends dbus-daemon with support for send_destination_prefix
attribute in XML policies.

It allows having policy rules for sending to bus names generated
within namespaces defined by a prefix. The similar behaviour can be
emulated by owning an additional name, not used for addressing messages,
as described in
https://lists.freedesktop.org/archives/dbus/2017-May/017188.html
However, introducing send_destination_prefix creates possibility
of communicating intentions in a more direct way, which is easier
to understand.

Signed-off-by: Adrian Szyndela <adrian.s@samsung.com>
Change-Id: I0016ad93f1c16b7742fef5f45ebaf01b55694d3c
2019-04-26 13:29:42 +02:00
Adrian Szyndela
3486e0f48d DBusString: extend with checking for starting with words
This extracts a few lines of code and adds it as a DBusString function
that checks if a DBusString starts with words given with a C string
and a word separator. In other words, it checks if:
- a DBusString is a given C string, or
- a DBusString starts with a given C string and the next character is
  a given word separator.

It is used for matching names to prefixes when checking the policy.

Signed-off-by: Adrian Szyndela <adrian.s@samsung.com>
Change-Id: Ie39d33916863d950dde38d3b8b20c8a539217302
2019-04-26 13:29:42 +02:00
Simon McVittie
339b94da6b cmake: Create all output directories for Doxygen
CI builds intermittently fail with

    error: Could not create output directory /.../doc/api/xml

or

    error: Could not create output directory /.../doc/api/man

Fixes: https://gitlab.freedesktop.org/dbus/dbus/issues/266
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-04-25 12:22:25 +01:00
Simon McVittie
9699150195 Merge branch 'rlimit-nofile' into 'master'
bus: Try to raise soft fd limit to match hard limit

See merge request dbus/dbus!103

Reviewed-by: @poettering
[smcv: Correct a comment]
Reviewed-by: @pwithnall
2019-04-25 10:18:40 +00:00
Simon McVittie
6ee63e3a70 Merge branch 'msys2-chmod' into 'master'
build: Don't assume we can set permissions on a directory

Closes #216

See merge request dbus/dbus!110
2019-04-18 15:35:22 +00:00
Simon McVittie
7eacbfece7 bus: Try to raise soft fd limit to match hard limit
Linux systems have traditionally set the soft limit to 1024 and the hard
limit to 4096. Recent versions of systemd keep the soft fd limit at
1024 to avoid breaking programs that still use select(), but raise the
hard limit to 512*1024, while in recent Debian versions a complicated
interaction between components gives a soft limit of 1024 and a hard
limit of 1024*1024. If we can, we might as well elevate our soft limit
to match the hard limit, minimizing the chance that we will run out of
file descriptor slots.

Unlike the previous code to raise the hard and soft limits to at least
65536, we do this even if we don't have privileges: privileges are
unnecessary to raise the soft limit up to the hard limit.

If we *do* have privileges, we also continue to raise the hard and soft
limits to at least 65536 if they weren't already that high, making
it harder to carry out a denial of service attack on the system bus on
systems that use the traditional limit (CVE-2014-7824).

As was previously the case on the system bus, we'll drop the limits back
to our initial limits before we execute a subprocess for traditional
(non-systemd) activation, if enabled.

systemd activation doesn't involve us starting subprocesses at all,
so in both cases activated services will still inherit the same limits
they did previously.

Reviewed-by: Lennart Poettering <lennart@poettering.net>
[smcv: Correct a comment based on Lennart's review, reword commit message]
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-04-18 11:54:48 +01:00
Simon McVittie
14f46d14a0 build: Don't assume we can set permissions on a directory
MSYS2 has enough of a Unixish environment to run Autotools, but
apparently not enough of a Unixish environment to have functional
permissions.

Closes: dbus#216
2019-04-17 16:32:01 +01:00
Simon McVittie
fd0c19d6d8 Merge branch 'disable-traditional-activation' into 'master'
Configure option to disable traditional activation

See merge request dbus/dbus!107
2019-04-17 13:33:06 +00:00
Simon McVittie
9e0fd2fbbf bus_driver_credentials_fill_unix_gids: Comment on a non-error
As described in the spec, we want GetConnectionCredentials() to report
less information, successfully, if it sees a group ID that it can't
represent.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-04-17 14:22:15 +01:00
Simon McVittie
301db92576 spec: Document what happens for unrepresentable group IDs
Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-04-17 14:19:15 +01:00
Simon McVittie
3c8422884a test-dbus-daemon: Fix a misleading variable name
In D-Bus I'd expect "ay_iter" to be an iterator over the type 'ay',
i.e. a byte-array. Abbreviate a little less to avoid this.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-04-17 14:17:41 +01:00
Simon McVittie
812678e595 test-dbus-daemon: Say why we don't check the value of LinuxSecurityLabel
Suggested on !105 by Matthijs van Duin.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-04-17 14:13:42 +01:00
Matthijs van Duin
afafd2fad0 Add UnixGroupIDs to connection credentials
Signed-off-by: Matthijs van Duin <matthijsvanduin@gmail.com>
2019-03-25 23:01:26 +01:00
Matthijs van Duin
a96d524fb1 Add _dbus_asv_add_fixed_array
This generalizes _dbus_asv_add_byte_array.

Signed-off-by: Matthijs van Duin <matthijsvanduin@gmail.com>
2019-03-25 21:04:21 +01:00
Topi Miettinen
94b5b236aa
Configure option to disable traditional activation
Traditional activation could be disabled if all services use
SystemdService activation instead. Provide an example of a hardened
DBus systemd service drop-in file for such a setup.

Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
2019-03-25 21:51:33 +02:00
Simon McVittie
df9cb47c3a Merge branch 'split-spawn-oom-test' into 'master'
Split spawn oom test

See merge request dbus/dbus!99
2019-03-15 17:06:01 +00:00
Ralf Habacker
433d5c2471 test-spawn-oom: Separate single spawn tests from oom related
This makes it possible to run each test independent from oom condition.
2019-03-15 17:06:01 +00:00
Simon McVittie
d757455c5e Merge branch 'msys2-fixes' into 'master'
cmake: Drop unused iconv dependency

Closes #262

See merge request dbus/dbus!101
2019-03-15 17:03:35 +00:00
Ralf Habacker
82e0847936 Merge branch 'cal-fix-cmake-pkgconfig' into 'master'
cmake: Avoid overwriting PKG_CONFIG_PATH env var

See merge request dbus/dbus!96

Reviewed-by: @rhabacker
2019-03-14 10:57:48 +00:00
Clemens Lang
3525cc045d cmake: Avoid overwriting PKG_CONFIG_PATH env var
The CMake config file installed by DBus will run in the context of other
projects. Consequently, changing the value of the PKG_CONFIG_DIR,
PKG_CONFIG_PATH or PKG_CONFIG_LIBDIR environment variables will affect
any further calls to pkg-config made by such projects, which can cause
problems.

A common case of this happening are pkg-config files installed in
usr/share/pkgconfig for .pc files that are architecture-independent, as
for example systemd does.

Avoid clobbering the environment variables by saving and restoring their
values. Note that for some of the variables, setting them to an empty
string is different from not setting them at all.

Signed-off-by: Clemens Lang <clemens.lang@bmw-carit.de>
2019-03-14 11:07:49 +01:00
Ralf Habacker
09b969e6ac Merge branch 'patch-1' into 'master'
Update dbus-specification.xml to remove redundancies in the interface name requirements.

See merge request dbus/dbus!102

Reviewed-by: @rhabacker
2019-03-13 18:47:19 +00:00
Felipe Gasper
570d6c6ab8 Update dbus-specification.xml to remove redundancies in the interface name requirements. 2019-03-13 17:26:03 +00:00
Ralf Habacker
77dec25007 Merge branch 'fix-cmake-doc-deps' into 'master'
Fixes rebuilding of dbus documentation at every make call

See merge request dbus/dbus!94
2019-03-13 10:04:03 +00:00
Ralf Habacker
f04e611a46 Try to fix doxygen error on CI reporting "Output directory ... does not exist and cannot be created" 2019-03-13 10:52:01 +01:00
Ralf Habacker
22fb56cfb7 Create top level dir for generating doxygon files 2019-03-13 10:52:01 +01:00
Ralf Habacker
a710cdd5e3 Fix dependency chain for doc files generated from docbook source 2019-03-13 10:52:01 +01:00
Ralf Habacker
d32ae7082e Update doxygen doc only if an associated source or Doxyfile has been changed
Use doxygen.stamp as output for generating doxygen doc similar to
autotools.
2019-03-13 10:49:54 +01:00
Ralf Habacker
44973e372d Target devhelp2 does not require dependencies that have already been specified in dbus.devhelp2 2019-03-13 10:49:54 +01:00
Ralf Habacker
cea3a27ed3 Cleanup dbus.devhelp2 make target pathes
Use absolute paths to avoid confusion about where
the associated file is located.
2019-03-13 10:49:54 +01:00
Ralf Habacker
e840edec09 Add target devhelp2 only when xsltproc has been found
It doesn't make sense to add a make target if it can't be created.
2019-03-13 10:49:54 +01:00