-
-
Save bzed/e1e6c76e98225f997062c57aacecd2fd to your computer and use it in GitHub Desktop.
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) |
That basically means that it can't find the base64 functions.
Maybe try
local base64 = require'base64'
somewhere. probably in the function?
I forgot to mention that I installed base64 from luarocks:
https://luarocks.org/modules/iskolbin/base64
Before that I had this error message:
[ALERT] 108/233244 (20196) : parsing [/etc/haproxy/haproxy.conf:14] : lua runtime error: /etc/haproxy/ssl_c_der.lua:1: module 'base64' not found:
no field package.preload['base64']
no file '/usr/share/lua/5.3/base64.lua'
no file '/usr/share/lua/5.3/base64/init.lua'
no file '/usr/lib64/lua/5.3/base64.lua'
no file '/usr/lib64/lua/5.3/base64/init.lua'
no file './base64.lua'
no file './base64/init.lua'
no file '/usr/lib64/lua/5.3/base64.so'
no file '/usr/lib64/lua/5.3/loadall.so'
no file './base64.so'
Where does the 'data' variable on line 9 get defined?
That basically means that it can't find the base64 functions.
Maybe try
somewhere. probably in the function?