-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨(project) add acl-proxy application
We need fine-grained control over dashboard permissions to ensure users cannot access variable values they are not expected to. As it appears that we cannot forbid dashboard input variable values passed via a GET request, we've designed a FastAPI-based application that proxy dashboards requests and check input values given grafana logged user. The acl-proxy application is used as a companion of our grafana instance along with the Caddy2 web proxy using an x-accel-redirect workflow.
- Loading branch information
Showing
25 changed files
with
1,593 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,28 @@ | ||
# Mac Os | ||
.DS_Store | ||
|
||
# Ignore compiled objects | ||
var/ | ||
|
||
# Ignore node packages | ||
node_modules/ | ||
dist/ | ||
coverage/ | ||
|
||
# == Python | ||
# Packaging | ||
build | ||
dist | ||
*.egg-info | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.coverage | ||
.cache | ||
.pytest_cache | ||
nosetests.xml | ||
coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
declare DOCKER_USER | ||
DOCKER_USER="$(id -u):$(id -g)" | ||
|
||
DOCKER_USER=${DOCKER_USER} docker-compose run --rm acl pytest "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"version": 1, | ||
"disable_existing_loggers": false, | ||
"formatters": { | ||
"default": { | ||
"()": "uvicorn.logging.DefaultFormatter", | ||
"fmt": "%(levelprefix)s %(name)s:%(funcName)s >> %(message)s", | ||
"use_colors": true | ||
}, | ||
"access": { | ||
"()": "uvicorn.logging.AccessFormatter", | ||
"fmt": "%(levelprefix)s %(client_addr)s - \"%(request_line)s\" %(status_code)s" | ||
} | ||
}, | ||
"handlers": { | ||
"default": { | ||
"formatter": "default", | ||
"class": "logging.StreamHandler", | ||
"stream": "ext://sys.stderr" | ||
}, | ||
"access": { | ||
"formatter": "access", | ||
"class": "logging.StreamHandler", | ||
"stream": "ext://sys.stdout" | ||
} | ||
}, | ||
"loggers": { | ||
"uvicorn": { "handlers": ["default"], "level": "INFO" }, | ||
"uvicorn.error": { "level": "INFO" }, | ||
"uvicorn.access": { | ||
"handlers": ["access"], | ||
"level": "INFO", | ||
"propagate": false | ||
}, | ||
"acl": {"handlers": ["default"], "level": "DEBUG"} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
localhost:8090 | ||
|
||
reverse_proxy * grafana:3000 | ||
|
||
reverse_proxy /d/* acl:8000 { | ||
|
||
@accel header X-Accel-Redirect * | ||
handle_response @accel { | ||
rewrite {http.reverse_proxy.header.X-Accel-Redirect} | ||
reverse_proxy grafana:3000 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
EDX_DATABASE_HOST=edx_mysql | ||
EDX_DATABASE_NAME=edxapp | ||
EDX_DATABASE_PORT=3306 | ||
EDX_DATABASE_USER_NAME=edxapp_user | ||
EDX_DATABASE_USER_PASSWORD=funfunfun | ||
EDX_DATASOURCE_NAME=edx_app | ||
GRAFANA_ROOT_URL=http://grafana:3000 | ||
# Required for aiomysql | ||
USERNAME=acl | ||
# Grafana | ||
GRAFANA_DATABASE_HOST=postgresql | ||
GRAFANA_DATABASE_NAME=potsie | ||
GRAFANA_DATABASE_PORT=5432 | ||
GRAFANA_DATABASE_USER_NAME=fun | ||
GRAFANA_DATABASE_USER_PASSWORD=pass |
Oops, something went wrong.