1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mosquitto_ynh.git synced 2024-09-03 19:45:54 +02:00

Merge branch 'testing'

This commit is contained in:
Grena 2022-06-26 16:17:20 +02:00
commit e140eb4c31
20 changed files with 154 additions and 238 deletions

View file

@ -8,7 +8,7 @@ about: When creating a bug report, please use the following template to provide
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to mosquitto itself. Refer to its documentation or repository for help.*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
@ -31,7 +31,7 @@ about: When creating a bug report, please use the following template to provide
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install mosquitto
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

View file

@ -1,9 +1,11 @@
# Mosquitto (MQTT Broker) 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/mosquitto.svg)](https://dash.yunohost.org/appci/app/mosquitto)
![](https://ci-apps.yunohost.org/ci/badges/mosquitto.status.svg)
![](https://ci-apps.yunohost.org/ci/badges/mosquitto.maintain.svg)
# Mosquitto for YunoHost
[![Integration level](https://dash.yunohost.org/integration/mosquitto.svg)](https://dash.yunohost.org/appci/app/mosquitto) ![Working status](https://ci-apps.yunohost.org/ci/badges/mosquitto.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/mosquitto.maintain.svg)
[![Install Mosquitto with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mosquitto)
*[Lire ce readme en français.](./README_fr.md)*
@ -15,50 +17,35 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
[Mosquitto](https://mosquitto.org/) gives you interconnect your objects and applications with an open source MQTT broker. Client can publish or subscribe after authentication (username, password).
**Shipped version:** 2.0.8
## Configuration
**Shipped version:** 2.0.12~ynh1
How to configure this app: From an admin panel or a plain file with SSH.
**Demo:** https://test.mosquitto.org
## Disclaimers / important information
## Documentation
## TODO
* Official documentation: https://mosquitto.org/documentation/
- [ ] Add MQTTS (MQTT with TLS)
## YunoHost specific features
## Documentation and resources
#### Multi-user support
* Are LDAP and HTTP auth supported? **No**
* Can the app be used by multiple users? **No**
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mosquitto.svg)](https://ci-apps.yunohost.org/ci/apps/mosquitto/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mosquitto.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mosquitto/)
## Links
* Report a bug: https://github.com/YunoHost-Apps/mosquitto_ynh/issues
* App website: https://mosquitto.org/
* Upstream app repository: https://github.com/eclipse/mosquitto
* YunoHost website: https://yunohost.org/
---
* Official app website: <https://mosquitto.org>
* Official user documentation: <https://yunohost.org/apps>
* Official admin documentation: <https://mosquitto.org/documentation/>
* Upstream app code repository: <https://github.com/eclipse/mosquitto>
* YunoHost documentation for this app: <https://yunohost.org/app_mosquitto>
* Report a bug: <https://github.com/YunoHost-Apps/mosquitto_ynh/issues>
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/mosquitto_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/mosquitto_ynh/tree/testing --debug
or
sudo yunohost app upgrade mosquitto -u https://github.com/YunoHost-Apps/mosquitto_ynh/tree/testing --debug
```
---
## Todo
- [ ] Add MQTTS (MQTT with TLS)
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,64 +1,51 @@
# Mosquitto (broker MQTT) pour 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.
-->
[![Niveau d'intégration](https://dash.yunohost.org/integration/mosquitto.svg)](https://dash.yunohost.org/appci/app/mosquitto)
![](https://ci-apps.yunohost.org/ci/badges/mosquitto.status.svg)
![](https://ci-apps.yunohost.org/ci/badges/mosquitto.maintain.svg)
# Mosquitto pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/mosquitto.svg)](https://dash.yunohost.org/appci/app/mosquitto) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/mosquitto.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/mosquitto.maintain.svg)
[![Installer Mosquitto avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mosquitto)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Mosquitto rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
[Mosquitto](https://mosquitto.org/) vous permet d'interconnecter vos objets et applications avec un broker MQTT open source. Le client peut publier ou s'abonner après authentification (nom d'utilisateur, mot de passe).
**Version incluse :** 2.0.8
## Configuration
**Version incluse :** 2.0.12~ynh1
Comment configurer cette application : via le panneau d'administration ou un fichier brut en SSH.
**Démo :** https://test.mosquitto.org
## Avertissements / informations importantes
## Documentation
## A faire
* Documentation officielle : https://mosquitto.org/documentation/
- [ ] Ajouter MQTTS (MQTT avec TLS)
## Caractéristiques spécifiques YunoHost
## Documentations et ressources
#### Support multi-utilisateur
* L'authentification LDAP et HTTP est-elle prise en charge ? **Non**
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Non**
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mosquitto.svg)](https://ci-apps.yunohost.org/ci/apps/mosquitto/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mosquitto.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mosquitto/)
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/mosquitto_ynh/issues
* Site de l'application : https://mosquitto.org/
* Dépôt de l'application principale : https://github.com/eclipse/mosquitto
* Site web YunoHost : https://yunohost.org/
---
* Site officiel de l'app : <https://mosquitto.org>
* Documentation officielle utilisateur : <https://yunohost.org/apps>
* Documentation officielle de l'admin : <https://mosquitto.org/documentation/>
* Dépôt de code officiel de l'app : <https://github.com/eclipse/mosquitto>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_mosquitto>
* Signaler un bug : <https://github.com/YunoHost-Apps/mosquitto_ynh/issues>
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/mosquitto_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/mosquitto_ynh/tree/testing --debug
ou
sudo yunohost app upgrade mosquitto -u https://github.com/YunoHost-Apps/mosquitto_ynh/tree/testing --debug
```
---
## A faire
- [ ] Ajouter MQTTS (MQTT avec TLS)
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -7,7 +7,10 @@
pkg_linter=1
setup_nourl=1
upgrade=1
# 1.5.7~ynh1
upgrade=1 from_commit=3423395180264623342ee41946d10f30cd38e471
# 2.0.8~ynh1
upgrade=1 from_commit=74185f9e1fb58a91271cfc24630029da662b6111
backup_restore=1
port_already_use=1 (1883)
;;; Options

View file

@ -1,4 +1,4 @@
listener __PORT__
allow_anonymous false
password_file __PASSWORD_FILE__
password_file /etc/mosquitto/passwd

0
doc/.gitkeep Normal file
View file

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
[Mosquitto](https://mosquitto.org/) gives you interconnect your objects and applications with an open source MQTT broker. Client can publish or subscribe after authentication (username, password).

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
[Mosquitto](https://mosquitto.org/) vous permet d'interconnecter vos objets et applications avec un broker MQTT open source. Le client peut publier ou s'abonner après authentification (nom d'utilisateur, mot de passe).

3
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,3 @@
## TODO
- [ ] Add MQTTS (MQTT with TLS)

3
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,3 @@
## A faire
- [ ] Ajouter MQTTS (MQTT avec TLS)

0
doc/screenshots/.gitkeep Normal file
View file

View file

@ -6,15 +6,23 @@
"en": "Interconnect your objects and applications with an open source MQTT broker",
"fr": "Interconnecter vos objets et vos applications grâce à un serveur MQTT open source"
},
"version": "2.0.8~ynh1",
"version": "2.0.12~ynh1",
"url": "https://mosquitto.org/",
"upstream": {
"license": "MIT",
"website": "https://mosquitto.org",
"demo": "https://test.mosquitto.org",
"admindoc": "https://mosquitto.org/documentation/",
"userdoc": "https://yunohost.org/apps",
"code": "https://github.com/eclipse/mosquitto"
},
"license": "MIT",
"maintainer": {
"name": "Grena",
"email": "grena+mosquitto@grenabox.fr"
},
"requirements": {
"yunohost": ">= 4.1.0"
"yunohost": ">= 4.3.0"
},
"multi_instance": false,
"services": [],
@ -42,4 +50,3 @@
]
}
}

View file

@ -1,16 +0,0 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -4,16 +4,8 @@
# COMMON VARIABLES
#=================================================
# files used by the app
password_file="/etc/mosquitto/passwd"
config_file="/etc/mosquitto/conf.d/default.conf"
# extra repository used by the app
extra_repo="deb https://repo.mosquitto.org/debian buster main"
extra_repo_key="http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key"
# dependencies used by the app
pkg_dependencies="mosquitto"
extra_pkg_dependencies="mosquitto"
#=================================================
# PERSONAL HELPERS

View file

@ -33,13 +33,6 @@ password=$(ynh_app_setting_get --app=$app --key=password)
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP FAIL2BAN CONFIGURATION
#=================================================
#ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
#ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
@ -53,14 +46,13 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# Backup the passwd file
ynh_backup --src_path="$password_file"
ynh_backup --src_path="/etc/mosquitto/passwd"
# Backup the config file
ynh_backup --src_path="$config_file"
ynh_backup --src_path="/etc/mosquitto/conf.d/default.conf"
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -20,11 +20,11 @@ ynh_abort_if_errors
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
app=$YNH_APP_INSTANCE_NAME
username=$YNH_APP_ARG_USERNAME
password=$YNH_APP_ARG_PASSWORD
app=$YNH_APP_INSTANCE_NAME
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
@ -53,38 +53,19 @@ ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=20
ynh_install_extra_app_dependencies --repo="$extra_repo" --package="$pkg_dependencies" --key="$extra_repo_key" --name="$app"
ynh_install_extra_app_dependencies --repo="deb https://repo.mosquitto.org/debian buster main" --package="$extra_pkg_dependencies" --key="http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key" --name="$app"
#=================================================
# SPECIFIC SETUP
#=================================================
# CONFIGURE MOSQUITTO
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring Mosquitto Password..." --weight=1
ynh_script_progression --message="Adding a configuration file..." --weight=1
cp ../conf/passwd "$password_file"
ynh_add_config --template="../conf/passwd" --destination="/etc/mosquitto/passwd"
mosquitto_passwd -U "/etc/mosquitto/passwd"
ynh_replace_string --match_string="__USERNAME__" --replace_string="$username" --target_file="$password_file"
ynh_replace_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="$password_file"
mosquitto_passwd -U "$password_file"
ynh_store_file_checksum --file="$password_file"
ynh_script_progression --message="Configuring Mosquitto..." --weight=1
cp ../conf/mosquitto.conf "$config_file"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_file"
ynh_replace_string --match_string="__PASSWORD_FILE__" --replace_string="$password_file" --target_file="$config_file"
ynh_store_file_checksum --file="$config_file"
#=================================================
# RESTART SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Restarting systemd service..." --weight=1
ynh_systemd_action --service_name="$app" --action=restart
ynh_add_config --template="../conf/mosquitto.conf" --destination="/etc/mosquitto/conf.d/default.conf"
#=================================================
# GENERIC FINALIZATION
@ -104,16 +85,15 @@ ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Allows MQTT clients to send/receive data" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"
#=================================================
# SETUP FAIL2BAN
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Configuring Fail2Ban..." --weight=1
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Create a dedicated Fail2Ban config
#ynh_add_fail2ban_config --logpath="/var/log/$app/$app.log" --ports="$port" --failregex="Regex to match into the log for a failed login"
# Start a systemd service
ynh_systemd_action --service_name=$app --action="restart"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -17,8 +17,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME
port=$(ynh_app_setting_get --app=$app --key=port)
username=$(ynh_app_setting_get --app=$app --key=username)
password=$(ynh_app_setting_get --app=$app --key=password)
#=================================================
# STANDARD REMOVE
@ -41,14 +39,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=6
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
@ -57,6 +47,14 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=6
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# CLOSE A PORT
#=================================================
@ -67,14 +65,6 @@ then
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
#=================================================
# REMOVE FAIL2BAN CONFIGURATION
#=================================================
ynh_script_progression --message="Removing Fail2ban configuration..." --weight=1
# Remove the dedicated Fail2Ban config
#ynh_remove_fail2ban_config
#=================================================
# SPECIFIC REMOVE
#=================================================
@ -86,14 +76,13 @@ ynh_script_progression --message="Removing various files..." --weight=1
ynh_secure_remove --file="/var/log/$app/$app.log"
# Remove the passwd file
ynh_secure_remove --file="$password_file"
ynh_secure_remove --file="/etc/mosquitto/passwd"
# Remove the config file
ynh_secure_remove --file="$config_file"
ynh_secure_remove --file="/etc/mosquitto/conf.d/default.conf"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -28,17 +28,6 @@ port=$(ynh_app_setting_get --app=$app --key=port)
username=$(ynh_app_setting_get --app=$app --key=username)
password=$(ynh_app_setting_get --app=$app --key=password)
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE FAIL2BAN CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=1
#ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
#ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
#ynh_systemd_action --action=restart --service_name=fail2ban
#=================================================
# SPECIFIC RESTORATION
#=================================================
@ -46,7 +35,25 @@ ynh_script_progression --message="Restoring the Fail2Ban configuration..." --wei
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=20
ynh_install_extra_app_dependencies --repo="$extra_repo" --package="$pkg_dependencies" --key="$extra_repo_key" --name="$app"
ynh_install_extra_app_dependencies --repo="deb https://repo.mosquitto.org/debian buster main" --package="$extra_pkg_dependencies" --key="http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key" --name="$app"
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..." --weight=1
# Restore the passwd file
ynh_restore_file --origin_path="/etc/mosquitto/passwd"
# Restore the config file
ynh_restore_file --origin_path="/etc/mosquitto/conf.d/default.conf"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
@ -56,33 +63,16 @@ ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Allows MQTT clients to send/receive data" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"
#=================================================
# RESTORE VARIOUS FILES
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Restoring the Mosquitto configuration..." --weight=1
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Restore the passwd file
ynh_restore_file --origin_path="$password_file"
# Restore the config file
ynh_restore_file --origin_path="$config_file"
ynh_systemd_action --service_name=$app --action="restart"
#=================================================
# RESTART SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Restarting systemd service..." --weight=1
ynh_systemd_action --service_name="$app" --action=restart
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the log rotation..." --weight=1
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
# GENERIC FINALIZATION
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -23,14 +23,10 @@ password=$(ynh_app_setting_get --app=$app --key=password)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -47,51 +43,37 @@ ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=10
ynh_install_extra_app_dependencies --repo="$extra_repo" --package="$pkg_dependencies" --key="$extra_repo_key" --name="$app"
ynh_install_extra_app_dependencies --repo="deb https://repo.mosquitto.org/debian buster main" --package="$extra_pkg_dependencies" --key="http://repo.mosquitto.org/debian/mosquitto-repo.gpg.key" --name="$app"
#=================================================
# SPECIFIC UPGRADE
#=================================================
# MODIFY A CONFIG FILE
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Configuring Mosquitto Password..." --weight=1
ynh_script_progression --message="Updating a configuration file..." --weight=1
# Verify the checksum and backup the file if it's different.
ynh_backup_if_checksum_is_different --file="$password_file"
ynh_add_config --template="../conf/passwd" --destination="/etc/mosquitto/passwd"
mosquitto_passwd -U "/etc/mosquitto/passwd"
cp ../conf/passwd "$password_file"
ynh_add_config --template="../conf/mosquitto.conf" --destination="/etc/mosquitto/conf.d/default.conf"
ynh_replace_string --match_string="__USERNAME__" --replace_string="$username" --target_file="$password_file"
ynh_replace_string --match_string="__PASSWORD__" --replace_string="$password" --target_file="$password_file"
mosquitto_passwd -U "$password_file"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$password_file"
ynh_script_progression --message="Configuring Mosquitto..." --weight=1
# Verify the checksum and backup the file if it's different.
ynh_backup_if_checksum_is_different --file="$config_file"
cp ../conf/mosquitto.conf "$config_file"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config_file"
ynh_replace_string --match_string="__PASSWORD_FILE__" --replace_string="$password_file" --target_file="$config_file"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$config_file"
#=================================================
# RESTART SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Restarting systemd service..." --weight=1
ynh_systemd_action --service_name="$app" --action=restart
#=================================================
# GENERIC FINALIZATION
@ -111,12 +93,11 @@ ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Allows MQTT clients to send/receive data" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"
#=================================================
# UPGRADE FAIL2BAN
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=1
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Create a dedicated Fail2Ban config
#ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
ynh_systemd_action --service_name=$app --action="restart"
#=================================================
# END OF SCRIPT