From 4f6d987ef464ab9b8e8d6f564d67097d2e48d449 Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Fri, 3 Apr 2020 16:32:28 +0530 Subject: [PATCH] infinoted: Fix permissions of sync directory Signed-off-by: Joseph Nuthalapati Reviewed-by: James Valleroy --- actions/infinoted | 16 +++++++--------- plinth/modules/infinoted/__init__.py | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/actions/infinoted b/actions/infinoted index 156f62afe..8542eabfa 100755 --- a/actions/infinoted +++ b/actions/infinoted @@ -16,9 +16,10 @@ from plinth import action_utils DATA_DIR = '/var/lib/infinoted' KEY_DIR = '/etc/infinoted' +SYNC_DIR = os.path.join(DATA_DIR, 'sync') CONF_PATH = '/etc/xdg/infinoted.conf' -CONF = ''' +CONF = f''' [infinoted] # Possible values : no-tls, allow-tls, require-tls @@ -48,7 +49,7 @@ interval=60 [directory-sync] # Directory to sync plain text files -directory=/var/lib/infinoted/sync +directory={SYNC_DIR} # Synchronize seconds interval=60 @@ -153,13 +154,10 @@ def subcommand_setup(_): 'infinoted' ], check=True) - if not os.path.exists(DATA_DIR): - os.makedirs(DATA_DIR, mode=0o750) - shutil.chown(DATA_DIR, user='infinoted', group='infinoted') - - if not os.path.exists(KEY_DIR): - os.makedirs(KEY_DIR, mode=0o750) - shutil.chown(KEY_DIR, user='infinoted', group='infinoted') + for directory in (DATA_DIR, KEY_DIR, SYNC_DIR): + if not os.path.exists(directory): + os.makedirs(directory, mode=0o750) + shutil.chown(directory, user='infinoted', group='infinoted') if not os.path.exists(KEY_DIR + '/infinoted-cert.pem'): old_umask = os.umask(0o027) diff --git a/plinth/modules/infinoted/__init__.py b/plinth/modules/infinoted/__init__.py index f65d0f8a3..64c42cf5d 100644 --- a/plinth/modules/infinoted/__init__.py +++ b/plinth/modules/infinoted/__init__.py @@ -15,7 +15,7 @@ from plinth.utils import format_lazy from .manifest import backup, clients # noqa, pylint: disable=unused-import -version = 2 +version = 3 managed_services = ['infinoted']