mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 00:37:00 +08:00
tests: enhanced the radius checks to test for Connect-Info presence
This commit is contained in:
@@ -3,10 +3,11 @@ FROM fedora:23
|
||||
RUN yum install -y gnutls gnutls-utils protobuf-c iproute pcllib http-parser tcp_wrappers pam systemd libseccomp
|
||||
RUN yum install -y bash openssh-server nuttcp
|
||||
RUN yum install -y libnl3 libtalloc libev
|
||||
RUN yum install -y lz4 radcli liboauth oathtool
|
||||
RUN yum install -y procps-ng lz4 radcli liboauth oathtool
|
||||
RUN yum install -y freeradius-client
|
||||
RUN yum install -y freeradius
|
||||
RUN yum install -y krb5-libs less
|
||||
RUN yum update -y
|
||||
RUN systemctl enable sshd
|
||||
RUN sed 's/PermitRootLogin without-password/PermitRootLogin yes/g' -i /etc/ssh/sshd_config
|
||||
|
||||
|
||||
@@ -3,9 +3,11 @@ FROM fedora:23
|
||||
RUN yum install -y gnutls gnutls-utils protobuf-c iproute pcllib http-parser tcp_wrappers pam systemd libseccomp
|
||||
RUN yum install -y bash openssh-server nuttcp
|
||||
RUN yum install -y libnl3 libtalloc libev
|
||||
RUN yum install -y lz4 radcli liboauth oathtool
|
||||
RUN yum install -y lz4 radcli liboauth oathtool procps-ng
|
||||
RUN yum install -y freeradius-client
|
||||
RUN yum install -y freeradius less
|
||||
RUN yum install -y freeradius
|
||||
RUN yum install -y krb5-libs less
|
||||
RUN yum update -y
|
||||
RUN systemctl enable sshd
|
||||
RUN sed 's/PermitRootLogin without-password/PermitRootLogin yes/g' -i /etc/ssh/sshd_config
|
||||
|
||||
|
||||
@@ -135,18 +135,19 @@ if test $? = 0;then
|
||||
stop
|
||||
fi
|
||||
|
||||
FILE=`$DOCKER exec $IMAGE_NAME ls /var/log/radius/radacct/127.0.0.1/`
|
||||
DIR=`$DOCKER exec $IMAGE_NAME ls '/var/log/radius/radacct/'|tail -1`
|
||||
FILE=`$DOCKER exec $IMAGE_NAME ls '/var/log/radius/radacct/'"$DIR"|tail -1`
|
||||
|
||||
OCTETS=`$DOCKER exec $IMAGE_NAME cat "/var/log/radius/radacct/127.0.0.1/$FILE"|grep Acct-Input-Octets|tail -1|sed 's/Acct-Input-Octets = //g'`
|
||||
OCTETS=`$DOCKER exec $IMAGE_NAME cat "/var/log/radius/radacct/$DIR/$FILE"|grep Acct-Input-Octets|tail -1|sed 's/Acct-Input-Octets = //g'`
|
||||
if test -z "$OCTETS" || test "$OCTETS" = 0;then
|
||||
$DOCKER exec $IMAGE_NAME cat "/var/log/radius/radacct/127.0.0.1/$FILE"
|
||||
$DOCKER exec $IMAGE_NAME cat "/var/log/radius/radacct/$DIR/$FILE"
|
||||
echo "Interim update showed no data!"
|
||||
stop
|
||||
fi
|
||||
|
||||
check_for_file /tmp/disconnect/ok
|
||||
if test $? != 0;then
|
||||
$DOCKER exec $IMAGE_NAME cat "/var/log/radius/radacct/127.0.0.1/$FILE"
|
||||
$DOCKER exec $IMAGE_NAME cat "/var/log/radius/radacct/$DIR/$FILE"
|
||||
echo "There was an issue getting stats"
|
||||
stop
|
||||
fi
|
||||
@@ -156,9 +157,9 @@ ret=0
|
||||
#wait until sec-mod has cleaned up its entries
|
||||
echo "Waiting for disconnection report"
|
||||
sleep 10
|
||||
DISC=`$DOCKER exec $IMAGE_NAME cat "/var/log/radius/radacct/127.0.0.1/$FILE"|grep "Acct-Terminate-Cause = User-Request"|tail -1`
|
||||
DISC=`$DOCKER exec $IMAGE_NAME cat "/var/log/radius/radacct/$DIR/$FILE"|grep "Acct-Terminate-Cause = User-Request"|tail -1`
|
||||
if test -z "$DISC";then
|
||||
$DOCKER exec $IMAGE_NAME cat "/var/log/radius/radacct/127.0.0.1/$FILE"
|
||||
$DOCKER exec $IMAGE_NAME cat "/var/log/radius/radacct/$DIR/$FILE"
|
||||
echo "No disconnect was detected!"
|
||||
stop
|
||||
fi
|
||||
@@ -166,7 +167,7 @@ fi
|
||||
# do the same with a certificate - test radius accounting with certificate auth
|
||||
echo "Trying with certificate"
|
||||
rm -f out$TMP.pid
|
||||
$DOCKER exec $IMAGE_NAME truncate --size=0 /var/log/radius/radacct/127.0.0.1/$FILE
|
||||
$DOCKER exec $IMAGE_NAME truncate --size=0 /var/log/radius/radacct/$DIR/$FILE
|
||||
$OPENCONNECT $IP:$PORT_OCSERV -b --sslkey ./user-key.pem -c ./user-cert.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --pid-file=out$TMP.pid
|
||||
|
||||
sleep 10
|
||||
@@ -195,8 +196,10 @@ kill -INT $PID
|
||||
|
||||
sleep 10
|
||||
|
||||
FILE=`$DOCKER exec $IMAGE_NAME ls /var/log/radius/radacct/127.0.0.1/|tail -1`
|
||||
$DOCKER exec $IMAGE_NAME cat "/var/log/radius/radacct/127.0.0.1/$FILE" >out$TMP
|
||||
DIR=`$DOCKER exec $IMAGE_NAME ls '/var/log/radius/radacct/'|tail -1`
|
||||
FILE=`$DOCKER exec $IMAGE_NAME ls '/var/log/radius/radacct/'"$DIR"|tail -1`
|
||||
|
||||
$DOCKER exec $IMAGE_NAME cat "/var/log/radius/radacct/$DIR/$FILE" >out$TMP
|
||||
cat out$TMP
|
||||
OCTETS=`cat out$TMP|grep Acct-Input-Octets|tail -1|sed 's/Acct-Input-Octets = //g'`
|
||||
if test -z "$OCTETS" || test "$OCTETS" = 0;then
|
||||
@@ -206,11 +209,17 @@ fi
|
||||
|
||||
DISC=`cat out$TMP|grep "Acct-Status-Type = Start"|tail -1`
|
||||
if test -z "$DISC";then
|
||||
cat out$TMP
|
||||
echo "No connect status was detected!"
|
||||
stop
|
||||
fi
|
||||
|
||||
DISC=`cat out$TMP|grep Connect-Info`
|
||||
if test -z "$DISC";then
|
||||
cat out$TMP
|
||||
echo "Accounting information had no Connect-Info!"
|
||||
stop
|
||||
fi
|
||||
|
||||
DISC=`cat out$TMP|grep "Acct-Terminate-Cause = User-Request"|tail -1`
|
||||
if test -z "$DISC";then
|
||||
cat out$TMP
|
||||
|
||||
Reference in New Issue
Block a user