You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like better support for cryptography in HAProxy. Specifically, I would like a stateless encryption & decryption API that doesn’t use a nonce and instead generates a long (192 bits or more) nonce using getentropy(). This could use XChaCha20-Poly1305 or an equivalent based on AES-GCM. The converter should also include the nonce and authentication tag in the output, which is often what one wants.
What are you trying to do?
While building a toy OpenID Connect relying party in HAProxy, I found that the current cryptographic converters are very error-prone and very difficult to use:
aes_gcm_enc and aes_gcm_dec are very difficult to use in a way that is not prone to nonce reuse, which leaks the authentication key.
There is no CSPRNG exposed to config files or Lua scripts.
Users need to base64-encode keys before using them for encryption, which isn’t great and is potentially vulnerable to timing attacks if the encoding is not constant-time.
Lua converters can only take strings as arguments, not binary data.
Overall, I concluded that the only reasonable solution is to use a C library with Lua bindings.
Output of haproxy -vv
HAProxy version 3.1.7 2025/04/17 - https://haproxy.org/
Status: stable branch - will stop receiving fixes around Q1 2026.
Known bugs: http://www.haproxy.org/bugs/bugs-3.1.7.html
Running on: Linux 6.12.25-1.qubes.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Apr 28 03:58:25 GMT 2025 x86_64
Build options :
TARGET = linux-glibc
CC = cc
CFLAGS = -O2 -g -fwrapv
OPTIONS = USE_PTHREAD_EMULATION=0 USE_OPENSSL=1 USE_LUA=1 USE_QUIC=1 USE_PCRE2=1 USE_PCRE2_JIT=1 USE_QUIC_OPENSSL_COMPAT=1
DEBUG =
Feature list : -51DEGREES +ACCEPT4 +BACKTRACE -CLOSEFROM +CPU_AFFINITY +CRYPT_H -DEVICEATLAS +DL -ENGINE +EPOLL -EVPORTS +GETADDRINFO -KQUEUE -LIBATOMIC +LIBCRYPT +LINUX_CAP +LINUX_SPLICE +LINUX_TPROXY +LUA +MATH -MEMORY_PROFILING +NETFILTER +NS -OBSOLETE_LINKER +OPENSSL -OPENSSL_AWSLC -OPENSSL_WOLFSSL -OT -PCRE +PCRE2 +PCRE2_JIT -PCRE_JIT +POLL +PRCTL -PROCCTL -PROMEX -PTHREAD_EMULATION +QUIC +QUIC_OPENSSL_COMPAT +RT +SHM_OPEN +SLZ +SSL -STATIC_PCRE -STATIC_PCRE2 +TFO +THREAD +THREAD_DUMP +TPROXY -WURFL -ZLIB
Default settings :
bufsize = 16384, maxrewrite = 1024, maxpollevents = 200
Built with multi-threading support (MAX_TGROUPS=16, MAX_THREADS=256, default=2).
Built with OpenSSL version : OpenSSL 3.2.4 11 Feb 2025
Running on OpenSSL version : OpenSSL 3.2.4 11 Feb 2025
OpenSSL library supports TLS extensions : yes
OpenSSL library supports SNI : yes
OpenSSL library supports : TLSv1.0 TLSv1.1 TLSv1.2 TLSv1.3
OpenSSL providers loaded : default
Built with Lua version : Lua 5.4.7
Built with network namespace support.
Built with libslz for stateless compression.
Compression algorithms supported : identity("identity"), deflate("deflate"), raw-deflate("deflate"), gzip("gzip")
Built with transparent proxy support using: IP_TRANSPARENT IPV6_TRANSPARENT IP_FREEBIND
Built with PCRE2 version : 10.44 2024-06-07
PCRE2 library supports JIT : yes
Encrypted password support via crypt(3): yes
Built with gcc compiler version 14.2.1 20250110 (Red Hat 14.2.1-7)
Available polling systems :
epoll : pref=300, test result OK
poll : pref=200, test result OK
select : pref=150, test result OK
Total: 3 (3 usable), will use epoll.
Available multiplexer protocols :
(protocols marked as <default> cannot be specified using 'proto' keyword)
quic : mode=HTTP side=FE mux=QUIC flags=HTX|NO_UPG|FRAMED
h2 : mode=HTTP side=FE|BE mux=H2 flags=HTX|HOL_RISK|NO_UPG
<default> : mode=HTTP side=FE|BE mux=H1 flags=HTX
h1 : mode=HTTP side=FE|BE mux=H1 flags=HTX|NO_UPG
fcgi : mode=HTTP side=BE mux=FCGI flags=HTX|HOL_RISK|NO_UPG
<default> : mode=SPOP side=BE mux=SPOP flags=HOL_RISK|NO_UPG
spop : mode=SPOP side=BE mux=SPOP flags=HOL_RISK|NO_UPG
<default> : mode=TCP side=FE|BE mux=PASS flags=
none : mode=TCP side=FE|BE mux=PASS flags=NO_UPG
Available services : none
Available filters :
[BWLIM] bwlim-in
[BWLIM] bwlim-out
[CACHE] cache
[COMP] compression
[FCGI] fcgi-app
[SPOE] spoe
[TRACE] trace
The text was updated successfully, but these errors were encountered:
Your Feature Request
I would like better support for cryptography in HAProxy. Specifically, I would like a stateless encryption & decryption API that doesn’t use a nonce and instead generates a long (192 bits or more) nonce using
getentropy()
. This could use XChaCha20-Poly1305 or an equivalent based on AES-GCM. The converter should also include the nonce and authentication tag in the output, which is often what one wants.What are you trying to do?
While building a toy OpenID Connect relying party in HAProxy, I found that the current cryptographic converters are very error-prone and very difficult to use:
aes_gcm_enc
andaes_gcm_dec
are very difficult to use in a way that is not prone to nonce reuse, which leaks the authentication key.Overall, I concluded that the only reasonable solution is to use a C library with Lua bindings.
Output of
haproxy -vv
The text was updated successfully, but these errors were encountered: