William Lallemand | 9c1aa0a | 2019-12-19 11:25:19 +0100 | [diff] [blame] | 1 | #REGTEST_TYPE=slow |
| 2 | |
| 3 | # This reg-test uses the "set ssl cert" command to update a certificate over the CLI. |
| 4 | # It requires socat and curl to upload and validate that the certificate was well updated |
| 5 | |
| 6 | # If this test does not work anymore: |
| 7 | # - Check that you have socat and curl |
| 8 | # - Check that the curl -v option still return the SSL CN |
| 9 | |
| 10 | varnishtest "Test the 'set ssl cert' feature of the CLI" |
| 11 | #REQUIRE_OPTIONS=OPENSSL |
William Lallemand | d5b464b | 2019-12-19 14:30:00 +0100 | [diff] [blame] | 12 | #REQUIRE_BINARIES=socat,curl |
William Lallemand | 9c1aa0a | 2019-12-19 11:25:19 +0100 | [diff] [blame] | 13 | feature ignore_unknown_macro |
| 14 | |
| 15 | |
| 16 | haproxy h1 -conf { |
| 17 | global |
| 18 | tune.ssl.default-dh-param 2048 |
| 19 | tune.ssl.capture-cipherlist-size 1 |
| 20 | stats socket "${tmpdir}/h1/stats" level admin |
| 21 | |
| 22 | listen frt |
| 23 | mode http |
| 24 | ${no-htx} option http-use-htx |
| 25 | bind "fd@${frt}" ssl crt ${testdir}/common.pem |
| 26 | http-request redirect location / |
| 27 | } -start |
| 28 | |
| 29 | |
| 30 | haproxy h1 -cli { |
| 31 | send "show ssl cert ${testdir}/common.pem" |
| 32 | expect ~ ".*SHA1 FingerPrint: 2195C9F0FD58470313013FC27C1B9CF9864BD1C6" |
| 33 | } |
| 34 | |
| 35 | shell { |
| 36 | HOST=${h1_frt_addr} |
| 37 | if [ "${h1_frt_addr}" = "::1" ] ; then |
| 38 | HOST="\[::1\]" |
| 39 | fi |
| 40 | curl -v -i -k https://$HOST:${h1_frt_port} 2>&1 | grep CN=www.test1.com |
| 41 | } |
| 42 | |
| 43 | shell { |
| 44 | echo -e "set ssl cert ${testdir}/common.pem <<\n$(cat ${testdir}/ecdsa.pem)\n" | socat "${tmpdir}/h1/stats" - |
| 45 | echo "commit ssl cert ${testdir}/common.pem" | socat "${tmpdir}/h1/stats" - |
| 46 | } |
| 47 | |
| 48 | haproxy h1 -cli { |
| 49 | send "show ssl cert ${testdir}/common.pem" |
| 50 | expect ~ ".*SHA1 FingerPrint: A490D069DBAFBEE66DE434BEC34030ADE8BCCBF1" |
| 51 | } |
| 52 | |
| 53 | shell { |
| 54 | HOST=${h1_frt_addr} |
| 55 | if [ "${h1_frt_addr}" = "::1" ] ; then |
| 56 | HOST="\[::1\]" |
| 57 | fi |
| 58 | curl -v -i -k https://$HOST:${h1_frt_port} 2>&1 | grep CN=localhost |
| 59 | } |