@@ -781,7 +781,7 @@ do_status() {
781781 local has_ssh_users=false
782782 if command -v sshtun-user & > /dev/null; then
783783 local user_list
784- user_list=$( sshtun-user list 2> /dev/null || true)
784+ user_list=$( timeout 10 sshtun-user list < /dev/null 2> /dev/null || true)
785785 if [[ -n " $user_list " ]]; then
786786 has_ssh_users=true
787787 echo -e " ${BOLD} SSH Tunnel Users${NC} "
@@ -1676,7 +1676,7 @@ do_manage_users() {
16761676
16771677 # Run initial configure
16781678 print_info " Applying SSH security configuration..."
1679- if sshtun-user configure 2>&1 ; then
1679+ if timeout 30 sshtun-user configure < /dev/null 2>&1 ; then
16801680 print_ok " SSH configuration applied"
16811681 else
16821682 print_warn " SSH configuration may not have applied fully — user management may have issues"
@@ -1704,7 +1704,7 @@ do_manage_users() {
17041704 echo " "
17051705 print_info " SSH tunnel users:"
17061706 echo " "
1707- sshtun-user list 2>&1 || print_warn " No users found or sshtun-user error"
1707+ timeout 10 sshtun-user list 2>&1 || print_warn " No users found or sshtun-user error"
17081708 ;;
17091709 2)
17101710 echo " "
@@ -1727,16 +1727,16 @@ do_manage_users() {
17271727 fi
17281728 echo " "
17291729 if [[ -n " $new_pass " ]]; then
1730- if sshtun-user create " $new_user " --insecure-password " $new_pass " 2>&1 ; then
1730+ if timeout 30 sshtun-user create " $new_user " --insecure-password " $new_pass " 2>&1 ; then
17311731 print_ok " User '${new_user} ' created"
17321732 else
1733- print_fail " Failed to create user '${new_user} '"
1733+ print_fail " Failed to create user '${new_user} ' (command timed out or failed) "
17341734 fi
17351735 else
1736- if sshtun-user create " $new_user " 2>&1 ; then
1737- print_ok " User '${new_user} ' created"
1736+ if timeout 30 sshtun-user create " $new_user " < /dev/null 2>&1 ; then
1737+ print_ok " User '${new_user} ' created (random password assigned) "
17381738 else
1739- print_fail " Failed to create user '${new_user} '"
1739+ print_fail " Failed to create user '${new_user} ' (command timed out or failed) "
17401740 fi
17411741 fi
17421742 ;;
@@ -1764,7 +1764,7 @@ do_manage_users() {
17641764 continue
17651765 fi
17661766 echo " "
1767- if sshtun-user update " $upd_user " --insecure-password " $upd_pass " 2>&1 ; then
1767+ if timeout 30 sshtun-user update " $upd_user " --insecure-password " $upd_pass " 2>&1 ; then
17681768 print_ok " Password updated for '${upd_user} '"
17691769 else
17701770 print_fail " Failed to update user '${upd_user} '"
@@ -1779,7 +1779,7 @@ do_manage_users() {
17791779 continue
17801780 fi
17811781 if prompt_yn " Are you sure you want to delete '${del_user} '?" " n" ; then
1782- if sshtun-user delete " $del_user " 2>&1 ; then
1782+ if timeout 30 sshtun-user delete " $del_user " 2>&1 ; then
17831783 print_ok " User '${del_user} ' deleted"
17841784 else
17851785 print_fail " Failed to delete user '${del_user} '"
@@ -2645,7 +2645,7 @@ step_ssh_user() {
26452645 # Configure SSH (only needed once)
26462646 print_info " Applying SSH security configuration..."
26472647 local configure_output
2648- configure_output=$( sshtun-user configure 2>&1 ) || true
2648+ configure_output=$( timeout 30 sshtun-user configure < /dev/null 2>&1 ) || true
26492649 if echo " $configure_output " | grep -qi " already" ; then
26502650 print_ok " SSH already configured"
26512651 elif echo " $configure_output " | grep -qi " error\|fail" ; then
@@ -2685,7 +2685,7 @@ step_ssh_user() {
26852685
26862686 # Create user
26872687 print_info " Creating SSH tunnel user: ${SSH_USER} ..."
2688- if sshtun-user create " $SSH_USER " --insecure-password " $SSH_PASS " 2>&1 ; then
2688+ if timeout 30 sshtun-user create " $SSH_USER " --insecure-password " $SSH_PASS " < /dev/null 2>&1 ; then
26892689 SSH_SETUP_DONE=true
26902690 print_ok " SSH tunnel user created: ${SSH_USER} "
26912691 else
0 commit comments