From 9506dc0062bd9d19fa7dce501db82cfb4baa32bb Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 29 Jun 2021 21:59:29 +0200 Subject: [PATCH 1/5] Handle installation on Raspberry Pi RPi have their own package for kernel headers --- scripts/_common.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index bfd7caa..cb7337e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,14 @@ #================================================= # dependencies used by the app -pkg_dependencies="linux-headers-$(uname -r) wireguard-dkms wireguard" +if grep "Raspberry Pi" /proc/device-tree/model; then + pkg_headers="raspberrypi-kernel-headers" +else + pkg_headers="linux-headers-$(uname -r)" +fi + +# dependencies used by the app +pkg_dependencies="$pkg_headers wireguard-dkms wireguard" #================================================= # PERSONAL HELPERS From 01f21b05eabc6d0e68e561fac3b6fc3fd1fff673 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 4 Jul 2021 21:43:22 +0200 Subject: [PATCH 2/5] Fix permissions --- scripts/install | 10 ++++++---- scripts/restore | 10 +++++++--- scripts/upgrade | 12 ++++++++---- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/scripts/install b/scripts/install index 82a89c3..3a5e43c 100644 --- a/scripts/install +++ b/scripts/install @@ -162,11 +162,13 @@ ynh_add_systemd_config --service=wireguard_ui_conf --template=wireguard_ui_conf. #================================================= # Set permissions to app files -chown -R root: $final_path -chown -R $app: $final_path/db -chmod -R 750 $final_path/db +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app: "$final_path" -chown -R $app:$app /etc/wireguard +chmod 750 /etc/wireguard +chmod -R o-rwx /etc/wireguard +chown -R $app: /etc/wireguard #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/restore b/scripts/restore index 267f725..237e265 100644 --- a/scripts/restore +++ b/scripts/restore @@ -75,9 +75,13 @@ ynh_restore_file --origin_path="/etc/sudoers.d/${app}_ynh" #================================================= # Restore permissions on app files -chown -R root: $final_path -chown -R $app: $final_path/db -chmod -R 750 $final_path/db +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app: "$final_path" + +chmod 750 /etc/wireguard +chmod -R o-rwx /etc/wireguard +chown -R $app: /etc/wireguard #================================================= # SPECIFIC RESTORATION diff --git a/scripts/upgrade b/scripts/upgrade index 11df9ea..57c79b3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -199,10 +199,14 @@ ynh_replace_string --match_string="__PORT_WG__" --replace_string="$port_wg" --ta # SECURE FILES AND DIRECTORIES #================================================= -# Set permissions on app files -chown -R root: $final_path -chown -R $app: $final_path/db -chmod -R 750 $final_path/db +# Set permissions to app files +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app: "$final_path" + +chmod 750 /etc/wireguard +chmod -R o-rwx /etc/wireguard +chown -R $app: /etc/wireguard #================================================= # INTEGRATE SERVICE IN YUNOHOST From 675c3161053a58ee3278c6c69bddfb58403e354c Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 4 Jul 2021 21:48:27 +0200 Subject: [PATCH 3/5] Fix backup and restore of /etc/wireguard Simple is better. --- scripts/backup | 2 +- scripts/restore | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index 28feb6b..6c7b085 100644 --- a/scripts/backup +++ b/scripts/backup @@ -64,7 +64,7 @@ ynh_backup --src_path="/etc/sudoers.d/${app}_ynh" #================================================= # Backup the wireguard interface config -ynh_backup --src_path=$(jq -r ".config_file_path" $final_path/db/server/global_settings.json) +ynh_backup --src_path="/etc/wireguard" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 237e265..8b7a3f4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -58,6 +58,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_script_progression --message="Restoring the app main directory..." --weight=1 ynh_restore_file --origin_path="$final_path" +ynh_restore_file --origin_path="/etc/wireguard" #================================================= # RECREATE THE DEDICATED USER From 499e4303405cfc6c23e54de8989bf8791b1ba6c5 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 4 Jul 2021 21:52:27 +0200 Subject: [PATCH 4/5] Bump package version --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index d8ffb2e..ca3cc4d 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Virtual Private Networks (VPN) via WireGuard, with a web UI to ease configuration", "fr": "Réseaux Privés Virtuels (VPN) via WireGuard, avec une web UI pour faciliter sa configuration" }, - "version": "0.2.7~ynh6", + "version": "0.2.7~ynh7", "url": "https://github.com/ngoduykhanh/wireguard-ui", "upstream": { "license": "MIT", From 1aa6a6cde74fcc73668d30cbce4e13238be9da5b Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sun, 4 Jul 2021 19:52:42 +0000 Subject: [PATCH 5/5] 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 97d28a5..7c1c2a7 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 Virtual Private Networks (VPN) via WireGuard, with a web UI to ease configuration -**Shipped version:** 0.2.7~ynh6 +**Shipped version:** 0.2.7~ynh7 diff --git a/README_fr.md b/README_fr.md index bc05010..96d1fb9 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Réseaux Privés Virtuels (VPN) via WireGuard, avec une web UI pour faciliter sa configuration -**Version incluse :** 0.2.7~ynh6 +**Version incluse :** 0.2.7~ynh7