mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-20 14:03:07 +01:00
Add simple auth (#186)
This commit is contained in:
52
dev/docker-compose-with-keycloak.yml
Normal file
52
dev/docker-compose-with-keycloak.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
version: '2.4'
|
||||
services:
|
||||
nginx:
|
||||
image: nginx:1.21
|
||||
volumes:
|
||||
- ./nginx-with-keycloak.conf:/etc/nginx/nginx.conf:ro
|
||||
ports: [ "80:80", "8529:8529", "9000:9000", "9002:9002", "9003:9003" ]
|
||||
networks: [ catalyst ]
|
||||
|
||||
arangodb:
|
||||
image: arangodb/arangodb:3.8.1
|
||||
environment:
|
||||
ARANGO_ROOT_PASSWORD: foobar
|
||||
networks: [ catalyst ]
|
||||
|
||||
minio:
|
||||
image: minio/minio:RELEASE.2021-12-10T23-03-39Z
|
||||
environment:
|
||||
MINIO_ROOT_USER: minio
|
||||
MINIO_ROOT_PASSWORD: minio123
|
||||
command: server /data -console-address ":9003"
|
||||
networks: [ catalyst ]
|
||||
|
||||
postgres:
|
||||
image: postgres:13
|
||||
environment:
|
||||
POSTGRES_DB: keycloak
|
||||
POSTGRES_USER: keycloak
|
||||
POSTGRES_PASSWORD: password
|
||||
networks: [ catalyst ]
|
||||
|
||||
keycloak:
|
||||
image: quay.io/keycloak/keycloak:14.0.0
|
||||
environment:
|
||||
DB_VENDOR: POSTGRES
|
||||
DB_ADDR: postgres
|
||||
DB_DATABASE: keycloak
|
||||
DB_USER: keycloak
|
||||
DB_SCHEMA: public
|
||||
DB_PASSWORD: password
|
||||
KEYCLOAK_USER: admin
|
||||
KEYCLOAK_PASSWORD: admin
|
||||
KEYCLOAK_IMPORT: /tmp/realm.json
|
||||
PROXY_ADDRESS_FORWARDING: "true"
|
||||
volumes:
|
||||
- ./keycloak/realm.json:/tmp/realm.json
|
||||
depends_on: [ postgres ]
|
||||
networks: [ catalyst ]
|
||||
|
||||
networks:
|
||||
catalyst:
|
||||
name: catalyst
|
||||
@@ -4,7 +4,7 @@ services:
|
||||
image: nginx:1.21
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
ports: [ "80:80", "8529:8529", "9000:9000", "9001:9001", "9002:9002", "9003:9003" ]
|
||||
ports: [ "80:80", "8529:8529", "9000:9000", "9003:9003" ]
|
||||
networks: [ catalyst ]
|
||||
|
||||
arangodb:
|
||||
@@ -21,32 +21,6 @@ services:
|
||||
command: server /data -console-address ":9003"
|
||||
networks: [ catalyst ]
|
||||
|
||||
postgres:
|
||||
image: postgres:13
|
||||
environment:
|
||||
POSTGRES_DB: keycloak
|
||||
POSTGRES_USER: keycloak
|
||||
POSTGRES_PASSWORD: password
|
||||
networks: [ catalyst ]
|
||||
|
||||
keycloak:
|
||||
image: quay.io/keycloak/keycloak:14.0.0
|
||||
environment:
|
||||
DB_VENDOR: POSTGRES
|
||||
DB_ADDR: postgres
|
||||
DB_DATABASE: keycloak
|
||||
DB_USER: keycloak
|
||||
DB_SCHEMA: public
|
||||
DB_PASSWORD: password
|
||||
KEYCLOAK_USER: admin
|
||||
KEYCLOAK_PASSWORD: admin
|
||||
KEYCLOAK_IMPORT: /tmp/realm.json
|
||||
PROXY_ADDRESS_FORWARDING: "true"
|
||||
volumes:
|
||||
- ./keycloak/realm.json:/tmp/realm.json
|
||||
depends_on: [ postgres ]
|
||||
networks: [ catalyst ]
|
||||
|
||||
networks:
|
||||
catalyst:
|
||||
name: catalyst
|
||||
|
||||
@@ -455,8 +455,8 @@
|
||||
"secret": "d3ec0d91-b6ea-482d-8a4e-2f5a7ca0b4cb",
|
||||
"redirectUris": [
|
||||
"http://catalyst.internal.com/*",
|
||||
"http://localhost:8000/callback",
|
||||
"http://localhost/callback"
|
||||
"http://localhost:8000/auth/callback",
|
||||
"http://localhost/auth/callback"
|
||||
],
|
||||
"webOrigins": [
|
||||
"http://catalyst.internal.com",
|
||||
|
||||
112
dev/nginx-with-keycloak.conf
Normal file
112
dev/nginx-with-keycloak.conf
Normal file
@@ -0,0 +1,112 @@
|
||||
user www-data;
|
||||
worker_processes 5;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
events {
|
||||
worker_connections 4096;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
index index.html index.htm;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] $status '
|
||||
'"$request" $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
resolver 127.0.0.11 valid=30s;
|
||||
set $upstream_catalyst host.docker.internal;
|
||||
proxy_pass http://$upstream_catalyst:8000;
|
||||
}
|
||||
|
||||
location /wss {
|
||||
resolver 127.0.0.11 valid=30s;
|
||||
set $upstream_catalyst host.docker.internal;
|
||||
proxy_pass http://$upstream_catalyst:8000;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_read_timeout 86400;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8529 default_server;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
resolver 127.0.0.11 valid=30s;
|
||||
set $upstream_arangodb arangodb;
|
||||
proxy_pass http://$upstream_arangodb:8529;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 9000 default_server;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $http_host;
|
||||
|
||||
proxy_connect_timeout 300;
|
||||
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
chunked_transfer_encoding off;
|
||||
|
||||
resolver 127.0.0.11 valid=30s;
|
||||
set $upstream_minio minio;
|
||||
proxy_pass http://$upstream_minio:9000;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 9002 default_server;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
resolver 127.0.0.11 valid=30s;
|
||||
set $upstream_keycloak keycloak;
|
||||
proxy_pass http://$upstream_keycloak:8080;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Server $host;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 9003 default_server;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Host $http_host;
|
||||
|
||||
proxy_connect_timeout 300;
|
||||
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
chunked_transfer_encoding off;
|
||||
|
||||
resolver 127.0.0.11 valid=30s;
|
||||
set $upstream_minio minio;
|
||||
proxy_pass http://$upstream_minio:9003;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,24 +70,6 @@ http {
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 9002 default_server;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
resolver 127.0.0.11 valid=30s;
|
||||
set $upstream_keycloak keycloak;
|
||||
proxy_pass http://$upstream_keycloak:8080;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Server $host;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 9003 default_server;
|
||||
server_name _;
|
||||
|
||||
19
dev/start_dev.sh
Normal file
19
dev/start_dev.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
export SECRET=4ef5b29539b70233dd40c02a1799d25079595565e05a193b09da2c3e60ada1cd
|
||||
|
||||
# export OIDC_ENABLE=true
|
||||
export OIDC_ISSUER=http://localhost:9002/auth/realms/catalyst
|
||||
export OIDC_CLIENT_SECRET=d3ec0d91-b6ea-482d-8a4e-2f5a7ca0b4cb
|
||||
|
||||
export ARANGO_DB_HOST=http://localhost:8529
|
||||
export ARANGO_DB_PASSWORD=foobar
|
||||
export S3_HOST=http://localhost:9000
|
||||
export S3_PASSWORD=minio123
|
||||
|
||||
export AUTH_BLOCK_NEW=false
|
||||
export AUTH_DEFAULT_ROLES=analyst,admin
|
||||
|
||||
export EXTERNAL_ADDRESS=http://localhost
|
||||
export CATALYST_ADDRESS=http://host.docker.internal
|
||||
export INITIAL_API_KEY=d0169af94c40981eb4452a42fae536b6caa9be3a
|
||||
|
||||
go run ../cmd/catalyst-dev/*.go
|
||||
20
dev/start_dev_with_keycloak.sh
Normal file
20
dev/start_dev_with_keycloak.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
export SECRET=4ef5b29539b70233dd40c02a1799d25079595565e05a193b09da2c3e60ada1cd
|
||||
|
||||
export SIMPLE_AUTH_ENABLE=false
|
||||
export OIDC_ENABLE=true
|
||||
export OIDC_ISSUER=http://localhost:9002/auth/realms/catalyst
|
||||
export OIDC_CLIENT_SECRET=d3ec0d91-b6ea-482d-8a4e-2f5a7ca0b4cb
|
||||
|
||||
export ARANGO_DB_HOST=http://localhost:8529
|
||||
export ARANGO_DB_PASSWORD=foobar
|
||||
export S3_HOST=http://localhost:9000
|
||||
export S3_PASSWORD=minio123
|
||||
|
||||
export AUTH_BLOCK_NEW=false
|
||||
export AUTH_DEFAULT_ROLES=analyst,admin
|
||||
|
||||
export EXTERNAL_ADDRESS=http://localhost
|
||||
export CATALYST_ADDRESS=http://host.docker.internal
|
||||
export INITIAL_API_KEY=d0169af94c40981eb4452a42fae536b6caa9be3a
|
||||
|
||||
go run ../cmd/catalyst-dev/*.go
|
||||
Reference in New Issue
Block a user