From c611340e540ed991793760c94d88cbdcfc9e861f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rard=20Collin?= Date: Tue, 14 Feb 2023 16:31:05 +0100 Subject: [PATCH] Add missing config for user to connect ssh --- .idea/cac-proxy_ynh.iml | 9 +++++++++ check_process | 2 +- manifest.json | 2 +- scripts/install | 2 +- scripts/upgrade | 12 ++++++++++-- 5 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 .idea/cac-proxy_ynh.iml diff --git a/.idea/cac-proxy_ynh.iml b/.idea/cac-proxy_ynh.iml new file mode 100644 index 0000000..bdf896d --- /dev/null +++ b/.idea/cac-proxy_ynh.iml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/check_process b/check_process index cf53ac3..ad71062 100644 --- a/check_process +++ b/check_process @@ -14,7 +14,7 @@ setup_private=0 setup_public=1 upgrade=1 - upgrade=0 from_commit=CommitHash + upgrade=1 from_commit=b446048d123428f5260c5757245e8ed5ad454fb0 backup_restore=1 multi_instance=0 port_already_use=0 diff --git a/manifest.json b/manifest.json index f032941..10a08fb 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "An advanced https proxy allowing you to call other websites from your own web application.", "fr": "Un proxy https avancé vous permettant d'appeler d'autres sites depuis votre propre application web." }, - "version": "1.0~ynh1", + "version": "1.0~ynh2", "url": "https://github.com/gcollin/cookie-aware-cors-proxy", "upstream": { "license": "MIT", diff --git a/scripts/install b/scripts/install index b516307..dc76966 100755 --- a/scripts/install +++ b/scripts/install @@ -122,7 +122,7 @@ ynh_use_nodejs ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" +ynh_system_user_create --username=$app --use_shell --home_dir="$final_path" --groups="ssh.app" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE diff --git a/scripts/upgrade b/scripts/upgrade index c096160..21742ea 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -83,8 +83,16 @@ ynh_use_nodejs #================================================= ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir="$final_path" + #Recreate the user to enable shell if needed +user_shell=$(grep "^$app:" /etc/passwd | cut -d: -f7) +if [ "$user_shell" == "/usr/sbin/nologin" ]; then + chsh --shell /bin/sh $app +fi + # Ensure the use can connect through ssh +user_groups=$(groups "$app") +if [[ "$user_groups" != *"ssh.app"* ]]; then + ynh_system_user_create --username=$app --groups="ssh.app" +fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE