diff --git a/README.md b/README.md index d0cb212..3116a8c 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# WebMin package installation for YunoHost +# Webmin for YunoHost [![Integration level](https://dash.yunohost.org/integration/webmin.svg)](https://dash.yunohost.org/appci/app/webmin) ![](https://ci-apps.yunohost.org/ci/badges/webmin.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/webmin.maintain.svg) -[![Install WebMin with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=webmin) +[![Install Webmin with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=webmin) -> *This package allows you to install WebMin quickly and simply on a YunoHost server. +> *This package allows you to install Webmin 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.* **Note:** This app has **root** access which can change core things in the system, thus **breaking the YunoHost**. Use it carefully and read the [documents](https://doxfer.webmin.com/Webmin/Main_Page) two times before changing values. @@ -15,19 +15,13 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Screenshots -![](https://upload.wikimedia.org/wikipedia/commons/7/71/Webmin_Dashboard.gif) +![](https://raw.githubusercontent.com/webmin-devel/webmin/master/media/webmin-demo-basic.gif) ## Important points + - Only **root** (system user) can connect - Webmin will **update itself** when system updates are run. So no need to **run upgrade script** once installed. - Only **user** given permission at time of the installation can **access** the Webmin -- Installation can only be done on **root path**. Eg. webmin.domain.tld -- No **multi-instance** for WebMin as it is a system integrated app - -## Documentation - - * Official documentation: https://doxfer.webmin.com/Webmin/Main_Page - * YunoHost documentation: If specific documentation is needed, feel free to contribute. ## Links @@ -38,8 +32,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in --- -Developer info ----------------- +## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/webmin_ynh/tree/testing). diff --git a/check_process b/check_process index 177a995..c349aa8 100644 --- a/check_process +++ b/check_process @@ -6,7 +6,7 @@ ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) - admin="john" (USER) + admin="john" (USER) ; Checks pkg_linter=1 setup_sub_dir=0 @@ -17,9 +17,8 @@ upgrade=1 backup_restore=1 multi_instance=0 - # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. - # incorrect_path=1 - port_already_use=1 + incorrect_path=0 + port_already_use=0 change_url=0 ;;; Levels # If the level 5 (Package linter) is forced to 1. Please add justifications here. diff --git a/conf/nginx.conf b/conf/nginx.conf index 909f13d..50323b9 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,22 +1,23 @@ location __PATH__ { - proxy_pass https://127.0.0.1:__PORT__/; - proxy_redirect off; + proxy_pass https://127.0.0.1:__PORT__/; + proxy_redirect off; - #Proxy Settings - proxy_redirect off; - proxy_set_header Host $host:$server_port; #this redirects the link without port no - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + #Proxy Settings + proxy_redirect off; + proxy_set_header Host $host:$server_port; #this redirects the link without port no + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_max_temp_file_size 0; + proxy_connect_timeout 90; + proxy_send_timeout 90; + proxy_read_timeout 90; + proxy_buffer_size 128k; + proxy_buffers 32 32k; + proxy_busy_buffers_size 256k; + proxy_temp_file_write_size 256k; - proxy_max_temp_file_size 0; - proxy_connect_timeout 90; - proxy_send_timeout 90; - proxy_read_timeout 90; - proxy_buffer_size 128k; - proxy_buffers 32 32k; - proxy_busy_buffers_size 256k; - proxy_temp_file_write_size 256k; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; more_clear_input_headers 'Accept-Encoding'; diff --git a/issue_template.md b/issue_template.md index 81a3af9..44a3665 100644 --- a/issue_template.md +++ b/issue_template.md @@ -7,7 +7,7 @@ about: Create a report to help us debug, it would be nice to fill the template a **How to post a meaningful bug report** 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!* + - *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 WebMin itself. Refer to its documentation or repository for help.* - *If you have a doubt, post here, we will figure it out together.* 3. *Delete the italic comments as you write over them below, and remove this guide.* @@ -34,8 +34,8 @@ about: Create a report to help us debug, it would be nice to fill the template a - *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:* 1. *Go to '...'* - 2. *Click on '....'* - 3. *Scroll down to '....'* + 2. *Click on '...'* + 3. *Scroll down to '...'* 4. *See error* **Expected behavior** diff --git a/manifest.json b/manifest.json index 066cf40..3a22650 100644 --- a/manifest.json +++ b/manifest.json @@ -4,17 +4,17 @@ "packaging_format": 1, "description": { "en": "Web-based interface for system administration for Unix.", - "fr": "Interface web d'administration système pour Unix." + "fr": "Interface Web d'administration système pour Unix." }, - "version": "1.941~ynh1", + "version": "1.941~ynh2", "url": "http://www.webmin.com", - "license": "free", + "license": "BSD-3-Clause", "maintainer": { "name": "Anmol Sharma", "email": "anmol@datamol.org" }, "requirements": { - "yunohost": ">= 3.5" + "yunohost": ">= 3.8.1" }, "multi_instance": false, "services": [ @@ -26,7 +26,8 @@ "name": "domain", "type": "domain", "ask": { - "en": "Choose a domain for Webmin" + "en": "Choose a domain for Webmin", + "fr": "Choisissez un nom de domaine pour Webmin" }, "example": "domain.org" }, @@ -34,7 +35,8 @@ "name": "admin", "type": "user", "ask": { - "en": "Choose the Webmin administrator (must be an existing YunoHost user)" + "en": "Choose the Webmin administrator (must be an existing YunoHost user)", + "fr": "Choisissez l'administrateur Webmin (doit être un utilisateur YunoHost existant)" }, "example": "johndoe" } diff --git a/scripts/_common.sh b/scripts/_common.sh index 6ca04e1..126fb46 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -18,5 +18,3 @@ pkg_dependencies="perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runt #================================================= # FUTURE OFFICIAL HELPERS #================================================= - - diff --git a/scripts/backup b/scripts/backup index cca5962..14274c6 100755 --- a/scripts/backup +++ b/scripts/backup @@ -42,8 +42,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # SPECIFIC BACKUP #================================================= -# BACKUP VARIOUS FILES -#================================================= ynh_backup --src_path="/etc/webmin/miniserv.conf" @@ -51,4 +49,4 @@ ynh_backup --src_path="/etc/webmin/miniserv.conf" # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for Webmin. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index d4b9c1e..99b410c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -25,7 +25,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." +ynh_script_progression --message="Backing up Webmin before changing its URL (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -60,30 +60,30 @@ fi #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." +ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped LSB" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file +# 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 + # Make a backup of the original NGINX config file if modified ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper + # Set global variables for NGINX helper domain="$old_domain" path_url="$new_path" - # Create a dedicated nginx config + # Create a dedicated NGINX config ynh_add_nginx_config fi -# Change the domain for nginx +# Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location @@ -93,8 +93,6 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi -#================================================= -# GENERIC FINALISATION #================================================= # START SYSTEMD SERVICE #================================================= @@ -106,7 +104,7 @@ ynh_systemd_action --service_name=$app --action="start" --line_match="Started LS #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -114,4 +112,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" +ynh_script_progression --message="Change of URL completed for Webmin" --last diff --git a/scripts/install b/scripts/install index 59ac3a1..cc40aa1 100644 --- a/scripts/install +++ b/scripts/install @@ -32,8 +32,10 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." --weight=1 +final_path=/var/www/$app +test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url @@ -41,7 +43,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url @@ -52,7 +54,7 @@ ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Configuring firewall..." +ynh_script_progression --message="Configuring firewall..." --weight=1 # Find an available port port=$(ynh_find_port --port=10000) @@ -61,7 +63,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." +ynh_script_progression --message="Installing dependencies..." --weight=12 ynh_install_app_dependencies $pkg_dependencies @@ -71,9 +73,9 @@ ynh_install_extra_app_dependencies --repo="deb https://download.webmin.com/downl #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring NGINX web server..." --weight=11 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -81,7 +83,7 @@ ynh_add_nginx_config #================================================= # MODIFY A CONFIG FILE #================================================= -ynh_script_progression --message="Modifying a config file..." +ynh_script_progression --message="Modifying a config file..." --weight=1 ynh_replace_string --match_string="port=10000" --replace_string="port=$port" --target_file="/etc/webmin/miniserv.conf" ynh_replace_string --match_string="listen=10000" --replace_string="listen=$port" --target_file="/etc/webmin/miniserv.conf" @@ -89,7 +91,7 @@ ynh_replace_string --match_string="listen=10000" --replace_string="listen=$port #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= -ynh_script_progression --message="Storing the config file checksum..." +ynh_script_progression --message="Storing the config file checksum..." --weight=1 # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="/etc/webmin/miniserv.conf" @@ -99,7 +101,7 @@ ynh_store_file_checksum --file="/etc/webmin/miniserv.conf" #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description "Webmin Daemon" @@ -114,15 +116,26 @@ ynh_systemd_action --service_name=$app --action="start" --line_match="Started LS #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring SSOwat..." --weight=1 # Restrict access to admin only -yunohost app addaccess --users=$admin $app +# yunohost app addaccess --users=$admin $app + +if ! ynh_permission_exists --permission "admin"; then + ynh_permission_create --permission "admin" --url "/admin" --allowed $admin +fi + +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=2 + +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -130,4 +143,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" +ynh_script_progression --message="Installation of Webmin completed" --last diff --git a/scripts/remove b/scripts/remove index abe648e..ba9427b 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -28,14 +28,14 @@ port=$(ynh_app_setting_get --app=$app --key=port) # Remove the service from the list of services known by Yunohost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then - ynh_script_progression --message="Removing $app service integration..." + ynh_script_progression --message="Removing Webmin service integration..." --weight=1 yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." +ynh_script_progression --message="Stopping and removing the systemd service..." --weight=2 # Remove the dedicated systemd config ynh_remove_systemd_config @@ -45,31 +45,22 @@ ynh_remove_systemd_config #================================================= ynh_script_progression --message="Removing dependencies..." + # Remove metapackage and its dependencies ynh_remove_app_dependencies #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - #================================================= # GENERIC FINALIZATION #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" +ynh_script_progression --message="Removal of Webmin completed" --last diff --git a/scripts/restore b/scripts/restore index 8ae01cc..1f10ab5 100755 --- a/scripts/restore +++ b/scripts/restore @@ -23,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." +ynh_script_progression --message="Loading settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -35,27 +35,22 @@ port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." +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}" -#================================================= -# STANDARD RESTORATION STEPS #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the nginx configuration..." +ynh_script_progression --message="Restoring the NGINX configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - -#================================================= -# SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." +ynh_script_progression --message="Reinstalling dependencies..." --weight=10 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies @@ -89,7 +84,7 @@ ynh_systemd_action --service_name=$app --action="start" --line_match="Started LS #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -97,4 +92,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" +ynh_script_progression --message="Restoration completed for Webmin" --last diff --git a/scripts/upgrade b/scripts/upgrade index e438e80..bc8bb46 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -24,7 +24,7 @@ port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." +ynh_script_progression --message="Backing up Webmin before upgrading (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -54,15 +54,15 @@ ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped LS #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading NGINX web server configuration..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." +ynh_script_progression --message="Upgrading dependencies..." --weight=1 ynh_install_app_dependencies $pkg_dependencies @@ -71,7 +71,7 @@ ynh_backup_if_checksum_is_different --file="/etc/webmin/miniserv.conf" ynh_install_extra_app_dependencies --repo="deb https://download.webmin.com/download/repository sarge contrib" --package="webmin" --key="https://download.webmin.com/jcameron-key.asc" #================================================= -# SPECIFIC UPGRADE +# INSTALL WEBMIN #================================================= # MODIFY A CONFIG FILE #================================================= @@ -100,17 +100,16 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --line_match="Started LSB" #================================================= -# SETUP SSOWAT +# START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." +ynh_script_progression --message="Starting a systemd service..." --weight=3 -# Restrict access to admin only -yunohost app addaccess --users=$admin $app +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -118,4 +117,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" +ynh_script_progression --message="Upgrade of Webmin completed" --last