diff options
author | Dani778 <30634612+Dani778@users.noreply.github.com> | 2023-09-18 16:00:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-18 16:00:21 +0200 |
commit | 6a70af486f8dda959d71743e027f122252262c22 (patch) | |
tree | bae047e7af76af224acf1b9fd91e9a0a879b5308 /lualib/rspamadm/configwizard.lua | |
parent | b59249576fb9d87008dd016cc5cfa3e06e69585e (diff) | |
download | rspamd-6a70af486f8dda959d71743e027f122252262c22.tar.gz rspamd-6a70af486f8dda959d71743e027f122252262c22.zip |
Update configwizard.lua
FIXED dkim key generation, update from old api
Diffstat (limited to 'lualib/rspamadm/configwizard.lua')
-rw-r--r-- | lualib/rspamadm/configwizard.lua | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/lualib/rspamadm/configwizard.lua b/lualib/rspamadm/configwizard.lua index fb8bd0d35..2637036f1 100644 --- a/lualib/rspamadm/configwizard.lua +++ b/lualib/rspamadm/configwizard.lua @@ -382,7 +382,10 @@ local function setup_dkim_signing(cfg, changes) end printf("--") end - + local function print_public_key(pk) + local base64_pk = tostring(rspamd_util.encode_base64(pk)) + printf('v=DKIM1; k=rsa; p=%s\n', base64_pk) + end repeat if has_domains then print_domains() @@ -406,22 +409,12 @@ local function setup_dkim_signing(cfg, changes) if not rspamd_util.file_exists(privkey_file) then if ask_yes_no("Do you want to create privkey " .. highlight(privkey_file), true) then - local pubkey_file = privkey_file .. ".pub" - local rspamd_cryptobox = require "rspamd_cryptobox" - local sk, pk = rspamd_cryptobox.generate_keypair("rsa", 2048) - pk:save_to_file(pubkey_file) - sk:save_to_file(privkey_file, tonumber('0600', 8)) - - local f = io.open(pubkey_file) - if not f then - printf("Cannot open pubkey file %s, fatal error", highlight(pubkey_file)) - os.exit(1) - end - - local content = f:read("*all") - f:close() - print("To make dkim signing working, you need to place the following record in your DNS zone:") - print(content) + local rsa = require "rspamd_rsa" + local sk, pk = rsa.keypair(2048) + sk:save(privkey_file, 'pem') + print("You need to chown private key file to rspamd user!!") + print("To make dkim signing working, to place the following record in your DNS zone:") + print_public_key(tostring(pk)) end end @@ -854,4 +847,3 @@ return { name = 'configwizard', description = parser._description, } - |