Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DynamicUser instead of a static kolibri user #2

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions data/dbus/org.learningequality.Kolibri.Daemon.conf.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Only @KOLIBRI_USER@ can own the service -->
<policy user="@KOLIBRI_USER@">
<allow own="@KOLIBRI_DAEMON_SERVICE@" />
</policy>

<!-- Any user can call into the service -->
<policy context="default">
<allow own="@KOLIBRI_DAEMON_SERVICE@" />
<allow send_destination="@KOLIBRI_DAEMON_SERVICE@" send_interface="org.freedesktop.DBus.Introspectable" />
<allow send_destination="@KOLIBRI_DAEMON_SERVICE@" send_interface="org.freedesktop.DBus.Properties" />
<allow send_destination="@KOLIBRI_DAEMON_SERVICE@" send_interface="org.learningequality.Kolibri.Daemon" />
Expand Down
2 changes: 1 addition & 1 deletion data/dbus/org.learningequality.Kolibri.Daemon.service.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[D-BUS Service]
Name=@KOLIBRI_DAEMON_SERVICE@
Exec=/bin/false
User=@KOLIBRI_USER@
User=root
SystemdService=dbus-@[email protected]
2 changes: 0 additions & 2 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
subdir('dbus')
subdir('environment.d')
subdir('systemd')
subdir('sysusers.d')
subdir('tmpfiles.d')

Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ ConditionPathExists=/var/lib/flatpak/app/@KOLIBRI_FLATPAK_ID@
Type=dbus
BusName=@KOLIBRI_DAEMON_SERVICE@
ExecStart=@libexecdir@/eos-kolibri-daemon
DynamicUser=yes
User=@KOLIBRI_USER@
PrivateTmp=yes
RuntimeDirectory=kolibri
StateDirectory=kolibri
Environment=HOME=%t/kolibri
1 change: 0 additions & 1 deletion data/sysusers.d/eos-kolibri.conf.in

This file was deleted.

6 changes: 0 additions & 6 deletions data/sysusers.d/meson.build

This file was deleted.

3 changes: 0 additions & 3 deletions data/tmpfiles.d/eos-kolibri.conf.in

This file was deleted.

6 changes: 0 additions & 6 deletions data/tmpfiles.d/meson.build

This file was deleted.

7 changes: 1 addition & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,8 @@ dbus_system_conf_dir = join_paths(datadir, 'dbus-1', 'system.d')

kolibri_user = get_option('kolibri_user')

kolibri_user_home = get_option('kolibri_user_home')
if kolibri_user_home == ''
kolibri_user_home = join_paths(get_option('prefix'), get_option('localstatedir'), 'lib', 'kolibri')
endif
kolibri_data_dir = join_paths(get_option('prefix'), get_option('localstatedir'), 'lib', 'kolibri', 'data')

kolibri_data_dir = join_paths(kolibri_user_home, 'data')
kolibri_flatpak_id = get_option('kolibri_flatpak_id')
kolibri_daemon_service = '@[email protected]'.format(kolibri_flatpak_id)

Expand All @@ -66,7 +62,6 @@ eos_kolibri_config.set('libexecdir', libexecdir)
eos_kolibri_config.set('PYTHON', 'python3')
eos_kolibri_config.set('PYTHON_INSTALL_DIR', python_install_dir)
eos_kolibri_config.set('KOLIBRI_USER', kolibri_user)
eos_kolibri_config.set('KOLIBRI_USER_HOME', kolibri_user_home)
eos_kolibri_config.set('KOLIBRI_DATA_DIR', kolibri_data_dir)
eos_kolibri_config.set('KOLIBRI_FLATPAK_ID', kolibri_flatpak_id)
eos_kolibri_config.set('KOLIBRI_DAEMON_SERVICE', kolibri_daemon_service)
Expand Down
7 changes: 0 additions & 7 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ option(
description: 'user to create for the system service'
)

option(
'kolibri_user_home',
type: 'string',
value: '',
description: 'home directory for the system user [default=$localstatedir/lib/kolibri]'
)

option(
'kolibri_flatpak_id',
type: 'string',
Expand Down
6 changes: 5 additions & 1 deletion src/eos-kolibri-daemon.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/sh

: ${KOLIBRI_HOME:="@KOLIBRI_DATA_DIR@"}
: ${STATE_DIRECTORY:=/var/lib/kolibri}

export KOLIBRI_HOME="${STATE_DIRECTORY}/data"

mkdir -p "${KOLIBRI_HOME}"

@bindir@/flatpak run \
--no-desktop \
Expand Down
3 changes: 1 addition & 2 deletions src/eos_kolibri/config.py.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/python3

KOLIBRI_DATA_DIR = '@KOLIBRI_DATA_DIR@'
KOLIBRI_FLATPAK_ID = '@KOLIBRI_FLATPAK_ID@'
KOLIBRI_SYSTEMD_SERVICE_NAME = 'dbus-@[email protected]'

KOLIBRI_USER = '@KOLIBRI_USER@'
KOLIBRI_DATA_DIR = '@KOLIBRI_DATA_DIR@'