Commit Graph

69 Commits

Author SHA1 Message Date
Philip Withnall
959d54df3b system-helper: Fix incorrect whitespace
This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
024d835460 common: Support unsigned summary files and separate repo metadata
In order to eliminate some race conditions around updating the
summary{,.sig} file on the server, and to decouple signing the summary
from signing commits, and to support peer to peer mirrors of content
from multiple upstream collections: add support for unsigned summary
files.

This relaxes the requirement for gpg-verify-summary=true iff
collection-id is set in a remote’s local configuration. It depends on
some pending libostree changes to verify the ref for each commit using
the commit’s signed metadata. See
https://github.com/ostreedev/ostree/issues/983.

Metadata storage has moved from the summary file to a new
ostree-metadata well-known branch on each repository, since this can be
signed for each update and for each collection separately. If the
collection-id is set in a remote’s local configuration, flatpak will
retrieve all repository metadata from this branch rather than from the
summary file. If collection-id is unset, it will ignore this branch and
continue to use the summary file, which will continue to be updated (and
externally signed as summary.sig) for backwards compatibility.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
30a5cf8136 common: Support collections in check_for_updates() and forward the results
Search for updates on peer to peer sources as well as the internet in
check_for_updates(), and pass the resulting OstreeRepoFinderResult array
to the pull() calls, so a consistent set of checksums are pulled.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
4fb3f71475 system-helper: Ensure template files are always distributed
Previously they weren’t getting distributed unless the system helper was
enabled at configure time for distcheck. They should be distributed
unconditionally so the user can choose whether to enable the system
helper when they call configure.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-03 16:50:22 +01:00
Philip Withnall
81301f0ef4 general: Remove trailing \n from GLib log messages
The GLib logging framework automatically appends a \n to messages, so it
doesn’t need to be added by callers.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-07-07 17:18:24 +01:00
Alexander Larsson
bda7575e79 Add version property to all dbus interfaces 2017-05-19 14:38:22 +02:00
Matthias Clasen
029a5e38e1 Remove unused variables
clang flags these.
2017-05-11 08:38:32 +02:00
Matthias Clasen
4b5062d344 Drop an unused variable 2017-05-10 11:43:40 +02:00
Alexander Larsson
9896005ad0 remote-modify: Implement --update-metadata as a system-helper method
We download the summary and send it to the system helper, it verifies
the checksum and applies the changes, with the same polkit permissions
required as for an app update (i.e. typically none).

This allows us to update metadata automatically, without permission
requests.
2017-05-09 13:25:21 +02:00
Alexander Larsson
41d9717113 Fix unused variable errors reported by clang 2017-03-30 10:01:24 +02:00
Alexander Larsson
5b0ad227e8 OCI: Verify signatures 2017-03-29 17:14:36 +02:00
Alexander Larsson
11943e7e40 OCI: Support OCI with system-helper by mirroring OCI repo
This allows us (when we later add signatures) to verify
the signatures of the OCI manifest, and can thus support
the system-helper.
2017-03-29 17:14:19 +02:00
Alexander Larsson
260f3df91c system-helper: Add User=root to service file
This is needed for systemd-less activation on the system bus.
2017-01-23 16:30:52 +01:00
Simon McVittie
1d6834db4d flatpak-system-helper: remove dangling reference to EXTERNAL_INSTALL_DIR
If EXTERNAL_INSTALL_DIR wasn't defined (which is likely, since nothing
in the build system does), then we would tell the system helper
to search /exports/share, which is not Flatpak's territory
(but is a semi-commonly-used path for site-specific NFS shares,
which might have contents that are inappropriate to search here).

Installations that do define an external installation directory
(Endless OS?) can easily override the Environment to include it
by placing a drop-in in
/etc/systemd/user/flatpak-system-helper.service.d/external.conf
or similar.
2017-01-20 15:05:28 +01:00
Ikey Doherty
605c7ee87b Fix compiler warnings with uninitialised cleanup pointers
This change fixes GCC compiler warnings where a cleanup function was
specified on an uninitialised pointer, which in the view of GCC could
result in an errornous free of uninitialised memory, if the functions
that initialise them do not return NULL.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-01-19 10:05:13 +01:00
Ikey Doherty
ca107ebb16 system-helper: Allow configuration of dbus configuration directory
Newer versions of dbus support stateless directories, and many distributions
now use /usr/share/dbus-1/system.d for the vendor configuration files, as
opposed to the legacy /etc/dbus-1/system.d directory.

