Skip to content

Commit a89a2d8

Browse files
committed
REGTESTS: don't rely on the base64 utility when openssl base64 is already used
Regtest ocsp_auto_update.vtc used to fail here on FreeBSD because the base64 utility was not installed by default. Once installed it would still fail because the utility doesn't support -w to wrap lines. Since the regtest already relies on openssl base64 for a few commands, let's just rely on it for the other ones. The only limitation is that openssl freezes on lines longer than 1024 bytes, and doesn't seem to process more than 255 chars at once, which might be the reason for using base64 -w 1000 in the first place (the script was probably tested like this). Instead sed is efficient at wrapping long lines and does the job pretty well. The output was fixed at 72 chars so that the output is also readable on a terminal for debugging.
1 parent a1ace74 commit a89a2d8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

reg-tests/ssl/ocsp_auto_update.vtc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ haproxy h5 -cli {
419419
shell {
420420
ocsp_resp_file="${tmpdir}.ocsp_resp.der"
421421

422-
echo "show ssl ocsp-response base64 303b300906052b0e03021a050004148a83e0060faff709ca7e9b95522a2e81635fda0a0414f652b0e435d5ea923851508f0adbe92d85de007a02021015" | socat "${tmpdir}/h5/stats" - | base64 -d > $ocsp_resp_file
422+
echo "show ssl ocsp-response base64 303b300906052b0e03021a050004148a83e0060faff709ca7e9b95522a2e81635fda0a0414f652b0e435d5ea923851508f0adbe92d85de007a02021015" | socat "${tmpdir}/h5/stats" - | sed -e 's/.\{72\}/&\n/g' | openssl base64 -d | tee /tmp/with-o64 > $ocsp_resp_file
423423

424424
if [ $? -eq 0 ]
425425
then
@@ -732,7 +732,7 @@ shell {
732732
echo "new ssl cert ${testdir}/ocsp_update/rsa.pem" | socat "${tmpdir}/h9/stats" -
733733
printf "set ssl cert ${testdir}/ocsp_update/rsa.pem <<\n$(cat ${testdir}/ocsp_update/multicert/server_ocsp.pem.rsa)\n\n" | socat "${tmpdir}/h9/stats" -
734734
printf "set ssl cert ${testdir}/ocsp_update/rsa.pem.issuer <<\n$(cat ${testdir}/ocsp_update/ocsp_update_rootca.crt)\n\n" | socat "${tmpdir}/h9/stats" -
735-
printf "set ssl cert ${testdir}/ocsp_update/rsa.pem.ocsp <<\n$(base64 -w 1000 ${testdir}/ocsp_update/multicert/server_ocsp.pem.rsa.ocsp)\n\n" | socat "${tmpdir}/h9/stats" -
735+
printf "set ssl cert ${testdir}/ocsp_update/rsa.pem.ocsp <<\n$(openssl base64 < ${testdir}/ocsp_update/multicert/server_ocsp.pem.rsa.ocsp)\n\n" | socat "${tmpdir}/h9/stats" -
736736
echo "commit ssl cert ${testdir}/ocsp_update/rsa.pem" | socat "${tmpdir}/h9/stats" -
737737

738738
printf "add ssl crt-list ${testdir}/ocsp_update/multicert_ecdsa_no_update.crt-list <<\nrsa.pem [ocsp-update off] foo.bar\n\n" | socat "${tmpdir}/h9/stats" -

0 commit comments

Comments
 (0)