From bcb7e4ab67c4647452847ba00ef12b3ea8e53915 Mon Sep 17 00:00:00 2001 From: orhtej2 <2871798+orhtej2@users.noreply.github.com> Date: Tue, 15 Aug 2023 22:42:56 +0200 Subject: [PATCH] Fixup permissions on cockpit.conf --- scripts/change_url | 7 ++++++- scripts/install | 7 ++++++- scripts/restore | 5 +++++ scripts/upgrade | 7 ++++++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 27f477b..6320d98 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -30,12 +30,17 @@ ynh_change_url_nginx_config #================================================= # UPDATE A CONFIG FILE #================================================= +ynh_script_progression --message="Fixing up permissions..." --weight=1 + +usermod -a -G cockpit cockpit-ws +usermod -a -G cockpit cockpit-wsinstance + ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_add_config --template="../conf/cockpit.conf" --destination="/etc/cockpit/cockpit.conf" chmod 650 "/etc/cockpit/cockpit.conf" -chown root:$app-ws "/etc/cockpit/cockpit.conf" +chown root:$app "/etc/cockpit/cockpit.conf" #================================================= # GENERIC FINALISATION diff --git a/scripts/install b/scripts/install index 23e7e82..a84aa68 100644 --- a/scripts/install +++ b/scripts/install @@ -22,6 +22,11 @@ ynh_add_nginx_config #================================================= # ADD A CONFIGURATION #================================================= +ynh_script_progression --message="Fixing up permissions..." --weight=1 + +usermod -a -G cockpit cockpit-ws +usermod -a -G cockpit cockpit-wsinstance + ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_replace_string --match_string="ListenStream=.*" --replace_string="ListenStream=$port" --target_file="/lib/systemd/system/cockpit.socket" @@ -31,7 +36,7 @@ systemctl restart $app.socket ynh_add_config --template="../conf/cockpit.conf" --destination="/etc/cockpit/cockpit.conf" chmod 650 "/etc/cockpit/cockpit.conf" -chown root:$app-ws "/etc/cockpit/cockpit.conf" +chown root:$app "/etc/cockpit/cockpit.conf" #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index 92551e1..65ebc3a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -13,6 +13,11 @@ source /usr/share/yunohost/helpers #================================================= # RESTORE VARIOUS FILES #================================================= +ynh_script_progression --message="Fixing up permissions..." --weight=1 + +usermod -a -G cockpit cockpit-ws +usermod -a -G cockpit cockpit-wsinstance + ynh_script_progression --message="Restoring various files..." --weight=1 ynh_replace_string --match_string="ListenStream=.*" --replace_string="ListenStream=$port" --target_file="/lib/systemd/system/cockpit.socket" diff --git a/scripts/upgrade b/scripts/upgrade index a4b40fa..4049d4f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,6 +37,11 @@ yunohost service add $app --description="Sysadmin login session in a web browser #================================================= # UPDATE A CONFIG FILE #================================================= +ynh_script_progression --message="Fixing up permissions..." --weight=1 + +usermod -a -G cockpit cockpit-ws +usermod -a -G cockpit cockpit-wsinstance + ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_replace_string --match_string="ListenStream=.*" --replace_string="ListenStream=$port" --target_file="/lib/systemd/system/cockpit.socket" @@ -46,7 +51,7 @@ systemctl restart $app.socket ynh_add_config --template="../conf/cockpit.conf" --destination="/etc/cockpit/cockpit.conf" chmod 650 "/etc/cockpit/cockpit.conf" -chown root:$app-ws "/etc/cockpit/cockpit.conf" +chown root:$app "/etc/cockpit/cockpit.conf" #================================================= # START SYSTEMD SERVICE