To enable this, we add a new --with-dbus-config-dir option to control the
configuration directory, whilst retaining backwards compatibility for those
still using older versions of dbus.

Signed-off-by: Ikey Doherty <ikey@solus-project.com>
2017-01-19 10:05:13 +01:00
Cosimo Cecchi
78c3391b78 system-helper: make sure to run with XDG_DATA_DIRS set
Otherwise we can see in the log that update-mime-database will complain
about it not being set when installing an application using the system
helper.
2017-01-16 11:36:48 +01:00
Alexander Larsson
f20e5f7823 bundles: Support dependencies and runtime-repo
If the bundle contains an origin link we can now install related
things from it, such as locale data.

You can also build the bundle with --runtime-repo=URL, where the url
points to a flatpakrepo file for a repo with runtimes. This works
similar to the RuntimeRepo= feature in flatpakref files.
2016-12-20 16:27:57 +01:00
Mario Sanchez Prada
719616f086 Add support for multiple installations in the system helper
Allow passing an extra string parameter specifying the ID of a
system installation to refer to it, or an empty string for the
default one.
2016-12-17 00:32:50 +00:00
Mario Sanchez Prada
521c3fcd4b Rename flatpak_dir_get_system() into flatpak_dir_get_system_default()
There will be a way to retrieve the list of all system installations,
not just the default one, so we rename this for backward compatibility.

Note that some (most?) of the places where we will be now using this
renamed function will likely have to migrate to using specific system
installations, but we don't have the necessary APIs yet so we do this
as an initial step to all the incremental changes that will come next.
2016-12-16 19:17:13 +00:00
Joaquim Rocha
1a1ec16a4f system-helper: Do not ask for password when removing apps/runtimes
As it's already done for installing an app or runtime, we shouldn't ask
privileged users to authenticate in order to remove them.
2016-12-07 19:53:51 +01:00
Alexander Larsson
4c77e37960 system-helper: Move option resetting to before using them
This means coverity will not complain about them being always
set to false.
2016-11-11 11:16:01 +01:00
Mario Sanchez Prada
57ac7cb56c Use an allow_active=auth_admin_keep policy default for the configure-remote policy
This will avoid clients such as GNOME Software from asking for the password
repeateadly when configuring different repos one after another.
2016-11-09 15:01:57 +01:00
Alexander Larsson
906b3b5871 dir: When pulling/deploying an app, support xa.extra-data-sources
If the downloaded app has a "xa.extra-data-sources" property in
the commit, then we download these as part of the pull operation
and store the result in the commitmeta object in the repo.

Then during deploy we look at the xa.extra-data-sources properties
again and extract them from the commitmeta into /app/extra
in the app, and afterwards we run /app/bin/apply_extra in a minimal
sandbox that has read-write access to /app/extra, but nowhere else.

There are some complexities:

We need to re-verify when extracting, because the commitmeta is not
really signed, so we could have picked up random stuff there
from the upstream repo, or from an attacker misusing the system-helper
local install codepath.

When using the system-helper the pull will fail if the commitmeta
is to large, so we have some code in this case to manually transfer
the larger commitmeta on the side to the local-pull code.
2016-10-21 08:57:42 +02:00
Alexander Larsson
e1527c9347 system-helper: Correctly return ALREADY_INSTALLED error on noop deploy
This was breaking the test suite
2016-10-19 12:41:08 +02:00
Alexander Larsson
ef7cf7ac92 Fix tests: Don't try to use policykit during the tests
Creating a policykit proxy was causing timeouts for me for unclear
reasons when running under the tests. But we're not using policykit at
all during the tests, so we can just avoid this call completely.
2016-09-20 05:56:19 +02:00
Sebastian Rasmussen
5fe8566461 system-helper: Fix typo in action description 2016-09-15 01:23:35 +08:00
Matthias Clasen
75218c4a65 Fix license headers
We were referring to the nonexisting "version 2" of the
Lesser GPL. It should be "version 2.1".
2016-07-29 14:27:49 -04:00
Alexander Larsson
764cb91cbe Remove workaround for issue #144 now that ostree is fixed
The fix for this is in ostree 2016.7

