1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/guacamole_ynh.git synced 2024-09-03 19:16:03 +02:00
This commit is contained in:
Éric Gaspar 2023-05-29 17:23:44 +02:00
parent fef5b40db7
commit b60bc25b76
13 changed files with 48 additions and 344 deletions

View file

@ -1,4 +1,4 @@
guacd-port: __GUACD_PORT__
guacd-port: __PORT_GUACD__
ldap-user-base-dn: ou=users,dc=yunohost,dc=org
ldap-group-base-dn: ou=groups,dc=yunohost,dc=org

View file

@ -6,7 +6,7 @@ After=network.target
Type=simple
User=__APP__-guacd
Group=__APP__-guacd
ExecStart=__INSTALL_DIR__/sbin/guacd -f -l __GUACD_PORT__ >> /var/log/__APP__/guacd.log 2>&1
ExecStart=__INSTALL_DIR__/sbin/guacd -f -l __PORT_GUACD__ >> /var/log/__APP__/guacd.log 2>&1
Restart=on-abnormal
Environment="LD_LIBRARY_PATH=__INSTALL_DIR__/lib:__INSTALL_DIR__/usr/lib"
Environment="GUACAMOLE_HOME=__INSTALL_DIR__/etc/guacamole"

View file

@ -1,3 +1 @@
## Configuration
L'utilisateur choisi comme admin durant le processus d'installation aura accès au paramétres d'administration dans le menu de configuration de l'application (sous le menu utilisateur). Le fichiers de configuration sont dans `/opt/yunohost/guacamole/etc/guacamole` (pour la première installation).

View file

@ -14,31 +14,26 @@ license = "Apache-2.0"
website = "https://guacamole.apache.org/"
admindoc = "https://guacamole.apache.org/doc/gug/"
code = "https://github.com/search?utf8=%E2%9C%93&q=repo%3Aapache%2Fguacamole-server+repo%3Aapache%2Fguacamole-client+repo%3Aapache%2Fguacamole-website&type=Repositories&ref=searchresults"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration]
yunohost = ">= 11.1.18"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
yunohost = ">= 11.1.19"
architectures = "all"
multi_instance = true
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ldap = false
sso = false
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain"
[install.path]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "path"
default = "/guacamole"
[install.admin]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "user"
[install.init_main_permission]
@ -80,6 +75,9 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
url = "https://downloads.apache.org/guacamole/1.5.1/binary/guacamole-auth-jdbc-1.5.1.tar.gz"
sha256 = "daf293856ddc2664b862a53b3f232ece82925832c081238161f27c49081b4305"
[resources.ports]
main.default = 8080
guacd.default = 4822
[resources.system_user]
@ -90,5 +88,8 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
[resources.permissions]
main.url = "/"
[resources.apt]
packages = "mariadb-server acl build-essential libcairo2 libjpeg62-turbo-dev libpng-dev libtool-bin libossp-uuid-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev freerdp2-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libwebsockets-dev libpulse-dev libssl-dev libvorbis-dev libwebp-dev tomcat9"
[resources.database]
type = "mysql"

View file

