Created
January 9, 2019 12:15
-
-
Save bzed/e1e6c76e98225f997062c57aacecd2fd to your computer and use it in GitHub Desktop.
haproxy pem formatted ssl client cert fetch - ssl_c_pem - like ssl_c_der
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("base64") | |
core.register_fetches("ssl_c_pem", function(txn) | |
local der = txn.f:ssl_c_der() | |
local wrap = ('.'):rep(64); | |
local envelope = "-----BEGIN %s-----\n%s\n-----END %s-----\n" | |
local typ = "CERTIFICATE"; | |
der = base64.encode(data); | |
return string.format(envelope, typ, der:gsub(wrap, '%0\n', (#der-1)/64), typ); | |
end) |
For folks finding this many years later, here is a working example
nice, thank you very much! Can't even remember which haproxy version we used back then :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For folks finding this many years later, here is a working example
This will add the
X-SSL-Client-Cert
header to the request or response with the contents of the header being URL encoded PEM of the client certificate and chain.You can use it in your haproxy config under a frontend like so
If you are using this header in hashicorp vault for example you'll want this config on the listener