https://github.com/flatpak/flatpak/issues/144
2016-07-29 01:20:40 +02:00
Matthias Clasen
3c52321a40 Use upstream gettext
Drop the intltool dependency that was recently added, and use
upstream gettext and its its features for the same purpose.
Note that polkit currently does not install .its files (I've
sent a patch). Until that is in place, this change has the
effect of installing the untranslated policy file.
2016-07-15 11:58:46 -04:00
Alexander Larsson
9915e3740b Disable static deltas for system-helper updates
Due to an issue with ostree (https://github.com/ostreedev/ostree/pull/362)
applying non-from-scratch deltas fail when using parent_repo such as
in the system-helper case. We fix this temporarily by disabling the
use of deltas for that case.
2016-06-23 12:16:02 +02:00
Jan Alexander Steffens (heftig)
599f8b963d system-handler: Don't leak path string
Without &, ^ay dups the string.
2016-06-20 23:42:22 +02:00
Jan Alexander Steffens (heftig)
55e26c296f system-helper: Reorder flatpak_authorize_method_handler
Reduces code duplication.
2016-06-20 23:42:01 +02:00
Alexander Larsson
0fffc8ec4c system-helper: Use org.freedesktop.DBus.Error.AccessDenied on polkit auth fail
This makes more sense than some unmapped permission error.
2016-06-20 11:16:10 +02:00
Alexander Larsson
cfef57e343 Properly handle subpaths on update 2016-06-07 22:12:51 +02:00
Alexander Larsson
f9e171a618 Merge pull request #92 from matthiasclasen/optional-system-helper
library-only build
2016-06-07 09:38:37 +02:00
Matthias Clasen
9b22b1f167 Make system helper build optional
This lets us avoid the polkit dependency when just building
flatpak for its library.
2016-06-04 14:56:59 -04:00
Alexander Larsson
e769af8661 system-helper: Handle installing bundles 2016-06-03 16:04:10 +02:00
Alexander Larsson
13707f6b18 system-helper: Support directly pulling local remotes
For a local (file:// uri) remote, do an (untrusted) direct pull instead
of pulling into the users cached repo first. This way we do less copies,
as well as guaranteeing the source of the data. The later means its
mostly safe to also allow this for non-gpg signed remotes.
2016-06-02 15:30:08 +02:00
Alexander Larsson
cb41e1bdba Correctly handle --with-privileged-group 2016-05-24 14:13:34 +02:00
Alexander Larsson
2b6f4f1bcf Add --with-privileged-group options
This allows distros to change the wheel group into something else,
for instance admin (ubuntu) or sudo (debian).
2016-05-24 10:13:23 +02:00
Alexander Larsson
910328e535 Support no-deploy and no-pull via system helper 2016-05-20 13:30:50 +02:00
Alexander Larsson
4af71aae7b Fix distcheck: clean up some more generated files 2016-05-18 10:30:47 +02:00
Alexander Larsson
3d232bbe15 Merge pull request #161 from smcv/spelling
Fix various spelling mistakes
2016-05-17 17:51:20 +02:00
Alexander Larsson
aa11387031 tests: Add test-run-system.sh 2016-05-17 17:49:55 +02:00
Alexander Larsson
b697a78dd3 system-helper: Support running unprivileged on session bus
This is only useful for testing.
2016-05-17 13:06:59 +02:00
Simon McVittie
a4641280a7 Fix various spelling mistakes
Mostly detected by Debian's Lintian tool.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-05-17 11:43:32 +01:00
Alexander Larsson
f916e87d74 system-helper: Add --no-idle-exit commandline argument
This is useful for tests and debugging, where we don't want it to
accidentally idle.
2016-05-17 11:56:58 +02:00
Alexander Larsson
251dcdb680 system-helper: Never use a system helper recursively 2016-05-17 11:54:44 +02:00
Alexander Larsson
1504f7bd7f system-helper: Support add/modify/delete of remotes 2016-05-13 16:23:43 +02:00