Compare commits
22 Commits
0.4.0+0.32
...
enable-bac
| Author | SHA1 | Date | |
|---|---|---|---|
| 1cf5a8a195 | |||
| eecfe6239c | |||
| 012818dfc2 | |||
| 705a039676 | |||
| cf9739b856 | |||
| 0c59e8d3c1 | |||
| 8a1423afaf | |||
| a56da6b1a2 | |||
| 7761cf1a26 | |||
| 8dd6ecfbb4 | |||
| 9cf0790379 | |||
| 2b11b5b3a3 | |||
| 602d308074 | |||
| 74ad44a0bc | |||
| 44bda9adb5 | |||
| f72bfbec56 | |||
| 8f1f30be7e | |||
| ecee17b998 | |||
| b9aa85dbc6 | |||
| 3d27184388 | |||
| 2a9f7a58f5 | |||
| 1ecc727a97 |
44
.drone.yml
Normal file
44
.drone.yml
Normal file
@ -0,0 +1,44 @@
|
||||
---
|
||||
kind: pipeline
|
||||
name: deploy to swarm-test.autonomic.zone
|
||||
steps:
|
||||
- name: deployment
|
||||
image: git.coopcloud.tech/coop-cloud/stack-ssh-deploy:latest
|
||||
settings:
|
||||
host: swarm-test.autonomic.zone
|
||||
stack: rauthy
|
||||
generate_secrets: true
|
||||
purge: true
|
||||
deploy_key:
|
||||
from_secret: drone_ssh_swarm_test
|
||||
networks:
|
||||
- proxy
|
||||
environment:
|
||||
DOMAIN: rauthy.swarm-test.autonomic.zone
|
||||
STACK_NAME: rauthy
|
||||
LETS_ENCRYPT_ENV: staging
|
||||
CONFIG_TOML_VERSION: v2
|
||||
SECRET_ENC_KEYS_A_VERSION: a1
|
||||
SECRET_ENC_KEYS_B_VERSION: b1
|
||||
SECRET_HQL_RAFT_VERSION: v1
|
||||
SECRET_HQL_API_VERSION: v1
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- main
|
||||
---
|
||||
kind: pipeline
|
||||
name: generate recipe catalogue
|
||||
steps:
|
||||
- name: release a new version
|
||||
image: plugins/downstream
|
||||
settings:
|
||||
server: https://build.coopcloud.tech
|
||||
token:
|
||||
from_secret: drone_abra-bot_token
|
||||
fork: true
|
||||
repositories:
|
||||
- toolshed/auto-recipes-catalogue-json
|
||||
|
||||
trigger:
|
||||
event: tag
|
||||
@ -1,6 +1,7 @@
|
||||
TYPE=rauthy
|
||||
DOMAIN=rauthy.example.com
|
||||
LETS_ENCRYPT_ENV=production
|
||||
ENABLE_BACKUPS=true
|
||||
|
||||
COMPOSE_FILE="compose.yml"
|
||||
|
||||
@ -9,8 +10,9 @@ ADMIN_FORCE_MFA=true
|
||||
|
||||
LOG_LEVEL=info
|
||||
|
||||
SECRET_ENC_KEYS_VERSION=v1
|
||||
ENC_KEY_ACTIVE=""
|
||||
SECRET_ENC_KEYS_A_VERSION=a1 # generate=false
|
||||
SECRET_ENC_KEYS_B_VERSION=b1 # generate=false
|
||||
ENC_KEY_ACTIVE="a1"
|
||||
|
||||
SECRET_HQL_RAFT_VERSION=v1
|
||||
SECRET_HQL_API_VERSION=v1
|
||||
|
||||
37
README.md
37
README.md
@ -17,20 +17,16 @@
|
||||
|
||||
## Quick start
|
||||
|
||||
* `abra app new rauthy`
|
||||
1. `abra app new rauthy`
|
||||
2. `abra app cmd --local <app> generate_enc_keys`
|
||||
3. `abra app secret generate <app> --all`
|
||||
4. `abra app deploy <app>`
|
||||
5. `abra app logs <app>`
|
||||
- You'll see the automatically generated admin password in the initial logs.
|
||||
Ensure that you reset this password after you log in. The `ADMIN_EMAIL` env
|
||||
var controls the value of the admin login username.
|
||||
|
||||
### Generate encryption keys
|
||||
|
||||
* `echo "$(openssl rand -hex 4)/$(openssl rand -base64 32)"`
|
||||
* `abra app secret insert <app> enc_keys v1 <enc-key>`
|
||||
* `abra app config <app>`
|
||||
* **N.B** you need to match the `ENC_KEY_ACTIVE` env var with the start of
|
||||
the generated `enc_keys` value (everything before the `/`. See [the
|
||||
docs](https://sebadob.github.io/rauthy/config/encryption.html) for more)
|
||||
|
||||
### Generate secrets
|
||||
|
||||
* `abra app secret generate <app> -a`
|
||||
For more, see [`docs.coopcloud.tech`](https://docs.coopcloud.tech).
|
||||
|
||||
### Host mode networking
|
||||
|
||||
@ -41,12 +37,13 @@ mistakenly rate limited based on internal ipv4 addresses (e.g. `10.0.0.6`).
|
||||
COMPOSE_FILE="$COMPOSE_FILE:compose.host.yml"
|
||||
```
|
||||
|
||||
### Deploy
|
||||
### Encryption key rotation
|
||||
|
||||
* `abra app deploy <app>`
|
||||
* `abra app logs <app>`
|
||||
* You'll see the automatically generated admin password in the initial logs.
|
||||
Ensure that you reset this password after you log in. The `ADMIN_EMAIL` env
|
||||
var controls the value of the admin login username.
|
||||
This recipe supports encryption key rotation as described in [the docs](https://sebadob.github.io/rauthy/config/encryption.html). To rotate keys the first time:
|
||||
|
||||
For more, see [`docs.coopcloud.tech`](https://docs.coopcloud.tech).
|
||||
1. Increment the version of `SECRET_ENC_KEYS_B_VERSION=b1` to `b2`
|
||||
2. `abra app secret insert <app> enc_keys_b b2 "$(openssl rand -base64 32)"`
|
||||
2. Change `ENC_KEY_ACTIVE="a1"` to `b2` (this tells rauthy to encrypt new secrets with the new key while still having access to `a1`)
|
||||
3. `abra app deploy <app>`
|
||||
|
||||
To rotate keys any future time, follow the same pattern of incrementing the non-active secret version and changing the active secret to that newly generated secret.
|
||||
|
||||
14
abra.sh
14
abra.sh
@ -1 +1,13 @@
|
||||
export CONFIG_TOML_VERSION=v2
|
||||
set -e
|
||||
|
||||
export CONFIG_TOML_VERSION=v3
|
||||
|
||||
generate_enc_keys() {
|
||||
KEY_A="$(openssl rand -base64 32)"
|
||||
KEY_B="$(openssl rand -base64 32)"
|
||||
abra app secret insert "$APP_NAME" enc_keys_a a1 "$KEY_A" --chaos
|
||||
abra app secret insert "$APP_NAME" enc_keys_b b1 "$KEY_B" --chaos
|
||||
echo "WARNING: secrets are NOT shown again, please save them NOW"
|
||||
echo " enc_keys_a $KEY_A"
|
||||
echo " enc_keys_b $KEY_B"
|
||||
}
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
---
|
||||
version: "3.13"
|
||||
|
||||
services:
|
||||
app:
|
||||
environment:
|
||||
@ -8,6 +5,7 @@ services:
|
||||
- SMTP_ENABLED
|
||||
- SMTP_FROM
|
||||
- SMTP_URL
|
||||
- SMTP_PORT
|
||||
- SMTP_USERNAME
|
||||
secrets:
|
||||
- smtp_password
|
||||
|
||||
21
compose.yml
21
compose.yml
@ -1,9 +1,6 @@
|
||||
---
|
||||
version: "3.13"
|
||||
|
||||
services:
|
||||
app:
|
||||
image: ghcr.io/sebadob/rauthy:0.32.2
|
||||
image: ghcr.io/sebadob/rauthy:0.33.1
|
||||
environment:
|
||||
- ADMIN_EMAIL
|
||||
- ADMIN_FORCE_MFA
|
||||
@ -14,7 +11,8 @@ services:
|
||||
- source: config_toml
|
||||
target: /app/config.toml
|
||||
secrets:
|
||||
- enc_keys
|
||||
- enc_keys_a
|
||||
- enc_keys_b
|
||||
- hql_api
|
||||
- hql_raft
|
||||
volumes:
|
||||
@ -30,7 +28,11 @@ services:
|
||||
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)"
|
||||
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
|
||||
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
|
||||
- "coop-cloud.${STACK_NAME}.version=0.4.0+0.32.2"
|
||||
- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
|
||||
- "traefik.http.middlewares.${STACK_NAME}-redirect.redirectscheme.scheme=https"
|
||||
- "traefik.http.middlewares.${STACK_NAME}-redirect.redirectscheme.permanent=true"
|
||||
- "coop-cloud.${STACK_NAME}.version=1.1.0+0.33.1"
|
||||
- "backupbot.backup=${ENABLE_BACKUPS:-true}"
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
@ -43,8 +45,11 @@ configs:
|
||||
template_driver: golang
|
||||
|
||||
secrets:
|
||||
enc_keys:
|
||||
name: ${STACK_NAME}_enc_keys_${SECRET_ENC_KEYS_VERSION}
|
||||
enc_keys_a:
|
||||
name: ${STACK_NAME}_enc_keys_a_${SECRET_ENC_KEYS_A_VERSION}
|
||||
external: true
|
||||
enc_keys_b:
|
||||
name: ${STACK_NAME}_enc_keys_b_${SECRET_ENC_KEYS_B_VERSION}
|
||||
external: true
|
||||
hql_raft:
|
||||
name: ${STACK_NAME}_hql_raft_${SECRET_HQL_RAFT_VERSION}
|
||||
|
||||
@ -24,7 +24,8 @@ level = '{{ env "LOG_LEVEL" }}'
|
||||
|
||||
[encryption]
|
||||
keys = [
|
||||
'{{ secret "enc_keys" }}'
|
||||
'{{ env "SECRET_ENC_KEYS_A_VERSION" }}/{{ secret "enc_keys_a" }}',
|
||||
'{{ env "SECRET_ENC_KEYS_B_VERSION" }}/{{ secret "enc_keys_b" }}'
|
||||
]
|
||||
key_active = '{{ env "ENC_KEY_ACTIVE" }}'
|
||||
|
||||
|
||||
22
release/1.0.0+0.32.3
Normal file
22
release/1.0.0+0.32.3
Normal file
@ -0,0 +1,22 @@
|
||||
WARNING! ⚠️
|
||||
This release supports encryption key rotation, which unfortunately requires some migration steps:
|
||||
|
||||
1. Obtain your old encryption key (enc_keys) if you backed it up. If not, you can extract your current encryption key from the config file. This is pretty advanced and can only be done from the server itself:
|
||||
|
||||
docker secret list # to obtain the secret's full name
|
||||
docker service create --name temp-reader --secret <secret-name> --mode replicated-job alpine:latest sh -c "cat /run/secrets/<secret-name>" && docker service logs --raw temp-reader && echo && docker service rm temp-reader
|
||||
|
||||
NOTE: the enc_keys secret has the format `<key_id>/<key_value>`; we'll refer to those two parts as $KEY_ID and $KEY_VALUE from here on.
|
||||
|
||||
2. Add these lines to your config, overwriting the existing SECRET_ENC_KEYS_VERSION and ENC_KEY_ACTIVE values:
|
||||
|
||||
SECRET_ENC_KEYS_A_VERSION=$KEY_ID # generated=false
|
||||
SECRET_ENC_KEYS_B_VERSION=b1 # generated=false
|
||||
ENC_KEY_ACTIVE="$KEY_ID"
|
||||
|
||||
3. Set key_a and generate key_b:
|
||||
|
||||
abra app secret insert $STACK_NAME enc_keys_a $KEY_ID "<your-existing-secret>" -C
|
||||
abra app secret insert $STACK_NAME enc_keys_b b1 "$(openssl rand -base64 32)" -C
|
||||
|
||||
Then you can deploy :)
|
||||
1
release/next
Normal file
1
release/next
Normal file
@ -0,0 +1 @@
|
||||
Enables backup-bot-2 backups
|
||||
6
renovate.json
Normal file
6
renovate.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:recommended"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user