Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ssh-tools for openSUSE:Factory checked in at 2021-11-02 19:18:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ssh-tools (Old) and /work/SRC/openSUSE:Factory/.ssh-tools.new.1890 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ssh-tools" Tue Nov 2 19:18:58 2021 rev:2 rq:928730 version:1.7 Changes: -------- --- /work/SRC/openSUSE:Factory/ssh-tools/ssh-tools.changes 2020-02-05 19:43:39.555323621 +0100 +++ /work/SRC/openSUSE:Factory/.ssh-tools.new.1890/ssh-tools.changes 2021-11-02 19:19:33.375101986 +0100 @@ -1,0 +2,13 @@ +Tue Nov 2 07:20:09 UTC 2021 - Martin Hauke <[email protected]> + +- Update to version 1.7 + * 'ssh-force-password': Enforces password authentication + * ssh-ping + + Option (-C) to connect/reconnect as soon as the host responds + + Exit Codes + - 1: More than 1 request lost + - 2: All requests lost + + Environment Variable + - SSH_PING_NO_COLORS: if set, no colors are shown (like -n) + +------------------------------------------------------------------- Old: ---- ssh-tools-1.6.tar.gz New: ---- ssh-tools-1.7.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ssh-tools.spec ++++++ --- /var/tmp/diff_new_pack.r1Um8i/_old 2021-11-02 19:19:33.803102314 +0100 +++ /var/tmp/diff_new_pack.r1Um8i/_new 2021-11-02 19:19:33.807102317 +0100 @@ -1,6 +1,7 @@ # # spec file for package ssh-tools # +# Copyright (c) 2021 SUSE LLC # Copyright (c) 2020, Martin Hauke <[email protected]> # # All modifications and additions to the file contributed by third parties @@ -12,12 +13,12 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: ssh-tools -Version: 1.6 +Version: 1.7 Release: 0 Summary: A collection of various tools using ssh License: GPL-3.0-or-later ++++++ ssh-tools-1.6.tar.gz -> ssh-tools-1.7.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssh-tools-1.6/CHANGELOG.md new/ssh-tools-1.7/CHANGELOG.md --- old/ssh-tools-1.6/CHANGELOG.md 2020-01-23 22:14:47.000000000 +0100 +++ new/ssh-tools-1.7/CHANGELOG.md 2021-10-31 17:55:29.000000000 +0100 @@ -1,3 +1,16 @@ +# 1.7 (2021-10-31) + +## Added + +- **ssh-force-password**: Enforces password authentication +- ssh-ping + - Option (-C) to connect/reconnect as soon as the host responds + - Exit Codes + - 1: More than 1 request lost + - 2: All requests lost + - Environment Variable + - SSH_PING_NO_COLORS: if set, no colors are shown (like -n) + # 1.6 (2020-01-23) ## Added diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssh-tools-1.6/ssh-force-password new/ssh-tools-1.7/ssh-force-password --- old/ssh-tools-1.6/ssh-force-password 1970-01-01 01:00:00.000000000 +0100 +++ new/ssh-tools-1.7/ssh-force-password 2021-10-31 17:55:29.000000000 +0100 @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +# +---------------------------------------------------------------------------------------------------------------+ +# | Title : ssh-force-password | +# | | +# | Description : Enforces password authentication (as long as the server allows it) | +# | It became quite annoying googling the SSH options for this every time | +# | | +# | Author : Sven Wick <[email protected]> | +# | URL : https://github.com/vaporup/ssh-tools | +# | | +# | Based On : https://www.cyberciti.biz/faq/howto-force-ssh-client-login-to-use-only-password-authentication | +# +---------------------------------------------------------------------------------------------------------------+ + +# shellcheck disable=SC2029 + +ssh_opts=( + -o "PreferredAuthentications=password" + -o "PubkeyAuthentication=no" +) + +# +# Usage/Help message +# + +function usage() { + +cat << EOF + + Usage: ${0##*/} [DEFAULT SSH OPTIONS] hostname + + Enforces password authentication (for password testing) + +EOF + +} + +if [[ -z $1 || $1 == "--help" ]]; then + usage + exit 1 +fi + +ssh "${ssh_opts[@]}" "$@" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssh-tools-1.6/ssh-ping new/ssh-tools-1.7/ssh-ping --- old/ssh-tools-1.6/ssh-ping 2020-01-23 22:14:47.000000000 +0100 +++ new/ssh-tools-1.7/ssh-ping 2021-10-31 17:55:29.000000000 +0100 @@ -78,6 +78,11 @@ -4 Use IPv4 only -6 Use IPv6 only -c count Stop after sending <count> request packets + -C Connect as soon as the host responds + and try reconnecting after a SSH session ends (e.g. rebooting). + Useful also for IDRAC, IPMI, ILO devices, Switches, etc... + which don't have a full shell environment. + CTRL+C stops reconnect attempts. -F configfile Specifies an alternative per-user configuration file. If a configuration file is given on the command line, the system-wide configuration file ( /etc/ssh/ssh_config ) will be ignored. @@ -85,7 +90,7 @@ -h Show this message -i interval Wait <interval> seconds between sending each request. The default is 1 second. - -l user Try login with <user> as username. The default is \$USER. + -l user Try login with <user> as username. The default is \$USER (${USER}). -D Print timestamp (unix time + microseconds as in gettimeofday) before each line -H Print timestamp (human readable) before each line -W timeout Time to wait for a response, in seconds @@ -93,8 +98,25 @@ This can be specified on a per-host basis in the configuration file. -q Quiet output. Nothing is displayed except the summary lines at startup time and when finished + -n No colors. + (e.g. for black on white terminals) -v Verbose output + ENVIRONMENT_VARIABLES: + + SSH_PING_NO_COLORS if set, no colors are shown (like -n) + + Example: SSH_PING_NO_COLORS=true ${0##*/} -c 1 hostname + + EXIT_CODES: + + 0 No requests lost + 1 More than 1 request lost + 2 All requests lost + + Example: ${0##*/} -q -c 1 hostname >/dev/null || ... + + EOF } @@ -115,7 +137,7 @@ if [[ "${print_timestamp_human_readable}" == "yes" ]]; then date else - if [[ "${OSTYPE}" == "linux-gnu" ]]; then + if [[ "${OSTYPE}" == "linux-gnu" ]] && command_exists date; then date +%s.%6N else command_exists perl && perl -MTime::HiRes=time -e 'printf "%.6f", time' @@ -126,7 +148,7 @@ function get_request_timestamp() { - if [[ "${OSTYPE}" == "linux-gnu" ]]; then + if [[ "${OSTYPE}" == "linux-gnu" ]] && command_exists date; then date +%s%3N else command_exists perl && perl -MTime::HiRes=time -e 'printf "%i", time * 1000' @@ -155,8 +177,8 @@ statistics_crit+="${RED}${requests_received}${RESET} ${WHITE}requests received${RESET}, " statistics_crit+="${RED}${requests_loss}%${RESET} ${WHITE}request loss${RESET}" - [[ ${requests_loss} -eq 100 ]] && echo -e "${statistics_crit}" && exit - [[ ${requests_loss} -gt 1 ]] && echo -e "${statistics_warn}" && exit + [[ ${requests_loss} -eq 100 ]] && echo -e "${statistics_crit}" && exit 2 + [[ ${requests_loss} -gt 1 ]] && echo -e "${statistics_warn}" && exit 1 [[ ${requests_loss} -eq 0 ]] && echo -e "${statistics_ok}" && exit } @@ -166,7 +188,7 @@ # # shellcheck disable=SC2249 -while getopts ":46c:F:hi:l:DHp:vW:q" opt; do +while getopts ":46c:CF:hi:l:DHp:vW:qn" opt; do case ${opt} in 4 ) SSH_FLAGS+=("-4") @@ -177,6 +199,9 @@ c ) [[ ${OPTARG} =~ ^[0-9]+$ ]] && ping_count=${OPTARG} ;; + C ) + connect="yes" + ;; F ) SSH_FLAGS+=("-F") SSH_FLAGS+=("${OPTARG}") @@ -210,6 +235,9 @@ q ) quiet="yes" ;; + n ) + colors="no" + ;; \? ) echo "Invalid option: ${OPTARG}" 1>&2 usage @@ -239,6 +267,24 @@ host=${1} fi +# +# Colors are counter productive +# on black on white terminals +# + +# shellcheck disable=SC2154 +if [[ -n "${SSH_PING_NO_COLORS}" ]]; then + + colors="no" + +fi + +if [[ ${colors} == no ]]; then + + unset -v RED GREEN YELLOW BLUE MAGENTA CYAN WHITE BOLD + +fi + [[ -z "${host}" ]] && { echo -e "\n ${RED}Error: No target host given${RESET}" ; usage; exit 1; } # @@ -279,9 +325,17 @@ start_request=$( get_request_timestamp ) if [[ -z "${username}" ]]; then - status=$(ssh "${SSH_FLAGS[@]}" "${SSH_OPTS[@]}" "${host}" echo pong 2>&1 | grep -oE 'pong|denied|sftp') + if [[ "${connect}" == "yes" ]]; then + status=$(ssh "${SSH_FLAGS[@]}" "${SSH_OPTS[@]}" "sshping@${host}" echo pong 2>&1 | grep -oE 'pong|denied|sftp') + else + status=$(ssh "${SSH_FLAGS[@]}" "${SSH_OPTS[@]}" "${host}" echo pong 2>&1 | grep -oE 'pong|denied|sftp') + fi else - status=$(ssh "${SSH_FLAGS[@]}" "${SSH_OPTS[@]}" "${username}@${host}" echo pong 2>&1 | grep -oE 'pong|denied|sftp') + if [[ "${connect}" == "yes" ]]; then + status=$(ssh "${SSH_FLAGS[@]}" "${SSH_OPTS[@]}" "sshping@${host}" echo pong 2>&1 | grep -oE 'pong|denied|sftp') + else + status=$(ssh "${SSH_FLAGS[@]}" "${SSH_OPTS[@]}" "${username}@${host}" echo pong 2>&1 | grep -oE 'pong|denied|sftp') + fi fi end_request=$( get_request_timestamp ) @@ -307,6 +361,15 @@ requests_transmitted=${ssh_seq} ssh_seq=$(( ssh_seq + 1 )) + if [[ "${connect}" == "yes" ]]; then + if [[ -z "${username}" ]]; then + ssh "${SSH_FLAGS[@]}" -o "BatchMode=no" "${SSH_OPTS[@]}" "${host}" + else + ssh "${SSH_FLAGS[@]}" -o "BatchMode=no" "${SSH_OPTS[@]}" "${username}@${host}" + fi + echo -e "Reconnecting... (Press CTRL+C to abort)" + fi + # # Don't sleep if we do just 1 request # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssh-tools-1.6/ssh-version new/ssh-tools-1.7/ssh-version --- old/ssh-tools-1.6/ssh-version 2020-01-23 22:14:47.000000000 +0100 +++ new/ssh-tools-1.7/ssh-version 2021-10-31 17:55:29.000000000 +0100 @@ -48,5 +48,5 @@ exit 1 fi -SSH_VERSION=$(ssh -vN "${ssh_opts[@]}" "$@" -l ForceLogin2Fail 2>&1 | grep "remote software version") +SSH_VERSION=$(ssh -vN "${ssh_opts[@]}" "$@" -l ssh-version 2>&1 | grep "remote software version") echo "${SSH_VERSION#debug1: }" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ssh-tools-1.6/test.sh new/ssh-tools-1.7/test.sh --- old/ssh-tools-1.6/test.sh 2020-01-23 22:14:47.000000000 +0100 +++ new/ssh-tools-1.7/test.sh 2021-10-31 17:55:29.000000000 +0100 @@ -20,6 +20,7 @@ test_commands+=( "${SCRIPT_PATH}/ssh-hostkeys ${TEST_SSH_SERVER}" ) test_commands+=( "sshpass -e ${SCRIPT_PATH}/ssh-ping -4 -v -c 3 -D ${TEST_SSH_USER}@${TEST_SSH_SERVER}" ) test_commands+=( "sshpass -e ${SCRIPT_PATH}/ssh-ping -4 -v -c 3 -H ${TEST_SSH_USER}@${TEST_SSH_SERVER}" ) +test_commands+=( "SSH_PING_NO_COLORS=true sshpass -e ${SCRIPT_PATH}/ssh-ping -4 -v -c 3 -H ${TEST_SSH_USER}@${TEST_SSH_SERVER}" ) test_commands+=( "${SCRIPT_PATH}/ssh-version ${TEST_SSH_SERVER}" ) for (( i = 0; i < ${#test_commands[@]} ; i++ )); do
