Base setup, shell must be set, fix remote host check

This commit is contained in:
2025-07-04 14:27:49 +09:00
parent d60ed41100
commit 50e6df775c
2 changed files with 3 additions and 2 deletions

View File

@@ -82,7 +82,8 @@ else
# User for sudo, but only if SUDO is enabled # User for sudo, but only if SUDO is enabled
if [ "${USE_SUDO}" != "0" ]; then if [ "${USE_SUDO}" != "0" ]; then
echo "+ Add user ${WWW_GROUP}:${SUDO_USER} with base folder ${GIT_WEBHOOK_BASE_FOLDER}"; echo "+ Add user ${WWW_GROUP}:${SUDO_USER} with base folder ${GIT_WEBHOOK_BASE_FOLDER}";
useradd -d "${GIT_WEBHOOK_BASE_FOLDER}" -m -s /usr/sbin/nologin "${SUDO_USER}" # Note: we need to set bin bash or we cannot use Jump Host
useradd -d "${GIT_WEBHOOK_BASE_FOLDER}" -m -s /bin/bash "${SUDO_USER}"
fi; fi;
if [ ! -d "${GIT_WEBHOOK_BASE_FOLDER}" ]; then if [ ! -d "${GIT_WEBHOOK_BASE_FOLDER}" ]; then
echo "+ Create Folder: ${GIT_WEBHOOK_BASE_FOLDER}"; echo "+ Create Folder: ${GIT_WEBHOOK_BASE_FOLDER}";

View File

@@ -45,7 +45,7 @@ else
# make sure the identiy file is there # make sure the identiy file is there
# grep "IdentityFile" in this # grep "IdentityFile" in this
SSH_TEST=("${SUDO_COMMAND[@]}" "ssh" "${REMOTE_HOST}"); SSH_TEST=("${SUDO_COMMAND[@]}" "ssh" "${REMOTE_HOST}");
result=$("${SSH_TEST[@]}"); result=$("${SSH_TEST[@]}" 2>&1);
validate_string="You've successfully authenticated with the key" validate_string="You've successfully authenticated with the key"
if [[ "$result" != *"$validate_string"* ]]; then if [[ "$result" != *"$validate_string"* ]]; then
echo "Could not connect to ${REMOTE_HOST}: ${result}"; echo "Could not connect to ${REMOTE_HOST}: ${result}";