mirror of
https://github.com/YunoHost-Apps/ssh_chroot_dir_ynh.git
synced 2024-09-03 20:26:26 +02:00
Remove password from log
This commit is contained in:
parent
93eedd7752
commit
3436d6f8c5
2 changed files with 26 additions and 2 deletions
|
@ -343,6 +343,23 @@ ynh_exec_fully_quiet () {
|
||||||
eval $@ > /dev/null 2>&1
|
eval $@ > /dev/null 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Remove any logs for all the following commands.
|
||||||
|
#
|
||||||
|
# usage: ynh_print_OFF
|
||||||
|
# WARNING: You should be careful with this helper, and never forgot to use ynh_print_ON as soon as possible to restore the logging.
|
||||||
|
ynh_print_OFF () {
|
||||||
|
set +x
|
||||||
|
}
|
||||||
|
|
||||||
|
# Restore the logging after ynh_print_OFF
|
||||||
|
#
|
||||||
|
# usage: ynh_print_ON
|
||||||
|
ynh_print_ON () {
|
||||||
|
set -x
|
||||||
|
# Print an echo only for the log, to be able to know that ynh_print_ON has been called.
|
||||||
|
echo ynh_print_ON > /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Install or update the main directory yunohost.multimedia
|
# Install or update the main directory yunohost.multimedia
|
||||||
|
|
|
@ -22,7 +22,7 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
ssh_user=$YNH_APP_ARG_SSH_USER
|
ssh_user=$YNH_APP_ARG_SSH_USER
|
||||||
# Default value null
|
# Default value null
|
||||||
password=${YNH_APP_ARG_PASSWORD:-}
|
ynh_print_OFF; password=${YNH_APP_ARG_PASSWORD:-}; ynh_print_ON
|
||||||
pub_key=${YNH_APP_ARG_PUB_KEY:-}
|
pub_key=${YNH_APP_ARG_PUB_KEY:-}
|
||||||
size=$YNH_APP_ARG_SIZE
|
size=$YNH_APP_ARG_SIZE
|
||||||
|
|
||||||
|
@ -32,7 +32,8 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
# DISCLAIMER
|
# DISCLAIMER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if IS_PACKAGE_CHECK; then
|
PACKAGE_CHECK_EXEC=${PACKAGE_CHECK_EXEC:-0}
|
||||||
|
if [ "$PACKAGE_CHECK_EXEC" != "0" ]; then
|
||||||
ynh_print_warn "This app can't be tested by package check. Please see the readme for more information. https://github.com/YunoHost-Apps/ssh_chroot_dir_ynh"
|
ynh_print_warn "This app can't be tested by package check. Please see the readme for more information. https://github.com/YunoHost-Apps/ssh_chroot_dir_ynh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -50,10 +51,12 @@ ynh_system_user_exists $ssh_user && ynh_die "This user already exist"
|
||||||
final_path=/opt/yunohost/$app
|
final_path=/opt/yunohost/$app
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
|
||||||
|
ynh_print_OFF
|
||||||
if test -z "$password" && test -z "$pub_key"
|
if test -z "$password" && test -z "$pub_key"
|
||||||
then
|
then
|
||||||
ynh_die "You can't left empty both password and public key. Please fill at least one of them."
|
ynh_die "You can't left empty both password and public key. Please fill at least one of them."
|
||||||
fi
|
fi
|
||||||
|
ynh_print_ON
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
|
@ -110,11 +113,13 @@ quotas_activate "$quotas_mount_point"
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
add_password=""
|
add_password=""
|
||||||
|
ynh_print_OFF
|
||||||
if [ -n "$password" ]
|
if [ -n "$password" ]
|
||||||
then
|
then
|
||||||
auth_opt="--password"
|
auth_opt="--password"
|
||||||
auth_value="$password"
|
auth_value="$password"
|
||||||
fi
|
fi
|
||||||
|
ynh_print_ON
|
||||||
|
|
||||||
add_sshkey=""
|
add_sshkey=""
|
||||||
if [ -n "$pub_key" ]
|
if [ -n "$pub_key" ]
|
||||||
|
@ -124,7 +129,9 @@ then
|
||||||
auth_value="$pub_key"
|
auth_value="$pub_key"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ynh_print_OFF
|
||||||
$final_path/chroot_manager.sh adduser --name $ssh_user $auth_opt "$auth_value" --directory "$user_dir" --quota $size
|
$final_path/chroot_manager.sh adduser --name $ssh_user $auth_opt "$auth_value" --directory "$user_dir" --quota $size
|
||||||
|
ynh_print_ON
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A LINK TO CHROOT_MANAGER
|
# ADD A LINK TO CHROOT_MANAGER
|
||||||
|
|
Loading…
Add table
Reference in a new issue