From 52a76fdb61c11d665eaa8826a8377b0528094e7b Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 29 Apr 2013 13:59:39 +0200 Subject: prosodyctl: Add message describing the distinguished name input expected --- prosodyctl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 30a10b9a..06590d1c 100755 --- a/prosodyctl +++ b/prosodyctl @@ -660,6 +660,8 @@ function cert_commands.config(arg) end local conf = openssl.config.new(); conf:from_prosody(hosts, config, arg); + show_message("Please provide details to include in the certificate config file."); + show_message("Leave the field empty to use the default value or '.' to exclude the field.") for k, v in pairs(conf.distinguished_name) do local nv; if k == "commonName" then -- cgit v1.2.3 From 3de4a3491951b78efd84113df1870f0ca8432bf9 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 29 Apr 2013 14:00:44 +0200 Subject: prosodyctl: Ask about the distinguished name in a in a consistent order --- prosodyctl | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 06590d1c..88daf11b 100755 --- a/prosodyctl +++ b/prosodyctl @@ -662,19 +662,22 @@ function cert_commands.config(arg) conf:from_prosody(hosts, config, arg); show_message("Please provide details to include in the certificate config file."); show_message("Leave the field empty to use the default value or '.' to exclude the field.") - for k, v in pairs(conf.distinguished_name) do - local nv; - if k == "commonName" then - v = arg[1] - elseif k == "emailAddress" then - v = "xmpp@" .. arg[1]; - end - nv = show_prompt(("%s (%s):"):format(k, nv or v)); - nv = (not nv or nv == "") and v or nv; - if nv:find"[\192-\252][\128-\191]+" then - conf.req.string_mask = "utf8only" + for i, k in ipairs(openssl._DN_order) do + local v = conf.distinguished_name[k]; + if v then + local nv; + if k == "commonName" then + v = arg[1] + elseif k == "emailAddress" then + v = "xmpp@" .. arg[1]; + end + nv = show_prompt(("%s (%s):"):format(k, nv or v)); + nv = (not nv or nv == "") and v or nv; + if nv:find"[\192-\252][\128-\191]+" then + conf.req.string_mask = "utf8only" + end + conf.distinguished_name[k] = nv ~= "." and nv or nil; end - conf.distinguished_name[k] = nv ~= "." and nv or nil; end local conf_file = io.open(conf_filename, "w"); conf_file:write(conf:serialize()); -- cgit v1.2.3 From eaf4462508016c6b5f9e750b13d77891a7b95c61 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 29 Apr 2013 14:01:19 +0200 Subject: prosodyctl: Guess the country from the TLD for the cert config --- prosodyctl | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 88daf11b..247b099a 100755 --- a/prosodyctl +++ b/prosodyctl @@ -670,6 +670,11 @@ function cert_commands.config(arg) v = arg[1] elseif k == "emailAddress" then v = "xmpp@" .. arg[1]; + elseif k == "countryName" then + local tld = arg[1]:match"%.([a-z]+)$"; + if tld and #tld == 2 and tld ~= "uk" then + v = tld:upper(); + end end nv = show_prompt(("%s (%s):"):format(k, nv or v)); nv = (not nv or nv == "") and v or nv; -- cgit v1.2.3