3 # Alias: Use multisite cookie auth
6 # Multisite provides a cookie based authentication which can be
7 # used as alternative to the default basic authentication.
8 # The cookie authentication is done by multisite. The cookie can
9 # also be used by other addons like NagVis. This is switched
17 echo "on: use cookie authentication"
18 echo "off: use basic authentication"
21 APACHE_CFG
=${OMD_ROOT}/etc
/apache
/conf.d
/cookie_auth.conf
22 NAGVIS_CFG
=${OMD_ROOT}/etc
/nagvis
/conf.d
/cookie_auth.ini.php
23 PNP_CFG
=${OMD_ROOT}/etc
/pnp4nagios
/config.d
/cookie_auth.php
24 WIKI_CFG
=${OMD_ROOT}/etc
/dokuwiki
/cookie_auth.php
25 if [ "$2" == "on" ]; then
26 cat > $APACHE_CFG <<EOF
27 <LocationMatch ^/${OMD_SITE}/(omd|wiki|nagvis|check_mk|pnp4nagios)>
34 if [ -d ${NAGVIS_CFG%/*} ]; then
35 cat > $NAGVIS_CFG <<EOF
37 logonmodule="LogonMultisite"
38 logon_multisite_htpasswd="/omd/sites/$OMD_SITE/etc/htpasswd"
39 logon_multisite_secret="/omd/sites/$OMD_SITE/etc/auth.secret"
40 logon_multisite_serials="/omd/sites/$OMD_SITE/etc/auth.serials"
44 if [ -d ${WIKI_CFG%/*} ]; then
47 // Created by OMD hook MULTISITE_COOKIE_AUTH
50 \$conf['authtype'] = 'authmultisite';
51 \$conf['superuser'] = '@admin';
52 \$conf['multisite']['authfile'] = '/omd/sites/$OMD_SITE/var/check_mk/wato/auth/auth.php';
53 \$conf['multisite']['auth_secret'] = '/omd/sites/$OMD_SITE/etc/auth.secret';
54 \$conf['multisite']['auth_serials'] = '/omd/sites/$OMD_SITE/etc/auth.serials';
55 \$conf['multisite']['htpasswd'] = '/omd/sites/$OMD_SITE/etc/htpasswd';
60 if [ -d ${PNP_CFG%/*} ]; then
63 // Created by OMD hook MULTISITE_COOKIE_AUTH
65 // Using the multisite cookie based authentication when no
66 // REMOTE_USER available.
68 \$conf['auth_multisite_enabled'] = TRUE;
69 \$conf['auth_multisite_htpasswd'] = '/omd/sites/$OMD_SITE/etc/htpasswd';
70 \$conf['auth_multisite_secret'] = '/omd/sites/$OMD_SITE/etc/auth.secret';
71 \$conf['auth_multisite_serials'] = '/omd/sites/$OMD_SITE/etc/auth.serials';
72 \$conf['auth_multisite_login_url'] = '/$OMD_SITE/check_mk/login.py';
78 [ -f $APACHE_CFG ] && rm $APACHE_CFG
79 [ -f $NAGVIS_CFG ] && rm $NAGVIS_CFG
80 [ -f $PNP_CFG ] && rm $PNP_CFG
81 [ -f $WIKI_CFG ] && rm $WIKI_CFG