Commit Graph

397 Commits

Author SHA1 Message Date
Alexander Larsson
50b3de3728 helper: Optionally add back setuid support
If you don't have userns support in your kernel you can use this.
The future lies with userns though, so it is the default.
2015-05-29 10:46:10 +02:00
Alexander Larsson
31692b6ab2 helper: Minor cleanup of uid/gid handling 2015-05-28 22:28:37 +02:00
Alexander Larsson
2c0c21744f helper: Drop setuid and use user namespaces 2015-05-28 22:02:31 +02:00
Alexander Larsson
8b7822ff07 helper: Only call get[ug]id() once at the start
Since the uid keeps changing during the runtime of the helper this makes things
much less complicated.
2015-05-28 21:59:34 +02:00
Alexander Larsson
d12c3cd09f run: Fix typo that broke env var support 0.3 2015-05-26 14:48:54 +02:00
Alexander Larsson
c6b6ba5095 Bump version to 0.3.0 2015-05-26 13:53:11 +02:00
Alexander Larsson
49bea07b74 build: Remove duplicated helper arguments 2015-05-25 21:36:56 +02:00
Alexander Larsson
3a20c07280 build: Always allow host fs access 2015-05-25 21:36:36 +02:00
Alexander Larsson
1a68b0bbf2 helper: Fix errors caused by create_file() return value change 2015-05-25 21:36:04 +02:00
Alexander Larsson
16b46d3579 Update docs for new run command line options 2015-05-25 16:01:33 +02:00
Alexander Larsson
2cb54a711e helper: Remove backwars compat /self symlink
We've broken the format anyway.
2015-05-25 15:37:12 +02:00
Alexander Larsson
111eff480e run: Remove hardcoded GI_TYPELIB_PATH
This is now better done in the [Environment] part of
the runtime metadata
2015-05-25 15:35:54 +02:00
Alexander Larsson
7f6d801d8e Context: Finish support for filesystems
You can now expose absolute paths, ~/foo paths, or xdg-* paths which
expands to xdg user dirs.
2015-05-25 15:28:29 +02:00
Alexander Larsson
15df2884a6 helper: Add support for moving files into sandbox
If you do -Mfoo=bar, then bar will be copied to foo and then unlinked.
2015-05-25 15:26:33 +02:00
Alexander Larsson
26f2e1bb29 helper: If old CWD is not mapped, use $HOME 2015-05-25 12:22:03 +02:00
Alexander Larsson
ee867058a9 Add support for persistent homedirectory dirs 2015-05-25 11:30:53 +02:00
Alexander Larsson
5521bf7ebd helper: Add support for read/write extra dirs 2015-05-25 11:30:38 +02:00
Alexander Larsson
b862cdb6aa Make extra_dirs and lock_dirs dynammic
This way we don't get an artificial max size.
2015-05-25 11:24:12 +02:00
Alexander Larsson
942e4bcdb6 Convert all builtins to the new metadata/arg formats using XdgAppContext 2015-05-22 16:55:45 +02:00
Alexander Larsson
7ba3d09e29 Add new XdgAppContext helper object
This will replace all the custom handling of context options
for metadata files and command line args. It also changes how
the permissions etc are serialized in the metadata files to a
saner format.
2015-05-22 16:52:25 +02:00
Alexander Larsson
8ffacee14c Change /self to /app
This changes the application prefix to /app, which has the
advantage of being the same length as /usr. This may help
making some packages relocatable.

We make /self a symlink to /app for now, to keep existing images
work, but at some point we will probably remove this.
2015-05-21 18:54:06 +02:00
Alexander Larsson
3a68d242a6 Bump version to 0.2.1 0.2.1 2015-05-21 17:08:36 +02:00
Alexander Larsson
a6fd8c3611 Merge pull request #77 from cgwalters/srcdir-builddir
build: Fix srcdir != builddir from git
2015-05-19 18:38:57 +02:00
Colin Walters
290253b4e2 build: Fix srcdir != builddir from git
We could just `mkdir -p profile`, but it's saner to just drop it in
the builddir.
2015-05-19 12:36:34 -04:00
Alexander Larsson
ea4adc2a8b Merge pull request #75 from amigadave/master
Add a simple profile.d snippet for XDG_DATA_DIRS
2015-05-19 18:17:20 +02:00
Alexander Larsson
34f264e1f1 proxy: Always send all possible queued messages in main callback 2015-05-19 11:23:14 +02:00
Alexander Larsson
a79214b56c proxy: Always read all incomming socket messages on each mainloop callback 2015-05-19 11:15:38 +02:00
Alexander Larsson
4708e73bee proxy: Properly detect authentication end
When reading the authentication messages we don't know the
packet size, so we may read to much data, getting a partial
(or full) dbus message after the authentication end.

