forked from sni/thruk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththruk_cookie_auth.example
21 lines (19 loc) · 1014 Bytes
/
thruk_cookie_auth.example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# put the RewriteLock outside your virtual hosts (only required for apache < 2.4)
<IfModule !mod_authz_core.c>
RewriteLock "/var/cache/thruk/apache_rewrite.lock"
</IfModule>
# put everything else inside your vhost
RewriteMap thruk_users prg:/usr/lib/thruk/thruk_auth
RewriteCond %{REQUEST_URI} !^/thruk/cgi-bin/restricted.cgi
RewriteCond %{REQUEST_URI} ^/thruk # limit thruk cookie auth to thruk itself in standalone mode
RewriteCond %{HTTP_COOKIE} (thruk_auth=[^;]+|$) [NC]
RewriteRule ^/(.*)$ /%1/%{REMOTE_ADDR}/____/$1/____/%{QUERY_STRING} [C,NS]
RewriteRule ^(.*)$ ${thruk_users:$1|/loginbad/} [C,NS]
RewriteRule ^/pass/(.*)$ /$1 [NS,PT,L,E=!REMOTE_USER]
RewriteRule ^/redirect/(.*)$ /$1 [NS,L,R=302]
RewriteRule ^/loginok/([^/]+)/(.*)$ /$2 [NS,PT,L,E=REMOTE_USER:$1]
<LocationMatch ^/thruk(?!/cgi-bin/restricted.cgi)>
Order allow,deny
Allow from all
Satisfy any
</LocationMatch>