Skip to content

Commit c2a62fb

Browse files
committed
tests: fix failing secrets test
When docker secrets are used, no dhparams are generated/present (unless the user mounts some). This prevents `inspircd` from starting up. Additionally, some newer versions of openssl now include spaces around the `=` in `OU=...`, so the `grep` pattern was updated.
1 parent 2e002de commit c2a62fb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Diff for: entrypoint.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,13 @@ time_stamping_key
4949
EOF
5050
/usr/bin/certtool --generate-privkey --bits 4096 --sec-param normal --outfile $INSPIRCD_ROOT/conf/key.pem
5151
/usr/bin/certtool --generate-self-signed --load-privkey $INSPIRCD_ROOT/conf/key.pem --outfile $INSPIRCD_ROOT/conf/cert.pem --template /tmp/cert.template
52-
/usr/bin/certtool --generate-dh-params --sec-param normal --outfile $INSPIRCD_ROOT/conf/dhparams.pem
5352
rm /tmp/cert.template
5453
fi
5554

55+
# Make sure dhparams are present
56+
if [ ! -e $INSPIRCD_ROOT/conf/dhparams.pem ]; then
57+
/usr/bin/certtool --generate-dh-params --sec-param normal --outfile $INSPIRCD_ROOT/conf/dhparams.pem
58+
fi
59+
5660
cd $INSPIRCD_ROOT
5761
exec env INSPIRCD_ROOT=$INSPIRCD_ROOT $INSPIRCD_ROOT/bin/inspircd --nofork $@

Diff for: tests/secrets.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ SECRETKEY=$(docker secret create test-secrets-key /tmp/test-secrets-key.pem)
5252
DOCKERSERVICE=$(docker service create -q -d -p "${CLIENT_PORT}:6667" -p "${TLS_CLIENT_PORT}:6697" --secret source=test-secrets-key,target=inspircd.key --secret source=test-secrets-cert,target=inspircd.crt inspircd:testing)
5353
sleep 35
5454
# Make sure TLS is working
55-
TLSCHECK=$(echo quit | timeout 10 openssl s_client -ign_eof -connect "localhost:${TLS_CLIENT_PORT}" 2>/dev/null | grep -c "OU=Secret Server Admins")
55+
TLSCHECK=$(echo quit | timeout 10 openssl s_client -ign_eof -connect "localhost:${TLS_CLIENT_PORT}" 2>/dev/null | grep -c "OU\s*=\s*Secret Server Admins")
5656
[ "$TLSCHECK" -gt 0 ] || exit 1
5757

5858
sleep 5

0 commit comments

Comments
 (0)