blob: 9497be89c9f10df39834d65273166add47218d50 [file] [log] [blame]
William Lallemand9c1aa0a2019-12-19 11:25:19 +01001#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
10varnishtest "Test the 'set ssl cert' feature of the CLI"
11#REQUIRE_OPTIONS=OPENSSL
William Lallemandd5b464b2019-12-19 14:30:00 +010012#REQUIRE_BINARIES=socat,curl
William Lallemand9c1aa0a2019-12-19 11:25:19 +010013feature ignore_unknown_macro
14
15
16haproxy 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
30haproxy h1 -cli {
31 send "show ssl cert ${testdir}/common.pem"
32 expect ~ ".*SHA1 FingerPrint: 2195C9F0FD58470313013FC27C1B9CF9864BD1C6"
33}
34
35shell {
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
43shell {
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
48haproxy h1 -cli {
49 send "show ssl cert ${testdir}/common.pem"
50 expect ~ ".*SHA1 FingerPrint: A490D069DBAFBEE66DE434BEC34030ADE8BCCBF1"
51}
52
53shell {
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}