[omd-commits] OMD Git: omd: Check_MK: Added missing MULTISITE_COOKIE_AUTH hook

git version control git at mathias-kettner.de
Mon May 7 10:17:03 CEST 2012


Module:   omd
Branch:   master
Commit:   db764b70796979af7beebbdca6d1f272cc5334fe
URL:      http://omdistro.org/projects/omd/repository/revisions/db764b70796979af7beebbdca6d1f272cc5334fe

Author:   Lars Michelsen <lm at mathias-kettner.de>
Date:     Mon May  7 09:32:04 2012 +0200
Commiter: Lars Michelsen <lm at mathias-kettner.de>
Date:     Mon May  7 09:32:04 2012 +0200

Check_MK: Added missing MULTISITE_COOKIE_AUTH hook

---

 packages/check_mk/MULTISITE_COOKIE_AUTH.hook |   43 ++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/packages/check_mk/MULTISITE_COOKIE_AUTH.hook b/packages/check_mk/MULTISITE_COOKIE_AUTH.hook
new file mode 100755
index 0000000..bc16f43
--- /dev/null
+++ b/packages/check_mk/MULTISITE_COOKIE_AUTH.hook
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+# Alias: Use multisite cookie auth
+# Menu: Web GUI
+# Description: 
+#  Multisite provides a cookie based authentication which can be
+#  used as alternative to the default basic authentication.
+#  The cookie authentication is done by multisite. The cookie can
+#  also be used by other addons like NagVis. This is switched
+#  using this option.
+
+case "$1" in
+   default)
+       echo "on"
+   ;;
+   choices)
+       echo "on: use cookie authentication"
+       echo "off: use basic authentication"
+   ;;
+   set)
+       APACHE_CFG=${OMD_ROOT}/etc/apache/conf.d/cookie_auth.conf
+       NAGVIS_CFG=${OMD_ROOT}/etc/nagvis/conf.d/cookie_auth.ini.php
+       if [ "$2" == "on" ]; then
+           cat > $APACHE_CFG <<EOF
+<LocationMatch ^/${OMD_SITE}/(omd|nagvis|check_mk|pnp4nagios)>
+    Order allow,deny
+    Allow from all
+    Satisfy any
+</LocationMatch>
+EOF
+
+          cat > $NAGVIS_CFG <<EOF
+[global]
+logonmodule="LogonMultisite"
+logon_multisite_secret="/omd/sites/$OMD_SITE/etc/auth.secret"
+logon_multisite_htpasswd="/omd/sites/$OMD_SITE/etc/htpasswd"
+EOF
+       else
+          [ -f $APACHE_CFG ] && rm $APACHE_CFG
+          [ -f $NAGVIS_CFG ] && rm $NAGVIS_CFG
+       fi
+   ;;
+esac



More information about the omd-commits mailing list