From 44b9c4bf350146bbcf90d601312c26d7c8973385 Mon Sep 17 00:00:00 2001 From: Emmanuel Averty Date: Wed, 11 Jan 2023 19:46:20 +0100 Subject: [PATCH] better ssh config --- conf/app.ini | 2 +- scripts/change_url | 4 ++-- scripts/install | 15 +++++++++------ scripts/restore | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/conf/app.ini b/conf/app.ini index b0032c0..a855f33 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -41,7 +41,7 @@ ENABLE_NOTIFY_MAIL = true DISABLE_REGISTRATION = true ENABLE_CAPTCHA = false REQUIRE_SIGNIN_VIEW = false -ENABLE_REVERSE_PROXY_AUTHENTICATION = false +ENABLE_REVERSE_PROXY_AUTHENTICATION = true ENABLE_REVERSE_PROXY_AUTO_REGISTRATION = true [picture] diff --git a/scripts/change_url b/scripts/change_url index 51d5e9a..561286a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -120,8 +120,8 @@ ssh_port=$(grep -P "Port\s+\d+" /etc/ssh/sshd_config | grep -P -o "\d+") ynh_exec_warn_less ynh_add_config --template="../conf/app.ini" --destination="$final_path/custom/conf/app.ini" -chmod 640 "$final_path/app.ini" -chown $app:$app "$final_path/app.ini" +chmod 640 "$final_path/custom/conf/app.ini" +chown $app:$app "$final_path/custom/conf/app.ini" #================================================= # GENERIC FINALISATION diff --git a/scripts/install b/scripts/install index 0f7c3b9..d05f3d8 100644 --- a/scripts/install +++ b/scripts/install @@ -91,8 +91,11 @@ ynh_psql_setup_db --db_user=$db_user --db_name=$db_name #================================================= ynh_script_progression --message="Configuring system user..." --weight=1 +datadir=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=datadir --value=$datadir + # Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path --groups ssh.app +ynh_system_user_create --username=$app --home_dir=$datadir --groups ssh.app --use_shell #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -100,7 +103,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path --groups ssh.app ynh_script_progression --message="Installing sources files..." --weight=10 ynh_app_setting_set --app=$app --key=final_path --value=$final_path -ynh_setup_source --dest-dir=$final_path --source-id=$YNH_ARCH +ynh_setup_source --dest_dir=$final_path --source_id=$YNH_ARCH mkdir -p "$final_path/custom/conf" @@ -120,9 +123,6 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Creating a data directory..." --weight=1 -datadir=/home/yunohost.app/$app -ynh_app_setting_set --app=$app --key=datadir --value=$datadir - if [ -e "$datadir" ]; then old_data_dir_path="$datadir$(date '+%Y%m%d.%H%M%S')" ynh_print_warn "A data directory already exist. Data was renamed to $old_data_dir_path" @@ -164,7 +164,10 @@ ynh_add_systemd_config ynh_script_progression --message="Configuring log rotation..." --weight=1 # Configure logrotate -ynh_use_logrotate --logfile "/var/log/$app" +ynh_use_logrotate --logfile "/var/log/$app/forgejo.log" + +chown $app:$app /var/log/$app +chmod u=rwX,g=rX,o= "/var/log/$app" #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/restore b/scripts/restore index 893b98a..f07d807 100644 --- a/scripts/restore +++ b/scripts/restore @@ -63,7 +63,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" --groups ssh.app +ynh_system_user_create --username=$app --home_dir="$datadir" --groups ssh.app --use_shell #================================================= # RESTORE THE APP MAIN DIR