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 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where does the 'data' variable on line 9 get defined?