Skip to content

Commit

Permalink
#431 ssh pm configurable startup test (#432)
Browse files Browse the repository at this point in the history
* Fixes 431 by offering configurable startup host for testing SSH probe

* Documentation enhancement for #431

* CHANGES update for #431 #432

* Update SSH.pm

add missing ,

---------

Co-authored-by: Ryan Rawdon <[email protected]>
Co-authored-by: Tobias Oetiker <[email protected]>
  • Loading branch information
3 people authored Feb 5, 2025
1 parent b6cc486 commit 1e59dad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Enhancements to SSH.pm probe for #431, allowing configurable start-up test host and doc improvements
- fix error when toggling autorefresh @jlu5
- Support parsing IPv6 output in OpenSSHJunOSPing Plugin @zimage
- Enhancement to SSHProbe allows specification of IPv4 vs IPv6 transport, #385
Expand Down
16 changes: 12 additions & 4 deletions lib/Smokeping/probes/SSH.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ The Probe asks the given host n-times for it's public key, where n is
the amount specified in the config File.
As part of the initialization, the probe asks 127.0.0.1 for it's public key
and tries to parse the output. Make sure you have SSH running on the
localhost as well.
and tries to parse the output. This is to ensure that the specified ssh-keyscan
binary provides output in the expected formatm before relying on it.Make sure
you have SSH running on the localhost as well, or specify an alternative
init_host target to test against, that is expected to be available during any
smokeping restart.
DOC
authors => <<'DOC',
Christian Recktenwald <[email protected]>
Expand All @@ -55,7 +58,7 @@ sub new($$$)
# no need for this if we run as a cgi
unless ( $ENV{SERVER_SOFTWARE} ) {

my $call = "$self->{properties}{binary} -t dsa,rsa,ecdsa 127.0.0.1";
my $call = "$self->{properties}{binary} -t dsa,rsa,ecdsa $self->{properties}{init_host}";
my $return = `$call 2>&1`;
if ($return =~ m/$ssh_re/s){
print "### parsing ssh-keyscan output...OK\n";
Expand Down Expand Up @@ -135,7 +138,12 @@ sub probevars {
-x $val or return "ERROR: binary '$val' is not executable";
return undef;
},
},
},
init_host => {
_doc => "Host to use for initialization, defaults to IPv4 localhost of 127.0.0.1",
_example => '127.0.0.1',
_default => '127.0.0.1',
}
})
}

Expand Down

0 comments on commit 1e59dad

Please sign in to comment.