1193 Commits (main)
 

Author SHA1 Message Date
Reion Wong c332dbac83
Merge pull request #1 from HougeLangley/main
Added debian/ directory easy to build deb packages and Update README.md
4 years ago
HougeLangley 0be1f06de6 Added debian/ directory easy to build deb packages and Update README.md 4 years ago
reionwong 27d48f4cd6 Update README 4 years ago
reionwong 4434f95092 Update readme 4 years ago
reionwong 5e9306f911 Update README 4 years ago
reionwong 010c97ffcb Add cutefish booster 4 years ago
reionwong bb3384e7fb Remove sailjail.c 4 years ago
reionwong 6040742b60 Adapt to cutefish 4 years ago
Tomi Leppänen 9649f24766
Merge pull request #10 from sailfishos/jb55089
[mapplauncherd] Allow specifying binary without path. JB#55089
4 years ago
Tomi Leppänen 0c99f3bf37 [mapplauncherd] Allow specifying binary without path. JB#55089
This relaxes checks for apps. If Exec line defines only application
binary (+ arguments to app) then it may be defined without path. In that
case we require that the invoked binary path points to a file in
/usr/bin and basename matches to Exec line's first word.

Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com>
4 years ago
Tomi Leppänen 6d0a407a26
Merge pull request #8 from sailfishos/jb54874
[invoker] Add --id option. JB#54874 OMP#JOLLA-241
4 years ago
Tomi Leppänen 25445d7db5 Make invoker less noisy
These loggings were warnings although they are just providing debug
information.

Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com>
4 years ago
Tomi Leppänen 7935aae4e8 [invoker] Add --id option. JB#54874 OMP#JOLLA-241
Add --id option to specify identifier to use when asking sailjaild
whether the app should be sandboxed. It's not used for application
specific boosters or if the binary is already sailjail.

Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com>
4 years ago
Raine Mäkeläinen fc1fad883a
Merge pull request #7 from dseight/jb54548_require_sailjail
[mapplauncherd] Require sailjail. JB#54548 OMP#JOLLA-191
4 years ago
Dmitry Gerasimov 169bfacc53 [mapplauncherd] Require sailjail. JB#54548 OMP#JOLLA-191 4 years ago
Tomi Leppänen 41557f01c1
Merge pull request #6 from spiiroin/jb54788_use_sandboxed_booster
[invoker] Skip enforced sandboxing when launching via sandboxed booster
4 years ago
Simo Piiroinen 843f0d26b6 [invoker] Skip enforced sandboxing when launching via sandboxed booster. JB#JB#54788 OMP#JOLLA-213
When sandboxed application booster has been selected via --application
or --auto-application options, there is no need to enforcing sandboxing
via injecting sailjail into launch argv.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
4 years ago
Simo Piiroinen 307f6a255e [invoker] Add --auto-application option. JB#JB#54788 OMP#JOLLA-213
When invoking via sandboxed application booster, application name
must be provided. As it usually is basename of the binary that is
going to be launched, using --application=binary-name creates
unnecessary repetition in Exec lines.

Add -A / --auto-application option that can be used when application
name matches executable basename.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
4 years ago
Simo Piiroinen 28b4f41f53 [invoker] Update --help output
Some options were missing from --help output.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
4 years ago
Tomi Leppänen b812c81e0b
Merge pull request #5 from sailfishos/jb54498_sandbox_as_requested
Sandbox apps when requested
4 years ago
Matti Lehtimäki d3637e1dbb
Merge pull request #4 from sailfishos/pkgconfig-fix
[mapplauncherd] Move .so file to devel package. Cleanup spec. JB#54626
4 years ago
Matti Lehtimäki 3b7b2cf34e
Merge pull request #3 from PureTryOut/musl-fix-build
Fix build on Musl libc systems
4 years ago
Bart Ribbers 3166700f4d
Don't link to systemd twice
We link (in a proper CMake way) later a bit below this line, and that
actually works on systems using e.g. elogind too.
4 years ago
Bart Ribbers ce1637e317
Make sure we use the POSIX basename rather than GNU's
When we include libgen.h, POSIX's basename will be used rather than
GNU's. Since we don't use the special functionalities of GNU's variant
anyway, this helps to compile it on POSIX-compliant libc's like Musl.

