aboutsummaryrefslogtreecommitdiffstats
path: root/lualib
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-11-30 11:50:27 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-11-30 11:50:50 +0000
commit2a712a329f217418b5393764d644362164ef0ca5 (patch)
treeb07910934ed38584666f9089af2978f5843b3f18 /lualib
parent3e6f598582a6d49e29ad7f2256be8a9745129d0e (diff)
downloadrspamd-2a712a329f217418b5393764d644362164ef0ca5.tar.gz
rspamd-2a712a329f217418b5393764d644362164ef0ca5.zip
[Minor] Allow to ask password from terminal
Diffstat (limited to 'lualib')
-rw-r--r--lualib/rspamadm/clickhouse.lua18
1 files changed, 15 insertions, 3 deletions
diff --git a/lualib/rspamadm/clickhouse.lua b/lualib/rspamadm/clickhouse.lua
index f8f339654..d1bbbef1a 100644
--- a/lualib/rspamadm/clickhouse.lua
+++ b/lualib/rspamadm/clickhouse.lua
@@ -38,9 +38,14 @@ parser:option '-d --database'
parser:flag '--no-ssl-verify'
:description 'Disable SSL verification'
:argname('no_ssl_verify')
-parser:option '-p --password'
- :description 'Password to use for Clickhouse'
- :argname('password')
+parser:mutex(
+ parser:option '-p --password'
+ :description 'Password to use for Clickhouse'
+ :argname('password'),
+ parser:flag '-a --ask-password'
+ :description 'Ask password from the terminal'
+ :argname('ask_password')
+)
parser:option '-s --server'
:description 'Address[:port] to connect to Clickhouse with'
:argname('server')
@@ -228,6 +233,13 @@ local function handler(args)
load_config(cmd_opts.config_file)
local cfg_opts = rspamd_config:get_all_opt('clickhouse')
+ if cmd_opts.ask_password then
+ local rspamd_util = require "rspamd_util"
+
+ io.write('Password: ')
+ cmd_opts.password = rspamd_util.readpassphrase()
+ end
+
local function override_settings(params)
for _, which in ipairs(params) do
if cmd_opts[which] == nil then