diff --git a/README.md b/README.md index d536b73..393c448 100644 --- a/README.md +++ b/README.md @@ -1,66 +1,54 @@ -# ZeroTier network controller user interface for YunoHost + -[![Integration level](https://dash.yunohost.org/integration/ztncui.svg)](https://dash.yunohost.org/appci/app/ztncui) -[![Install ztncui with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ztncui) +# Zerotier UI for YunoHost + +[![Integration level](https://dash.yunohost.org/integration/ztncui.svg)](https://dash.yunohost.org/appci/app/ztncui) ![](https://ci-apps.yunohost.org/ci/badges/ztncui.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/ztncui.maintain.svg) +[![Install Zerotier UI with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ztncui) *[Lire ce readme en français.](./README_fr.md)* -> *This package allow you to install ztncui quickly and simply on a YunoHost server. -If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* +> *This package allows you to install Zerotier UI quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview -ztncui is a web user interface for a standalone ZeroTier network controller. It requires the ZeroTier app for YunoHost. -**Shipped version:** 0.5.8 +ztncui is a web user interface for a standalone ZeroTier network controller. +It allows you to take control of your own ZeroTier network without relying on the publisher's cloud-based controller. + + + +**Shipped version:** 20210310~ynh1 + + ## Screenshots -![](https://key-networks.com/images/ztncui/07-networks-list.png) +![](./doc/screenshots/screenshot.jpg) -## Configuration +## Disclaimers / important information -No particular configuration is needed after initial installation. - -## Documentation - - * Official documentation: https://key-networks.com/ztncui/ - * YunoHost documentation: If specific documentation is needed, feel free to contribute. - -## YunoHost specific features - -#### Multi-users support - - * No LDAP and HTTP auth supported. - * Can the app be used by multiple users? Yes, you have to add them manually in `/opt/key-networks/ztncui/src/etc/passwd`, see ztncui documentation. - -#### Supported architectures - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/ztncui%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/ztncui/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/ztncui%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/ztncui/) - -## Limitations +### Dependency * [ZeroTier for YunoHost](https://github.com/YunoHost-Apps/zerotier_ynh) has to be installed beforehand. -## Additional information +### Multi-users support -* Other information you would add about this application + * LDAP and HTTP auth are not supported. + * Multiple users can use the app, you have to add them manually in `/opt/key-networks/ztncui/src/etc/passwd`, see ztncui's documentation. -**More information on the documentation page:** -https://yunohost.org/packaging_apps +## Documentation and resources -## Links +* Official app website: https://key-networks.com/ztncui/ +* Upstream app code repository: https://github.com/key-networks/ztncui +* YunoHost documentation for this app: https://yunohost.org/app_ztncui +* Report a bug: https://github.com/YunoHost-Apps/ztncui_ynh/issues - * Report a bug: https://github.com/YunoHost-Apps/ztncui_ynh/issues - * App website: https://key-networks.com/ztncui/ - * Upstream app repository: https://github.com/key-networks/ztncui - * YunoHost website: https://yunohost.org/ +## Developer info ---- - -## Developers info - -Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/ztncui_ynh/tree/testing). +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/ztncui_ynh/tree/testing). To try the testing branch, please proceed like that. ``` @@ -68,3 +56,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/ztncui_ynh/tree/testi or sudo yunohost app upgrade ztncui -u https://github.com/YunoHost-Apps/ztncui_ynh/tree/testing --debug ``` + +**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..235e8f6 --- /dev/null +++ b/README_fr.md @@ -0,0 +1,56 @@ +# Zerotier UI pour YunoHost + +[![Niveau d'intégration](https://dash.yunohost.org/integration/ztncui.svg)](https://dash.yunohost.org/appci/app/ztncui) ![](https://ci-apps.yunohost.org/ci/badges/ztncui.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/ztncui.maintain.svg) +[![Installer Zerotier UI avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ztncui) + +*[Read this readme in english.](./README.md)* +*[Lire ce readme en français.](./README_fr.md)* + +> *Ce package vous permet d'installer Zerotier UI rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* + +## Vue d'ensemble + +ztncui is a web user interface for a standalone ZeroTier network controller. +It allows you to take control of your own ZeroTier network without relying on the publisher's cloud-based controller. + + + +**Version incluse :** 20210310~ynh1 + + + +## Captures d'écran + +![](./doc/screenshots/screenshot.jpg) + +## Avertissements / informations importantes + +### Dependency + +* [ZeroTier for YunoHost](https://github.com/YunoHost-Apps/zerotier_ynh) has to be installed beforehand. + +### Multi-users support + + * LDAP and HTTP auth are not supported. + * Multiple users can use the app, you have to add them manually in `/opt/key-networks/ztncui/src/etc/passwd`, see ztncui's documentation. + +## Documentations et ressources + +* Site officiel de l'app : https://key-networks.com/ztncui/ +* Dépôt de code officiel de l'app : https://github.com/key-networks/ztncui +* Documentation YunoHost pour cette app : https://yunohost.org/app_ztncui +* Signaler un bug : https://github.com/YunoHost-Apps/ztncui_ynh/issues + +## Informations pour les développeurs + +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/ztncui_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/ztncui_ynh/tree/testing --debug +ou +sudo yunohost app upgrade ztncui -u https://github.com/YunoHost-Apps/ztncui_ynh/tree/testing --debug +``` + +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service index fc89f0e..ed26158 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -4,11 +4,41 @@ After=network.target [Service] Type=simple -User=ztncui -Group=ztncui +User=__APP__ +Group=__APP__ Environment="__YNH_NODE_LOAD_PATH__" WorkingDirectory=__FINALPATH__/src/ ExecStart=__YNH_NPM__ start +StandardOutput=append:/var/log/__APP__/__APP__.log +StandardError=inherit + +# Sandboxing options to harden security +# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html +NoNewPrivileges=yes +PrivateTmp=yes +PrivateDevices=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +RestrictNamespaces=yes +RestrictRealtime=yes +DevicePolicy=closed +ProtectSystem=full +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +LockPersonality=yes +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap + +# Denying access to capabilities that should not be relevant for webapps +# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html +CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD +CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE +CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT +CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK +CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM +CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG +CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE +CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW +CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG [Install] WantedBy=multi-user.target diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..36eea67 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1,3 @@ +ztncui is a web user interface for a standalone ZeroTier network controller. +It allows you to take control of your own ZeroTier network without relying on the publisher's cloud-based controller. + diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..e16555a --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,8 @@ +### Dependency + +* [ZeroTier for YunoHost](https://github.com/YunoHost-Apps/zerotier_ynh) has to be installed beforehand. + +### Multi-users support + + * LDAP and HTTP auth are not supported. + * Multiple users can use the app, you have to add them manually in `/opt/key-networks/ztncui/src/etc/passwd`, see ztncui's documentation. diff --git a/doc/screenshots/screenshot.jpg b/doc/screenshots/screenshot.jpg new file mode 100644 index 0000000..f31c66c Binary files /dev/null and b/doc/screenshots/screenshot.jpg differ diff --git a/manifest.json b/manifest.json index df9d23d..68c37fe 100644 --- a/manifest.json +++ b/manifest.json @@ -8,13 +8,18 @@ }, "version": "20210310~ynh1", "url": "https://key-networks.com/ztncui", + "upstream": { + "license": "GPL-3.0-only", + "website": "https://key-networks.com/ztncui/", + "code": "https://github.com/key-networks/ztncui" + }, "license": "GPL-3.0-only", "maintainer": { "name": "tituspijean", "email": "tituspijean@outlook.com" }, "requirements": { - "yunohost": ">= 4.1.2" + "yunohost": ">= 4.1.7" }, "services": [], "multi_instance": false, @@ -34,8 +39,7 @@ "help": { "en": "Ztncui can only be installed at the root of a domain.", "fr": "Ztncui ne peut être installée qu'à la racine d'un domaine." - }, - "example": "zt.example.com" + } }, { "name": "is_public", @@ -48,8 +52,7 @@ }, { "name": "admin", - "type": "user", - "example": "johndoe" + "type": "user" }, { "name": "password", @@ -57,8 +60,7 @@ "help": { "en": "It will always be asked by Ztncui, in addition to your YunoHost credentials if set to private.", "fr": "Il sera toujours demandé par Ztncui, en plus des identifiants YunoHost si l'app est privée." - }, - "example": "Choose a password" + } } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index 7002da4..28d89ae 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # COMMON VARIABLES #================================================= -nodejs_version=12 +nodejs_version=16 # dependencies used by the app pkg_dependencies="g++" @@ -17,21 +17,6 @@ pkg_dependencies="g++" # EXPERIMENTAL HELPERS #================================================= -#!/bin/bash - -# Execute a command as another user -# usage: exec_as USER COMMAND [ARG ...] -ynh_exec_as() { - local USER=$1 - shift 1 - - if [[ $USER = $(whoami) ]]; then - eval "$@" - else - sudo -u "$USER" "$@" - fi -} - #================================================= # FUTURE OFFICIAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index c7fba70..cc1a81c 100644 --- a/scripts/install +++ b/scripts/install @@ -110,10 +110,10 @@ ynh_script_progression --message="Performing Node app installation..." --weight= chown -R $app: $final_path pushd $final_path/src - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error install node-gyp - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error install - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error install argon2-cli - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error audit fix + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install node-gyp + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install argon2-cli + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm audit fix --force popd #================================================= @@ -171,7 +171,6 @@ chown -R $app: $final_path #================================================= ynh_script_progression --message="Configuring log rotation..." --weight=1 - # Use logrotate to manage application logfile(s) ynh_use_logrotate diff --git a/scripts/restore b/scripts/restore index 410f372..53a3c3c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -37,8 +37,6 @@ nodejs_version=$(ynh_app_setting_get --app=$app --key=nodejs_version) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -ynh_webpath_available --domain=$domain --path_url=$path_url \ - || ynh_die --message="Path not available: ${domain}${path_url}" test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " @@ -110,6 +108,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= ynh_restore_file --origin_path="/etc/logrotate.d/$app" +mkdir -p "/var/log/$app" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index c56f86f..79ae1bb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -114,7 +114,10 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=2 ynh_install_app_dependencies $pkg_dependencies -ynh_install_nodejs --nodejs_version=$nodejs_version +if [ $nodejs_version != $(ynh_app_setting_get --app=$app --key=nodejs_version) ]; then + ynh_remove_nodejs + ynh_install_nodejs --nodejs_version=$nodejs_version +fi #================================================= # CREATE DEDICATED USER @@ -133,11 +136,13 @@ ynh_script_progression --message="Performing Node app installation..." --weight= chown -R $app: $final_path +ynh_use_nodejs + pushd $final_path/src - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error install node-gyp - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error install - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error install argon2-cli - ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error audit fix + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH HOME=$final_path $ynh_npm install node-gyp + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH HOME=$final_path $ynh_npm install argon2-cli + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH HOME=$final_path $ynh_npm install + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH HOME=$final_path $ynh_npm audit fix --force popd #=================================================