1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ztncui_ynh.git synced 2024-09-03 18:06:05 +02:00

Merge pull request #17 from YunoHost-Apps/linter

Linter
This commit is contained in:
tituspijean 2021-10-24 11:49:01 +02:00 committed by GitHub
commit a1c1db3e77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 157 additions and 80 deletions

View file

@ -1,66 +1,54 @@
# ZeroTier network controller user interface for YunoHost <!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
[![Integration level](https://dash.yunohost.org/integration/ztncui.svg)](https://dash.yunohost.org/appci/app/ztncui) # Zerotier UI for YunoHost
[![Install ztncui with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ztncui)
[![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)* *[Lire ce readme en français.](./README_fr.md)*
> *This package allow you to install ztncui quickly and simply on a YunoHost server. > *This package allows you to install Zerotier UI 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.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## 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 ## 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. ### Dependency
## 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
* [ZeroTier for YunoHost](https://github.com/YunoHost-Apps/zerotier_ynh) has to be installed beforehand. * [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:** ## Documentation and resources
https://yunohost.org/packaging_apps
## 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 ## Developer info
* App website: https://key-networks.com/ztncui/
* Upstream app repository: https://github.com/key-networks/ztncui
* YunoHost website: https://yunohost.org/
--- Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/ztncui_ynh/tree/testing).
## Developers info
Please do 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. 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 or
sudo yunohost app upgrade ztncui -u https://github.com/YunoHost-Apps/ztncui_ynh/tree/testing --debug 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

56
README_fr.md Normal file
View file

@ -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

View file

@ -4,11 +4,41 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
User=ztncui User=__APP__
Group=ztncui Group=__APP__
Environment="__YNH_NODE_LOAD_PATH__" Environment="__YNH_NODE_LOAD_PATH__"
WorkingDirectory=__FINALPATH__/src/ WorkingDirectory=__FINALPATH__/src/
ExecStart=__YNH_NPM__ start 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] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

3
doc/DESCRIPTION.md Normal file
View file

@ -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.

8
doc/DISCLAIMER.md Normal file
View file

@ -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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

View file

@ -8,13 +8,18 @@
}, },
"version": "20210310~ynh1", "version": "20210310~ynh1",
"url": "https://key-networks.com/ztncui", "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", "license": "GPL-3.0-only",
"maintainer": { "maintainer": {
"name": "tituspijean", "name": "tituspijean",
"email": "tituspijean@outlook.com" "email": "tituspijean@outlook.com"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.1.2" "yunohost": ">= 4.1.7"
}, },
"services": [], "services": [],
"multi_instance": false, "multi_instance": false,
@ -34,8 +39,7 @@
"help": { "help": {
"en": "Ztncui can only be installed at the root of a domain.", "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." "fr": "Ztncui ne peut être installée qu'à la racine d'un domaine."
}, }
"example": "zt.example.com"
}, },
{ {
"name": "is_public", "name": "is_public",
@ -48,8 +52,7 @@
}, },
{ {
"name": "admin", "name": "admin",
"type": "user", "type": "user"
"example": "johndoe"
}, },
{ {
"name": "password", "name": "password",
@ -57,8 +60,7 @@
"help": { "help": {
"en": "It will always be asked by Ztncui, in addition to your YunoHost credentials if set to private.", "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." "fr": "Il sera toujours demandé par Ztncui, en plus des identifiants YunoHost si l'app est privée."
}, }
"example": "Choose a password"
} }
] ]
} }

View file

@ -4,7 +4,7 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
nodejs_version=12 nodejs_version=16
# dependencies used by the app # dependencies used by the app
pkg_dependencies="g++" pkg_dependencies="g++"
@ -17,21 +17,6 @@ pkg_dependencies="g++"
# EXPERIMENTAL HELPERS # 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 # FUTURE OFFICIAL HELPERS
#================================================= #=================================================

View file

@ -110,10 +110,10 @@ ynh_script_progression --message="Performing Node app installation..." --weight=
chown -R $app: $final_path chown -R $app: $final_path
pushd $final_path/src pushd $final_path/src
ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error install node-gyp ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install node-gyp
ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error install ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install argon2-cli
ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error install argon2-cli ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install
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 audit fix --force
popd popd
#================================================= #=================================================
@ -171,7 +171,6 @@ chown -R $app: $final_path
#================================================= #=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1 ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate ynh_use_logrotate

View file

@ -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_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 \ test ! -d $final_path \
|| ynh_die --message="There is already a directory: $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" ynh_restore_file --origin_path="/etc/logrotate.d/$app"
mkdir -p "/var/log/$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION

View file

@ -114,7 +114,10 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=2
ynh_install_app_dependencies $pkg_dependencies 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 # CREATE DEDICATED USER
@ -133,11 +136,13 @@ ynh_script_progression --message="Performing Node app installation..." --weight=
chown -R $app: $final_path chown -R $app: $final_path
ynh_use_nodejs
pushd $final_path/src pushd $final_path/src
ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error install node-gyp ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH HOME=$final_path $ynh_npm install node-gyp
ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error install ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH HOME=$final_path $ynh_npm install argon2-cli
ynh_exec_as $app $ynh_node_load_PATH $ynh_npm --loglevel=error install argon2-cli ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH HOME=$final_path $ynh_npm install
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 audit fix --force
popd popd
#================================================= #=================================================