https://www.man7.org/linux/man-pages/man3/basename.3.html
4 years ago
Tomi Leppänen 4ec490169e [invoker] Sandbox apps when requested. JB#54498 OMP#JOLLA-178
Forces use of generic booster when it detects that application should be
sandboxed but it is not launched via sailjail already and prepends
sailjail argument.

Skips freeing of calloc'ed array.

Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com>
4 years ago
Tomi Leppänen 479435fb1e [mapplauncherd] Check sailjaild for sandboxing of apps. JB#54498 OMP#JOLLA-178
Check before executing if the arguments don't contain sailjaild and the
if the app should be launched in a sandbox. In that case prepend the
arguments with sailjail.

This is not sufficient alone as the apps are launched via silica-qt5
booster which can't execute sailjail so this must be also taken into
account already before arguments reach booster.

Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com>
4 years ago
Matti Lehtimäki 3465fc3e01 [mapplauncherd] Move .so file to devel package. Cleanup spec. JB#54626 4 years ago
Matti Lehtimäki 3f37dedbbc Bump version also in cmake file. 4 years ago
Matti Lehtimäki 99db471353 Bump version. Update URL in spec. 4 years ago
Matti Lehtimäki 21852f2b34
Merge pull request #1 from PureTryOut/pkgconfig
Add pkgconfig file
4 years ago
Bart Ribbers f110211be1
Packaging: add new pkgconfig file to devel package and add new dep on ECM 4 years ago
Bart Ribbers 4f57437ce1
Add pkgconfig file
Without it, -lapplauncherd is undefined and it can not be used to
compile other applications with it. I needed this to get
mapplauncherd-qt to compile
4 years ago
Raine Makelainen 51abc464b7 Bump version 4 years ago
Simo Piiroinen 402d9fde2f
Merge pull request #2 from sailfishos/jb53844_sandboxed_boosters
Sandboxed application boosters
4 years ago
Simo Piiroinen 833b551af1 [mapplauncerd] Sandboxed application boosters. JB#53844 OMP#JOLLA-43
When booster is executing in sandbox as an applicatiom booster, it
needs to verify that command line received from invoker matches
Exec line in application desktop file, application launch is allowed,
and permissions granted are as was expected at the time of booster
launch.

Provide booster-generic@.service that can be used for instantiating
sandboxed application boosters.

D-Bus ipc with sailjaild is modified version of similar code in
sailjailclient. The biggest difference is that this version uses
private connection via libdbus to avoid leaving stray dbus connections
or threads behind when transferring control to application code
without use of exec*() functions.

Remove cap_sys_ptrace from booster executable as makes it impossible
to run the booster within a no-new-privs sandbox.

Fix socket passing from booster instance to booster daemon so that it
works also when invoker is running in different namespace than booster
instance (invoker pid might be unresolvable).

Replace ad-hoc booster argument parsing with getopt_long().

Fix issues with argv handling: using const pointers for non-const
data, passing data by reference between objects that might have
different lifespans and never releasing the dynamically allocated
arrays.

Fix issues with env passing: duplicating invoker env at booster
side as-is can lead to problems like loss of customg session
bus socket address that has been set up by firejail.

If booster bumps into command read problems, bailout immediately
instead of relying on out-of sequence data possibly triggering
exit due to unknown commands.

As an enabler for sharing code between invoker (written in c) and
daemon (written in c++), modify Logger class used by c++ code so
that it is just a wrapper for logging functionality used by invoker.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
4 years ago
Simo Piiroinen f24871adb2 Revert "[launcherlib] Add checks for invoker"
This reverts commit 88bf4689e4.
4 years ago
Tomi Leppänen 254e3d1493 Merge branch 'cmake' into 'master'
Fix CMake issues

See merge request mer-core/mapplauncherd!17
4 years ago
Simo Piiroinen 15f235ff24 Version to 4.2.1
Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
4 years ago
spiiroin 59ebf7cd70 Merge branch 'jb53845_peer_exit' into 'master'
Avoid using signals for peer termination

See merge request mer-core/mapplauncherd!32
4 years ago
Simo Piiroinen 1a3ec406de [mapplauncherd] Avoid using signals for peer termination. Fixes JB#53845 OMP#JOLLA-44
Invoker and booster instance make up a process pair that are meant to exit
at the same time. To arrange this a) when invoker is about to exit, it sends
a terminating signal to booster instance, and b) when booster instance
exits, booster daemon sends a terminating signal to invoker. Overall this
has worked well enough - save some hiccups from potential race conditions -
but it is not compatible with setup where invoker and booster daemon are
running in different namespaces and sending signals is not possible.

