Net::SSH::Perl is out of date in the Fedora git repos. The version
currently supported in Fedora fails to connect to most modern sshd's,
and updating to the new version would require adding several new perl
packages to Fedora. Instead, this patch switches to using
Net::OpenSSH, whose current version in Fedora works properly *EXCEPT*
that it is missing the line "Requires: perl(IO:TTy)" in its specfiles
(I filed
https://bugzilla.redhat.com/1542666 requesting that fix to be
applied to Fedora git repos. For now, just run "dnf install
perl-IO-Tty" separately)
NB: prior to this patch, Net::SSH::Perl was required, but had no
Required: line in the specfile, so you would have to install it by
hand. If you had done that, you can probably now dnf erase it.
---
perl-Sys-Virt-TCK.spec.PL | 3 ++-
scripts/nwfilter/100-ping-still-working.t | 1 -
scripts/nwfilter/210-no-mac-spoofing.t | 27 ++++++++++++++-------------
scripts/nwfilter/220-no-ip-spoofing.t | 23 ++++++++++++-----------
scripts/nwfilter/230-no-mac-broadcast.t | 23 ++++++++++++-----------
scripts/nwfilter/240-no-arp-spoofing.t | 23 ++++++++++++-----------
scripts/nwfilter/300-vsitype.t | 1 -
7 files changed, 52 insertions(+), 49 deletions(-)
diff --git a/perl-Sys-Virt-TCK.spec.PL b/perl-Sys-Virt-TCK.spec.PL
index 9a10880..4172499 100644
--- a/perl-Sys-Virt-TCK.spec.PL
+++ b/perl-Sys-Virt-TCK.spec.PL
@@ -37,7 +37,7 @@ __DATA__
Summary: Sys::Virt::TCK - libvirt Technology Compatibility Kit
Name: perl-%{appname}
Version: @VERSION@
-Release: 1%{_extra_release}
+Release: 99%{_extra_release}
License: GPLv2
Group: Development/Tools
Source:
http://libvirt.org/sources/tck/%{appname}-v%{version}.tar.gz
@@ -73,6 +73,7 @@ Requires: perl(Test::Exception)
Requires: perl(TAP::Formatter::HTML)
Requires: perl(TAP::Formatter::JUnit)
Requires: perl(TAP::Harness::Archive)
+Requires: perl(Net::OpenSSH)
Requires: /usr/bin/mkisofs
BuildArchitectures: noarch
diff --git a/scripts/nwfilter/100-ping-still-working.t
b/scripts/nwfilter/100-ping-still-working.t
index dc1efd2..5afc6a6 100644
--- a/scripts/nwfilter/100-ping-still-working.t
+++ b/scripts/nwfilter/100-ping-still-working.t
@@ -32,7 +32,6 @@ use Test::More tests => 4;
use Sys::Virt::TCK;
use Sys::Virt::TCK::NetworkHelpers;
use Test::Exception;
-use Net::SSH::Perl;
use File::Spec::Functions qw(catfile catdir rootdir);
diff --git a/scripts/nwfilter/210-no-mac-spoofing.t
b/scripts/nwfilter/210-no-mac-spoofing.t
index 03001a8..eb01d13 100644
--- a/scripts/nwfilter/210-no-mac-spoofing.t
+++ b/scripts/nwfilter/210-no-mac-spoofing.t
@@ -31,7 +31,7 @@ use Test::More tests => 5;
use Sys::Virt::TCK;
use Sys::Virt::TCK::NetworkHelpers;
use Test::Exception;
-use Net::SSH::Perl;
+use Net::OpenSSH;
use File::Spec::Functions qw(catfile catdir rootdir);
@@ -88,9 +88,10 @@ diag $ping;
ok($ping =~ "10 received", "ping $guestip test");
# log into guest
-my $ssh = Net::SSH::Perl->new($guestip);
diag "ssh'ing into $guestip";
-$ssh->login("root", $tck->root_password());
+my $ssh = Net::OpenSSH->new($guestip,
+ user => "root",
+ password => $tck->root_password());
# now bring eth0 down, change MAC and bring it up again
diag "fiddling with mac";
@@ -108,26 +109,26 @@ echo "DEV=`ip link | head -3 | tail -1 | awk '{print
\\\$2}' | sed -e 's/://'`
/sbin/ip addr show dev \\\$DEV" > /test.sh
EOF
diag $cmdfile;
-my ($stdout, $stderr, $exit) = $ssh->cmd($cmdfile);
+my ($stdout, $stderr) = $ssh->capture2($cmdfile);
diag $stdout;
diag $stderr;
-diag $exit;
-($stdout, $stderr, $exit) = $ssh->cmd("chmod +x /test.sh");
+diag "Exit Code: $?";
+($stdout, $stderr) = $ssh->capture2("chmod +x /test.sh");
diag $stdout;
diag $stderr;
-diag $exit;
-($stdout, $stderr, $exit) = $ssh->cmd("/test.sh > /test.log");
+diag "Exit Code: $?";
+($stdout, $stderr) = $ssh->capture2("/test.sh > /test.log");
diag $stdout;
diag $stderr;
-diag $exit;
-($stdout, $stderr, $exit) = $ssh->cmd("cat /test.sh");
+diag "Exit Code: $?";
+($stdout, $stderr) = $ssh->capture2("cat /test.sh");
diag $stdout;
diag $stderr;
-diag $exit;
-($stdout, $stderr, $exit) = $ssh->cmd("cat /test.log");
+diag "Exit Code: $?";
+($stdout, $stderr) = $ssh->capture2("cat /test.log");
diag $stdout;
diag $stderr;
-diag $exit;
+diag "Exit Code: $?";
ok($stdout =~ /100% packet loss|Network is unreachable/, "packet loss
expected");
shutdown_vm_gracefully($dom);
diff --git a/scripts/nwfilter/220-no-ip-spoofing.t
b/scripts/nwfilter/220-no-ip-spoofing.t
index d447a19..872dcc3 100644
--- a/scripts/nwfilter/220-no-ip-spoofing.t
+++ b/scripts/nwfilter/220-no-ip-spoofing.t
@@ -31,7 +31,7 @@ use Test::More tests => 4;
use Sys::Virt::TCK;
use Sys::Virt::TCK::NetworkHelpers;
use Test::Exception;
-use Net::SSH::Perl;
+use Net::OpenSSH;
use File::Spec::Functions qw(catfile catdir rootdir);
@@ -71,9 +71,10 @@ diag $ebtable;
ok($ebtable =~ "$guestip", "check ebtables entry");
# log into guest
-my $ssh = Net::SSH::Perl->new($guestip);
diag "ssh'ing into $guestip";
-$ssh->login("root", $tck->root_password());
+my $ssh = Net::OpenSSH->new($guestip,
+ user => "root",
+ password => $tck->root_password());
# now bring eth0 down, change IP and bring it up again
diag "preparing ip spoof";
@@ -95,23 +96,23 @@ MASK=`ip addr show \\\$DEV | grep 'inet ' | awk '{print
\\\$2}' | sed -e 's/.*\\
/sbin/ip addr show \\\$DEV" > /test.sh
EOF
diag $cmdfile;
-my ($stdout, $stderr, $exit) = $ssh->cmd($cmdfile);
+my ($stdout, $stderr) = $ssh->capture2($cmdfile);
diag $stdout;
diag $stderr;
-diag $exit;
-($stdout, $stderr, $exit) = $ssh->cmd("chmod +x /test.sh");
+diag "Exit Code: $?";
+($stdout, $stderr) = $ssh->capture2("chmod +x /test.sh");
diag $stdout;
diag $stderr;
-diag $exit;
-($stdout, $stderr, $exit) = $ssh->cmd("cat /test.sh");
+diag "Exit Code: $?";
+($stdout, $stderr) = $ssh->capture2("cat /test.sh");
diag $stdout;
diag $stderr;
-diag $exit;
+diag "Exit Code: $?";
diag "running ip spoof";
-($stdout, $stderr, $exit) = $ssh->cmd("/test.sh");
+($stdout, $stderr) = $ssh->capture2("/test.sh");
diag $stdout;
diag $stderr;
-diag $exit;
+diag "Exit Code: $?";
diag "checking result";
ok($stdout =~ "100% packet loss", "packet loss expected");
diff --git a/scripts/nwfilter/230-no-mac-broadcast.t
b/scripts/nwfilter/230-no-mac-broadcast.t
index 9d00dc4..70c1ab4 100644
--- a/scripts/nwfilter/230-no-mac-broadcast.t
+++ b/scripts/nwfilter/230-no-mac-broadcast.t
@@ -31,7 +31,7 @@ use Test::More tests => 4;
use Sys::Virt::TCK;
use Sys::Virt::TCK::NetworkHelpers;
use Test::Exception;
-use Net::SSH::Perl;
+use Net::OpenSSH;
use File::Spec::Functions qw(catfile catdir rootdir);
my $tck = Sys::Virt::TCK->new();
@@ -85,9 +85,10 @@ diag "prepare tcpdump";
system("/usr/sbin/tcpdump -v -i virbr0 -n host 255.255.255.255 2>
/tmp/tcpdump.log &");
# log into guest
-my $ssh = Net::SSH::Perl->new($guestip);
diag "ssh'ing into $guestip";
-$ssh->login("root", $tck->root_password());
+my $ssh = Net::OpenSSH->new($guestip,
+ user => "root",
+ password => $tck->root_password());
# now generate a mac broadcast paket
diag "generate mac broadcast";
@@ -95,22 +96,22 @@ my $cmdfile = <<EOF;
echo '/bin/ping -c 1 192.168.122.255 -b' > /test.sh
EOF
diag $cmdfile;
-my ($stdout, $stderr, $exit) = $ssh->cmd($cmdfile);
+my ($stdout, $stderr) = $ssh->capture2($cmdfile);
diag $stdout;
diag $stderr;
-diag $exit;
-($stdout, $stderr, $exit) = $ssh->cmd("chmod +x /test.sh");
+diag "Exit Code: $?";
+($stdout, $stderr) = $ssh->capture2("chmod +x /test.sh");
diag $stdout;
diag $stderr;
-diag $exit;
-($stdout, $stderr, $exit) = $ssh->cmd("/test.sh > /test.log");
+diag "Exit Code: $?";
+($stdout, $stderr) = $ssh->capture2("/test.sh > /test.log");
diag $stdout;
diag $stderr;
-diag $exit;
-($stdout, $stderr, $exit) = $ssh->cmd("cat /test.log");
+diag "Exit Code: $?";
+($stdout, $stderr) = $ssh->capture2("cat /test.log");
diag $stdout;
diag $stderr;
-diag $exit;
+diag "Exit Code: $?";
# now stop tcpdump and verify result
diag "stopping tcpdump";
diff --git a/scripts/nwfilter/240-no-arp-spoofing.t
b/scripts/nwfilter/240-no-arp-spoofing.t
index f1e6870..141fb92 100644
--- a/scripts/nwfilter/240-no-arp-spoofing.t
+++ b/scripts/nwfilter/240-no-arp-spoofing.t
@@ -31,7 +31,7 @@ use Test::More tests => 4;
use Sys::Virt::TCK;
use Sys::Virt::TCK::NetworkHelpers;
use Test::Exception;
-use Net::SSH::Perl;
+use Net::OpenSSH;
use File::Spec::Functions qw(catfile catdir rootdir);
my $spoofid = "192.168.122.183";
@@ -85,9 +85,10 @@ diag "prepare tcpdump";
system("/usr/sbin/tcpdump -v -i virbr0 not ip > /tmp/tcpdump.log &");
# log into guest
-my $ssh = Net::SSH::Perl->new($guestip);
diag "ssh'ing into $guestip";
-$ssh->login("root", $tck->root_password());
+my $ssh = Net::OpenSSH->new($guestip,
+ user => "root",
+ password => $tck->root_password());
# now generate a arp spoofing packets
diag "generate arpspoof";
@@ -100,23 +101,23 @@ EOF
diag "content of cmdfile:";
diag $cmdfile;
diag "creating cmdfile";
-my ($stdout, $stderr, $exit) = $ssh->cmd($cmdfile);
+my ($stdout, $stderr) = $ssh->capture2($cmdfile);
diag $stdout;
diag $stderr;
-diag $exit;
-($stdout, $stderr, $exit) = $ssh->cmd("chmod +x /test.sh");
+diag "Exit Code: $?";
+($stdout, $stderr) = $ssh->capture2("chmod +x /test.sh");
diag $stdout;
diag $stderr;
-diag $exit;
+diag "Exit Code: $?";
diag "excuting cmdfile";
-($stdout, $stderr, $exit) = $ssh->cmd("/test.sh > /test.log");
+($stdout, $stderr) = $ssh->capture2("/test.sh > /test.log");
diag $stdout;
diag $stderr;
-diag $exit;
-($stdout, $stderr, $exit) = $ssh->cmd("echo test.log\ncat /test.log");
+diag "Exit Code: $?";
+($stdout, $stderr) = $ssh->capture2("echo test.log\ncat /test.log");
diag $stdout;
diag $stderr;
-diag $exit;
+diag "Exit Code: $?";
# now stop tcpdump and verify result
diag "stopping tcpdump";
diff --git a/scripts/nwfilter/300-vsitype.t b/scripts/nwfilter/300-vsitype.t
index 430618f..d169339 100644
--- a/scripts/nwfilter/300-vsitype.t
+++ b/scripts/nwfilter/300-vsitype.t
@@ -31,7 +31,6 @@ use Test::More;
use Sys::Virt::TCK;
use Sys::Virt::TCK::NetworkHelpers;
use Test::Exception;
-use Net::SSH::Perl;
use File::Spec::Functions qw(catfile catdir rootdir);
my $tck = Sys::Virt::TCK->new();
--
2.13.6