Generate testcert.conf and testcert6.conf in test.sh

This commit is contained in:
Gerhard Rieger 2015-04-02 15:53:08 +02:00
parent cd164e7b58
commit 0f65dd68fb
4 changed files with 49 additions and 24 deletions

View file

@ -299,6 +299,7 @@ new features:
SOCAT_OPENSSL_X509V3_SUBJECTALTNAME_DNS SOCAT_OPENSSL_X509V3_SUBJECTALTNAME_DNS
Tests: ENV_OPENSSL_{CLIENT,SERVER}_X509_* Tests: ENV_OPENSSL_{CLIENT,SERVER}_X509_*
docu docu
minor corrections in docu (thanks to Paggas) minor corrections in docu (thanks to Paggas)
@ -306,6 +307,10 @@ docu
client process -> child process client process -> child process
testing:
Do not distribute testcert.conf with socat source but generate it
(and new testcert6.conf) during test.sh run.
####################### V 2.0.0-b7: ####################### V 2.0.0-b7:
security: security:

View file

@ -83,8 +83,7 @@ DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY \
SHFILES = daemon.sh mail.sh ftp.sh readline.sh SHFILES = daemon.sh mail.sh ftp.sh readline.sh
TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \ TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \
proxy.sh socks4a-echo.sh bin/cat2.sh bin/predialog.sh \ proxy.sh socks4a-echo.sh bin/cat2.sh bin/predialog.sh \
bin/cat2.sh bin/predialog.sh \ bin/cat2.sh bin/predialog.sh
testcert.conf
OSFILES = Config/Makefile.Linux-2-6-24 Config/config.Linux-2-6-24.h \ OSFILES = Config/Makefile.Linux-2-6-24 Config/config.Linux-2-6-24.h \
Config/Makefile.SunOS-5-10 Config/config.SunOS-5-10.h \ Config/Makefile.SunOS-5-10 Config/config.SunOS-5-10.h \
Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \ Config/Makefile.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \

52
test.sh
View file

@ -78,18 +78,48 @@ LOCALHOST6=[::1]
PROTO=$((144+RANDOM/2048)) PROTO=$((144+RANDOM/2048))
PORT=12002 PORT=12002
SOURCEPORT=2002 SOURCEPORT=2002
# SSL certificate contents
TESTCERT_CONF=testcert.conf TESTCERT_CONF=testcert.conf
TESTCERT6_CONF=testcert6.conf TESTCERT6_CONF=testcert6.conf
# keep these values consistent with testcert.conf #
TESTCERT_COMMONNAME="$LOCALHOST" TESTCERT_COMMONNAME="$LOCALHOST"
TESTCERT_COUNTRYNAME="$(grep ^countryName= testcert.conf)"; TESTCERT_COUNTRYNAME="${TESTCERT_COUNTRYNAME##*=}" TESTCERT_COMMONNAME6="$LOCALHOST6"
TESTCERT_LOCALITYNAME="$(grep ^L= testcert.conf)"; TESTCERT_LOCALITYNAME="${TESTCERT_LOCALITYNAME##*=}" TESTCERT_COUNTRYNAME="XY"
TESTCERT_ORGANIZATIONALUNITNAME="$(grep ^OU= testcert.conf)"; TESTCERT_ORGANIZATIONALUNITNAME="${TESTCERT_ORGANIZATIONALUNITNAME##*=}" TESTCERT_LOCALITYNAME="Lunar Base"
TESTCERT_ORGANIZATIONNAME="$(grep ^O= testcert.conf)"; TESTCERT_ORGANIZATIONNAME="${TESTCERT_ORGANIZATIONNAME##*=}" TESTCERT_ORGANIZATIONALUNITNAME="socat"
TESTCERT_SUBJECT="C = XY, CN = localhost, O = dest-unreach, OU = socat, L = Lunar Base" TESTCERT_ORGANIZATIONNAME="dest-unreach"
TESTCERT_ISSUER="C = XY, CN = localhost, O = dest-unreach, OU = socat, L = Lunar Base" TESTCERT_SUBJECT="C = $TESTCERT_COUNTRYNAME, CN = $TESTCERT_COMMONNAME, O = $TESTCERT_ORGANIZATIONNAME, OU = $TESTCERT_ORGANIZATIONALUNITNAME, L = $TESTCERT_LOCALITYNAME"
CAT=cat TESTCERT_ISSUER="C = $TESTCERT_COUNTRYNAME, CN = $TESTCERT_COMMONNAME, O = $TESTCERT_ORGANIZATIONNAME, OU = $TESTCERT_ORGANIZATIONALUNITNAME, L = $TESTCERT_LOCALITYNAME"
OD_C="od -c" cat >$TESTCERT_CONF <<EOF
prompt=no
[ req ]
default_bits = 768
distinguished_name=Test
[ Test ]
countryName=$TESTCERT_COUNTRYNAME
commonName=$TESTCERT_COMMONNAME
O=$TESTCERT_ORGANIZATIONNAME
OU=$TESTCERT_ORGANIZATIONALUNITNAME
L=$TESTCERT_LOCALITYNAME
EOF
cat >$TESTCERT6_CONF <<EOF
prompt=no
[ req ]
default_bits = 768
distinguished_name=Test
[ Test ]
countryName=$TESTCERT_COUNTRYNAME
commonName=$TESTCERT_COMMONNAME6
O=$TESTCERT_ORGANIZATIONNAME
OU=$TESTCERT_ORGANIZATIONALUNITNAME
L=$TESTCERT_LOCALITYNAME
EOF
# clean up from previous runs # clean up from previous runs
rm -f testcli.{crt,key,pem} rm -f testcli.{crt,key,pem}
@ -97,6 +127,10 @@ rm -f testsrv.{crt,key,pem}
rm -f testcli6.{crt,key,pem} rm -f testcli6.{crt,key,pem}
rm -f testsrv6.{crt,key,pem} rm -f testsrv6.{crt,key,pem}
CAT=cat
OD_C="od -c"
# precision sleep; takes seconds with fractional part # precision sleep; takes seconds with fractional part
psleep () { psleep () {
local T="$1" local T="$1"

View file

@ -1,13 +0,0 @@
prompt=no
[ req ]
default_bits = 768
distinguished_name=Test
[ Test ]
countryName=XY
commonName=localhost
O=dest-unreach
OU=socat
L=Lunar Base