Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Ory [WIP] #242

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vscode
dom-html.txt
dom-html.txt
.scannerwork/
3 changes: 2 additions & 1 deletion browser-extension/plugin/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
dist/
node_modules/
*.zip
*.env
*.env
.scannerwork/
70 changes: 70 additions & 0 deletions ory/kratos/docker-kratos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
version: '3.7'
services:
kratos-migrate:
image: oryd/kratos:v0.11.1
read_only: true
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
environment:
- DSN=postgres://kratos:secret@postgresd:5432/kratos?sslmode=disable&max_conns=20&max_idle_conns=4
volumes:
- type: bind
source: ./email-password
target: /etc/config/kratos
command: -c /etc/config/kratos/kratos.yml migrate sql -e --yes
restart: on-failure
networks:
- intranet

kratos-selfservice-ui-node:
image: oryd/kratos-selfservice-ui-node:v0.12.6
environment:
- PORT=4455
- SECURITY_MODE=
- KRATOS_PUBLIC_URL=http://kratos:4433/
- KRATOS_BROWSER_URL=http://127.0.0.1:4433/
networks:
- intranet
restart: on-failure

kratos:
depends_on:
- kratos-migrate
image: oryd/kratos:v0.11.1
read_only: true
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
restart: unless-stopped
environment:
- DSN=postgres://kratos:secret@postgresd:5432/kratos?sslmode=disable&max_conns=20&max_idle_conns=4
- LOG_LEVEL=info
command: serve -c /etc/config/kratos/kratos.yml --dev --watch-courier
volumes:
- type: bind
source: ./email-password
target: /etc/config/kratos
networks:
- intranet

postgresd:
image: postgres:15.3
environment:
- POSTGRES_USER=kratos
- POSTGRES_PASSWORD=secret
- POSTGRES_DB=kratos
networks:
- intranet

mailslurper:
image: oryd/mailslurper:latest-smtps
ports:
- '4436:4436'
- '4437:4437'
networks:
- intranet
networks:
intranet:
35 changes: 35 additions & 0 deletions ory/kratos/docker-oathkeeper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: '3.7'

services:
kratos:
environment:
- SERVE_PUBLIC_BASE_URL=http://127.0.0.1:4455/.ory/kratos/public/

kratos-selfservice-ui-node:
environment:
- PORT=4435
- KRATOS_BROWSER_URL=http://127.0.0.1:4455/.ory/kratos/public
- JWKS_URL=http://oathkeeper:4456/.well-known/jwks.json
- SECURITY_MODE=jwks

oathkeeper:
image: oryd/oathkeeper:v0.40.3
read_only: true
cap_drop:
- ALL
security_opt:
- no-new-privileges:true
depends_on:
- kratos
ports:
- "4455:4455"
- "4456:4456"
command:
serve proxy -c "/etc/config/oathkeeper/oathkeeper.yml"
environment:
- LOG_LEVEL=info
restart: on-failure
networks:
- intranet
volumes:
- ../oathkeeper:/etc/config/oathkeeper
39 changes: 39 additions & 0 deletions ory/kratos/email-password/identity.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$id": "./ory/kratos/email-password/identity.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Person",
"type": "object",
"properties": {
"traits": {
"type": "object",
"properties": {
"email": {
"type": "string",
"format": "email",
"title": "E-Mail",
"minLength": 3,
"ory.sh/kratos": {
"credentials": {
"password": {
"identifier": true
},
"totp": {
"account_name": true
}
},
"verification": {
"via": "email"
},
"recovery": {
"via": "email"
}
}
}
},
"required": [
"email"
],
"additionalProperties": false
}
}
}
129 changes: 129 additions & 0 deletions ory/kratos/email-password/kratos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
version: v0.11.1

dsn: memory

serve:
public:
base_url: http://127.0.0.1:4433/
cors:
enabled: true
admin:
base_url: http://kratos:4434/

selfservice:
default_browser_return_url: http://127.0.0.1:4455/
allowed_return_urls:
- http://127.0.0.1:4455

methods:
password:
enabled: true
config:
haveibeenpwned_enabled: true
ignore_network_errors: true
haveibeenpwned_host: "api.pwnedpasswords.com"
min_password_length: 8
identifier_similarity_check_enabled: true
totp:
config:
issuer: Tattle
enabled: true
lookup_secret:
enabled: true
link:
enabled: false
code:
enabled: true
config:
lifespan: 15m
oidc:
enabled: false
webauthn:
enabled: false
profile:
enabled: false

