Module: check_mk
Branch: master
Commit: a65aba33c347b32855644377a2b4fec4bd5f72c1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a65aba33c347b3…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jul 26 09:33:53 2016 +0200
Addition password store cleanups
---
bin/pwquery | 15 ---------------
checks/check_http | 2 +-
checks/check_mail | 2 +-
checks/check_mail_loop | 4 ++--
checks/check_mailboxes | 2 +-
checks/check_sql | 2 +-
modules/check_mk_base.py | 5 ++++-
web/htdocs/valuespec.py | 8 +-------
8 files changed, 11 insertions(+), 29 deletions(-)
diff --git a/bin/pwquery b/bin/pwquery
deleted file mode 100755
index 10b6124..0000000
--- a/bin/pwquery
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-
-# this is run from active checks with empty environment, so we somehow need to figure
out
-# where python, the passwordstore.py and the passwordstore itself reside
-
-OMD_ROOT=$1
-shift
-
-export PYTHONPATH=$OMD_ROOT/lib/python:$OMD_ROOT/local/lib/python
-
-$OMD_ROOT/bin/python $OMD_ROOT/lib/python/cmk/passwordstore.py\
- --get $1\
- --keydir $OMD_ROOT/var/check_mk/private_keys\
- --file $OMD_ROOT/var/check_mk/passwords.json
-
diff --git a/checks/check_http b/checks/check_http
index 96dadb8..7641730 100644
--- a/checks/check_http
+++ b/checks/check_http
@@ -95,7 +95,7 @@ def check_http_arguments(params):
if "auth" in settings:
username, password = settings["auth"]
- args += passwordstore.get_cmdline(" -a %s:%%s" %
quote_shell_string(username), password)
+ args += passwordstore_get_cmdline(" -a %s:%%s" %
quote_shell_string(username), password)
if "proxy_auth" in settings:
auth = settings["proxy_auth"]
diff --git a/checks/check_mail b/checks/check_mail
index 347e0d8..a76aa11 100644
--- a/checks/check_mail
+++ b/checks/check_mail
@@ -42,7 +42,7 @@ def check_mail_arguments(params):
args += ' --port=%d' % fetch_port
args += ' --username=%s' %
quote_shell_string(fetch_params['auth'][0])
- args += passwordstore.get_cmdline(" --password=%s",
fetch_params['auth'][1])
+ args += passwordstore_get_cmdline(" --password=%s",
fetch_params['auth'][1])
if 'connect_timeout' in params:
args += ' --connect-timeout=%d' % params['connect_timeout']
diff --git a/checks/check_mail_loop b/checks/check_mail_loop
index dbb104f..bd7ba6a 100644
--- a/checks/check_mail_loop
+++ b/checks/check_mail_loop
@@ -43,7 +43,7 @@ def check_mail_loop_arguments(params):
if 'smtp_auth' in params:
args += ' --smtp-username=%s' %
quote_shell_string(params['smtp_auth'][0])
- args += passwordstore.get_cmdline(" --smtp-password=%s",
params['smtp_auth'][1])
+ args += passwordstore_get_cmdline(" --smtp-password=%s",
params['smtp_auth'][1])
fetch_proto, fetch_params = params['fetch']
args += ' --fetch-protocol=%s' % quote_shell_string(fetch_proto)
@@ -60,7 +60,7 @@ def check_mail_loop_arguments(params):
args += ' --fetch-port=%d' % fetch_port
args += ' --fetch-username=%s' %
quote_shell_string(fetch_params['auth'][0])
- args += passwordstore.get_cmdline(" --fetch-password=%s",
fetch_params['auth'][1])
+ args += passwordstore_get_cmdline(" --fetch-password=%s",
fetch_params['auth'][1])
args += ' --mail-from=%s' % quote_shell_string(params['mail_from'])
args += ' --mail-to=%s' % quote_shell_string(params['mail_to'])
diff --git a/checks/check_mailboxes b/checks/check_mailboxes
index 5e3a857..38212cc 100644
--- a/checks/check_mailboxes
+++ b/checks/check_mailboxes
@@ -44,7 +44,7 @@ def check_mailboxes_arguments(params):
username, password = fetch_params['auth']
args.append('--username=%s' % quote_shell_string(username))
- args.append(passwordstore.get_cmdline("--password=%s", password))
+ args.append(passwordstore_get_cmdline("--password=%s", password))
if 'connect_timeout' in params:
args.append('--connect-timeout=%d' % params['connect_timeout'])
diff --git a/checks/check_sql b/checks/check_sql
index f306cc0..d3c6ceb 100644
--- a/checks/check_sql
+++ b/checks/check_sql
@@ -38,7 +38,7 @@ def check_sql_arguments(params):
args += " --dbms %s" % quote_shell_string(params["dbms"])
args += " --name %s" % quote_shell_string(params["name"])
args += " --user %s" % quote_shell_string(params["user"])
- args += passwordstore.get_cmdline(" --password=%s",
params["password"])
+ args += passwordstore_get_cmdline(" --password=%s",
params["password"])
if "port" in params:
args += " --port %s" % params["port"]
diff --git a/modules/check_mk_base.py b/modules/check_mk_base.py
index 3ff017d..ed6393e 100644
--- a/modules/check_mk_base.py
+++ b/modules/check_mk_base.py
@@ -57,7 +57,6 @@ from cmk.exceptions import MKGeneralException, MKTerminate
from cmk.regex import regex
import cmk.tty as tty
import cmk.render as render
-import cmk.passwordstore as passwordstore
# PLANNED CLEANUP:
# - central functions for outputting verbose information and bailing
@@ -2111,6 +2110,10 @@ def utc_mktime(time_struct):
import calendar
return calendar.timegm(time_struct)
+
+def passwordstore_get_cmdline(fmt, pw):
+ return fmt % quote_shell_string(pw)
+
#.
# .--Check helpers-------------------------------------------------------.
# | ____ _ _ _ _ |
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index f85e422..68b090e 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -3403,13 +3403,7 @@ class PasswordFromStore(Alternative):
def __stored_passwords(self):
- from cmk.passwordstore import CryptoBackend, PasswordStore, NonePasswordProvider
- backend = CryptoBackend(defaults.var_dir + "/private_keys",
NonePasswordProvider())
-
- # TODO: we can't limit the view to only the passwords accessible by the user
because at
- # this point the user_id has not been set yet
- with PasswordStore(defaults.var_dir + "/passwords.json", backend) as
store:
- return store.list(with_details=True)
+ return [] # TODO
def matching_alternative(self, value):