Skip to content

Instantly share code, notes, and snippets.

@kylekrall
Last active August 29, 2015 13:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylekrall/8946831 to your computer and use it in GitHub Desktop.
Save kylekrall/8946831 to your computer and use it in GitHub Desktop.
Logstash + Kibana + Nginx + Google_Auth_Proxy - Authentication w/ Google OAuth2 using bit.ly's google_auth_proxy - Restrict dashboard editing to specific users
location ~ ^/kibana-int/dashboard/.*$ {
set $privs NA; # by default, no privs needed
proxy_read_timeout 90;
if ( $request_method ~ (PUT|DELETE) ) {
set $privs M; # M for modify
}
if ( $remote_user ~ (admin1|admin2|admin3|admin4) ) {
set $privs "${privs}Y"; # Y for admin
}
if ( $privs = MY ) {
proxy_pass http://127.0.0.1:9200; # if modify w/ admin proxy it over
}
if ( $privs = M ) {
return 401; # if modify w/o admin return 401 Unauthorized
}
if ( $request_method !~ (PUT|DELETE) ) {
proxy_pass http://127.0.0.1:9200; # acts as an else statement
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment