mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-12 01:26:48 +08:00
Test whether the statistics are exported to disconnect script.
This commit is contained in:
@@ -5,6 +5,7 @@ RUN apt-get install -y libgnutls28
|
||||
RUN apt-get install -y libwrap0 libpam0g libseccomp2 libdbus-1-3 libreadline5 libnl-route-3-200
|
||||
RUN apt-get install -y libprotobuf-c0 libhttp-parser2.1 libpcl1 libopts25 autogen
|
||||
RUN apt-get install -y libsystemd-daemon0 valgrind nuttcp openssh-server bash
|
||||
#RUN apt-get install -y inotify-tools
|
||||
|
||||
RUN echo 'root:root' |chpasswd
|
||||
RUN useradd -m -d /home/admin -s /bin/bash admin
|
||||
@@ -27,8 +28,9 @@ ADD passwd /etc/ocserv/
|
||||
ADD ocserv /usr/sbin/
|
||||
ADD ocpasswd /usr/bin/
|
||||
ADD occtl /usr/bin/
|
||||
ADD myscript /usr/bin/
|
||||
# It's not possible to use mknod inside a container with the default LXC
|
||||
# template, so we untar it from this archive.
|
||||
ADD dev-tun.tgz /dev/
|
||||
|
||||
CMD nuttcp -S;/etc/init.d/ssh restart;/usr/sbin/ocserv -d 1 -f
|
||||
CMD nuttcp -S;/etc/init.d/ssh restart;mkdir -p /tmp/disconnect/;usr/sbin/ocserv -d 1 -f
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
EXTRA_DIST = passwd ocserv.conf Dockerfile dev-tun.tgz
|
||||
EXTRA_DIST = passwd ocserv.conf Dockerfile dev-tun.tgz myscript
|
||||
|
||||
TESTS_ENVIRONMENT = srcdir="$(srcdir)" \
|
||||
top_builddir="$(top_builddir)"
|
||||
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$REASON" != "connect" ];then
|
||||
if test "$STATS_BYTES_IN" != "0";then
|
||||
echo $STATS_BYTES_IN >/tmp/disconnect/ok
|
||||
else
|
||||
echo $STATS_BYTES_IN >/tmp/disconnect/not-ok
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -150,7 +150,7 @@ rekey-method = ssl
|
||||
# in the P-t-P connection), IP_REMOTE (the VPN IP of the client),
|
||||
# ID (a unique numeric ID); REASON may be "connect" or "disconnect".
|
||||
#connect-script = /usr/bin/myscript
|
||||
#disconnect-script = /usr/bin/myscript
|
||||
disconnect-script = /usr/bin/myscript
|
||||
|
||||
# UTMP
|
||||
use-utmp = true
|
||||
|
||||
+13
-2
@@ -124,9 +124,20 @@ fi
|
||||
# stop
|
||||
#fi
|
||||
|
||||
kill $PID
|
||||
|
||||
sleep 3
|
||||
|
||||
#check whether /tmp/disconnect/ok was created
|
||||
rm -f ./ok
|
||||
$DOCKER cp test_ocserv:/tmp/disconnect/ok ./
|
||||
if ! test -f ./ok;then
|
||||
echo "Did not get stats"
|
||||
stop
|
||||
fi
|
||||
rm -f ./ok
|
||||
|
||||
$DOCKER stop test_ocserv
|
||||
$DOCKER rm test_ocserv
|
||||
|
||||
kill $PID
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user