diff --git a/Regression/bz1367415-RFE-telnet-add-option-to-specify-IPv6-or-IPv4/main.fmf b/Regression/bz1367415-RFE-telnet-add-option-to-specify-IPv6-or-IPv4/main.fmf new file mode 100644 index 0000000..6a60826 --- /dev/null +++ b/Regression/bz1367415-RFE-telnet-add-option-to-specify-IPv6-or-IPv4/main.fmf @@ -0,0 +1,25 @@ +summary: Test for BZ#1367415 ([RFE] telnet add option to specify IPv6 or IPv4) +description: | + Bug summary: [RFE] telnet: add option to specify IPv6 or IPv4 explicitly + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1367415 +contact: fhrdina@redhat.com +component: + - telnet +test: ./runtest.sh +framework: beakerlib +recommend: + - telnet +duration: 5m +enabled: true +tag: + - Tier1 +tier: '1' +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1367415 +adjust: + - enabled: false + when: distro < rhel-7 + continue: false +extra-nitrate: TC#0552016 +extra-summary: /CoreOS/telnet/Regression/bz1367415-RFE-telnet-add-option-to-specify-IPv6-or-IPv4 +extra-task: /CoreOS/telnet/Regression/bz1367415-RFE-telnet-add-option-to-specify-IPv6-or-IPv4 diff --git a/Regression/bz1367415-RFE-telnet-add-option-to-specify-IPv6-or-IPv4/runtest.sh b/Regression/bz1367415-RFE-telnet-add-option-to-specify-IPv6-or-IPv4/runtest.sh new file mode 100755 index 0000000..47d7ebb --- /dev/null +++ b/Regression/bz1367415-RFE-telnet-add-option-to-specify-IPv6-or-IPv4/runtest.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/telnet/Regression/bz1367415-RFE-telnet-add-option-to-specify-IPv6-or-IPv4 +# Description: Test for BZ#1367415 ([RFE] telnet add option to specify IPv6 or IPv4) +# Author: Karel Volny +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="telnet" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + rlRun -s "telnet localhost 3" 1 "Trying to connect to localhost without specifying protocol" + rlLogInfo "telnet should try both protocols (as default distro config resolves localhost both for IPv4 and IPv6)" + rlAssertGrep "::1" $rlRun_LOG + rlAssertGrep "127.0.0.1" $rlRun_LOG + rm $rlRun_LOG + + rlRun -s "telnet -6 localhost 3" 1 "Trying to connect to localhost with IPv6 explicitly" + rlLogInfo "telnet should try just IPv6" + rlAssertGrep "::1" $rlRun_LOG + rlAssertNotGrep "127.0.0.1" $rlRun_LOG + rm $rlRun_LOG + + rlRun -s "telnet -4 localhost 3" 1 "Trying to connect to localhost with IPv4 explicitly" + rlLogInfo "telnet should try just IPv4" + rlAssertNotGrep "::1" $rlRun_LOG + rlAssertGrep "127.0.0.1" $rlRun_LOG + rm $rlRun_LOG + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/Regression/telnet-is-logging-hostname-in-utmp-not-IP/main.fmf b/Regression/telnet-is-logging-hostname-in-utmp-not-IP/main.fmf new file mode 100644 index 0000000..cb651f8 --- /dev/null +++ b/Regression/telnet-is-logging-hostname-in-utmp-not-IP/main.fmf @@ -0,0 +1,31 @@ +summary: Test for BZ#1323094 ([RFE] telnet is logging hostname in utmp not IP) +description: | + Bug summary: [RFE] telnet is logging hostname in utmp not IP address. + Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1323094 +contact: fhrdina@redhat.com +component: + - telnet +test: ./runtest.sh +framework: beakerlib +recommend: + - telnet + - telnet-server + - expect +duration: 15m +enabled: true +tag: + - Tier1 +tier: '1' +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1323094 + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1637085 +adjust: + - enabled: false + when: distro < rhel-7 + continue: false + - enabled: false + when: arch != x86_64 + continue: false +extra-nitrate: TC#0533310 +extra-summary: /CoreOS/telnet/Regression/telnet-is-logging-hostname-in-utmp-not-IP +extra-task: /CoreOS/telnet/Regression/telnet-is-logging-hostname-in-utmp-not-IP diff --git a/Regression/telnet-is-logging-hostname-in-utmp-not-IP/runtest.sh b/Regression/telnet-is-logging-hostname-in-utmp-not-IP/runtest.sh new file mode 100755 index 0000000..79fe2a4 --- /dev/null +++ b/Regression/telnet-is-logging-hostname-in-utmp-not-IP/runtest.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/telnet/Regression/telnet-is-logging-hostname-in-utmp-not-IP +# Description: Test for BZ#1323094 ([RFE] telnet is logging hostname in utmp not IP) +# Author: Andrej Dzilsky +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2016 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="telnet" +LOGIN_xyzyxz="telnet-test" +PASSWORD_xyzyxz="test" + +rlJournalStart + + ########## SETUP PHASE ########## + rlPhaseStartSetup + rlAssertRequired + rlFileBackup --clean --no-missing-ok "/etc/systemd/system" `readlink -f /etc/systemd/system` + + rlRun "useradd -m $LOGIN_xyzyxz" + rlRun "echo -n $PASSWORD_xyzyxz | passwd --stdin $LOGIN_xyzyxz" + + rlRun "systemctl daemon-reload" + rlRun "systemctl stop telnet.socket" + rlPhaseEnd + + ########## SETUP PHASE ########## + rlPhaseStartSetup "Start telnet service" + rlRun "cp /usr/lib/systemd/system/telnet\@.service /etc/systemd/system/" + rlRun "cp /usr/lib/systemd/system/telnet.socket /etc/systemd/system/" + rlRun "sed -i 's;\\(ExecStart=-/usr/sbin/in.telnetd\\);\\1 -i;' /etc/systemd/system/telnet\@.service" + #debug + rlLog "########### cat /etc/systemd/system/telnet.socket" + cat /usr/lib/systemd/system/telnet.socket + rlLog "########### cat /etc/systemd/system/telnet\@.service" + cat /usr/lib/systemd/system/telnet\@.service + rlRun "systemctl --no-pager start telnet.socket" + sleep 20 + #debug + systemctl --no-pagerstatus telnet.socket + rlPhaseEnd + + #################### REBUILD/TEST PHASE #################### + rlPhaseStartTest "Connect and get information from UTMP" + rlRun -s "expect telnet.expect $LOGIN_xyzyxz $PASSWORD_xyzyxz" + rlAssertGrep "127.0.0.1" $rlRun_LOG -x + rlPhaseEnd + + ########## CLEANUP PHASE ########## + rlPhaseStartCleanup + rlRun "systemctl stop telnet.socket" + rlFileRestore + rlRun "userdel -fr telnet-test" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/Regression/telnet-is-logging-hostname-in-utmp-not-IP/telnet.expect b/Regression/telnet-is-logging-hostname-in-utmp-not-IP/telnet.expect new file mode 100644 index 0000000..342f0c4 --- /dev/null +++ b/Regression/telnet-is-logging-hostname-in-utmp-not-IP/telnet.expect @@ -0,0 +1,24 @@ +#!/usr/bin/expect -d + +log_user 0 +exp_internal -f dbg 1 + +set timeout 30 +set login [lindex $argv 0] +set password [lindex $argv 1] + +spawn telnet -d 127.0.0.1 +expect "Escape character is '^]'." +sleep 5 +send -- "$login\r" +expect "Password:" +sleep 5 +send -- "$password\r" +expect "telnet-test" +log_user 1 +#send -- "w | grep \"telnet-t\" | grep -o \"::1\"\r" +spawn utmpdump /var/run/utmp +sleep 5 +send "utmpdump /var/run/utmp | grep \"telnet-test\" | cut -d'\\\[' -f7 | grep -o '127.0.0.1'\r" +expect "127.0.0.1" +puts $expect_out(0,string)