From 26741af271deafa0099c461dea192cc54f19b613 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 01:38:20 +0200 Subject: [PATCH 01/11] Apply example_ynh --- README.md | 4 ++-- README_fr.md | 4 ++-- check_process | 4 ++++ manifest.json | 20 ++------------------ scripts/backup | 2 +- scripts/change_url | 4 ++-- scripts/install | 37 ++++++++++++++++--------------------- scripts/remove | 4 ++-- scripts/restore | 28 +++++++++++----------------- scripts/upgrade | 40 ++++++++++++++++++---------------------- 10 files changed, 60 insertions(+), 87 deletions(-) diff --git a/README.md b/README.md index e889bee..b85bfe6 100644 --- a/README.md +++ b/README.md @@ -42,8 +42,8 @@ How to configure this app: by an admin panel at https://bitwarden.domain.tld/adm #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/bitwarden%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/bitwarden/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/bitwarden%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/bitwarden/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/bitwarden.svg)](https://ci-apps.yunohost.org/ci/apps/bitwarden/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/bitwarden.svg)](https://ci-apps-arm.yunohost.org/ci/apps/bitwarden/) ## Links diff --git a/README_fr.md b/README_fr.md index d292d82..fa36c5d 100644 --- a/README_fr.md +++ b/README_fr.md @@ -42,8 +42,8 @@ Comment configurer cette application : via le panneau d'administration https://b #### Architectures supportées -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/bitwarden%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/bitwarden/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/bitwarden%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/bitwarden/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/bitwarden.svg)](https://ci-apps.yunohost.org/ci/apps/bitwarden/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/bitwarden.svg)](https://ci-apps-arm.yunohost.org/ci/apps/bitwarden/) ## Liens diff --git a/check_process b/check_process index ec673b0..03da315 100644 --- a/check_process +++ b/check_process @@ -33,6 +33,8 @@ upgrade=1 from_commit=df2a0510288c352cfc03886763149f49839ed620 # 1.19.0~ynh1 upgrade=1 from_commit=980f625ab1eb3136437ff6275bec7990c534282c + # 1.20.0~ynh2 + upgrade=1 from_commit=5250a50f0bf177a79b30c25f8b6baa7ef615f75e backup_restore=1 multi_instance=1 port_already_use=0 @@ -57,3 +59,5 @@ Notification=all name=1.16.3~ynh3 ; commit=980f625ab1eb3136437ff6275bec7990c534282c name=1.19.0~ynh1 + ; commit=5250a50f0bf177a79b30c25f8b6baa7ef615f75e + name=1.20.0~ynh2 diff --git a/manifest.json b/manifest.json index a9cda2f..1ae223b 100644 --- a/manifest.json +++ b/manifest.json @@ -6,14 +6,14 @@ "en": "Manage passwords and other sensitive informations", "fr": "Gérez les mots de passe et autres informations sensibles" }, - "version": "1.20.0~ynh2", + "version": "1.20.0~ynh3", "url": "https://github.com/dani-garcia/bitwarden_rs", "license": "GPL-3.0-or-later", "maintainer": { "name": "yalh76" }, "requirements": { - "yunohost": ">= 4.1.7.3" + "yunohost": ">= 4.1.3" }, "multi_instance": true, "services": [ @@ -24,38 +24,22 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for Bitwarden", - "fr": "Choisissez un nom de domaine pour Bitwarden" - }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for Bitwarden", - "fr": "Choisissez un chemin pour Bitwarden" - }, "example": "/bitwarden", "default": "/bitwarden" }, { "name": "admin", "type": "user", - "ask": { - "en": "Choose an admin user", - "fr": "Choisissez l'administrateur" - }, "example": "johndoe" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "default": true } ] diff --git a/scripts/backup b/scripts/backup index cb104bf..3807be9 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers diff --git a/scripts/change_url b/scripts/change_url index e63ec90..fafdaca 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -37,7 +37,7 @@ rocket_port=$(ynh_app_setting_get --app=$app --key=rocket_port) websocket_port=$(ynh_app_setting_get --app=$app --key=websocket_port) #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." @@ -47,7 +47,7 @@ ynh_clean_setup () { # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script diff --git a/scripts/install b/scripts/install index fdbf219..4abf0c1 100644 --- a/scripts/install +++ b/scripts/install @@ -77,6 +77,14 @@ ynh_script_progression --message="Installing dependencies..." ynh_install_app_dependencies $pkg_dependencies +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -98,14 +106,6 @@ ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated NGINX config ynh_add_nginx_config "websocket_port rocket_port" -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." - -# Create a system user -ynh_system_user_create --username="$app" --home_dir="$final_path" - #================================================= # SPECIFIC SETUP #================================================= @@ -148,30 +148,25 @@ ynh_script_progression --message="Configuring a systemd service..." ynh_add_systemd_config #================================================= -# MODIFY A CONFIG FILE +# ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Modifying a config file..." +ynh_script_progression --message="Adding a config file..." ynh_add_config --template="../conf/bitwarden_rs.env" --destination="$final_path/live/bitwarden_rs.env" +chmod 400 "$final_path/some_config_file" +chown $app:$app "$final_path/some_config_file" + #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions to app files -chown -R "$app":"$app" "$final_path" -mkdir -p "/var/log/$app" -chown -R "$app":"$app" "/var/log/$app" - #================================================= # SETUP LOGROTATE #================================================= ynh_script_progression --message="Configuring log rotation..." # Use logrotate to manage application logfile(s) +chown -R "$app":"$app" "$final_path" +mkdir -p "/var/log/$app" ynh_use_logrotate #================================================= @@ -179,7 +174,7 @@ ynh_use_logrotate #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app daemon for Bitwarden" --log "/var/log/$app/$app.log" +yunohost service add $app --description="$app daemon for Bitwarden" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/remove b/scripts/remove index 50ef568..e8c4267 100644 --- a/scripts/remove +++ b/scripts/remove @@ -25,7 +25,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) +# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then ynh_script_progression --message="Removing $app service integration..." @@ -75,7 +75,7 @@ ynh_remove_logrotate #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Removing Fail2Ban configuration..." +ynh_script_progression --message="Removing Fail2ban configuration..." # Remove the dedicated Fail2Ban config ynh_remove_fail2ban_config diff --git a/scripts/restore b/scripts/restore index ea4ea2d..c97975d 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -23,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -46,17 +46,10 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the nginx configuration..." +ynh_script_progression --message="Restoring the NGINX web server configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring the app main directory..." - -ynh_restore_file --origin_path="$final_path" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -66,14 +59,15 @@ ynh_script_progression --message="Recreating the dedicated system user..." ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= -# RESTORE USER RIGHTS +# RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring user rights..." +ynh_script_progression --message="Restoring the app main directory..." -# Restore permissions on app files -chown -R "$app":"$app" "$final_path" -mkdir -p "/var/log/$app" -chown -R "$app":"$app" /var/log/"$app" +ynh_restore_file --origin_path="$final_path" + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" #================================================= # RESTORE FAIL2BAN CONFIGURATION @@ -112,7 +106,7 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app daemon for Bitwarden" --log "/var/log/$app/$app.log" +yunohost service add $app --description="$app daemon for Bitwarden" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index db0aa28..d9aadcb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -63,7 +63,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take ynh_backup_before_upgrade ynh_clean_setup () { ynh_clean_check_starting - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -78,6 +78,14 @@ ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" --line_match="Stopped Bitwarden Server" +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -93,6 +101,10 @@ then ynh_setup_source --dest_dir="$final_path/live/web-vault/" --source_id="web" fi +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -108,14 +120,6 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_dependencies -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" - #================================================= # SPECIFIC UPGRADE #================================================= @@ -167,30 +171,22 @@ ynh_script_progression --message="Upgrading systemd configuration..." ynh_add_systemd_config #================================================= -# MODIFY A CONFIG FILE +# UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Modifying a config file..." +ynh_script_progression --message="Updating a config file..." ynh_add_config --template="../conf/bitwarden_rs.env" --destination="$final_path/live/bitwarden_rs.env" #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions on app files -chown -R "$app":"$app" "$final_path" -mkdir -p "/var/log/$app" -chown -R "$app":"$app" /var/log/"$app" - #================================================= # SETUP LOGROTATE #================================================= ynh_script_progression --message="Upgrading logrotate configuration..." # Use logrotate to manage app-specific logfile(s) +mkdir -p "/var/log/$app" +chown -R "$app":"$app" /var/log/"$app" ynh_use_logrotate --non-append #================================================= @@ -198,7 +194,7 @@ ynh_use_logrotate --non-append #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description "$app daemon for Bitwarden" --log "/var/log/$app/$app.log" +yunohost service add $app --description="$app daemon for Bitwarden" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE From e702d2829854f211b179f0584d5870956efe9437 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 01:57:45 +0200 Subject: [PATCH 02/11] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 4abf0c1..bca67eb 100644 --- a/scripts/install +++ b/scripts/install @@ -154,8 +154,8 @@ ynh_script_progression --message="Adding a config file..." ynh_add_config --template="../conf/bitwarden_rs.env" --destination="$final_path/live/bitwarden_rs.env" -chmod 400 "$final_path/some_config_file" -chown $app:$app "$final_path/some_config_file" +chmod 400 "$final_path/live/bitwarden_rs.env" +chown $app:$app "$final_path/live/bitwarden_rs.env" #================================================= # GENERIC FINALIZATION From 7eb1ed5383f2f2a56378914cc7a678725247a73e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 18:05:36 +0200 Subject: [PATCH 03/11] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 1ae223b..b6a6f18 100644 --- a/manifest.json +++ b/manifest.json @@ -13,7 +13,7 @@ "name": "yalh76" }, "requirements": { - "yunohost": ">= 4.1.3" + "yunohost": ">= 4.1.7.3" }, "multi_instance": true, "services": [ From 81e072f42675940390a4a38df877fba465adce91 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 23:52:18 +0200 Subject: [PATCH 04/11] Apply last example_ynh --- scripts/install | 23 +++++++++++++---------- scripts/restore | 1 - scripts/upgrade | 17 ++++++++++------- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/scripts/install b/scripts/install index bca67eb..99d38c5 100644 --- a/scripts/install +++ b/scripts/install @@ -98,6 +98,10 @@ ynh_setup_source --dest_dir="$final_path/build/" --source_id="app" # Download, check integrity, uncompress and patch the source from web.src ynh_setup_source --dest_dir="$final_path/live/web-vault/" --source_id="web" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -139,14 +143,6 @@ ynh_secure_remove --file="$final_path/.rustup" # Create datadir mkdir -p "$final_path"/live/data -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." - -# Create a dedicated systemd config -ynh_add_systemd_config - #================================================= # ADD A CONFIGURATION #================================================= @@ -157,6 +153,14 @@ ynh_add_config --template="../conf/bitwarden_rs.env" --destination="$final_path/ chmod 400 "$final_path/live/bitwarden_rs.env" chown $app:$app "$final_path/live/bitwarden_rs.env" +#================================================= +# SETUP SYSTEMD +#================================================= +ynh_script_progression --message="Configuring a systemd service..." + +# Create a dedicated systemd config +ynh_add_systemd_config + #================================================= # GENERIC FINALIZATION #================================================= @@ -165,8 +169,6 @@ chown $app:$app "$final_path/live/bitwarden_rs.env" ynh_script_progression --message="Configuring log rotation..." # Use logrotate to manage application logfile(s) -chown -R "$app":"$app" "$final_path" -mkdir -p "/var/log/$app" ynh_use_logrotate #================================================= @@ -190,6 +192,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l ynh_script_progression --message="Configuring Fail2Ban..." # Create a dedicated Fail2Ban config +mkdir -p "/var/log/$app" touch /var/log/"$app"/"$app".log ynh_add_fail2ban_config --logpath="/var/log/$app/$app.log" --failregex="^.*Username or password is incorrect\. Try again\. IP: \. Username:.*$" diff --git a/scripts/restore b/scripts/restore index c97975d..26a93f0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -76,7 +76,6 @@ ynh_script_progression --message="Restoring the Fail2Ban configuration..." # Create a dedicated Fail2Ban config mkdir -p "/var/log/$app" -chown -R "$app":"$app" "/var/log/$app" touch /var/log/"$app"/"$app".log ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" diff --git a/scripts/upgrade b/scripts/upgrade index d9aadcb..3b4dea0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -162,6 +162,16 @@ then ynh_secure_remove --file="$final_path/.rustup" fi +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a config file..." + +ynh_add_config --template="../conf/bitwarden_rs.env" --destination="$final_path/live/bitwarden_rs.env" + +chmod 400 "$final_path/live/bitwarden_rs.env" +chown $app:$app "$final_path/live/bitwarden_rs.env" + #================================================= # SETUP SYSTEMD #================================================= @@ -170,13 +180,6 @@ ynh_script_progression --message="Upgrading systemd configuration..." # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# UPDATE A CONFIG FILE -#================================================= -ynh_script_progression --message="Updating a config file..." - -ynh_add_config --template="../conf/bitwarden_rs.env" --destination="$final_path/live/bitwarden_rs.env" - #================================================= # GENERIC FINALIZATION #================================================= From 463fbc2f537686f73e37489e6cb6627418777c2f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 11 Apr 2021 20:32:45 +0200 Subject: [PATCH 05/11] Fix rights --- scripts/install | 5 +---- scripts/restore | 2 +- scripts/upgrade | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/install b/scripts/install index 99d38c5..3114bc5 100644 --- a/scripts/install +++ b/scripts/install @@ -100,7 +100,7 @@ ynh_setup_source --dest_dir="$final_path/live/web-vault/" --source_id="web" chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # NGINX CONFIGURATION @@ -117,9 +117,6 @@ ynh_add_nginx_config "websocket_port rocket_port" #================================================= ynh_script_progression --message="Making install..." -# Set right permissions -chown -R "$app":"$app" "$final_path" - # Install rustup with the toolchain needed by bitwarden_rs pushd "$final_path" sudo -u "$app" RUSTUP_HOME="$final_path"/.rustup CARGO_HOME="$final_path"/.cargo bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain nightly' diff --git a/scripts/restore b/scripts/restore index 26a93f0..407ffdf 100644 --- a/scripts/restore +++ b/scripts/restore @@ -67,7 +67,7 @@ ynh_restore_file --origin_path="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # RESTORE FAIL2BAN CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 3b4dea0..bb4b009 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -46,7 +46,7 @@ fi if ! ynh_permission_exists --permission="admin"; then # Create the required permissions - ynh_permission_create --permission="admin" --url="/admin" --allowed="$admin" --show_tile="false" + ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin --show_tile="false" fi # Create a permission if needed @@ -103,7 +103,7 @@ fi chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # NGINX CONFIGURATION From 7561be31f76fad5d6d9f1ef8e158cb3c93eb0572 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 13 Apr 2021 01:30:04 +0200 Subject: [PATCH 06/11] Fix rights --- scripts/install | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 3114bc5..10c532b 100644 --- a/scripts/install +++ b/scripts/install @@ -138,7 +138,11 @@ ynh_secure_remove --file="$final_path/.cargo" ynh_secure_remove --file="$final_path/.rustup" # Create datadir -mkdir -p "$final_path"/live/data +mkdir -p "$final_path/live/data" + +chmod 750 "$final_path/live/data" +chmod -R o-rwx "$final_path/live/data" +chown -R $app:$app "$final_path/live/data" #================================================= # ADD A CONFIGURATION From a613a1571fc08c4a03be2675053242bb93c3f2c9 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 14 Apr 2021 20:54:27 +0200 Subject: [PATCH 07/11] fix cp --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 10c532b..8e30d22 100644 --- a/scripts/install +++ b/scripts/install @@ -130,7 +130,7 @@ pushd "$final_path"/build popd # Install bitwarden_rs -cp -a "$final_path/build/target/release/bitwarden_rs" "$final_path/live/bitwarden_rs" +cp -af "$final_path/build/target/release/bitwarden_rs" "$final_path/live/bitwarden_rs" # Remove build files and rustup ynh_secure_remove --file="$final_path/build" From 671c540ab01377f91d97b88d029d4669dba379d5 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 15 Apr 2021 20:27:30 +0200 Subject: [PATCH 08/11] Fix chmod --- scripts/install | 4 ++-- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 8e30d22..e406b9f 100644 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,7 @@ ynh_setup_source --dest_dir="$final_path/build/" --source_id="app" # Download, check integrity, uncompress and patch the source from web.src ynh_setup_source --dest_dir="$final_path/live/web-vault/" --source_id="web" -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" @@ -140,7 +140,7 @@ ynh_secure_remove --file="$final_path/.rustup" # Create datadir mkdir -p "$final_path/live/data" -chmod 750 "$final_path/live/data" +chmod -R 750 "$final_path/live/data" chmod -R o-rwx "$final_path/live/data" chown -R $app:$app "$final_path/live/data" diff --git a/scripts/restore b/scripts/restore index 407ffdf..5966c06 100644 --- a/scripts/restore +++ b/scripts/restore @@ -65,7 +65,7 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index bb4b009..2dbd6c1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -101,7 +101,7 @@ then ynh_setup_source --dest_dir="$final_path/live/web-vault/" --source_id="web" fi -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" From ad33d502f22b7fd444f1ce19decc2cda62c05e0d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 17 Apr 2021 18:30:49 +0200 Subject: [PATCH 09/11] Fix recursive chmod --- scripts/install | 4 ++-- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index e406b9f..8e30d22 100644 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,7 @@ ynh_setup_source --dest_dir="$final_path/build/" --source_id="app" # Download, check integrity, uncompress and patch the source from web.src ynh_setup_source --dest_dir="$final_path/live/web-vault/" --source_id="web" -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" @@ -140,7 +140,7 @@ ynh_secure_remove --file="$final_path/.rustup" # Create datadir mkdir -p "$final_path/live/data" -chmod -R 750 "$final_path/live/data" +chmod 750 "$final_path/live/data" chmod -R o-rwx "$final_path/live/data" chown -R $app:$app "$final_path/live/data" diff --git a/scripts/restore b/scripts/restore index 5966c06..407ffdf 100644 --- a/scripts/restore +++ b/scripts/restore @@ -65,7 +65,7 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index 2dbd6c1..bb4b009 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -101,7 +101,7 @@ then ynh_setup_source --dest_dir="$final_path/live/web-vault/" --source_id="web" fi -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" From 45622010bdc2a9d86c0ca402565492d431099e9d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 17 Apr 2021 20:25:36 +0200 Subject: [PATCH 10/11] Remove logrotate Fix #122 --- scripts/backup | 6 ------ scripts/install | 8 -------- scripts/restore | 7 ------- scripts/upgrade | 12 ++---------- 4 files changed, 2 insertions(+), 31 deletions(-) diff --git a/scripts/backup b/scripts/backup index 3807be9..79cfc6d 100644 --- a/scripts/backup +++ b/scripts/backup @@ -56,12 +56,6 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" #================================================= # SPECIFIC BACKUP -#================================================= -# BACKUP LOGROTATE -#================================================= - -ynh_backup --src_path="/etc/logrotate.d/$app" - #================================================= # BACKUP SYSTEMD #================================================= diff --git a/scripts/install b/scripts/install index 8e30d22..8cd9cbd 100644 --- a/scripts/install +++ b/scripts/install @@ -164,14 +164,6 @@ ynh_add_systemd_config #================================================= # GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/restore b/scripts/restore index 407ffdf..7615ded 100644 --- a/scripts/restore +++ b/scripts/restore @@ -114,13 +114,6 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Rocket has launched from" --length=100 -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index bb4b009..994b9a9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -54,6 +54,8 @@ if ! ynh_permission_exists --permission="api"; then ynh_permission_create --permission="api" --url="/api" --additional_urls="/identity/connect/token" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" fi +ynh_remove_logrotate + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -182,16 +184,6 @@ ynh_add_systemd_config #================================================= # GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." - -# Use logrotate to manage app-specific logfile(s) -mkdir -p "/var/log/$app" -chown -R "$app":"$app" /var/log/"$app" -ynh_use_logrotate --non-append - #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= From 7d3d38b0404a9895f60f23ffca2efb68655f2751 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 22 Apr 2021 21:19:02 +0200 Subject: [PATCH 11/11] Fix upgrade --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 994b9a9..de68fb0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -54,8 +54,6 @@ if ! ynh_permission_exists --permission="api"; then ynh_permission_create --permission="api" --url="/api" --additional_urls="/identity/connect/token" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" fi -ynh_remove_logrotate - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -71,6 +69,8 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +ynh_remove_logrotate + #================================================= # STANDARD UPGRADE STEPS #=================================================