Module: check_mk
Branch: master
Commit: 7d6ec28b8b1dc7a81ef937585501a599711a6ecf
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7d6ec28b8b1dc7…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Sat Jan 26 21:49:03 2019 +0100
Refactored LDAP user sync plugins to plugin registry
* Clarified plugin API
* Reduced special cases
* Fixed localization of plugin titles / help texts
* Added tests for plugin registration
* Added no migration code for legacy plugins. A warning will
be shown when legacy plugins are found. You will have to migrate
them after update to 1.6
CMK-1572
Change-Id: I5dc54a112a2a1843b6dd27c851a8011c2d8d7136
---
cmk/gui/plugins/userdb/ldap_connector.py | 1139 +++++++++++++---------
cmk/gui/plugins/wato/utils/__init__.py | 3 -
cmk/gui/userdb.py | 8 +-
cmk/gui/wato/pages/ldap.py | 4 +-
tests/unit/cmk/gui/test_userdb.py | 55 ++
tests/unit/cmk/gui/test_userdb_ldap_connector.py | 129 ++-
6 files changed, 810 insertions(+), 528 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=7d6ec28b8b…
Module: check_mk
Branch: master
Commit: 4404711fb4a3d916dd798e20527a26cd9824600a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4404711fb4a3d9…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jan 28 23:42:07 2019 +0100
7078 FIX Docker container: Don't print missleading initial password with CMK_PASSWORD
When using the environment option CMK_PASSWORD to set an initial password,
the previous docker containers showed the default "welcome message" after
site creation with a random initial password. The initial password was set
afterwards leaving the missleading password in the log.
The initial password is now set during site creation which makes the output
don't show the wrong password anymore.
Change-Id: I747cca73798b2ac052815440e96e686eb71ad434
---
.werks/7078 | 16 ++++++++++++++++
docker/docker-entrypoint.sh | 7 +------
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/.werks/7078 b/.werks/7078
new file mode 100644
index 0000000..f6c297c
--- /dev/null
+++ b/.werks/7078
@@ -0,0 +1,16 @@
+Title: Docker container: Don't print missleading initial password with CMK_PASSWORD
+Level: 1
+Component: omd
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1548715130
+Class: fix
+
+When using the environment option CMK_PASSWORD to set an initial password,
+the previous docker containers showed the default "welcome message" after
+site creation with a random initial password. The initial password was set
+afterwards leaving the missleading password in the log.
+
+The initial password is now set during site creation which makes the output
+don't show the wrong password anymore.
diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh
index 985a2ee..b17e7fa 100755
--- a/docker/docker-entrypoint.sh
+++ b/docker/docker-entrypoint.sh
@@ -34,18 +34,13 @@ fi
# site tmpfs below tmp.
if [ ! -d "/opt/omd/sites/$CMK_SITE_ID/etc" ] ; then
echo "### CREATING SITE '$CMK_SITE_ID'"
- omd create --no-tmpfs -u 1000 -g 1000 "$CMK_SITE_ID"
+ omd create --no-tmpfs -u 1000 -g 1000 --admin-password "$CMK_PASSWORD" "$CMK_SITE_ID"
omd config "$CMK_SITE_ID" set APACHE_TCP_ADDR 0.0.0.0
omd config "$CMK_SITE_ID" set APACHE_TCP_PORT 5000
if [ "$CMK_LIVESTATUS_TCP" = "on" ]; then
omd config "$CMK_SITE_ID" set LIVESTATUS_TCP on
fi
-
- if [ -n "$CMK_PASSWORD" ]; then
- echo "### SETTING PASSWORD OF 'cmkadmin'"
- htpasswd -b -m "/omd/sites/$CMK_SITE_ID/etc/htpasswd" cmkadmin "$CMK_PASSWORD"
- fi
fi
# In case of an update (see update procedure docs) the container is started
Module: check_mk
Branch: master
Commit: 4dfb88f2b1a86c94254481f60f062275939f74b8
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4dfb88f2b1a86c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jan 28 23:24:44 2019 +0100
Add support for pre-created site directory with tmpfs
In dockerized environments the tmpfs may be managed by docker using the
--tmpfs option). In this case the site directory created as parent of
the tmp directory to mount the tmpfs container initialization. Detect
this situation and don't treat the site as existing in that case.
Change-Id: Iaef722a67e385fd7c42d34e49c17c679a0dc8970
---
docker/docker-entrypoint.sh | 6 +++++-
omd/packages/omd/omdlib/main.py | 18 +++++++++++++++++-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh
index d334c62..985a2ee 100755
--- a/docker/docker-entrypoint.sh
+++ b/docker/docker-entrypoint.sh
@@ -28,7 +28,11 @@ if [ ! -z "$MAIL_RELAY_HOST" ]; then
fi
# Create the site in case it does not exist
-if [ ! -d "/opt/omd/sites/$CMK_SITE_ID" ] ; then
+#
+# Check for a file in the directory because the directory itself might have
+# been pre-created by docker when the --tmpfs option is used to create a
+# site tmpfs below tmp.
+if [ ! -d "/opt/omd/sites/$CMK_SITE_ID/etc" ] ; then
echo "### CREATING SITE '$CMK_SITE_ID'"
omd create --no-tmpfs -u 1000 -g 1000 "$CMK_SITE_ID"
omd config "$CMK_SITE_ID" set APACHE_TCP_ADDR 0.0.0.0
diff --git a/omd/packages/omd/omdlib/main.py b/omd/packages/omd/omdlib/main.py
index e5bc7ae..62dde00 100644
--- a/omd/packages/omd/omdlib/main.py
+++ b/omd/packages/omd/omdlib/main.py
@@ -2868,7 +2868,11 @@ def main_rm(site, args, options=None):
def create_site_dir(site):
- os.makedirs(site.dir)
+ try:
+ os.makedirs(site.dir)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
os.chown(site.dir, user_id(site.name), group_id(site.name))
@@ -4217,6 +4221,18 @@ class SiteContext(AbstractSiteContext):
return config
def exists(self):
+ # In dockerized environments the tmpfs may be managed by docker (when
+ # using the --tmpfs option). In this case the site directory is
+ # created as parent of the tmp directory to mount the tmpfs during
+ # container initialization. Detect this situation and don't treat the
+ # site as existing in that case.
+ if is_dockerized():
+ if not os.path.exists(self.dir):
+ return False
+ if os.listdir(self.dir) == ["tmp"]:
+ return False
+ return True
+
return os.path.exists(self.dir)
def is_empty(self):