summaryrefslogtreecommitdiffstats
path: root/debian/tests/utils
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:35:12 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:35:12 +0000
commit89057599f4791f03c1ee5de836fbe2b5ea434aa9 (patch)
tree09ef6df146509f94541c1afe9cbd78b7f75e81e7 /debian/tests/utils
parentAdding upstream version 2.6.12. (diff)
downloadhaproxy-89057599f4791f03c1ee5de836fbe2b5ea434aa9.tar.xz
haproxy-89057599f4791f03c1ee5de836fbe2b5ea434aa9.zip
Adding debian version 2.6.12-1+deb12u1.debian/2.6.12-1+deb12u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/utils')
-rw-r--r--debian/tests/utils58
1 files changed, 58 insertions, 0 deletions
diff --git a/debian/tests/utils b/debian/tests/utils
new file mode 100644
index 0000000..df11b55
--- /dev/null
+++ b/debian/tests/utils
@@ -0,0 +1,58 @@
+
+create_ca() {
+ certtool --generate-privkey --bits 4096 --outfile /etc/ssl/private/mycakey.pem
+
+ cat <<EOF > /etc/ssl/ca.info
+cn = Example Company
+ca
+cert_signing_key
+expiration_days = 3650
+EOF
+
+ certtool --generate-self-signed \
+ --load-privkey /etc/ssl/private/mycakey.pem \
+ --template /etc/ssl/ca.info \
+ --outfile /usr/local/share/ca-certificates/mycacert.crt
+
+ update-ca-certificates
+}
+
+create_selfsigned_cert() {
+ dir="$1"
+ mkdir -p "${dir}"
+
+ certtool --generate-privkey --bits 2048 --outfile "${dir}/localhost_key.pem"
+
+ cat <<EOF > "${dir}/localhost.info"
+organization = Example Company
+cn = localhost
+tls_www_server
+encryption_key
+signing_key
+expiration_days = 365
+EOF
+
+ certtool --generate-certificate \
+ --load-privkey "${dir}/localhost_key.pem" \
+ --load-ca-certificate /etc/ssl/certs/mycacert.pem \
+ --load-ca-privkey /etc/ssl/private/mycakey.pem \
+ --template "${dir}/localhost.info" \
+ --outfile "${dir}/localhost_cert.pem"
+
+ cat "${dir}/localhost_cert.pem" "${dir}/localhost_key.pem" | tee "${dir}/localhost.pem"
+ chgrp haproxy "${dir}/localhost_key.pem" "${dir}/localhost.pem"
+ chmod 0640 "${dir}/localhost_key.pem" "${dir}/localhost.pem"
+}
+
+check_index_file() {
+ haproxy_url="$1"
+ # index.html is shipped with apache2
+ # Download it via haproxy and compare
+ if wget -t1 "${haproxy_url}" -O- | cmp /var/www/html/index.html -; then
+ echo "OK: index.html downloaded via haproxy matches the source file."
+ else
+ echo "FAIL: downloaded index.html via haproxy is different from the"
+ echo " file delivered by apache."
+ exit 1
+ fi
+}