diff --git a/README.md b/README.md
index d35789d..2159a22 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ It shall NOT be edited by hand.
Regularly create deduplicated, encrypted backups sent to another server using Borg
[](https://www.borgbackup.org)
-[?style=for-the-badge)](https://ci-apps.yunohost.org/ci/apps/borg/)
+[?style=for-the-badge)](https://ci-apps.yunohost.org/ci/apps/borg/)

diff --git a/config_panel.toml b/config_panel.toml
index f55ad18..52c4dbd 100644
--- a/config_panel.toml
+++ b/config_panel.toml
@@ -36,6 +36,21 @@ name.fr = "Configuration de Borg"
type = "string"
readonly = true
+ [main.general.change_passphrase]
+ ask.en = "Change the backup passphrase"
+ ask.fr = "Modifier le phrase de passe des sauvegardes"
+ type = "boolean"
+ bind = "null"
+
+ [main.general.new_passphrase]
+ ask.en = "Fill your new passphrase (NEEDS TO BE STRONG)"
+ ask.fr = "Renseignez votre nouvelle phrase de passe (DOIT ÊTRE ROBUSTE)"
+ type = "password"
+ bind = "null"
+ help.en = "Keep it safe! There will be **no way** to restore your backup if you lose it. Do not communicate it to the remote host server holder, or anyone else."
+ help.fr = "Gardez-la précieusement ! Il sera **impossible** de restaurer vos sauvegardes sans celle-ci. Elle est destinée à rester **secrète** : ne la donnez **pas** à la personne qui gère le serveur distant - où à n'importe qui d'autre !"
+ visible = "change_passphrase"
+
[main.general.remote_path]
ask.en = "Remote borg command (remote-path)"
type = "string"
diff --git a/manifest.toml b/manifest.toml
index f4772c1..5c6a32a 100644
--- a/manifest.toml
+++ b/manifest.toml
@@ -7,7 +7,7 @@ name = "Borg Backup"
description.en = "Regularly create deduplicated, encrypted backups sent to another server using Borg"
description.fr = "Créez régulièrement des sauvegardes dédupliquées et chiffées envoyées sur un autre serveur à l'aide de Borg"
-version = "1.4.5~ynh3"
+version = "1.4.5~ynh4"
maintainers = ["ljf", "fflorent"]
@@ -41,8 +41,8 @@ ram.runtime = "50M"
example = "ssh://john@serverb.tld:22/~/backup"
[install.passphrase]
- ask.en = "Provide a strong passphrase to encrypt your backups. No blank space"
- ask.fr = "Indiquez une phrase de passe forte pour chiffrer vos sauvegardes. Sans espaces"
+ ask.en = "Provide a strong passphrase to encrypt your backups"
+ ask.fr = "Indiquez une phrase de passe robuste pour chiffrer vos sauvegardes"
help.en = "Keep it safe! There will be **no way** to restore your backup if you lose it. Do not communicate it to the remote host server holder, or anyone else."
help.fr = "Gardez-la précieusement ! Il sera **impossible** de restaurer vos sauvegardes sans celle-ci. Elle est destinée à rester **secrète** : ne la donnez **pas** à la personne qui gère le serveur distant - où à n'importe qui d'autre !"
type = "password"
diff --git a/scripts/config b/scripts/config
index aacacfc..ff6cb89 100644
--- a/scripts/config
+++ b/scripts/config
@@ -57,9 +57,6 @@ get__data_multimedia() {
get__last_backups() {
local backup_list
- # Source the env file inside the command substitution ("$(...)")
- # so the variables don't pollute the rest of the function and of the script.
- # Indeed the command substitution spawns a subshell which is convenient here.
backup_list=$(ynh_exec_as_app "$borg_with_env_vars" list --short --last 50 "${repository}" 2> /dev/null)
if [ -z "$backup_list" ]; then
@@ -123,5 +120,21 @@ set__remote_path() {
ynh_config_add --template="env.jinja" --destination="$install_dir/.env" --jinja
}
+set__new_passphrase() {
+ if [ -n "${new_passphrase}" ]; then
+ (
+ set -eEux -o pipefail
+ set -a
+ source "${install_dir}/.env"
+ BORG_NEW_PASSPHRASE="${new_passphrase}" "${install_dir}/venv/bin/borg" key change-passphrase
+ )
+ ynh_app_setting_set --key=passphrase --value="${new_passphrase}"
+ # store the new value into the `passphrase` variable so the template for `.env`
+ # takes the changes into account
+ passphrase="${new_passphrase}"
+ ynh_config_add --template="env.jinja" --destination="${install_dir}/.env" --jinja
+ fi
+}
+
#=================================================
ynh_app_config_run $1