From 0f65dd68fbab728e6ecc887f15ab88609f3eb732 Mon Sep 17 00:00:00 2001 From: Gerhard Rieger Date: Thu, 2 Apr 2015 15:53:08 +0200 Subject: [PATCH] Generate testcert.conf and testcert6.conf in test.sh --- CHANGES | 5 +++++ Makefile.in | 3 +-- test.sh | 52 ++++++++++++++++++++++++++++++++++++++++++--------- testcert.conf | 13 ------------- 4 files changed, 49 insertions(+), 24 deletions(-) delete mode 100644 testcert.conf diff --git a/CHANGES b/CHANGES index 0e990b6..29daadf 100644 --- a/CHANGES +++ b/CHANGES @@ -299,6 +299,7 @@ new features: SOCAT_OPENSSL_X509V3_SUBJECTALTNAME_DNS Tests: ENV_OPENSSL_{CLIENT,SERVER}_X509_* + docu minor corrections in docu (thanks to Paggas) @@ -306,6 +307,10 @@ docu 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: security: diff --git a/Makefile.in b/Makefile.in index 3f0b2bd..689cfe8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -83,8 +83,7 @@ DOCFILES = README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY \ SHFILES = daemon.sh mail.sh ftp.sh readline.sh TESTFILES = test.sh socks4echo.sh proxyecho.sh gatherinfo.sh readline-test.sh \ proxy.sh socks4a-echo.sh bin/cat2.sh bin/predialog.sh \ - bin/cat2.sh bin/predialog.sh \ - testcert.conf + bin/cat2.sh bin/predialog.sh 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.FreeBSD-6-1 Config/config.FreeBSD-6-1.h \ diff --git a/test.sh b/test.sh index e0a9a7e..d1e0623 100755 --- a/test.sh +++ b/test.sh @@ -78,18 +78,48 @@ LOCALHOST6=[::1] PROTO=$((144+RANDOM/2048)) PORT=12002 SOURCEPORT=2002 + +# SSL certificate contents TESTCERT_CONF=testcert.conf TESTCERT6_CONF=testcert6.conf -# keep these values consistent with testcert.conf +# TESTCERT_COMMONNAME="$LOCALHOST" -TESTCERT_COUNTRYNAME="$(grep ^countryName= testcert.conf)"; TESTCERT_COUNTRYNAME="${TESTCERT_COUNTRYNAME##*=}" -TESTCERT_LOCALITYNAME="$(grep ^L= testcert.conf)"; TESTCERT_LOCALITYNAME="${TESTCERT_LOCALITYNAME##*=}" -TESTCERT_ORGANIZATIONALUNITNAME="$(grep ^OU= testcert.conf)"; TESTCERT_ORGANIZATIONALUNITNAME="${TESTCERT_ORGANIZATIONALUNITNAME##*=}" -TESTCERT_ORGANIZATIONNAME="$(grep ^O= testcert.conf)"; TESTCERT_ORGANIZATIONNAME="${TESTCERT_ORGANIZATIONNAME##*=}" -TESTCERT_SUBJECT="C = XY, CN = localhost, O = dest-unreach, OU = socat, L = Lunar Base" -TESTCERT_ISSUER="C = XY, CN = localhost, O = dest-unreach, OU = socat, L = Lunar Base" -CAT=cat -OD_C="od -c" +TESTCERT_COMMONNAME6="$LOCALHOST6" +TESTCERT_COUNTRYNAME="XY" +TESTCERT_LOCALITYNAME="Lunar Base" +TESTCERT_ORGANIZATIONALUNITNAME="socat" +TESTCERT_ORGANIZATIONNAME="dest-unreach" +TESTCERT_SUBJECT="C = $TESTCERT_COUNTRYNAME, CN = $TESTCERT_COMMONNAME, O = $TESTCERT_ORGANIZATIONNAME, OU = $TESTCERT_ORGANIZATIONALUNITNAME, L = $TESTCERT_LOCALITYNAME" +TESTCERT_ISSUER="C = $TESTCERT_COUNTRYNAME, CN = $TESTCERT_COMMONNAME, O = $TESTCERT_ORGANIZATIONNAME, OU = $TESTCERT_ORGANIZATIONALUNITNAME, L = $TESTCERT_LOCALITYNAME" +cat >$TESTCERT_CONF <$TESTCERT6_CONF <