From nobody Thu May 15 03:29:02 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1518055510726344.661097485946; Wed, 7 Feb 2018 18:05:10 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 93E03356C1; Thu, 8 Feb 2018 02:05:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 387185F703; Thu, 8 Feb 2018 02:05:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5263A4A46D; Thu, 8 Feb 2018 02:05:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w18255i1023195 for ; Wed, 7 Feb 2018 21:05:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id DE5D42156A37; Thu, 8 Feb 2018 02:05:05 +0000 (UTC) Received: from tlap.laine.org.com (ovpn-120-186.rdu2.redhat.com [10.10.120.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4C3A2156A32; Thu, 8 Feb 2018 02:05:05 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Wed, 7 Feb 2018 21:04:53 -0500 Message-Id: <20180208020459.16928-4-laine@laine.org> In-Reply-To: <20180208020459.16928-1-laine@laine.org> References: <20180208020459.16928-1-laine@laine.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [tck PATCH 3/9] Use Net::OpenSSH instead of Net::SSH::Perl X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 08 Feb 2018 02:05:10 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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. Reviewed-by: Daniel P. Berrange --- 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 =20 diff --git a/scripts/nwfilter/100-ping-still-working.t b/scripts/nwfilter/1= 00-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 =3D> 4; use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; -use Net::SSH::Perl; =20 use File::Spec::Functions qw(catfile catdir rootdir); =20 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 =3D> 5; use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; -use Net::SSH::Perl; +use Net::OpenSSH; =20 use File::Spec::Functions qw(catfile catdir rootdir); =20 @@ -88,9 +88,10 @@ diag $ping; ok($ping =3D~ "10 received", "ping $guestip test"); =20 # log into guest -my $ssh =3D Net::SSH::Perl->new($guestip); diag "ssh'ing into $guestip"; -$ssh->login("root", $tck->root_password()); +my $ssh =3D Net::OpenSSH->new($guestip, + user =3D> "root", + password =3D> $tck->root_password()); =20 # now bring eth0 down, change MAC and bring it up again diag "fiddling with mac"; @@ -108,26 +109,26 @@ echo "DEV=3D`ip link | head -3 | tail -1 | awk '{prin= t \\\$2}' | sed -e 's/://'` /sbin/ip addr show dev \\\$DEV" > /test.sh EOF diag $cmdfile; -my ($stdout, $stderr, $exit) =3D $ssh->cmd($cmdfile); +my ($stdout, $stderr) =3D $ssh->capture2($cmdfile); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("chmod +x /test.sh"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("chmod +x /test.sh"); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("/test.sh > /test.log"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("/test.sh > /test.log"); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("cat /test.sh"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("cat /test.sh"); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("cat /test.log"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("cat /test.log"); diag $stdout; diag $stderr; -diag $exit; +diag "Exit Code: $?"; ok($stdout =3D~ /100% packet loss|Network is unreachable/, "packet loss ex= pected"); =20 shutdown_vm_gracefully($dom); diff --git a/scripts/nwfilter/220-no-ip-spoofing.t b/scripts/nwfilter/220-n= o-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 =3D> 4; use Sys::Virt::TCK; use Sys::Virt::TCK::NetworkHelpers; use Test::Exception; -use Net::SSH::Perl; +use Net::OpenSSH; =20 use File::Spec::Functions qw(catfile catdir rootdir); =20 @@ -71,9 +71,10 @@ diag $ebtable; ok($ebtable =3D~ "$guestip", "check ebtables entry"); =20 # log into guest -my $ssh =3D Net::SSH::Perl->new($guestip); diag "ssh'ing into $guestip"; -$ssh->login("root", $tck->root_password()); +my $ssh =3D Net::OpenSSH->new($guestip, + user =3D> "root", + password =3D> $tck->root_password()); =20 # now bring eth0 down, change IP and bring it up again diag "preparing ip spoof"; @@ -95,23 +96,23 @@ MASK=3D`ip addr show \\\$DEV | grep 'inet ' | awk '{pri= nt \\\$2}' | sed -e 's/.*\\ /sbin/ip addr show \\\$DEV" > /test.sh EOF diag $cmdfile; -my ($stdout, $stderr, $exit) =3D $ssh->cmd($cmdfile); +my ($stdout, $stderr) =3D $ssh->capture2($cmdfile); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("chmod +x /test.sh"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("chmod +x /test.sh"); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("cat /test.sh"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("cat /test.sh"); diag $stdout; diag $stderr; -diag $exit; +diag "Exit Code: $?"; diag "running ip spoof"; -($stdout, $stderr, $exit) =3D $ssh->cmd("/test.sh"); +($stdout, $stderr) =3D $ssh->capture2("/test.sh"); diag $stdout; diag $stderr; -diag $exit; +diag "Exit Code: $?"; diag "checking result"; ok($stdout =3D~ "100% packet loss", "packet loss expected"); =20 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 =3D> 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); =20 my $tck =3D 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/tcp= dump.log &"); =20 # log into guest -my $ssh =3D Net::SSH::Perl->new($guestip); diag "ssh'ing into $guestip"; -$ssh->login("root", $tck->root_password()); +my $ssh =3D Net::OpenSSH->new($guestip, + user =3D> "root", + password =3D> $tck->root_password()); =20 # now generate a mac broadcast paket=20 diag "generate mac broadcast"; @@ -95,22 +96,22 @@ my $cmdfile =3D < /test.sh EOF diag $cmdfile; -my ($stdout, $stderr, $exit) =3D $ssh->cmd($cmdfile); +my ($stdout, $stderr) =3D $ssh->capture2($cmdfile); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("chmod +x /test.sh"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("chmod +x /test.sh"); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("/test.sh > /test.log"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("/test.sh > /test.log"); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("cat /test.log"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("cat /test.log"); diag $stdout; diag $stderr; -diag $exit; +diag "Exit Code: $?"; =20 # 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 =3D> 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); =20 my $spoofid =3D "192.168.122.183"; @@ -85,9 +85,10 @@ diag "prepare tcpdump"; system("/usr/sbin/tcpdump -v -i virbr0 not ip > /tmp/tcpdump.log &"); =20 # log into guest -my $ssh =3D Net::SSH::Perl->new($guestip); diag "ssh'ing into $guestip"; -$ssh->login("root", $tck->root_password()); +my $ssh =3D Net::OpenSSH->new($guestip, + user =3D> "root", + password =3D> $tck->root_password()); =20 # now generate a arp spoofing packets=20 diag "generate arpspoof"; @@ -100,23 +101,23 @@ EOF diag "content of cmdfile:"; diag $cmdfile; diag "creating cmdfile"; -my ($stdout, $stderr, $exit) =3D $ssh->cmd($cmdfile); +my ($stdout, $stderr) =3D $ssh->capture2($cmdfile); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("chmod +x /test.sh"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("chmod +x /test.sh"); diag $stdout; diag $stderr; -diag $exit; +diag "Exit Code: $?"; diag "excuting cmdfile"; -($stdout, $stderr, $exit) =3D $ssh->cmd("/test.sh > /test.log"); +($stdout, $stderr) =3D $ssh->capture2("/test.sh > /test.log"); diag $stdout; diag $stderr; -diag $exit; -($stdout, $stderr, $exit) =3D $ssh->cmd("echo test.log\ncat /test.log"); +diag "Exit Code: $?"; +($stdout, $stderr) =3D $ssh->capture2("echo test.log\ncat /test.log"); diag $stdout; diag $stderr; -diag $exit; +diag "Exit Code: $?"; =20 # 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); =20 my $tck =3D Sys::Virt::TCK->new(); --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list