server-tokens test added
This commit is contained in:
parent
adc4d2b81b
commit
ba80602fc0
2 changed files with 116 additions and 0 deletions
33
core/server-tokens/main.fmf
Normal file
33
core/server-tokens/main.fmf
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
summary: httpd ServerTokens Full-Release
|
||||
description: |
|
||||
Bug summary: [RFE] Apache does not report patch level when scanned
|
||||
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=240857
|
||||
|
||||
Test for BZ#240857 (httpd ServerTokens Full-Release)
|
||||
contact: Branislav Náter <bnater@redhat.com>
|
||||
component:
|
||||
- httpd
|
||||
test: ./runtest.sh
|
||||
path: /misc/bug240857
|
||||
framework: beakerlib
|
||||
require:
|
||||
- library(httpd/http)
|
||||
recommend:
|
||||
- httpd
|
||||
- curl
|
||||
- grep
|
||||
- pyOpenSSL
|
||||
duration: 5m
|
||||
enabled: true
|
||||
tag:
|
||||
- HttpdSclDone
|
||||
- Tier1
|
||||
tier: '1'
|
||||
link:
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=240857
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=811714
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1932442
|
||||
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=2029071
|
||||
extra-nitrate: TC#0078363
|
||||
extra-summary: /CoreOS/httpd/misc/bug240857
|
||||
extra-task: /CoreOS/httpd/misc/bug240857
|
||||
83
core/server-tokens/runtest.sh
Executable file
83
core/server-tokens/runtest.sh
Executable file
|
|
@ -0,0 +1,83 @@
|
|||
#!/bin/bash
|
||||
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# runtest.sh of /CoreOS/httpd/misc/bug240857
|
||||
# Description: Test for BZ#240857 (httpd ServerTokens Full-Release)
|
||||
# Author: Joe Orton <jorton@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2007 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing
|
||||
# to use, modify, copy, or redistribute it subject to the terms
|
||||
# and conditions of the GNU General Public License version 2.
|
||||
#
|
||||
# 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, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
# Include Beaker environment
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
PACKAGES="${PACKAGES:-httpd}"
|
||||
REQUIRES="${REQUIRES:-curl}"
|
||||
|
||||
rlJournalStart
|
||||
rlPhaseStartSetup "Setup #1"
|
||||
rlRun "rlImport httpd/http" 0 "Import httpd library"
|
||||
rlAssertRpm --all
|
||||
CONF="${httpCONFDIR}/conf/httpd.conf"
|
||||
VERSION=`rpm -q --qf '%{VERSION}' $httpHTTPD`
|
||||
RELEASE=`rpm -q --qf '%{RELEASE}' $httpHTTPD`
|
||||
rlIsFedora && OS="Fedora"
|
||||
rlIsCentOS && OS="CentOS"
|
||||
rlIsRHEL && OS="Red Hat Enterprise Linux"
|
||||
rlRun "rlFileBackup $CONF"
|
||||
# Full-Release not present in Fedora
|
||||
if ! rlIsFedora; then
|
||||
grep ServerTokens $CONF || rlRun "echo 'ServerTokens Full-Release' >> $CONF"
|
||||
else
|
||||
rlRun "sed -i 's/^ServerTokens.*/ServerTokens Full-Release/' $CONF"
|
||||
fi
|
||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
||||
rlRun "pushd $TmpDir"
|
||||
rlRun "httpStart" 0 "Start httpd"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Test #1"
|
||||
rlRun "curl -s -D output http://localhost/" 0 "Getting Full Release Tokens"
|
||||
cat output
|
||||
|
||||
rlAssertGrep "^Server: Apache/$VERSION ($OS) (Release $RELEASE)" output
|
||||
rlRun "httpStop" 0 "Stop httpd"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartSetup "Setup #2"
|
||||
rlRun "sed -i 's/^ServerTokens.*/ServerTokens OS/' $CONF"
|
||||
rlRun "httpStart" 0 "Start httpd"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Test #2"
|
||||
rlRun "curl -s -D output http://localhost/" 0 "Getting default headers"
|
||||
cat output
|
||||
rlRun "tr -d '\r' < output | grep \"^Server: Apache/$VERSION ($OS)\$\""
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartCleanup
|
||||
rlRun "popd"
|
||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
||||
rlRun "httpStop" 0 "Stop httpd"
|
||||
rlRun "rlFileRestore"
|
||||
rlPhaseEnd
|
||||
rlJournalPrintText
|
||||
rlJournalEnd
|
||||
Loading…
Add table
Add a link
Reference in a new issue