flows:
error:
ui_url: http://127.0.0.1:4455/error

settings:
ui_url: http://127.0.0.1:4455/settings
privileged_session_max_age: 15m
required_aal: highest_available

recovery:
enabled: true
ui_url: http://127.0.0.1:4455/recovery
use: code
lifespan: 15m
#notify_unknown_recipients: false

verification:
enabled: true
ui_url: http://127.0.0.1:4455/verification
use: code
lifespan: 15m
#notify_unknown_recipients: false
after:
default_browser_return_url: http://127.0.0.1:4455/login

logout:
after:
default_browser_return_url: http://127.0.0.1:4455/login

login:
ui_url: http://127.0.0.1:4455/login
lifespan: 10m
after:
password:
hooks:
- hook: require_verified_address

registration:
lifespan: 10m
ui_url: http://127.0.0.1:4455/registration
enabled: true

log:
level: debug
format: text
leak_sensitive_values: false
redaction_text: "<REDACTED>"

secrets:
cookie:
- PLEASE-CHANGE-ME-I-AM-VERY-INSECURE
cipher:
- 32-LONG-SECRET-NOT-SECURE-AT-ALL

ciphers:
algorithm: xchacha20-poly1305

hashers:
algorithm: argon2
argon2:
iterations: 3
parallelism: 1
salt_length: 16
key_length: 32
expected_duration: 500ms
expected_deviation: 500ms
dedicated_memory: 1GB
memory: 128MB

session:
lifespan: 24h
earliest_possible_extend: 24h
whoami:
required_aal: highest_available

identity:
default_schema_id: default
schemas:
- id: default
url: file:///etc/config/kratos/identity.schema.json

courier:
smtp:
connection_uri: smtps://test:test@mailslurper:1025/?skip_ssl_verify=true
60 changes: 60 additions & 0 deletions ory/oathkeeper/access-rules.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
-
id: "ory:kratos:public"
upstream:
preserve_host: true
url: "http://kratos:4433"
strip_path: /.ory/kratos/public
match:
url: "http://127.0.0.1:4455/.ory/kratos/public/<**>"
methods:
- GET
- POST
- PUT
- DELETE
- PATCH
authenticators:
-
handler: noop
authorizer:
handler: allow
mutators:
- handler: noop

-
id: "ory:kratos-selfservice-ui-node:anonymous"
upstream:
preserve_host: true
url: "http://kratos-selfservice-ui-node:4435"
match:
url: "http://127.0.0.1:4455/<{registration,welcome,recovery,verification,login,error,health/{alive,ready},**.css,**.js,**.png,}>"
methods:
- GET
authenticators:
-
handler: anonymous
authorizer:
handler: allow
mutators:
-
handler: noop

-
id: "ory:kratos-selfservice-ui-node:protected"
upstream:
preserve_host: true
url: "http://kratos-selfservice-ui-node:4435"
match:
url: "http://127.0.0.1:4455/<{sessions,settings}>"
methods:
- GET
authenticators:
-
handler: cookie_session
authorizer:
handler: allow
mutators:
- handler: id_token
errors:
- handler: redirect
config:
to: http://127.0.0.1:4455/login
18 changes: 18 additions & 0 deletions ory/oathkeeper/id_token.jwks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"keys": [
{
"use": "sig",
"kty": "RSA",
"kid": "a2aa9739-d753-4a0d-87ee-61f101050277",
"alg": "RS256",
"n": "zpjSl0ySsdk_YC4ZJYYV-cSznWkzndTo0lyvkYmeBkW60YHuHzXaviHqonY_DjFBdnZC0Vs_QTWmBlZvPzTp4Oni-eOetP-Ce3-B8jkGWpKFOjTLw7uwR3b3jm_mFNiz1dV_utWiweqx62Se0SyYaAXrgStU8-3P2Us7_kz5NnBVL1E7aEP40aB7nytLvPhXau-YhFmUfgykAcov0QrnNY0DH0eTcwL19UysvlKx6Uiu6mnbaFE1qx8X2m2xuLpErfiqj6wLCdCYMWdRTHiVsQMtTzSwuPuXfH7J06GTo3I1cEWN8Mb-RJxlosJA_q7hEd43yYisCO-8szX0lgCasw",
"e": "AQAB",
"d": "x3dfY_rna1UQTmFToBoMn6Edte47irhkra4VSNPwwaeTTvI-oN2TO51td7vo91_xD1nw-0c5FFGi4V2UfRcud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