diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-04-07 21:50:14 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-04-07 21:50:14 +0100 |
commit | 5bea1b1c639424c178ae8d029774b34f2d62b0e2 (patch) | |
tree | 63a3eab65d04eeadb5ca56bb219005eda729d101 /lualib/rspamadm | |
parent | 81c36ce90012a2977e12eba3ad0a51c499d97dfe (diff) | |
download | rspamd-5bea1b1c639424c178ae8d029774b34f2d62b0e2.tar.gz rspamd-5bea1b1c639424c178ae8d029774b34f2d62b0e2.zip |
[Minor] Fix key type in output
Diffstat (limited to 'lualib/rspamadm')
-rw-r--r-- | lualib/rspamadm/dkim_keygen.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lualib/rspamadm/dkim_keygen.lua b/lualib/rspamadm/dkim_keygen.lua index c00371298..5fff5707f 100644 --- a/lualib/rspamadm/dkim_keygen.lua +++ b/lualib/rspamadm/dkim_keygen.lua @@ -85,12 +85,13 @@ end local function print_public_key_dns(opts, base64_pk) + local key_type = opts.type == 'rsa' and 'rsa' or 'ed25519' if #base64_pk < 255 - 2 then - io.write(string.format('%s._domainkey IN TXT ( "v=DKIM1; k=rsa;" \n\t"p=%s" ) ;\n', opts.selector, base64_pk)) + io.write(string.format('%s._domainkey IN TXT ( "v=DKIM1; k=%s;" \n\t"p=%s" ) ;\n', opts.selector, key_type, base64_pk)) else -- Split it by parts local parts = split_string(base64_pk) - io.write(string.format('%s._domainkey IN TXT ( "v=DKIM1; k=rsa; "\n', opts.selector)) + io.write(string.format('%s._domainkey IN TXT ( "v=DKIM1; k=%s; "\n', opts.selector, key_type)) for i,part in ipairs(parts) do if i == 1 then io.write(string.format('\t"p=%s"\n', part)) @@ -104,6 +105,7 @@ local function print_public_key_dns(opts, base64_pk) end local function print_public_key(opts, pk) + local key_type = opts.type == 'rsa' and 'rsa' or 'ed25519' local base64_pk = tostring(rspamd_util.encode_base64(pk)) if opts.output == 'plain' then io.write(base64_pk) @@ -111,7 +113,7 @@ local function print_public_key(opts, pk) elseif opts.output == 'dns' then print_public_key_dns(opts, base64_pk) elseif opts.output == 'dnskey' then - io.write(string.format('v=DKIM1; k=rsa; p=%s\n', base64_pk)) + io.write(string.format('v=DKIM1; k=%s; p=%s\n', key_type, base64_pk)) end end |