@ -4,9 +4,6 @@
# COMMON VARIABLES
#=================================================
# dependencies used by the app
#REMOVEME? pkg_dependencies="acl build-essential libcairo2 libjpeg62-turbo-dev libpng-dev libtool-bin libossp-uuid-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev freerdp2-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libwebsockets-dev libpulse-dev libssl-dev libvorbis-dev libwebp-dev tomcat9"
#=================================================
# PERSONAL HELPERS
#=================================================
@ -25,7 +22,7 @@ function setup_sources {
ynh_setup_source --source_id="auth-ldap" --dest_dir="$install_dir/etc/guacamole/extensions/ldap"
mv "$install_dir/etc/guacamole/extensions/ldap/guacamole-auth-ldap-$guacamole_verson.jar" "$install_dir/etc/guacamole/extensions/guacamole-auth-ldap.jar"
#REMOVEME? ynh_secure_remove --file="$install_dir/etc/guacamole/extensions/ldap"
ynh_secure_remove --file="$install_dir/etc/guacamole/extensions/ldap"
ynh_setup_source --source_id="auth-header" --dest_dir="$install_dir/etc/guacamole/extensions/header"
mv "$install_dir/etc/guacamole/extensions/header/guacamole-auth-header-$guacamole_verson.jar" "$install_dir/etc/guacamole/extensions/guacamole-auth-header.jar"
@ -34,7 +31,7 @@ function setup_sources {
ynh_setup_source --source_id="auth-jdbc" --dest_dir="$install_dir/etc/guacamole/extensions/jdbc"
mv "$install_dir/etc/guacamole/extensions/jdbc/mysql/guacamole-auth-jdbc-mysql-$guacamole_verson.jar" "$install_dir/etc/guacamole/extensions/guacamole-auth-jdbc-mysql.jar"
mv "$install_dir/etc/guacamole/extensions/jdbc/mysql/schema" "$install_dir/etc/guacamole/extensions/mysql-schema"
#REMOVEME? ynh_secure_remove --file="$install_dir/etc/guacamole/extensions/jdbc"
ynh_secure_remove --file="$install_dir/etc/guacamole/extensions/jdbc"
ynh_setup_source --source_id="mariadb-java-client" --dest_dir="$install_dir/etc/guacamole/lib/"
@ -44,13 +41,13 @@ function setup_sources {
ar x "$install_dir/tomcat9.deb" "data.tar.xz"
popd || ynh_die
#REMOVEME? ynh_secure_remove --file="$install_dir/tomcat9.deb"
ynh_secure_remove --file="$install_dir/tomcat9.deb"
mkdir -p "$install_dir/tomcat9-data"
tar -C "$install_dir/tomcat9-data" -xJf "$install_dir/data.tar.xz"
cp -r "$install_dir/tomcat9-data/usr/share/tomcat9/etc" -T "$install_dir/etc/tomcat9/"
cp -r "$install_dir/tomcat9-data/etc/tomcat9/" -T "$install_dir/etc/tomcat9/"
#REMOVEME? ynh_secure_remove --file="$install_dir/data.tar.xz"
#REMOVEME? ynh_secure_remove --file="$install_dir/tomcat9-data"
ynh_secure_remove --file="$install_dir/data.tar.xz"
ynh_secure_remove --file="$install_dir/tomcat9-data"
}
#=================================================

View file

@ -10,27 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_print_info --message="Loading installation settings..."
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================

View file

@ -9,60 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN
#REMOVEME? old_path=$YNH_APP_OLD_PATH
#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN
#REMOVEME? new_path=$YNH_APP_NEW_PATH
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? # Needed for helper "ynh_add_nginx_config"
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
#REMOVEME? change_domain=0
#REMOVEME? if [ "$old_domain" != "$new_domain" ]
then
#REMOVEME? change_domain=1
fi
#REMOVEME? change_path=0
#REMOVEME? if [ "$old_path" != "$new_path" ]
then
#REMOVEME? change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
@ -80,30 +26,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
ynh_change_url_nginx_config
#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
#REMOVEME? domain="$old_domain"
#REMOVEME? path="$new_path"
# Create a dedicated NGINX config
#REMOVEME? ynh_add_nginx_config
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path"
#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
@ -135,13 +57,6 @@ ynh_script_progression --message="Starting systemd services..." --weight=1
ynh_systemd_action --service_name="$app-guacd" --action="start" --log_path="/var/log/$app/guacd.log"
ynh_systemd_action --service_name="$app-tomcat" --action="start" --log_path="/var/log/$app/tomcat.log"
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,64 +9,10 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
#REMOVEME? path=$YNH_APP_ARG_PATH
#REMOVEME? admin=$YNH_APP_ARG_ADMIN
#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1
#REMOVEME? install_dir=/opt/yunohost/$app
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
# Register (book) web path
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding available ports..." --weight=1
# Find available ports
#REMOVEME? guacd_port=$(ynh_find_port --port=4822)
#REMOVEME? ynh_app_setting_set --app=$app --key=guacd_port --value=$guacd_port
#REMOVEME? port=$(ynh_find_port --port=8080)
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_script_progression --message="Installing dependencies..." --weight=1
# Guacamole depends on Apache Tomcat.
# But installing Tomcat from the Debian repos automatically enables and starts it.
@ -95,28 +41,17 @@ fi
#=================================================
# CREATE DEDICATED USERS
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring system users..." --weight=1
ynh_script_progression --message="Configuring system users..." --weight=1
# Create system users
#REMOVEME? ynh_system_user_create --username="$app-guacd"
#REMOVEME? ynh_system_user_create --username="$app-tomcat"
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
#REMOVEME? ynh_script_progression --message="Creating a MySQL database..." --weight=1
#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app)
#REMOVEME? db_user=$db_name
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
ynh_system_user_create --username="$app-guacd"
ynh_system_user_create --username="$app-tomcat"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCES
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=3
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
# Download, check integrity, uncompress and patch the source from app.src
setup_sources
@ -130,7 +65,7 @@ ynh_replace_string --match_string="guacadmin" --replace_string="$admin" -f "$ins
ynh_replace_string --match_string="CA458A7D494E3BE824F5E1E175A1556C0F8EEF2C2D7DF3633BEC4A29C4411960" --replace_string="$(hexdump -n 32 -e '4/4 "%08X"' /dev/urandom)" -f "$install_dir/etc/guacamole/extensions/mysql-schema/002-create-admin-user.sql"
ynh_replace_string --match_string="FE24ADC5E11E2B25288D1704ABE67A79E342ECC26064CE69C5B3177795A82264" --replace_string="$(hexdump -n 32 -e '4/4 "%08X"' /dev/urandom)" -f "$install_dir/etc/guacamole/extensions/mysql-schema/002-create-admin-user.sql"
ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database="$db_name" < "$install_dir/etc/guacamole/extensions/mysql-schema/002-create-admin-user.sql"
#REMOVEME? ynh_secure_remove --file="$install_dir/etc/guacamole/extensions/mysql-schema"
ynh_secure_remove --file="$install_dir/etc/guacamole/extensions/mysql-schema"
#=================================================
# NGINX CONFIGURATION
@ -147,11 +82,11 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Compiling guacd..." --weight=30
pushd "$install_dir/.guacd-src" || ynh_die
pushd "$install_dir/.guacd-src"
./configure --enable-allow-freerdp-snapshots --prefix="$install_dir" --data_dir="$install_dir" --with-freerdp-plugin-dir="$install_dir/lib/x86_64-linux-gnu/freerdp2"
ynh_exec_warn_less make
ynh_exec_warn_less make install
popd || ynh_die
popd
#=================================================
# SETUP TOMCAT
@ -165,6 +100,7 @@ ln -s -f "/var/cache/$app-tomcat9" "$install_dir/var/lib/tomcat9/work"
#=================================================
# CREATE LOG DIRS
#=================================================
mkdir -p "/var/log/$app/tomcat/" "/var/log/$app/guacd/" "/var/log/$app/tomcat/"
#=================================================
@ -234,26 +170,6 @@ ynh_script_progression --message="Configuring Fail2Ban..." --weight=1
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/syslog" --failregex='o.a.g.r.auth.AuthenticationService - Authentication attempt from <HOST> for user "[^"]*" failed\.$'
#=================================================
# SETUP SSOWAT
#=================================================
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
#REMOVEME? if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,19 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? db_user=$db_name
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#=================================================
# STANDARD REMOVE
#=================================================
@ -47,30 +34,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
ynh_remove_systemd_config --service="$app-guacd"
ynh_remove_systemd_config --service="$app-tomcat"
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." --weight=1
# Remove a database if it exists, along with the associated user
#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
#REMOVEME? ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
#REMOVEME? ynh_secure_remove --file="$install_dir"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
@ -109,12 +72,11 @@ ynh_secure_remove --file="/var/log/$app"
#=================================================
# REMOVE DEDICATED USERS
#=================================================
#REMOVEME? ynh_script_progression --message="Removing the dedicated system users..." --weight=1
ynh_script_progression --message="Removing the dedicated system users..." --weight=1
# Delete a system user
#REMOVEME? ynh_system_user_delete --username="$app-guacd"
#REMOVEME? ynh_system_user_delete --username="$app-tomcat"
ynh_system_user_delete --username="$app-guacd"
ynh_system_user_delete --username="$app-tomcat"
#=================================================
# END OF SCRIPT

View file

@ -10,37 +10,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
#REMOVEME? ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? db_user=$db_name
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
#REMOVEME? test ! -d $install_dir \
|| ynh_die --message="There is already a directory: $install_dir "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
@ -56,8 +25,8 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
#REMOVEME? ynh_system_user_create --username="$app-guacd"
#REMOVEME? ynh_system_user_create --username="$app-tomcat"
ynh_system_user_create --username="$app-guacd"
ynh_system_user_create --username="$app-tomcat"
#=================================================
# RESTORE THE APP MAIN DIR
@ -80,7 +49,7 @@ ynh_systemd_action --action=restart --service_name=fail2ban
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=1
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
tomcat_enabled=""
tomcat_active=""
@ -119,10 +88,8 @@ setfacl -n -R -m user:$app-guacd:- -m default:user:$app-guacd:- "$install_dir/va
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." --weight=1
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================

View file

@ -9,44 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin)
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? guacd_port=$(ynh_app_setting_get --app=$app --key=guacd_port)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? db_user=$db_name
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
# Restore it if the upgrade fails
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
#REMOVEME? ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -63,8 +31,8 @@ ynh_systemd_action --service_name="$app-tomcat" --action="stop" --log_path="/var
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create dedicated users (if not existing)
#REMOVEME? ynh_system_user_create --username="$app-guacd"
#REMOVEME? ynh_system_user_create --username="$app-tomcat"
ynh_system_user_create --username="$app-guacd"
ynh_system_user_create --username="$app-tomcat"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -89,7 +57,7 @@ ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_script_progression --message="Upgrading dependencies..." --weight=1
# Guacamole depends on Apache Tomcat.
# But installing Tomcat from the Debian repos automatically enables and starts it.
@ -122,11 +90,11 @@ fi
#=================================================
ynh_script_progression --message="Compiling guacd..." --weight=30
pushd "$install_dir/.guacd-src" || ynh_die
pushd "$install_dir/.guacd-src"
./configure --enable-allow-freerdp-snapshots --prefix="$install_dir" --data_dir="$install_dir" --with-freerdp-plugin-dir="$install_dir/lib/x86_64-linux-gnu/freerdp2"
ynh_exec_warn_less make
ynh_exec_warn_less make install
popd || ynh_die
popd
#=================================================
# SETUP TOMCAT
@ -140,6 +108,7 @@ ln -s -f "/var/cache/$app-tomcat9" "$install_dir/var/lib/tomcat9/work"
#=================================================
# CREATE LOG DIRS
#=================================================
mkdir -p "/var/log/$app/tomcat/" "/var/log/$app/guacd/" "/var/log/$app/tomcat/"
#=================================================
@ -208,13 +177,6 @@ ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=1
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/syslog" --failregex='o.a.g.r.auth.AuthenticationService - Authentication attempt from <HOST> for user "[^"]*" failed\.$'
#=================================================
# RELOAD NGINX
#=================================================
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

7
tests.toml Normal file
View file

@ -0,0 +1,7 @@
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------