From 739a5da383387ae034593923eb6a1d26ab2c9ee1 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 16 Jul 2022 16:48:13 +0000 Subject: [PATCH 1/6] Upgrade to v1.25.1 --- conf/app.src | 4 ++-- conf/web.src | 4 ++-- manifest.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/conf/app.src b/conf/app.src index 261b6ac..ce014da 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://api.github.com/repos/dani-garcia/vaultwarden/tarball/1.25.0 -SOURCE_SUM=39b5e9fa094e94630ddb69ea10116faf71467b56af0f015c41bbb3f775a5958d +SOURCE_URL=https://api.github.com/repos/dani-garcia/vaultwarden/tarball/1.25.1 +SOURCE_SUM=553cce24eec00c4fa9a08dabdcb50258cc479ff6a2e21d76153af343957114c2 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/web.src b/conf/web.src index 2507107..a6edd9d 100644 --- a/conf/web.src +++ b/conf/web.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/dani-garcia/bw_web_builds/releases/download/v2.28.1/bw_web_v2.28.1.tar.gz -SOURCE_SUM=c477fe948a07469e70926c194ace0c7d1988288d18cb799febf3adf2abe92c24 +SOURCE_URL=https://github.com/dani-garcia/bw_web_builds/releases/download/v2022.6.2/bw_web_v2022.6.2.tar.gz +SOURCE_SUM=206fde0814d46bb78a79a7a5ab10963beaeb5c952e05a9e1b18c2495fb7174e1 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 1cb369f..2fb3450 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Manage passwords and other sensitive informations", "fr": "Gérez les mots de passe et autres informations sensibles" }, - "version": "1.25.0~ynh2", + "version": "1.25.1~ynh1", "url": "https://github.com/dani-garcia/vaultwarden", "upstream": { "license": "GPL-3.0-or-later", From 9ba5033842e73974afde10c2a359226c3370518e Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 16 Jul 2022 16:48:17 +0000 Subject: [PATCH 2/6] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 442b2ed..6d0b01a 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Alternative implementation of the Bitwarden server API written in Rust and compatible with upstream Bitwarden clients*, perfect for self-hosted deployment where running the official resource-heavy service might not be ideal. -**Shipped version:** 1.25.0~ynh2 +**Shipped version:** 1.25.1~ynh1 **Demo:** https://vault.bitwarden.com/#/register diff --git a/README_fr.md b/README_fr.md index 6fa60bb..6696610 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,7 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Alternative implementation of the Bitwarden server API written in Rust and compatible with upstream Bitwarden clients*, perfect for self-hosted deployment where running the official resource-heavy service might not be ideal. -**Version incluse :** 1.25.0~ynh2 +**Version incluse :** 1.25.1~ynh1 **Démo :** https://vault.bitwarden.com/#/register From bfafc1a62a28e54c6ba127cee0b4f6d79b8039d4 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 17 Jul 2022 04:46:43 +0200 Subject: [PATCH 3/6] Update vaultwarden.env --- conf/vaultwarden.env | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conf/vaultwarden.env b/conf/vaultwarden.env index ae6cc99..0b65bfc 100644 --- a/conf/vaultwarden.env +++ b/conf/vaultwarden.env @@ -43,6 +43,7 @@ DATA_FOLDER=__DATADIR__ # ICON_CACHE_FOLDER=data/icon_cache # ATTACHMENTS_FOLDER=data/attachments # SENDS_FOLDER=data/sends +# TMP_FOLDER=data/tmp ## Templates data folder, by default uses embedded templates ## Check source code to see the format @@ -116,12 +117,10 @@ WEBSOCKET_PORT=__WEBSOCKET_PORT__ # LOG_TIMESTAMP_FORMAT="%Y-%m-%d %H:%M:%S.%3f" ## Logging to file -## It's recommended to also set 'ROCKET_CLI_COLORS=off' LOG_FILE=/var/log/__APP__/__APP__.log ## Logging to Syslog ## This requires extended logging -## It's recommended to also set 'ROCKET_CLI_COLORS=off' # USE_SYSLOG=false ## Log level @@ -271,6 +270,9 @@ ADMIN_TOKEN=__ADMIN_TOKEN__ ## The change only applies when the password is changed # PASSWORD_ITERATIONS=100000 +## Controls whether users can set password hints. This setting applies globally to all users. +# PASSWORD_HINTS_ALLOWED=true + ## Controls whether a password hint should be shown directly in the web page if ## SMTP service is not configured. Not recommended for publicly-accessible instances ## as this provides unauthenticated access to potentially sensitive data. From 93039d9fc80ec699764ab9545f3414099a0225e5 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 17 Jul 2022 05:00:15 +0200 Subject: [PATCH 4/6] fix namespace --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 41cc7d7..a83cd57 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ After=network.target User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/live/ -ReadWriteDirectories=__FINALPATH__/live/ __DATADIR__ /var/log/__APP__/ +ReadWriteDirectories=__FINALPATH__/live/ __DATADIR__/ /var/log/__APP__/ EnvironmentFile=__FINALPATH__/live/.env ExecStart=__FINALPATH__/live/vaultwarden From 322bd1770e4539412150402cbca8c8a4915af71e Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 17 Jul 2022 05:57:09 +0200 Subject: [PATCH 5/6] Apply last example_ynh --- check_process | 24 +++--------------------- conf/nginx.conf | 2 +- manifest.json | 8 ++++---- scripts/backup | 8 +++++++- scripts/install | 15 ++++++++++++--- scripts/restore | 23 ++++++++++++++++------- scripts/upgrade | 48 ++++++++++++++++++++++++++---------------------- 7 files changed, 69 insertions(+), 59 deletions(-) diff --git a/check_process b/check_process index 9c6e306..47a5527 100644 --- a/check_process +++ b/check_process @@ -1,14 +1,9 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; Manifest domain="domain.tld" path="/path" - admin="john" is_public=1 + admin="john" ; Checks pkg_linter=1 setup_sub_dir=1 @@ -32,18 +27,5 @@ port_already_use=0 change_url=1 ;;; Options -Email=yalh@yahoo.com -Notification=all -;;; Upgrade options - ; commit=d5e1fa7d327c55d8e5ae4c24e7c6aaac006256db - name=Bitwarden 1.20.0~ynh4 - ; commit=3f7d7d2740a1cb3f16a290b64c89e84422d06ede - name=1.21.0~ynh1 - ; commit=703d5a9cb86d127c7723bb380d7c392a8eb9e703 - name=1.21.0~ynh2 - ; commit=c233d94d76cae449630c59ce228b7a3c72f8fa12 - name=1.22.2~ynh1 - ; commit=2808a3a8e985bb5431f6d8f2353b07201355afe4 - name=1.23.0~ynh1 - ; commit=7492e0d21c795696f4ff44912edc199437d4bb71 - name=1.23.0~ynh3 +Email= +Notification=none diff --git a/conf/nginx.conf b/conf/nginx.conf index aade80d..1b65fd3 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/ ; + alias __FINALPATH__/; # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file client_max_body_size 100M; diff --git a/manifest.json b/manifest.json index 2fb3450..636c550 100644 --- a/manifest.json +++ b/manifest.json @@ -38,14 +38,14 @@ "example": "/vaultwarden", "default": "/vaultwarden" }, - { - "name": "admin", - "type": "user" - }, { "name": "is_public", "type": "boolean", "default": true + }, + { + "name": "admin", + "type": "user" } ] } diff --git a/scripts/backup b/scripts/backup index 2215093..b6833b3 100644 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ynh_clean_check_starting + true } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -63,6 +63,12 @@ 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 67096dc..0676523 100644 --- a/scripts/install +++ b/scripts/install @@ -26,8 +26,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH -admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC +admin=$YNH_APP_ARG_ADMIN app=$YNH_APP_INSTANCE_NAME @@ -83,7 +83,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Configuring system user..." # Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -91,7 +91,6 @@ ynh_system_user_create --username=$app --home_dir=$final_path ynh_script_progression --message="Setting up source files..." ynh_app_setting_set --app=$app --key=final_path --value=$final_path - # Download, check integrity, uncompress the source of vaultwarden from app.src to his build directory ynh_setup_source --dest_dir="$final_path/build/" --source_id="app" @@ -174,6 +173,16 @@ ynh_add_systemd_config #================================================= # GENERIC FINALIZATION +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Configuring log rotation..." + +# Use logrotate to manage application logfile(s) +mkdir -p "/var/log/$app" +chown -R $app:$app "/var/log/$app" +ynh_use_logrotate + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/restore b/scripts/restore index dfeb2ba..3f612c6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -42,13 +42,6 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE 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" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -105,6 +98,13 @@ ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +#================================================= +# RESTORE 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 SYSTEMD #================================================= @@ -113,6 +113,15 @@ ynh_script_progression --message="Restoring the systemd configuration..." ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." + +mkdir -p "/var/log/$app" +chown -R $app:$app "/var/log/$app" +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4651851..8aaa4f1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -89,8 +89,6 @@ then fi fi -ynh_remove_logrotate - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -113,21 +111,9 @@ 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 -#================================================= -# 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 - -#================================================= -# CREATE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Making sure data directory exists..." - # If datadir doesn't exist, create it if [ -z $datadir ]; then + ynh_script_progression --message="Making sure data directory exists..." datadir=/home/yunohost.app/$app ynh_app_setting_set --app=$app --key=datadir --value=$datadir mkdir -p $datadir @@ -138,6 +124,14 @@ if [ -z $datadir ]; then chown -R $app:$app "$datadir" fi +#================================================= +# 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 #================================================= @@ -160,6 +154,13 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # NGINX CONFIGURATION #================================================= @@ -168,13 +169,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # SPECIFIC UPGRADE #================================================= @@ -237,6 +231,16 @@ ynh_add_systemd_config #================================================= # GENERIC FINALIZATION +#================================================= +# SETUP LOGROTATE +#================================================= +ynh_script_progression --message="Upgrading logrotate configuration..." + +mkdir -p "/var/log/$app" +chown -R $app:$app "/var/log/$app" +# Use logrotate to manage app-specific logfile(s) +ynh_use_logrotate --non-append + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= From fa990678febb29eb701d263a764f307425d36b39 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 18 Jul 2022 20:41:18 +0200 Subject: [PATCH 6/6] less warnings --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 0676523..9fb7e08 100644 --- a/scripts/install +++ b/scripts/install @@ -121,7 +121,7 @@ ynh_script_progression --message="Making install..." # Install rustup with the toolchain needed by vaultwarden pushd "$final_path" - ynh_exec_as "$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' + ynh_exec_warn_less ynh_exec_as "$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 stable' popd export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin" diff --git a/scripts/upgrade b/scripts/upgrade index 8aaa4f1..d40471b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -183,7 +183,7 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then # Install rustup with the toolchain needed by vaultwarden pushd "$final_path" - ynh_exec_as "$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' + ynh_exec_warn_less ynh_exec_as "$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 stable' popd export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"