tests: replaced explicit ports with random assignment

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
This commit is contained in:
Nikos Mavrogiannopoulos
2020-08-09 12:05:51 +02:00
parent f814cf851b
commit b2c0c6c1cf
99 changed files with 243 additions and 162 deletions

View File

@@ -21,13 +21,14 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
builddir=${builddir:-.}
PORT=4358
VPNNET=172.23.115.0/24
TMPFILE=ios.$$.tmp
VERBOSE=1
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing environment under apple ios client"
function finish {

View File

@@ -23,12 +23,13 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4173
TMPFILE=ocserv-plbanner.$$.tmp
PIDFILE=ocserv-pid.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
function finish {
set +e
echo " * Cleaning up..."

View File

@@ -23,7 +23,6 @@
OCCTL="${OCCTL:-../src/occtl/occtl}"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4574
PIDFILE=ocserv-pid.$$.tmp
CLIPID=oc-pid.$$.tmp
PATH=${PATH}:/usr/sbin
@@ -32,6 +31,8 @@ OUTFILE=traffic.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
if test -z "${IP}";then
echo "no IP tool is present"
exit 77

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Copyright (C) 2011-2013 Free Software Foundation, Inc.
# Copyright 2013 Nikos Mavrogiannopoulos

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4513
udp-port = 4513
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4425
udp-port = 4425
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4502
udp-port = 4502
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4498
udp-port = 4498
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4499
udp-port = 4499
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -30,8 +30,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4444
udp-port = 4444
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4456
udp-port = 4456
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4456
udp-port = 4456
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 8446
udp-port = 8446
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -35,8 +35,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 6550
udp-port = 6550
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 6552
udp-port = 6552
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4449
udp-port = 4449
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -29,8 +29,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4438
udp-port = 4438
tcp-port = @PORT@
udp-port = @PORT@
#listen-clear-file = ./ocserv-gssapi-conn.socket

View File

@@ -29,8 +29,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4439
udp-port = 4439
tcp-port = @PORT@
udp-port = @PORT@
#listen-clear-file = ./ocserv-gssapi-conn.socket

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4449
udp-port = 4449
tcp-port = @PORT@
udp-port = @PORT@
#listen-clear-file = ./ocserv-gssapi-conn.socket

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4501
udp-port = 4501
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4479
udp-port = 4479
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4489
udp-port = 4489
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -30,8 +30,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 6552
udp-port = 6552
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -29,8 +29,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 6552
udp-port = 6552
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 8445
udp-port = 8445
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 4
# TCP and UDP port number
tcp-port = 4448
udp-port = 4448
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -30,8 +30,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4444
udp-port = 4444
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 443
udp-port = 443
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4473
udp-port = 4473
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ rate-limit-ms = 0
max-same-clients = 5
# TCP and UDP port number
tcp-port = 4450
udp-port = 4450
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4445
udp-port = 4445
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4512
udp-port = 4512
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -35,8 +35,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 6555
udp-port = 6555
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -35,8 +35,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 6551
udp-port = 6551
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -30,8 +30,8 @@ max-ban-score = 0
max-same-clients = 2
# TCP and UDP port number
tcp-port = 443
udp-port = 443
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -28,8 +28,8 @@ max-clients = 16
max-same-clients = 2
# TCP and UDP port number
tcp-port = 4446
udp-port = 4446
tcp-port = @PORT@
udp-port = @PORT@
# Keepalive in seconds
keepalive = 32400

View File

@@ -27,7 +27,6 @@
OCCTL="${OCCTL:-../src/occtl/occtl}"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4477
TMPFILE=ocfile.$$.tmp
PIDFILE=ocserv-pid.$$.tmp
CLIPID=oc-pid.$$.tmp
@@ -35,6 +34,8 @@ OCCTL_SOCKET=./occtl-$$.socket
. `dirname $0`/common.sh
eval "${GETPORT}"
if test "$(id -u)" != "0";then
echo "This test must be run as root"
exit 77

View File

@@ -25,7 +25,6 @@
OCCTL="${OCCTL:-../src/occtl/occtl}"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4459
TMPFILE=ocfile.$$.tmp
PIDFILE=ocserv-pid.$$.tmp
CLIPID=oc-pid.$$.tmp
@@ -33,6 +32,8 @@ OCCTL_SOCKET=./occtl-$$.socket
. `dirname $0`/common.sh
eval "${GETPORT}"
if test "$(id -u)" != "0";then
echo "This test must be run as root"
exit 77

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Copyright (C) 2020 Microsoft Corp.
#
@@ -21,11 +21,12 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4504
PIDFILE=ocserv-pid.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing flow control... "
update_config test1.config

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Copyright (C) 2013 Nikos Mavrogiannopoulos
#
@@ -21,8 +21,6 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4466
HAPORT=4467
PIDFILE=ocserv-pid.$$.tmp
PATH=${PATH}:/usr/sbin
HACONFIG=haproxy.conf.$$.tmp
@@ -30,6 +28,11 @@ HAPROXY=$(which haproxy)
. `dirname $0`/common.sh
eval "${GETPORT}"
HAPORT=${PORT}
eval "${GETPORT}"
if test -z "${HAPROXY}";then
echo "no haproxy present"
exit 77

View File

@@ -20,8 +20,6 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4566
HAPORT=4567
PIDFILE=ocserv-pid.$$.tmp
CLIPID=oc-pid.$$.tmp
HACONFIG=haproxy.conf.$$.tmp
@@ -31,6 +29,11 @@ IP=$(which ip)
. `dirname $0`/common.sh
eval "${GETPORT}"
HAPORT=${PORT}
eval "${GETPORT}"
if test -z "${HAPROXY}";then
echo "no haproxy present"
exit 77

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Copyright (C) 2013 Nikos Mavrogiannopoulos
#
@@ -21,11 +21,12 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PIDFILE=ocserv-pid.$$.tmp
PORT=3492
NO_NEED_ROOT=1
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing whether invalid configurations fail as expected... "
# plain + pam (primary)

View File

@@ -20,13 +20,14 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4313
PIDFILE=ocserv-pid.$$.tmp
CLIPID=oc-pid.$$.tmp
IP=$(which ip)
. `dirname $0`/common.sh
eval "${GETPORT}"
if test -z "${IP}";then
echo "no IP tool is present"
exit 77

View File

@@ -21,7 +21,6 @@
OCCTL="${OCCTL:-../src/occtl/occtl}"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4568
PIDFILE=ocserv-pid.$$.tmp
CLIPID=oc-pid.$$.tmp
PATH=${PATH}:/usr/sbin
@@ -30,6 +29,8 @@ OUTFILE=json.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
if test -z "${IP}";then
echo "no IP tool is present"
exit 77

View File

@@ -23,13 +23,14 @@
OCCTL="${OCCTL:-../src/occtl/occtl}"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=443
PIDFILE=ocserv-pid.$$.tmp
KRB5PIDFILE=krb5-pid.$$.tmp
CLIPID=oc-pid.$$.tmp
PATH=${PATH}:/usr/sbin
IP=$(which ip)
OUTFILE=traffic.$$.tmp
# This port needs to be fixed to 443 due to KKDCP
PORT=443
USERNAME=krb5user
USERPASS=krb5user123

View File

@@ -23,7 +23,6 @@
OCCTL="${OCCTL:-../src/occtl/occtl}"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4568
PIDFILE=ocserv-pid.$$.tmp
CLIPID=oc-pid.$$.tmp
PATH=${PATH}:/usr/sbin
@@ -32,6 +31,8 @@ OUTFILE=traffic.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
if test -z "${IP}";then
echo "no IP tool is present"
exit 77

View File

@@ -23,7 +23,6 @@
OCCTL="${OCCTL:-../src/occtl/occtl}"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4568
PIDFILE=ocserv-pid.$$.tmp
CLIPID=oc-pid.$$.tmp
PATH=${PATH}:/usr/sbin
@@ -32,6 +31,8 @@ OUTFILE=traffic.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
if test -z "${IP}";then
echo "no IP tool is present"
exit 77

View File

@@ -20,19 +20,21 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4513
# Test whether more than 128 routes can be read from a config file.
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing ocserv and user route application... "
TMPFILE1=multiple-routes.$$.tmp
rm -f ${TMPFILE1}
launch_simple_server -d 1 -f -c "${srcdir}/data/multiple-routes.config"
update_config multiple-routes.config
launch_simple_server -d 1 -f -c "${CONFIG}"
PID=$!
wait_server $PID
@@ -57,7 +59,7 @@ fi
echo ok
rm -f ${TMPFILE1}
rm -f ${TMPFILE1} ${CONFIG}
kill $PID
wait

View File

@@ -20,11 +20,12 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=5743
TMPFILE=$(mktemp)
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing whether exclude routes are being sent (with route=default)... "
function finish {

View File

@@ -20,11 +20,12 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=5744
TMPFILE=$(mktemp)
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing whether group exclude routes are being sent (with route=default)... "
function finish {

View File

@@ -23,7 +23,6 @@
OCCTL="${OCCTL:-../src/occtl/occtl}"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4569
PIDFILE=ocserv-pid.$$.tmp
CLIPID=oc-pid.$$.tmp
PATH=${PATH}:/usr/sbin
@@ -38,6 +37,8 @@ fi
. `dirname $0`/common.sh
eval "${GETPORT}"
if test -z "${IP}";then
echo "no IP tool is present"
exit 77

View File

@@ -23,7 +23,6 @@
OCCTL="${OCCTL:-../src/occtl/occtl}"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4569
PIDFILE=ocserv-pid.$$.tmp
CLIPID=oc-pid.$$.tmp
PATH=${PATH}:/usr/sbin
@@ -38,6 +37,8 @@ fi
. `dirname $0`/common.sh
eval "${GETPORT}"
if test -z "${IP}";then
echo "no IP tool is present"
exit 77

View File

@@ -23,7 +23,6 @@
OCCTL="${OCCTL:-../src/occtl/occtl}"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4569
PIDFILE=ocserv-pid.$$.tmp
CLIPID=oc-pid.$$.tmp
PATH=${PATH}:/usr/sbin
@@ -38,6 +37,8 @@ fi
. `dirname $0`/common.sh
eval "${GETPORT}"
if test -z "${IP}";then
echo "no IP tool is present"
exit 77

View File

@@ -24,7 +24,6 @@ PKG_CONFIG="${PKG_CONFIG:-/usr/bin/pkg-config}"
OCCTL="${OCCTL:-../src/occtl/occtl}"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4569
PIDFILE=ocserv-pid.$$.tmp
CLIPID=oc-pid.$$.tmp
PATH=${PATH}:/usr/sbin
@@ -39,6 +38,8 @@ fi
. `dirname $0`/common.sh
eval "${GETPORT}"
if test -z "${IP}";then
echo "no IP tool is present"
exit 77

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Copyright (C) 2017 Red Hat, Inc.
#
@@ -21,10 +21,11 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4444
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing server cert with ed25519... "
update_config test-ed25519.config

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Copyright (C) 2017 Red Hat, Inc.
#
@@ -21,10 +21,11 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4444
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing server cert with RSA-PSS... "
update_config test-rsa-pss.config

View File

@@ -20,24 +20,23 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4612
# Test whether append-routes behaves as expected.
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing ocserv and user append-route application... "
CONFFILE=${srcdir}/test-append-routes-conf.tmp
TMPFILE1=${srcdir}/test-append-routes.tmp
rm -f ${TMPFILE1}
cp ${srcdir}/data/test-user-config.config ${CONFFILE}
echo "append-routes = true" >> ${CONFFILE}
sed -i 's/= 4512/= 4612/g' ${CONFFILE}
update_config test-user-config.config
echo "append-routes = true" >> ${CONFIG}
launch_server -d 1 -f -c ${CONFFILE} & PID=$!
launch_server -d 1 -f -c ${CONFIG} & PID=$!
wait_server $PID
echo "Checking if routes are appended... "
@@ -68,7 +67,7 @@ fi
echo ok
rm -f ${TMPFILE1}
rm -f ${CONFFILE}
rm -f ${CONFIG}
kill $PID
wait

View File

@@ -21,7 +21,6 @@
OCCTL="${OCCTL:-../src/occtl/occtl}"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4497
OCCTL_SOCKET=./occtl-ban-$$.socket
PIDFILE=ocserv-pid.$$.tmp
OUTFILE=ban.$$.tmp
@@ -36,6 +35,8 @@ VPNADDR6=fc39:d561:62c6:861b:9f38:9734:9fa1:0
. `dirname $0`/common.sh
. `dirname $0`/ns.sh
eval "${GETPORT}"
update_config test-ban.config
if test "$VERBOSE" = 1;then
DEBUG="-d 3"

View File

@@ -21,13 +21,14 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4446
CRLNAME=crl.pem.$$.tmp
CRLTMPLNAME=crl.tmpl.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing ocserv with certificates... "
rm -f "${CRLNAME}" "${CRLTMPLNAME}"

View File

@@ -20,11 +20,12 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4425
OUTFILE=test-cert-opt-pass.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing local backend with certificate and optional username-password... "
connect()

View File

@@ -23,7 +23,6 @@
OCCTL="${OCCTL:-../src/occtl/occtl}"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=8447
PIDFILE=ocserv-pid.$$.tmp
CLIPID=oc-pid.$$.tmp
PATH=${PATH}:/usr/sbin
@@ -32,6 +31,8 @@ OUTFILE=traffic.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
if test -z "${IP}";then
echo "no IP tool is present"
exit 77

View File

@@ -20,16 +20,18 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4502
. `dirname $0`/common.sh
eval "${GETPORT}"
PIDFILE1="${srcdir}/ci$$-1.pid.tmp"
PIDFILE2="${srcdir}/ci$$-2.pid.tmp"
echo "Testing whether cookies are being correctly invalidated... "
rm -f "${PIDFILE1}" "${PIDFILE2}"
launch_server -d 1 -f -c ${srcdir}/data/test-cookie-invalidation.config & PID=$!
update_config test-cookie-invalidation.config
launch_server -d 1 -f -c ${CONFIG} & PID=$!
wait_server $PID
echo "Connecting to obtain cookie... "
@@ -91,6 +93,7 @@ if [ -f "${PIDFILE2}" ];then
fi
rm -f "${PIDFILE1}" "${PIDFILE2}"
rm -f ${CONFIG}
kill $PID
wait

View File

@@ -20,15 +20,17 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4499
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing whether cookies will expire as expected... "
PIDFILE="${srcdir}/ct$$.pid.tmp"
launch_server -d 1 -f -c ${srcdir}/data/test-cookie-timeout.config & PID=$!
update_config test-cookie-timeout.config
launch_server -d 1 -f -c ${CONFIG} & PID=$!
wait_server $PID
echo "Connecting to obtain cookie... "
@@ -111,6 +113,6 @@ fi
kill $PID
wait
rm -f "${PIDFILE}"
rm -f "${PIDFILE}" ${CONFIG}
exit 0

View File

@@ -20,14 +20,16 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4498
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing whether cookies will remain valid during the session time... "
rm -f ${srcdir}/pid.$$
launch_server -d 1 -f -c ${srcdir}/data/test-cookie-timeout-2.config & PID=$!
update_config test-cookie-timeout-2.config
launch_server -d 1 -f -c ${CONFIG} & PID=$!
wait_server $PID
echo "Connecting to obtain cookie... "
@@ -73,6 +75,6 @@ kill $PID
wait
rm -f ${srcdir}/pid.$$
rm -f ${srcdir}/pid2.$$
rm -f ${srcdir}/pid2.$$ ${CONFIG}
exit 0

View File

@@ -21,10 +21,11 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4456
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing local backend with encrypted PKCS #8 key file... "
update_config test-enc-key.config

View File

@@ -21,10 +21,11 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
TMPFILE=${srcdir}/outfile.$$
PORT=8446
. `dirname $0`/common.sh
eval "${GETPORT}"
connect()
{
opts=$1
@@ -54,7 +55,8 @@ return 0
echo "Testing local backend with username-password and explicit IP addresses... "
launch_server -d 1 -f -c "${srcdir}/data/test-explicit-ip.config" & PID=$!
update_config test-explicit-ip.config
launch_server -d 1 -f -c "${CONFIG}" & PID=$!
wait_server $PID
echo -n "Connecting with an illegal address assigned... "

View File

@@ -20,11 +20,12 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4432
PIDFILE=ocserv-pid.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing operation when run on background..."
update_config test1.config

View File

@@ -21,13 +21,14 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4445
TMPFILE=getcert.$$.tmp
TMPFILE2=getcert2.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing ocserv certificate GET handlers... "
update_config test-user-cert.config

View File

@@ -21,10 +21,11 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=6550
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing local backend with certificate... "
launch_sr_server -d 1 -f -c data/test-group-cert.config & PID=$!

View File

@@ -21,7 +21,6 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=443
HEAD=$(mktemp)
POST=$(mktemp)
COOKIES=$(mktemp)
@@ -29,6 +28,8 @@ OUTFILE=$(mktemp)
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing whether group labels are translated to groups... "
# This is a necessary condition for some anyconnect clients
@@ -47,7 +48,7 @@ launch_simple_sr_server -d 1 -f -c ${CONFIG}
PID=$!
wait_server $PID
TARGET=https://$ADDRESS
TARGET=https://$ADDRESS:$PORT
cat >$HEAD <<_EOF
Accept-Encoding:identity

View File

@@ -21,10 +21,11 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=6552
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing local backend with username-group-password... "
update_config test-group-pass.config

View File

@@ -22,7 +22,6 @@ SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
builddir=${builddir:-.}
NO_NEED_ROOT=1
PORT=4449
NTLMSSP_CONF=""
for conf in /etc/gss/mech.d/mech.ntlmssp.conf /etc/gss/mech.d/ntlmssp.conf;do
@@ -45,6 +44,8 @@ fi
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing local backend with gssapi... "
export NTLM_USER_FILE=${builddir}/ntlm.pass

View File

@@ -21,7 +21,6 @@ SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
builddir=${builddir:-.}
NO_NEED_ROOT=1
PORT=4438
OUTFILE=test-gssapi-opt-pass.$$.tmp
connect()
@@ -68,6 +67,8 @@ fi
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing local backend with gssapi and password fallback... "
VERBOSE=1

View File

@@ -21,7 +21,6 @@ SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
builddir=${builddir:-.}
NO_NEED_ROOT=1
PORT=4439
OUTFILE=test-gssapi-opt-pass.$$.tmp
connect()
@@ -68,6 +67,8 @@ fi
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing local backend with gssapi and password fallback... "
VERBOSE=1

View File

@@ -20,15 +20,17 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4501
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing ocserv and user route application... "
rm -f ${srcdir}/test-iroute.tmp
launch_server -d 1 -f -c "${srcdir}/data/test-iroute.config" & PID=$!
update_config test-iroute.config
launch_server -d 1 -f -c "${CONFIG}" & PID=$!
wait_server $PID
echo -n "Connecting to obtain cookie (with certificate)... "
@@ -60,7 +62,7 @@ fi
echo ok
rm -f ${srcdir}/test-iroute.tmp
rm -f ${srcdir}/test-iroute.tmp ${CONFIG}
kill $PID
wait

View File

@@ -20,10 +20,11 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4434
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing ocserv and SIGUSR2/forced maintenance behavior... "
update_config test-sighup.config

View File

@@ -20,10 +20,11 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4516
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing whether max-same-clients=1 allows cookie re-use... "
PIDFILE1="${srcdir}/ci$$-1.pid.tmp"

View File

@@ -20,10 +20,11 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4500
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing whether cookies are being re-used... "
PIDFILE1="${srcdir}/ci$$-1.pid.tmp"

View File

@@ -18,7 +18,6 @@
SERV="${SERV:-../src/ocserv}"
PIDFILE=ocserv-pid.$$.tmp
srcdir=${srcdir:-.}
PORT=4498
LISTEN_NS="ocserv-listen-ns-tmp-$$"
OUTFILE=lsof.$$.tmp
SS=$(which ss)
@@ -42,6 +41,8 @@ trap finish EXIT
. `dirname $0`/common.sh
. `dirname $0`/ns.sh
eval "${GETPORT}"
update_config test-namespace-listen.config
if test "$VERBOSE" = 1;then
DEBUG="-d 3"

View File

@@ -21,12 +21,13 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4503
PIDFILE=ocserv-pid.$$.tmp
OCCTL_SOCKET=./occtl-oidc-$$.socket
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing local backend with oidc token auth... "
update_config test-oidc-auth.config

View File

@@ -22,11 +22,12 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4489
OTP_FILE=test-otp.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing local backend with username-password-otp and certificate... "
$SERV --version 2>&1|grep oath >/dev/null 2>&1

View File

@@ -22,11 +22,12 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4479
OTP_FILE=test-otp-users.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing local backend with username-password-otp and certificate... "
#user 'test' has cert, password + OTP

View File

@@ -21,12 +21,13 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=6552
VERBOSE=1
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing PAM backend with username-password... "
export TEST_PAMDIR=data/pam

View File

@@ -21,10 +21,11 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=6552
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing PAM acct backend with username-password... "
export TEST_PAMDIR=data/pam-single

View File

@@ -21,11 +21,12 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4444
PIDFILE=ocserv-pid.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing local backend with username-password... "
update_config test1.config

View File

@@ -21,11 +21,12 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4445
ISOLATE_WORKERS=false
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing local backend with username-password and certificate... "
update_config test-user-cert.config

View File

@@ -21,10 +21,11 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=6551
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing local backend with username-password and certificate... "
update_config test-user-group-cert.config

View File

@@ -21,10 +21,11 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=6555
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing local backend with username-password and certificate... "
update_config test-user-group-cert-no-pass.config

View File

@@ -22,11 +22,12 @@ SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
TMPFILE=${srcdir}/outfile.$$.tmp
NO_NEED_ROOT=1
PORT=8445
PIDFILE=ocserv-pid.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing local backend with username-password and optional certificate... "
update_config test-pass-opt-cert.config

View File

@@ -21,13 +21,14 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
builddir=${builddir:-.}
PORT=4448
OPIDFILE=pass-script.$$.tmp
OPIDFILE2=pass-script2.$$.tmp
PARAMSFILE=pass-script.params.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing connect and disconnect script behavior"
rm -f ${OPIDFILE}
@@ -61,7 +62,8 @@ fi
echo " * Testing local backend with username-password... "
launch_server -d 1 -f -c "${srcdir}/data/test-pass-script.config" & PID=$!
update_config test-pass-script.config
launch_server -d 1 -f -c "${CONFIG}" & PID=$!
wait_server $PID
echo " * Connecting to obtain cookie with wrong username... "
@@ -213,4 +215,6 @@ wait
echo "Script tests were successful"
rm -f ${CONFIG}
exit 0

View File

@@ -27,6 +27,8 @@ CRLTMPLNAME=crl.tmpl.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing ocserv with certificates... "
rm -f "${CRLNAME}" "${CRLTMPLNAME}"
@@ -47,25 +49,25 @@ PID=$!
wait_server $PID
echo -n "Connecting to obtain cookie (without certificate)... "
( LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) &&
( LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS:$PORT --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) &&
fail $PID "Connected without certificate!"
echo "ok (failed as expected)"
echo -n "Connecting to obtain cookie (with invalid certificate)... "
( LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS --sslkey "${srcdir}/certs/user-key.pem" -c "${srcdir}/certs/user-cert-invalid.pem" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) &&
( LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS:$PORT --sslkey "${srcdir}/certs/user-key.pem" -c "${srcdir}/certs/user-cert-invalid.pem" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) &&
fail $PID "Connected with invalid certificate!"
echo "ok (failed as expected)"
echo -n "Connecting to obtain cookie (with certificate - no SAN)... "
( LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS --sslkey "${srcdir}/certs/user-key.pem" -c "${srcdir}/certs/user-cert.pem" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) &&
( LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS:$PORT --sslkey "${srcdir}/certs/user-key.pem" -c "${srcdir}/certs/user-cert.pem" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) &&
fail $PID "Connected with invalid certificate!"
echo "ok (failed as expected)"
echo -n "Connecting to obtain cookie (with certificate - SAN)... "
( LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS --sslkey "${srcdir}/certs/user-key.pem" -c "${srcdir}/certs/user-san-cert.pem" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) ||
( LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS:$PORT --sslkey "${srcdir}/certs/user-key.pem" -c "${srcdir}/certs/user-san-cert.pem" --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly </dev/null >/dev/null 2>&1 ) ||
fail $PID "Failed to connect with certificate!"
echo ok

View File

@@ -22,7 +22,6 @@ SERV="${SERV:-../src/ocserv}"
OCCTL="${OCCTL:-../src/occtl/occtl}"
srcdir=${srcdir:-.}
builddir=${builddir:-.}
PORT=4472
PIDFILE=ocserv-pid.$$.tmp
VPNNET=172.29.205.0/24
OUTFILE=out.$$.tmp
@@ -30,6 +29,8 @@ USERNAME=test
. `dirname $0`/common.sh
eval "${GETPORT}"
if test "${DISABLE_ASAN_BROKEN_TESTS}" = 1;then
echo "Skipping test requiring ldpreload"
exit 77

View File

@@ -20,10 +20,11 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4441
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing ocserv and SIGHUP behavior... "
update_config test-sighup.config

View File

@@ -21,13 +21,14 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
NO_NEED_ROOT=1
PORT=4473
TEMPLATE=temp-key.$$.tmpl.tmp
SERVER_CERT=server-cert-temp.pem.tmp
SERVER_KEY=server-key-temp.pem.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing ocserv and SIGHUP behavior on server key change... "
cat <<_EOF_>"${TEMPLATE}"

View File

@@ -20,10 +20,11 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4450
. `dirname $0`/common.sh
eval "${GETPORT}"
run_client() {
HOST=$1;
shift;

View File

@@ -24,8 +24,6 @@ CLIPID="${srcdir:-.}/ci$$-1.pid.tmp"
CLIPID2="${srcdir:-.}/ci$$-2.pid.tmp"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4166
HAPORT=4167
PIDFILE=ocserv-pid.$$.tmp
CONFIG_UDP_LISTEN_LOCAL=ocserv_udp_listen_local.conf.$$.tmp
HACONFIG=haproxy.conf.$$.tmp
@@ -35,6 +33,10 @@ IP=$(command -v ip)
. "$(dirname "$0")/common.sh"
eval "${GETPORT}"
HAPORT=${PORT}
eval "${GETPORT}"
if test -z "${HAPROXY}";then
echo "no haproxy present"
exit 77

View File

@@ -20,13 +20,14 @@
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4512
# Test whether DPD, keepalive per user are actually set, and whether
# the expose-iroutes option has an effect to other users.
. `dirname $0`/common.sh
eval "${GETPORT}"
echo "Testing ocserv and user route application... "
TMPFILE1=${srcdir}/test-user-config.tmp
@@ -35,7 +36,8 @@ TMPFILE2=${srcdir}/test-user-config-2.tmp
rm -f ${TMPFILE1}
rm -f ${TMPFILE2}
launch_simple_server -d 1 -f -c "${srcdir}/data/test-user-config.config"
update_config test-user-config.config
launch_simple_server -d 1 -f -c "${CONFIG}"
PID=$!
wait_server $PID
@@ -182,7 +184,7 @@ echo ok
kill $kpid3
rm -f ${TMPFILE1}
rm -f ${TMPFILE1} ${CONFIG}
rm -f ${TMPFILE2}
kill $PID
wait

View File

@@ -20,7 +20,6 @@
PKG_CONFIG="${PKG_CONFIG:-/usr/bin/pkg-config}"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=443
NO_NEED_ROOT=1
TMPFILE=pid.$$.tmp
@@ -28,6 +27,8 @@ VERBOSE=1
. `dirname $0`/common.sh
eval "${GETPORT}"
connect()
{
vhost=$1:$PORT

View File

@@ -21,7 +21,6 @@
OCCTL="${OCCTL:-../src/occtl/occtl}"
SERV="${SERV:-../src/ocserv}"
srcdir=${srcdir:-.}
PORT=4568
PIDFILE=ocserv-pid.$$.tmp
CLIPID=oc-pid.$$.tmp
PATH=${PATH}:/usr/sbin
@@ -30,6 +29,8 @@ OUTFILE=traffic.$$.tmp
. `dirname $0`/common.sh
eval "${GETPORT}"
if test -z "${IP}";then
echo "no IP tool is present"
exit 77