diff --git a/data/actionsmap/yunohost.yml b/data/actionsmap/yunohost.yml
index cbe959b55..fabdcb923 100644
--- a/data/actionsmap/yunohost.yml
+++ b/data/actionsmap/yunohost.yml
@@ -1623,6 +1623,32 @@ tools:
full: --force
action: store_true
+ ### tools_regen_conf()
+ regen-conf:
+ action_help: Regenerate the configuration file(s)
+ api: PUT /tools/regenconf
+ arguments:
+ names:
+ help: Categories to regenerate configuration of (all by default)
+ nargs: "*"
+ metavar: NAME
+ -d:
+ full: --with-diff
+ help: Show differences in case of configuration changes
+ action: store_true
+ -f:
+ full: --force
+ help: Override all manual modifications in configuration files
+ action: store_true
+ -n:
+ full: --dry-run
+ help: Show what would have been regenerated
+ action: store_true
+ -p:
+ full: --list-pending
+ help: List pending configuration files and exit
+ action: store_true
+
subcategories:
migrations:
diff --git a/data/helpers.d/backend b/data/helpers.d/backend
index 6a574ab9a..710e6299b 100644
--- a/data/helpers.d/backend
+++ b/data/helpers.d/backend
@@ -3,17 +3,17 @@
# Use logrotate to manage the logfile
#
# usage: ynh_use_logrotate [--logfile=/log/file] [--nonappend] [--specific_user=user/group]
-# | arg: -l, --logfile= - absolute path of logfile
-# | arg: -n, --nonappend - (Option) Replace the config file instead of appending this new config.
+# | arg: -l, --logfile - absolute path of logfile
+# | arg: -n, --nonappend - (optional) Replace the config file instead of appending this new config.
# | arg: -u, --specific_user : run logrotate as the specified user and group. If not specified logrotate is runned as root.
#
-# If no argument provided, a standard directory will be use. /var/log/${app}
-# You can provide a path with the directory only or with the logfile.
+# If no --logfile is provided, /var/log/${app} will be used as default.
+# logfile can be just a directory, or a full path to a logfile :
# /parentdir/logdir
# /parentdir/logdir/logfile.log
#
-# It's possible to use this helper several times, each config will be added to the same logrotate config file.
-# Unless you use the option --non-append
+# It's possible to use this helper multiple times, each config will be added to
+# the same logrotate config file. Unless you use the option --non-append
#
# Requires YunoHost version 2.6.4 or higher.
ynh_use_logrotate () {
@@ -175,8 +175,7 @@ ynh_remove_systemd_config () {
#
# usage: ynh_add_nginx_config "list of others variables to replace"
#
-# | arg: list of others variables to replace separeted by a space
-# | for example : 'path_2 port_2 ...'
+# | arg: list - (Optional) list of others variables to replace separated by spaces. For example : 'path_2 port_2 ...'
#
# This will use a template in ../conf/nginx.conf
# __PATH__ by $path_url
@@ -249,13 +248,23 @@ ynh_remove_nginx_config () {
# Create a dedicated php-fpm config
#
-# usage: ynh_add_fpm_config
+# usage: ynh_add_fpm_config [--phpversion=7.X]
+# | arg: -v, --phpversion - Version of php to use.
#
# Requires YunoHost version 2.7.2 or higher.
ynh_add_fpm_config () {
+ # Declare an array to define the options of this helper.
+ local legacy_args=v
+ declare -Ar args_array=( [v]=phpversion= )
+ local phpversion
+ # Manage arguments with getopts
+ ynh_handle_getopts_args "$@"
+
# Configure PHP-FPM 7.0 by default
- local fpm_config_dir="/etc/php/7.0/fpm"
- local fpm_service="php7.0-fpm"
+ phpversion="${phpversion:-7.0}"
+
+ local fpm_config_dir="/etc/php/$phpversion/fpm"
+ local fpm_service="php${phpversion}-fpm"
# Configure PHP-FPM 5 on Debian Jessie
if [ "$(ynh_get_debian_release)" == "jessie" ]; then
fpm_config_dir="/etc/php5/fpm"
@@ -269,6 +278,7 @@ ynh_add_fpm_config () {
ynh_replace_string --match_string="__NAMETOCHANGE__" --replace_string="$app" --target_file="$finalphpconf"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$finalphpconf"
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$finalphpconf"
+ ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="$finalphpconf"
sudo chown root: "$finalphpconf"
ynh_store_file_checksum --file="$finalphpconf"
diff --git a/data/helpers.d/debug b/data/helpers.d/debug
index ea20ffc1a..7ad097dbd 100644
--- a/data/helpers.d/debug
+++ b/data/helpers.d/debug
@@ -37,6 +37,8 @@ ynh_debug () {
PS4='$(basename ${BASH_SOURCE[0]})-L${LINENO}: '
# Force xtrace to stderr
BASH_XTRACEFD=2
+ # Force stdout to stderr
+ exec 1>&2
fi
if [ "$trace" == "0" ]
then
@@ -44,6 +46,8 @@ ynh_debug () {
set +x
# Put xtrace back to its original fild descriptor
BASH_XTRACEFD=$old_bash_xtracefd
+ # Restore stdout
+ exec 1>&1
fi
# Renable set xtrace
set -x
diff --git a/data/helpers.d/filesystem b/data/helpers.d/filesystem
index 6fb6347a6..c471a6872 100644
--- a/data/helpers.d/filesystem
+++ b/data/helpers.d/filesystem
@@ -15,16 +15,13 @@ CAN_BIND=${CAN_BIND:-1}
# If DEST is ended by a slash it complete this path with the basename of SRC.
#
# usage: ynh_backup --src_path=src_path [--dest_path=dest_path] [--is_big] [--not_mandatory]
-# | arg: -s, --src_path - file or directory to bind or symlink or copy. it shouldn't be in
-# the backup dir.
-# | arg: -d, --dest_path - destination file or directory inside the
-# backup dir
+# | arg: -s, --src_path - file or directory to bind or symlink or copy. it shouldn't be in the backup dir.
+# | arg: -d, --dest_path - destination file or directory inside the backup dir
# | arg: -b, --is_big - Indicate data are big (mail, video, image ...)
# | arg: -m, --not_mandatory - Indicate that if the file is missing, the backup can ignore it.
# | arg: arg - Deprecated arg
#
-# example:
-# # Wordpress app context
+# Example in the context of a wordpress app
#
# ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
# # => This line will be added into CSV file
@@ -80,7 +77,7 @@ ynh_backup() {
echo "Source path '${src_path}' does not exist" >&2
if [ "$not_mandatory" == "0" ]
then
- echo "Source path '${SRC_PATH}' does not exist" >&2
+ echo "Source path '${src_path}' does not exist" >&2
# This is a temporary fix for fail2ban config files missing after the migration to stretch.
if echo "${src_path}" | grep --quiet "/etc/fail2ban"
@@ -198,28 +195,25 @@ with open(sys.argv[1], 'r') as backup_file:
# Restore a file or a directory
#
# Use the registered path in backup_list by ynh_backup to restore the file at
-# the good place.
+# the right place.
#
# usage: ynh_restore_file --origin_path=origin_path [--dest_path=dest_path] [--not_mandatory]
-# | arg: -o, --origin_path - Path where was located the file or the directory before
-# to be backuped or relative path to $YNH_CWD where it is located in the backup archive
-# | arg: -d, --dest_path - Path where restore the file or the dir, if unspecified,
-# the destination will be ORIGIN_PATH or if the ORIGIN_PATH doesn't exist in
-# the archive, the destination will be searched into backup.csv
+# | arg: -o, --origin_path - Path where was located the file or the directory before to be backuped or relative path to $YNH_CWD where it is located in the backup archive
+# | arg: -d, --dest_path - Path where restore the file or the dir, if unspecified, the destination will be ORIGIN_PATH or if the ORIGIN_PATH doesn't exist in the archive, the destination will be searched into backup.csv
# | arg: -m, --not_mandatory - Indicate that if the file is missing, the restore process can ignore it.
#
+# examples:
+# ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
+# # You can also use relative paths:
+# ynh_restore_file "conf/nginx.conf"
+#
# If DEST_PATH already exists and is lighter than 500 Mo, a backup will be made in
# /home/yunohost.conf/backup/. Otherwise, the existing file is removed.
#
-# examples:
-# ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
-# # if apps/wordpress/etc/nginx/conf.d/$domain.d/$app.conf exists, restore it into
-# # /etc/nginx/conf.d/$domain.d/$app.conf
-# # if no, search a correspondance in the csv (eg: conf/nginx.conf) and restore it into
-# # /etc/nginx/conf.d/$domain.d/$app.conf
-#
-# # DON'T GIVE THE ARCHIVE PATH:
-# ynh_restore_file "conf/nginx.conf"
+# if apps/wordpress/etc/nginx/conf.d/$domain.d/$app.conf exists, restore it into
+# /etc/nginx/conf.d/$domain.d/$app.conf
+# if no, search for a match in the csv (eg: conf/nginx.conf) and restore it into
+# /etc/nginx/conf.d/$domain.d/$app.conf
#
# Requires YunoHost version 2.6.4 or higher.
ynh_restore_file () {
@@ -348,8 +342,7 @@ ynh_store_file_checksum () {
#
# usage: ynh_backup_if_checksum_is_different --file=file
# | arg: -f, --file - The file on which the checksum test will be perfomed.
-#
-# | ret: Return the name a the backup file, or nothing
+# | ret: the name of a backup file, or nothing
#
# Requires YunoHost version 2.6.4 or higher.
ynh_backup_if_checksum_is_different () {
diff --git a/data/helpers.d/getopts b/data/helpers.d/getopts
index f89784578..b6cd95f3c 100644
--- a/data/helpers.d/getopts
+++ b/data/helpers.d/getopts
@@ -152,10 +152,15 @@ ynh_handle_getopts_args () {
# If there's already another value for this option, add a ; before adding the new value
eval ${option_var}+="\;"
fi
- # Escape double quote to prevent any interpretation during the eval
- all_args[$i]="${all_args[$i]//\"/\\\"}"
- eval ${option_var}+=\"${all_args[$i]}\"
+ # For the record.
+ # We're using eval here to get the content of the variable stored itself as simple text in $option_var...
+ # Other ways to get that content would be to use either ${!option_var} or declare -g ${option_var}
+ # But... ${!option_var} can't be used as left part of an assignation.
+ # declare -g ${option_var} will create a local variable (despite -g !) and will not be available for the helper itself.
+ # So... Stop fucking arguing each time that eval is evil... Go find an other working solution if you can find one!
+
+ eval ${option_var}+='"${all_args[$i]}"'
shift_value=$(( shift_value + 1 ))
fi
done
@@ -193,12 +198,9 @@ ynh_handle_getopts_args () {
# The variable name will be stored in 'option_var'
local option_var="${args_array[$option_flag]%=}"
- # Escape double quote to prevent any interpretation during the eval
- arguments[$i]="${arguments[$i]//\"/\\\"}"
-
# Store each value given as argument in the corresponding variable
# The values will be stored in the same order than $args_array
- eval ${option_var}+=\"${arguments[$i]}\"
+ eval ${option_var}+='"${arguments[$i]}"'
done
unset legacy_args
else
diff --git a/data/helpers.d/mysql b/data/helpers.d/mysql
index 313b7a245..d7400db2d 100644
--- a/data/helpers.d/mysql
+++ b/data/helpers.d/mysql
@@ -186,7 +186,7 @@ ynh_mysql_drop_user() {
# usage: ynh_mysql_setup_db --db_user=user --db_name=name [--db_pwd=pwd]
# | arg: -u, --db_user - Owner of the database
# | arg: -n, --db_name - Name of the database
-# | arg: -p, --db_pwd - Password of the database. If not given, a password will be generated
+# | arg: -p, --db_pwd - Password of the database. If not provided, a password will be generated
#
# Requires YunoHost version 2.6.4 or higher.
ynh_mysql_setup_db () {
@@ -200,7 +200,7 @@ ynh_mysql_setup_db () {
ynh_handle_getopts_args "$@"
local new_db_pwd=$(ynh_string_random) # Generate a random password
- # If $db_pwd is not given, use new_db_pwd instead for db_pwd
+ # If $db_pwd is not provided, use new_db_pwd instead for db_pwd
db_pwd="${db_pwd:-$new_db_pwd}"
ynh_mysql_create_db "$db_name" "$db_user" "$db_pwd" # Create the database
diff --git a/data/helpers.d/network b/data/helpers.d/network
index 8812f8f39..4dc080203 100644
--- a/data/helpers.d/network
+++ b/data/helpers.d/network
@@ -1,14 +1,16 @@
#!/bin/bash
# Normalize the url path syntax
+#
# Handle the slash at the beginning of path and its absence at ending
# Return a normalized url path
#
-# example: url_path=$(ynh_normalize_url_path $url_path)
-# ynh_normalize_url_path example -> /example
-# ynh_normalize_url_path /example -> /example
-# ynh_normalize_url_path /example/ -> /example
-# ynh_normalize_url_path / -> /
+# examples:
+# url_path=$(ynh_normalize_url_path $url_path)
+# ynh_normalize_url_path example # -> /example
+# ynh_normalize_url_path /example # -> /example
+# ynh_normalize_url_path /example/ # -> /example
+# ynh_normalize_url_path / # -> /
#
# usage: ynh_normalize_url_path --path_url=path_to_normalize
# | arg: -p, --path_url - URL path to normalize before using it
diff --git a/data/helpers.d/nodejs b/data/helpers.d/nodejs
index b51bcd7c3..6833b7593 100644
--- a/data/helpers.d/nodejs
+++ b/data/helpers.d/nodejs
@@ -123,7 +123,7 @@ ynh_install_nodejs () {
fi
# Store the ID of this app and the version of node requested for it
- echo "$YNH_APP_ID:$nodejs_version" | tee --append "$n_install_dir/ynh_app_version"
+ echo "$YNH_APP_INSTANCE_NAME:$nodejs_version" | tee --append "$n_install_dir/ynh_app_version"
# Store nodejs_version into the config of this app
ynh_app_setting_set --app=$app --key=nodejs_version --value=$nodejs_version
@@ -147,7 +147,7 @@ ynh_remove_nodejs () {
nodejs_version=$(ynh_app_setting_get --app=$app --key=nodejs_version)
# Remove the line for this app
- sed --in-place "/$YNH_APP_ID:$nodejs_version/d" "$n_install_dir/ynh_app_version"
+ sed --in-place "/$YNH_APP_INSTANCE_NAME:$nodejs_version/d" "$n_install_dir/ynh_app_version"
# If no other app uses this version of nodejs, remove it.
if ! grep --quiet "$nodejs_version" "$n_install_dir/ynh_app_version"
diff --git a/data/helpers.d/print b/data/helpers.d/print
index 95d2af139..468c41e96 100644
--- a/data/helpers.d/print
+++ b/data/helpers.d/print
@@ -192,6 +192,7 @@ ynh_print_ON () {
# | arg: -m, --message= - The text to print
# | arg: -w, --weight= - The weight for this progression. This value is 1 by default. Use a bigger value for a longer part of the script.
# | arg: -t, --time= - Print the execution time since the last call to this helper. Especially usefull to define weights.
+# The execution time is given for the duration since the previous call. So the weight should be applied to this previous call.
# | arg: -l, --last= - Use for the last call of the helper, to fill te progression bar.
#
# Requires YunoHost version 3.?.? or higher.
@@ -201,6 +202,7 @@ previous_weight=0
base_time=$(date +%s)
ynh_script_progression () {
# Declare an array to define the options of this helper.
+ local legacy_args=mwtl
declare -Ar args_array=( [m]=message= [w]=weight= [t]=time [l]=last )
local message
local weight
@@ -222,9 +224,9 @@ ynh_script_progression () {
local weight_calls=$(grep --perl-regexp --count "^[^#]*ynh_script_progression.*(--weight|-w )" $0)
# Get the weight of each occurrences of 'ynh_script_progression' in the script using --weight
- local weight_valuesA="$(grep --perl-regexp "^[^#]*ynh_script_progression.*--weight" $0 | sed 's/.*--weight[= ]\([[:digit:]].*\)/\1/g')"
- # Get the weight of each occurrences of 'ynh_script_progression' in the script using -w
- local weight_valuesB="$(grep --perl-regexp "^[^#]*ynh_script_progression.*-w " $0 | sed 's/.*-w[= ]\([[:digit:]].*\)/\1/g')"
+ local weight_valuesA="$(grep --perl-regexp "^[^#]*ynh_script_progression.*--weight" $0 | sed 's/.*--weight[= ]\([[:digit:]]*\).*/\1/g')"
+ # Get the weight of each occurrences of 'ynh_script_progression' in the script using -w
+ local weight_valuesB="$(grep --perl-regexp "^[^#]*ynh_script_progression.*-w " $0 | sed 's/.*-w[= ]\([[:digit:]]*\).*/\1/g')"
# Each value will be on a different line.
# Remove each 'end of line' and replace it by a '+' to sum the values.
local weight_values=$(( $(echo "$weight_valuesA" | tr '\n' '+') + $(echo "$weight_valuesB" | tr '\n' '+') 0 ))
diff --git a/data/helpers.d/psql b/data/helpers.d/psql
index 2212d692a..c5e065f07 100644
--- a/data/helpers.d/psql
+++ b/data/helpers.d/psql
@@ -174,7 +174,7 @@ ynh_psql_database_exists() {
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
- if ! sudo --login --user=postgres PGUSER="postgres" PGPASSWORD="$(sudo cat $PSQL_ROOT_PWD_FILE)" psql -tAc "SELECT datname FROM pg_database WHERE datname='$database';" | grep --quiet "$user"; then
+ if ! sudo --login --user=postgres PGUSER="postgres" PGPASSWORD="$(sudo cat $PSQL_ROOT_PWD_FILE)" psql -tAc "SELECT datname FROM pg_database WHERE datname='$database';" | grep --quiet "$database"; then
return 1
else
return 0
diff --git a/data/helpers.d/system b/data/helpers.d/system
index c4c049c31..757fdf93c 100644
--- a/data/helpers.d/system
+++ b/data/helpers.d/system
@@ -75,6 +75,7 @@ ynh_get_debian_release () {
# | arg: -e, --length= - Length of the error log : Default : 20
ynh_systemd_action() {
# Declare an array to define the options of this helper.
+ local legacy_args=nalpte
declare -Ar args_array=( [n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length= )
local service_name
local action
@@ -175,6 +176,7 @@ ynh_clean_check_starting () {
# Requires YunoHost version 3.?.? or higher.
ynh_read_manifest () {
# Declare an array to define the options of this helper.
+ local legacy_args=mk
declare -Ar args_array=( [m]=manifest= [k]=manifest_key= )
local manifest
local manifest_key
@@ -200,6 +202,8 @@ ynh_read_manifest () {
#
# Requires YunoHost version 3.?.? or higher.
ynh_app_upstream_version () {
+ # Declare an array to define the options of this helper.
+ local legacy_args=m
declare -Ar args_array=( [m]=manifest= )
local manifest
# Manage arguments with getopts
@@ -221,6 +225,8 @@ ynh_app_upstream_version () {
#
# Requires YunoHost version 3.?.? or higher.
ynh_app_package_version () {
+ # Declare an array to define the options of this helper.
+ local legacy_args=m
declare -Ar args_array=( [m]=manifest= )
local manifest
# Manage arguments with getopts
@@ -235,7 +241,7 @@ ynh_app_package_version () {
# - UPGRADE_APP if the upstream app version has changed
# - UPGRADE_PACKAGE if only the YunoHost package has changed
#
-## It stops the current script without error if the package is up-to-date
+# It stops the current script without error if the package is up-to-date
#
# This helper should be used to avoid an upgrade of an app, or the upstream part
# of it, when it's not needed
diff --git a/data/helpers.d/user b/data/helpers.d/user
index 83fa47aa8..9ee44515d 100644
--- a/data/helpers.d/user
+++ b/data/helpers.d/user
@@ -89,16 +89,15 @@ ynh_system_group_exists() {
# Create a system user
#
# examples:
-# - ynh_system_user_create --username=nextcloud -> creates a nextcloud user with
-# no home directory and /usr/sbin/nologin login shell (hence no login capability)
-# - ynh_system_user_create --username=discourse --home_dir=/var/www/discourse --use_shell --> creates a
-# discourse user using /var/www/discourse as home directory and the default login shell
+# # Create a nextcloud user with no home directory and /usr/sbin/nologin login shell (hence no login capability)
+# ynh_system_user_create --username=nextcloud
+# # Create a discourse user using /var/www/discourse as home directory and the default login shell
+# ynh_system_user_create --username=discourse --home_dir=/var/www/discourse --use_shell
#
# usage: ynh_system_user_create --username=user_name [--home_dir=home_dir] [--use_shell]
# | arg: -u, --username - Name of the system user that will be create
# | arg: -h, --home_dir - Path of the home dir for the user. Usually the final path of the app. If this argument is omitted, the user will be created without home
-# | arg: -s, --use_shell - Create a user using the default login shell if present.
-# If this argument is omitted, the user will be created with /usr/sbin/nologin shell
+# | arg: -s, --use_shell - Create a user using the default login shell if present. If this argument is omitted, the user will be created with /usr/sbin/nologin shell
#
# Requires YunoHost version 2.6.4 or higher.
ynh_system_user_create () {
diff --git a/data/hooks/conf_regen/03-ssh b/data/hooks/conf_regen/03-ssh
index 5bb9cf916..54b7c55b7 100755
--- a/data/hooks/conf_regen/03-ssh
+++ b/data/hooks/conf_regen/03-ssh
@@ -12,7 +12,7 @@ do_pre_regen() {
[[ ! -f /etc/yunohost/from_script ]] || return 0
cd /usr/share/yunohost/templates/ssh
-
+
# do not listen to IPv6 if unavailable
[[ -f /proc/net/if_inet6 ]] && ipv6_enabled=true || ipv6_enabled=false
@@ -23,6 +23,9 @@ do_pre_regen() {
ssh_keys="$ssh_keys $(ls /etc/ssh/ssh_host_dsa_key 2>/dev/null || true)"
fi
+ # Support different strategy for security configurations
+ export compatibility="$(yunohost settings get 'security.ssh.compatibility')"
+
export ssh_keys
export ipv6_enabled
ynh_render_template "sshd_config" "${pending_dir}/etc/ssh/sshd_config"
diff --git a/data/hooks/conf_regen/15-nginx b/data/hooks/conf_regen/15-nginx
index 7ca63c003..59654a771 100755
--- a/data/hooks/conf_regen/15-nginx
+++ b/data/hooks/conf_regen/15-nginx
@@ -10,7 +10,25 @@ do_init_regen() {
exit 1
fi
- do_pre_regen ""
+ cd /usr/share/yunohost/templates/nginx
+
+ nginx_dir="/etc/nginx"
+ nginx_conf_dir="${nginx_dir}/conf.d"
+ mkdir -p "$nginx_conf_dir"
+
+ # install plain conf files
+ cp plain/* "$nginx_conf_dir"
+
+ # probably run with init: just disable default site, restart NGINX and exit
+ rm -f "${nginx_dir}/sites-enabled/default"
+
+ export compatibility="intermediate"
+ ynh_render_template "yunohost_admin.conf" "${nginx_conf_dir}/yunohost_admin.conf"
+
+ # Restart nginx if conf looks good, otherwise display error and exit unhappy
+ nginx -t 2>/dev/null && service nginx restart || (nginx -t && exit 1)
+
+ exit 0
}
do_pre_regen() {
@@ -22,20 +40,16 @@ do_pre_regen() {
nginx_conf_dir="${nginx_dir}/conf.d"
mkdir -p "$nginx_conf_dir"
- # install plain conf files
+ # install / update plain conf files
cp plain/* "$nginx_conf_dir"
- # probably run with init: just disable default site, restart NGINX and exit
- if [[ -z "$pending_dir" ]]; then
- rm -f "${nginx_dir}/sites-enabled/default"
- service nginx restart
- exit 0
- fi
-
# retrieve variables
main_domain=$(cat /etc/yunohost/current_host)
domain_list=$(sudo yunohost domain list --output-as plain --quiet)
+ # Support different strategy for security configurations
+ export compatibility="$(yunohost settings get 'security.nginx.compatibility')"
+
# add domain conf files
for domain in $domain_list; do
domain_conf_dir="${nginx_conf_dir}/${domain}.d"
@@ -58,6 +72,8 @@ do_pre_regen() {
done
+ ynh_render_template "yunohost_admin.conf" "${nginx_conf_dir}/yunohost_admin.conf"
+
# remove old domain conf files
conf_files=$(ls -1 /etc/nginx/conf.d \
| awk '/^[^\.]+\.[^\.]+.*\.conf$/ { print $1 }')
diff --git a/data/templates/nginx/plain/yunohost_panel.conf.inc b/data/templates/nginx/plain/yunohost_panel.conf.inc
index 34afe136d..1c5a2d656 100644
--- a/data/templates/nginx/plain/yunohost_panel.conf.inc
+++ b/data/templates/nginx/plain/yunohost_panel.conf.inc
@@ -1,8 +1,8 @@
-# Insert YunoHost panel
-sub_filter '';
+# Insert YunoHost button + portal overlay
+sub_filter '';
sub_filter_once on;
# Apply to other mime types than text/html
sub_filter_types application/xhtml+xml;
# Prevent YunoHost panel files from being blocked by specific app rules
-location ~ ynhpanel\.(js|json|css) {
+location ~ (ynh_portal.js|ynh_overlay.css|ynh_userinfo.json) {
}
diff --git a/data/templates/nginx/server.tpl.conf b/data/templates/nginx/server.tpl.conf
index d8793ef05..fa8b6586b 100644
--- a/data/templates/nginx/server.tpl.conf
+++ b/data/templates/nginx/server.tpl.conf
@@ -29,6 +29,14 @@ server {
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:50m;
+ {% if compatibility == "modern" %}
+ # Ciphers with modern compatibility
+ # https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=nginx-1.6.2&openssl=1.0.1t&hsts=yes&profile=modern
+ # The following configuration use modern ciphers, but remove compatibility with some old clients (android < 5.0, Internet Explorer < 10, ...)
+ ssl_protocols TLSv1.2;
+ ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
+ ssl_prefer_server_ciphers on;
+ {% else %}
# As suggested by Mozilla : https://wiki.mozilla.org/Security/Server_Side_TLS and https://en.wikipedia.org/wiki/Curve25519
ssl_ecdh_curve secp521r1:secp384r1:prime256v1;
ssl_prefer_server_ciphers on;
@@ -38,15 +46,10 @@ server {
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
- # Ciphers with modern compatibility
- # https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=nginx-1.6.2&openssl=1.0.1t&hsts=yes&profile=modern
- # Uncomment the following to use modern ciphers, but remove compatibility with some old clients (android < 5.0, Internet Explorer < 10, ...)
- #ssl_protocols TLSv1.2;
- #ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
-
# Uncomment the following directive after DH generation
# > openssl dhparam -out /etc/ssl/private/dh2048.pem -outform PEM -2 2048
#ssl_dhparam /etc/ssl/private/dh2048.pem;
+ {% endif %}
# Follows the Web Security Directives from the Mozilla Dev Lab and the Mozilla Obervatory + Partners
# https://wiki.mozilla.org/Security/Guidelines/Web_Security
diff --git a/data/templates/nginx/plain/yunohost_admin.conf b/data/templates/nginx/yunohost_admin.conf
similarity index 88%
rename from data/templates/nginx/plain/yunohost_admin.conf
rename to data/templates/nginx/yunohost_admin.conf
index ff61b8638..e0d9f6bb1 100644
--- a/data/templates/nginx/plain/yunohost_admin.conf
+++ b/data/templates/nginx/yunohost_admin.conf
@@ -20,6 +20,14 @@ server {
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:50m;
+ {% if compatibility == "modern" %}
+ # Ciphers with modern compatibility
+ # https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=nginx-1.6.2&openssl=1.0.1t&hsts=yes&profile=modern
+ # Uncomment the following to use modern ciphers, but remove compatibility with some old clients (android < 5.0, Internet Explorer < 10, ...)
+ ssl_protocols TLSv1.2;
+ ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
+ ssl_prefer_server_ciphers on;
+ {% else %}
# As suggested by Mozilla : https://wiki.mozilla.org/Security/Server_Side_TLS and https://en.wikipedia.org/wiki/Curve25519
ssl_ecdh_curve secp521r1:secp384r1:prime256v1;
ssl_prefer_server_ciphers on;
@@ -29,20 +37,15 @@ server {
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
- # Ciphers with modern compatibility
- # https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=nginx-1.6.2&openssl=1.0.1t&hsts=yes&profile=modern
- # Uncomment the following to use modern ciphers, but remove compatibility with some old clients (android < 5.0, Internet Explorer < 10, ...)
- #ssl_protocols TLSv1.2;
- #ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
-
# Uncomment the following directive after DH generation
# > openssl dhparam -out /etc/ssl/private/dh2048.pem -outform PEM -2 2048
#ssl_dhparam /etc/ssl/private/dh2048.pem;
-
+ {% endif %}
+
# Follows the Web Security Directives from the Mozilla Dev Lab and the Mozilla Obervatory + Partners
# https://wiki.mozilla.org/Security/Guidelines/Web_Security
- # https://observatory.mozilla.org/
- more_set_headers "Strict-Transport-Security : max-age=63072000; includeSubDomains; preload";
+ # https://observatory.mozilla.org/
+ more_set_headers "Strict-Transport-Security : max-age=63072000; includeSubDomains; preload";
more_set_headers "Referrer-Policy : 'same-origin'";
more_set_headers "Content-Security-Policy : upgrade-insecure-requests; object-src 'none'; script-src https: 'unsafe-eval'";
more_set_headers "X-Content-Type-Options : nosniff";
diff --git a/data/templates/ssh/sshd_config b/data/templates/ssh/sshd_config
index ed870e5dc..8dc0e8dfc 100644
--- a/data/templates/ssh/sshd_config
+++ b/data/templates/ssh/sshd_config
@@ -15,10 +15,17 @@ HostKey {{ key }}{% endfor %}
# https://infosec.mozilla.org/guidelines/openssh
# ##############################################
-# Keys, ciphers and MACS
-KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
-Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
-MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com
+{% if compatibility == "intermediate" %}
+ KexAlgorithms diffie-hellman-group-exchange-sha256
+ Ciphers aes256-ctr,aes192-ctr,aes128-ctr
+ MACs hmac-sha2-512,hmac-sha2-256
+{% else %}
+ # By default use "modern" Mozilla configuration
+ # Keys, ciphers and MACS
+ KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
+ Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
+ MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com
+{% endif %}
# Use kernel sandbox mechanisms where possible in unprivileged processes
UsePrivilegeSeparation sandbox
diff --git a/data/templates/yunohost/services.yml b/data/templates/yunohost/services.yml
index 62509e1e9..0d79b182f 100644
--- a/data/templates/yunohost/services.yml
+++ b/data/templates/yunohost/services.yml
@@ -20,8 +20,6 @@ mysql:
glances: {}
ssh:
log: /var/log/auth.log
-ssl:
- status: null
metronome:
log: [/var/log/metronome/metronome.log,/var/log/metronome/metronome.err]
slapd:
@@ -34,10 +32,9 @@ yunohost-firewall:
need_lock: true
nslcd:
log: /var/log/syslog
-nsswitch:
- status: null
-yunohost:
- status: null
+nsswitch: null
+ssl: null
+yunohost: null
bind9: null
tahoe-lafs: null
memcached: null
diff --git a/debian/changelog b/debian/changelog
index 444d797e1..a22959899 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,53 @@
+yunohost (3.5.2.2) stable; urgency=low
+
+ - Hotfix for ynh_psql_remove_db (from ljf)
+
+ -- Alexandre Aubin
Arguments:
App helpers
-{% for category, helpers in data %}
+{% for category, helpers in data.helpers %}
{{ category }}
@@ -27,8 +27,12 @@
- {% for name, descr in h.args %}
-
{{ name }}
: {{ descr }}{{ infos[0] }}
: {{ infos[1] }}{{ infos[0] }}
, {{ infos[1] }}
: {{ infos[2] }}
Example: {{ h.example }}
+ Examples:
{{ example }}
+ {% else %}
+ {{ example.strip("# ") }}
+ {% endif %}
+ Details: @@ -63,6 +81,8 @@ {% endfor %} {% endfor %} +
Generated by this script on {{data.date}} (Yunohost version {{data.version}})
+