Skip to content

Commit 01edc68

Browse files
committed
Add a new test ftp-proxy
Test if FTP installation with `inst.proxy` works as expected. To be able to support this we need to allow more ports in the squid.
1 parent 15331c6 commit 01edc68

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

ftp-proxy.ks.in

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#test name: basic-ftp
2+
url --url=@KSTEST_FTP_URL@
3+
network --bootproto=dhcp
4+
5+
bootloader --timeout=1
6+
zerombr
7+
clearpart --all
8+
autopart
9+
10+
keyboard us
11+
lang en
12+
timezone America/New_York
13+
rootpw qweqwe
14+
shutdown
15+
16+
%packages
17+
%end
18+
19+
%post
20+
# If we made it post, that's good enough
21+
echo SUCCESS > /root/RESULT
22+
%end

ftp-proxy.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (C) 2015 Red Hat, Inc.
4+
#
5+
# This copyrighted material is made available to anyone wishing to use,
6+
# modify, copy, or redistribute it subject to the terms and conditions of
7+
# the GNU General Public License v.2, or (at your option) any later version.
8+
# This program is distributed in the hope that it will be useful, but WITHOUT
9+
# ANY WARRANTY expressed or implied, including the implied warranties of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11+
# Public License for more details. You should have received a copy of the
12+
# GNU General Public License along with this program; if not, write to the
13+
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
14+
# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
15+
# source code or documentation are not subject to the GNU General Public
16+
# License and may only be used or replicated with the express permission of
17+
# Red Hat, Inc.
18+
19+
# Ignore unused variable parsed out by tooling scripts as test tags metadata
20+
# shellcheck disable=SC2034
21+
TESTTYPE="method ftp proxy"
22+
23+
. ${KSTESTDIR}/functions.sh
24+
25+
kernel_args() {
26+
proxy_url="$(cat ${tmpdir}/proxy_url)"
27+
echo ${DEFAULT_BOOTOPTS} inst.proxy=${proxy_url}
28+
}
29+
30+
prepare() {
31+
ks=$1
32+
tmpdir=$2
33+
34+
# Start a proxy server
35+
start_proxy ${tmpdir}/proxy
36+
37+
cp ${ks} ${tmpdir}/kickstart.ks
38+
echo ${tmpdir}/kickstart.ks
39+
}
40+
41+
validate() {
42+
tmpdir=$1
43+
validate_RESULT $tmpdir
44+
if [ ! -f $tmpdir/RESULT ]; then
45+
return 1
46+
fi
47+
48+
grep -q "$KSTEST_FTP_URL" $tmpdir/proxy/access.log
49+
if [[ $? -ne 0 ]]; then
50+
echo 'FTP URL server request was not proxied' >> $tmpdir/RESULT
51+
fi
52+
53+
# check for .treeinfo request
54+
grep -q '\.treeinfo[[:space:]]' $tmpdir/proxy/access.log
55+
if [[ $? -ne 0 ]]; then
56+
echo '.treeinfo request to repository server was not proxied' >> $tmpdir/RESULT
57+
fi
58+
59+
check_result_file "$tmpdir"
60+
}

scripts/confs/squid.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ acl localnet src 192.168.0.0/16 # RFC 1918 local private network (LAN)
1616
acl Safe_ports port 80 # http
1717
acl Safe_ports port 443 # https
1818
acl Safe_ports port 40000-41000 # our_http
19+
acl Safe_ports port 20 # ftp
20+
acl Safe_ports port 21 # ftp
1921
acl CONNECT method CONNECT
2022

2123
#

0 commit comments

Comments
 (0)