diff --git a/bin/plugin/open/alive b/bin/plugin/open/alive index 6c3d34e..d78f950 100755 --- a/bin/plugin/open/alive +++ b/bin/plugin/open/alive @@ -57,11 +57,15 @@ push @command, $host; while (1) { $fnret = OVH::Bastion::execute(cmd => \@command, noisy_stdout => 1, noisy_stderr => 1); if ($fnret->err eq 'ERR_EXEC_FAILED') { - osh_exit $fnret if $command[0] eq 'ping'; - @command = qw{ ping -c 1 -w 1 -- }; - push @command, $host; - $isFping = 0; - next; + if ($isFping) { + + # maybe fping doesn't work, fallback to ping + @command = qw{ ping -c 1 -w 1 -- }; + push @command, $host; + $isFping = 0; + next; + } + osh_exit $fnret; # we tried both ping and fping :( } $fnret or osh_exit $fnret; if ($fnret->value->{'sysret'} == 0) { diff --git a/docker/Dockerfile.opensuse15 b/docker/Dockerfile.opensuse15 index 5a80422..4a5c540 100644 --- a/docker/Dockerfile.opensuse15 +++ b/docker/Dockerfile.opensuse15 @@ -5,6 +5,7 @@ LABEL maintainer="stephane.lesimple+bastion@ovhcloud.com" COPY bin/admin/install-ttyrec.sh bin/admin/install-yubico-piv-checker.sh bin/admin/packages-check.sh /opt/bastion/bin/admin/ COPY lib/shell /opt/bastion/lib/shell/ RUN ["/opt/bastion/bin/admin/packages-check.sh","-i","-d","-s"] +RUN ["/usr/bin/chmod","u+s","/usr/bin/ping","/usr/sbin/fping"] RUN ["/opt/bastion/bin/admin/install-ttyrec.sh","-r"] RUN ["/opt/bastion/bin/admin/install-yubico-piv-checker.sh","-r"] diff --git a/tests/functional/tests.d/360-plugins.sh b/tests/functional/tests.d/360-plugins.sh index af5bb5f..e255fae 100644 --- a/tests/functional/tests.d/360-plugins.sh +++ b/tests/functional/tests.d/360-plugins.sh @@ -7,7 +7,7 @@ testsuite_plugins() { - success withHost $a0 --osh ping -w 2 --host 127.0.0.1 -c 2 + success ping_withHost $a0 --osh ping -w 2 --host 127.0.0.1 -c 2 json .command ping .error_code OK # in some tests environments, ping is not allowed... _sysret=$(get_json | $jq .value.sysret) @@ -20,7 +20,7 @@ testsuite_plugins() fi unset _sysret - success withoutHost $a0 --osh ping -c 1 127.0.0.1 -w 1 + success ping_withoutHost $a0 --osh ping -c 1 127.0.0.1 -w 1 json .command ping .error_code OK _sysret=$(get_json | $jq .value.sysret) if [ "$_sysret" = 0 ]; then @@ -32,7 +32,7 @@ testsuite_plugins() fi unset _sysret - success loss $a0 --osh ping 192.0.2.1 -w 1 -c 1 + success ping_loss $a0 --osh ping 192.0.2.1 -w 1 -c 1 json .command ping .error_code OK _sysret=$(get_json | $jq .value.sysret) if [ "$_sysret" = 1 ]; then @@ -44,7 +44,7 @@ testsuite_plugins() fi unset _sysret - success withHost $a0 --osh nc --port 22 --host 127.0.0.1 --timeout 1 + success nc_withHost $a0 --osh nc --port 22 --host 127.0.0.1 --timeout 1 json $(cat <