From 92a9f41d3d4633cc8afbcef12d2dbd3743ac300d Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Mon, 3 Jan 2022 13:31:34 +0000 Subject: add set_proxy to simplify testing + more checks in test_proxy_with_certs --- regress/tests.sh | 53 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 22 deletions(-) (limited to 'regress/tests.sh') diff --git a/regress/tests.sh b/regress/tests.sh index 564145e..398c458 100644 --- a/regress/tests.sh +++ b/regress/tests.sh @@ -316,14 +316,8 @@ test_174_bugfix() { test_proxy_relay_to() { gen_config '' '' - # append config for second host - cat <> reg.conf -server "localhost.local" { - cert "$PWD/cert.pem" - key "$PWD/key.pem" - proxy { relay-to "localhost:$port" } -} -EOF + set_proxy '' + run ggflags="-P localhost:$port -H localhost.local" @@ -333,23 +327,38 @@ EOF } test_proxy_with_certs() { + ggflags="-P localhost:$port -H localhost.local" + + # first test using the valid keys + gen_config '' 'require client ca "'$PWD'/testca.pem"' - # append config for second host - cat <> reg.conf -server "localhost.local" { - cert "$PWD/cert.pem" - key "$PWD/key.pem" - proxy { - relay-to "localhost:$port" - cert "$PWD/valid.crt" - key "$PWD/valid.key" - } -} -EOF + set_proxy " + cert \"$PWD/valid.crt\" + key \"$PWD/valid.key\" + " run - ggflags="-P localhost:$port -H localhost.local" + fetch / + check_reply "20 text/gemini" "# hello world" || return 1 + + # then using some invalid keys + + gen_config '' 'require client ca "'$PWD'/testca.pem"' + set_proxy " + cert \"$PWD/invalid.cert.pem\" + key \"$PWD/invalid.key.pem\" + " + run fetch / - check_reply "20 text/gemini" "# hello world" + check_reply "61 certificate not authorised" || return 1 + + # and finally without keys + + gen_config '' 'require client ca "'$PWD'/testca.pem"' + set_proxy '' + run + + fetch / + check_reply "60 client certificate required" || return 1 } -- cgit v1.2.3