There is already an unix domain socket that is kept open for the lifetime of
boosted application - used for transferring application information from
invoker to booster daemon during startup and exit status from booster daemon
to invoker at exit time. This socket can be utilized also for detecting when
peer process exits.

Normally when application (booster instance) exits, booster daemon receives
SIGCHLD, collects application exit reason, forwards it to invoker via
booster socket, and invoker then makes exit with the same exit status as
what application used.

Augment this by having booster daemon watch over booster sockets and
terminate booster instance upon eof on socket. This accomplishes that
application gets killed if/when invoker dies.

Additionally all booster instances are terminated if booster daemon exits
due to SIGTERM.

In general, instead of simply closing booster socket at each end at exit
time, an orderly disconnect is done via: shutdown write end of the socket,
read data until eof is received, then close socket. If this is accomplished
successfully within reasonable time limit, there is no need to send signals
- both peers know that the other end is going to make an appropriate exit.

Previously booster daemon and invoker made an attempt to reproduce
application getting killed by some signal such as as SIGSEGV also at the
invoker side. As this produces false positive crash reports and complicates
things (some of the signals are terminal and can't be handled in
asynchronous manner) this is no longer done - only standard TERM and KILL
signals are used for terminating peers and even then it is done as a last
resort.

Invoker signal handler used non async signal safe functions, those
have been removed.

To ease ad-hoc debugging, logging is automatically switched from syslog to
stderr when booster/invoker is executed from interactive command line.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
4 years ago
Simo Piiroinen dbd90c880e Version to 4.2.0
Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
4 years ago
spiiroin 1137a3ba4b Merge branch 'jb53864_socket_paths' into 'master'
Adjust booster socket paths

See merge request mer-core/mapplauncherd!31
4 years ago
Simo Piiroinen 23846d0db4 [mapplauncherd] Adjust booster socket paths. Fixes JB#53864 OMP#JOLLA-39
Having all booster sockets reside at the same level in /run/user
directory structure makes it difficult to limit what boosters
sandboxed applications have access to.

Move socket files to booster specific sub-directories. And as an enabler
for sandboxed boosters, add another sub-directory level that can be used
for identifying application specific boosters.

As an example, silica-qt booster socket file path changes from

  /run/user/UID/mapplauncherd/silica-qt5

to

  /run/user/UID/mapplauncherd/_default/silica-qt5/socket

and sandboxed silica-qt5 booster for application APP would use

  /run/user/UID/mapplauncherd/_APP/silica-qt5/socket

Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
4 years ago
Simo Piiroinen 66db6e7063 [mapplauncherd] Cleanup compilation warnings
Comparing signed vs unsigned integers.

Unused static data.

Questionable variable declarations.

Const correctness issues.

Unchecked socket and pipe i/o.

Unchecked chdir() call.

String sender that silently skips null strings while protocol does
not make it possible for receiver to detect such omissions.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
4 years ago
Bart Ribbers 75aafafa6e
Respect GNUInstallDirs
This allows packagers to set the proper directories to install stuff
too using CMAKE_INSTALL_PREFIX, CMAKE_INSTALL_LIBDIR, etc.

Also make installing systemd unit files optional, for systemd without
systemd, but enable them by default
4 years ago
Bart Ribbers 87e8190d44
Make CMake respect current source dir when generating docs 4 years ago
Bart Ribbers be365526e7
Fix the install rules for executables 4 years ago
Bart Ribbers e5707b8f3f
Fix linking to systemd when elogind is used instead
This is mainly useful for non-glibc systems. Yes, systemd doesn't even run
on non-glibc systems, but elogind does and this way it links to both systemd
and elogind.

However due to switching the way we link to systemd, we now also make
sure systemd is actually installed on the system before we even try to
compile, thus preventing compiler errors when systemd isn't present.
4 years ago
Tomi Leppänen 9970c11190 Merge branch 'jb53620' into 'master'
Add checks for invoker, v2

See merge request mer-core/mapplauncherd!30
4 years ago
Tomi Leppänen 82acc16141 [mapplauncherd] Drop capabilities before launching process. Contributes to JB#53620
Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com>
4 years ago