This commit does a better job looking for the authentication end,
and when found it queues any leftover data from the buffer and
reads it instead of the socket input in the next iteration.
2015-05-19 10:56:21 +02:00
Alexander Larsson
7a31cdc9a9 proxy: Minor cleanup for first byte case
We treat this mostly the same as the !authenticated case
rather than a completely different case
2015-05-19 09:05:03 +02:00
David King
27fdae4153 Add a simple profile.d snippet for XDG_DATA_DIRS
https://github.com/alexlarsson/xdg-app/issues/74
2015-05-15 17:00:38 +01:00
Alexander Larsson
e72beada8a helper: Bind mount /sys subset
Instead of mounting our own sysfs instance we bind mount in only
a subset of the /sys subdirectories from the host. This has several
advantages:

* If something was covered out in the host we will shadow that (i.e.
  the app will never see more of sysfs than non xdg-apps)
* We can avoid showing some weird parts of sysfs, focusing on the
  device descriptions needed for e.g. mesa
* Bind mounts are allowed in a non-root user-namespace, whereas
  the sysfs mount is not, taking us one step closer to that.
2015-05-15 17:44:20 +02:00
Alexander Larsson
a1892ee8b0 Fix build with old glib
We failed to include libglnx headers for the proxy which made
things fail if the autoptr support was not in glib.
2015-05-15 13:28:11 +02:00
Alexander Larsson
9028b3960d Merge pull request #72 from matthiasclasen/typo-fix
Fix a typo
2015-05-15 10:24:47 +02:00
Matthias Clasen
072743e11e Fix a typo 2015-05-14 17:50:48 -04:00
Alexander Larsson
798f758969 Bump version to 0.2 0.2 2015-05-13 17:09:53 +02:00
Alexander Larsson
d4aeb5c10b Only warn if removing old commits fail 2015-05-13 17:07:24 +02:00
Alexander Larsson
c8d2df6ad1 xdg-app build: Bind mount host resolv.conf during builds
Its not totally unheard of to use network during builds, for
instance to download packages. This does so via a straight
(readonly) bind mount of the host version.

This is slightly different from what xdg-app run does, as
that relies on a full session and xdg-app-helper, but instead
that handles the config changing during runtime.
2015-05-13 16:36:59 +02:00
Alexander Larsson
d91f297362 build-init: Don't fail if /var/run already exists 2015-05-13 09:56:05 +02:00
Alexander Larsson
63cdb04cf6 metadata: Rename [Vars] to [Environment Vars]
This matches better the other full names used for the
metadata groups.
2015-05-12 14:49:15 +02:00
Alexander Larsson
5c3ea485c9 Support filtering of session bus
If the session bus is allowed we get unfiltered access to it, but if
it is not, then we install a filter with the policy specified by the
runtime and the app.

By default you can always own your app-id and wildcarded names below
it (i.e. org.gnome.gedit and org.gnome.gedit.*). On top of that we add
all the policies specified in the metadata for the runtime, and then
the metadata from the application.

The metadata policy config looks like this:

[Session Bus Policy]
ca.desrt.dconf=talk
org.gtk.*=see
org.my.name=own
2015-05-12 14:44:08 +02:00
Alexander Larsson
2e4d410bc6 More special casing of LD_LIBRARY_PATH
* Convert LD_LIBRARY_PATH in [Vars] to _LD_LIBRARY_PATH in the env
  so that its properly propagated.

* Always unset the regular LD_LIBRARY_PATH in the app if
  _LD_LIBRARY_PATH is unset.

* Always unset LD_LIBRARY_PATH as passed to the helper to
  avoid it getting some weird effect.
2015-05-12 12:06:07 +02:00
Alexander Larsson
6c99fcb832 builtin-run: Switch over to same env helpers 2015-05-12 11:39:43 +02:00
Alexander Larsson
4ef2ba28ff build: Apply runtime env vars 2015-05-12 11:39:43 +02:00
Alexander Larsson
80ea030fe5 Add xdg_app_run_apply_env_vars() helper 2015-05-12 11:39:43 +02:00
Alexander Larsson
11ec2f6895 build: Use an strv for envp instead of a GPtrArray 2015-05-12 11:39:43 +02:00
Alexander Larsson
6006f8d753 Move setting of env vars from helper to launcher
Some env vars (like LD_LIBRARY_PATH) was set by the helper, which
made it hard to override it. We instead set all these from the
launcher which gives us the same result but greater control.

For LD_LIBRARY_PATH in particular we pass it as _LD_LIBRARY_PATH
to avoid the env var affecting the helper.
2015-05-12 11:39:43 +02:00
Alexander Larsson
1eb08342d1 builtins-run: Use XdgAppDeploy 2015-05-12 11:39:43 +02:00
Alexander Larsson
a61ece1885 Add xdg_app_find_deploy_for_ref 2015-05-12 11:39:43 +02:00
Alexander Larsson
1a1f311d8a XdgAppDir: Add XdgAppDeploy helper object 2015-05-12 11:39:43 +02:00
Alexander Larsson
6939799fe2 proxy: Fix double-free of socket control messages 2015-05-12 10:56:53 +02:00