Archived
Compare commits
222
Commits
5c600d0af0
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
caa6c3001a | ||
|
|
7751662bb4 | ||
|
|
cb855416db | ||
|
|
faad7cc962 | ||
|
|
afe2fce12d | ||
|
|
7c6eb8c2a9 | ||
|
|
65cf245fbd | ||
|
|
eb13c88e73 | ||
|
|
daf02789ac | ||
|
|
2954bcf671 | ||
|
|
e733382f6c | ||
|
|
80bdeb8d9d | ||
|
|
dd9d798bae | ||
|
|
2073f953dd | ||
|
|
6d85b51b52 | ||
|
|
f88e45b783 | ||
|
|
cc794c3896 | ||
|
|
dccff1d61c | ||
|
|
f17a8ee22c | ||
|
|
8bb9ee242e | ||
|
|
46abc20577 | ||
|
|
065d59d68b | ||
|
|
d47635879a | ||
|
|
f27d98b57f | ||
|
|
656df7fb41 | ||
|
|
b68d90bad5 | ||
|
|
d25ffd8957 | ||
|
|
c127e8a709 | ||
|
|
fb07135179 | ||
|
|
eb68cdc425 | ||
|
|
031ed3ac37 | ||
|
|
93b24200b1 | ||
|
|
951b37e78a | ||
|
|
5e47ae2777 | ||
|
|
cc015fe9a2 | ||
|
|
d9cce278e6 | ||
|
|
e455438325 | ||
|
|
f303ddd6a7 | ||
|
|
c89b8129ec | ||
|
|
c98b2d8232 | ||
|
|
3a9b3786c5 | ||
|
|
1131eceb94 | ||
|
|
586be50567 | ||
|
|
d0e08b8fc1 | ||
|
|
487117b31a | ||
|
|
82fa90d843 | ||
|
|
ef1e7432ee | ||
|
|
427ea20e43 | ||
|
|
3298219ccf | ||
|
|
b30c7f3a8a | ||
|
|
374511c123 | ||
|
|
313f7f1c21 | ||
|
|
6aa78525c2 | ||
|
|
5e0de23ff7 | ||
|
|
3c655dabcf | ||
|
|
60e59f95a8 | ||
|
|
cdf37fb2c9 | ||
|
|
f56b734cb4 | ||
|
|
10c4373c0e | ||
|
|
2619d86dc1 | ||
|
|
1b679a4f09 | ||
|
|
02033cd3f9 | ||
|
|
d932bc57d0 | ||
|
|
c4cfa8081f | ||
|
|
90c9094a6f | ||
|
|
36c5f2b1e3 | ||
|
|
7bc2729ef6 | ||
|
|
9d79f828e4 | ||
|
|
22b3659cdf | ||
|
|
4440fddb2b | ||
|
|
d74000fbd0 | ||
|
|
9efdb5c781 | ||
|
|
e7fd52616d | ||
|
|
b7b4b4d36d | ||
|
|
40f5a3ce0d | ||
|
|
8e43118661 | ||
|
|
0e76f3cef1 | ||
|
|
8d18ab7059 | ||
|
|
6a959d85c3 | ||
|
|
79c583eca3 | ||
|
|
7fcafed3f9 | ||
|
|
0b67830d7f | ||
|
|
d878a0f9b8 | ||
|
|
9c38910a67 | ||
|
|
4a38a9421d | ||
|
|
5d32693925 | ||
|
|
696cecfecb | ||
|
|
c0360a14b9 | ||
|
|
5589594d2c | ||
|
|
0bd41b2fb1 | ||
|
|
5f10d0366e | ||
|
|
9f98101c5d | ||
|
|
0c20676590 | ||
|
|
59e2c2b9a3 | ||
|
|
61d49e85a3 | ||
|
|
8f84ed6d83 | ||
|
|
24cbb02bff | ||
|
|
685a472572 | ||
|
|
9de1bee542 | ||
|
|
306e2c14db | ||
|
|
63b47b59b5 | ||
|
|
52bd2d9fa2 | ||
|
|
034ad17cf9 | ||
|
|
ef2846562b | ||
|
|
52e2102f93 | ||
|
|
a9b21912db | ||
|
|
c9e4aeb8d6 | ||
|
|
96a44d5da6 | ||
|
|
0d936677e5 | ||
|
|
5c38b92bc8 | ||
|
|
fc5c882193 | ||
|
|
a4501d4034 | ||
|
|
c0958d8f02 | ||
|
|
2a97864a06 | ||
|
|
bd23339edd | ||
|
|
f8091a5c76 | ||
|
|
6a2639f931 | ||
|
|
fae5e119d1 | ||
|
|
872038d0c9 | ||
|
|
7a6db9fcfd | ||
|
|
d6a8979d55 | ||
|
|
a9a8a708d3 | ||
|
|
749c0d500d | ||
|
|
8f112af65b | ||
|
|
580e9b9aed | ||
|
|
c77db36865 | ||
|
|
e11dc22999 | ||
|
|
862ddd42f8 | ||
|
|
d0e7e52150 | ||
|
|
f0aa9941d8 | ||
|
|
6789451bd6 | ||
|
|
b8d9e62954 | ||
|
|
9f36dabcdc | ||
|
|
3c78e9c140 | ||
|
|
40a976f712 | ||
|
|
451be4ab0d | ||
|
|
b848d6b807 | ||
|
|
4695839df4 | ||
|
|
cb92ebc70e | ||
|
|
5c3bc0317c | ||
|
|
c7dd9f2229 | ||
|
|
7258d150ad | ||
|
|
020d6ecb79 | ||
|
|
b3cc235164 | ||
|
|
b422a55c02 | ||
|
|
b6d2e4ee62 | ||
|
|
438cf57127 | ||
|
|
6ada434618 | ||
|
|
2a6c905eb8 | ||
|
|
9ad21c5846 | ||
|
|
2bab864d5e | ||
|
|
ebae1ed990 | ||
|
|
5e49b6774b | ||
|
|
228413d780 | ||
|
|
7279ade925 | ||
|
|
a826c85e08 | ||
|
|
1918b83061 | ||
|
|
fa54b956a7 | ||
|
|
d69c74e537 | ||
|
|
0654d9673f | ||
|
|
ff0c413d06 | ||
|
|
f69028963b | ||
|
|
624d7be17c | ||
|
|
b17adee7cc | ||
|
|
27c5c3f631 | ||
|
|
361d2dc87b | ||
|
|
2499924afc | ||
|
|
b2ff514a71 | ||
|
|
b5cfdde00f | ||
|
|
d99e2767b5 | ||
|
|
7f8e920fa1 | ||
|
|
c10b834be0 | ||
|
|
f08a567933 | ||
|
|
85d7859b14 | ||
|
|
d06c53ef0b | ||
|
|
85cf56fcaf | ||
|
|
a576dfdaa0 | ||
|
|
cf516ab1f4 | ||
|
|
e7feec9146 | ||
|
|
49caca5700 | ||
|
|
97f0bac724 | ||
|
|
f8370b6a99 | ||
|
|
d27a994fe6 | ||
|
|
937c6164d8 | ||
|
|
4eed2fd710 | ||
|
|
ba41ce7eb0 | ||
|
|
26b7b461a3 | ||
|
|
72cda2dc92 | ||
|
|
2b83cd5599 | ||
|
|
c0ed8cfc5f | ||
|
|
7646f8187b | ||
|
|
8d462a83c7 | ||
|
|
29856c4d1c | ||
|
|
ce626ee0c8 | ||
|
|
18104468aa | ||
|
|
f136f49e51 | ||
|
|
ee609201b3 | ||
|
|
25f91e301c | ||
|
|
cbdf9c9562 | ||
|
|
de82d295fb | ||
|
|
8224009aa6 | ||
|
|
d98f74a9d0 | ||
|
|
3d49ebdeee | ||
|
|
a515e3e25b | ||
|
|
0a3cfa4631 | ||
|
|
15b349604c | ||
|
|
4a0ab9d184 | ||
|
|
155373a171 | ||
|
|
a29fcc85d0 | ||
|
|
b6ff09513f | ||
|
|
a0b9dd980b | ||
|
|
649965e97a | ||
|
|
db57390bf9 | ||
|
|
4e61ac701f | ||
|
|
cd47fe324e | ||
|
|
d6baa39bf4 | ||
|
|
6f47e654a8 | ||
|
|
24047b0eaa | ||
|
|
0ddbb7d7ad | ||
|
|
43f25321d7 | ||
|
|
9678c6a8f1 | ||
|
|
c1401e3e08 |
No files matched your search
@@ -0,0 +1,71 @@
|
|||||||
|
name: Generate Docs
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 */6 * * *"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
generate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: tcp://docker-socket-proxy:2375
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Install docker CLI
|
||||||
|
run: |
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y docker.io docker-compose
|
||||||
|
|
||||||
|
- name: Generate docs
|
||||||
|
run: |
|
||||||
|
scripts/docs/generate-all.sh
|
||||||
|
|
||||||
|
- name: Validate generated docs
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
|
||||||
|
test -s docs/generated/docker-compose.resolved.yml
|
||||||
|
test -s docs/generated/host-topology.md
|
||||||
|
test -s docs/public/physical-topology.svg
|
||||||
|
test -s docs/public/docker-traefik-dynu.svg
|
||||||
|
|
||||||
|
! grep -R "Host inventory JSON not found" docs/public docs/diagrams
|
||||||
|
! grep -R "Generate terraform inventory" docs/public docs/diagrams
|
||||||
|
|
||||||
|
# Ensure no obvious secrets leaked
|
||||||
|
! grep -R -E -i "password|token|api[_-]?key|secret" docs/public \
|
||||||
|
|| (echo "Secret-like string detected"; exit 1)
|
||||||
|
|
||||||
|
- name: Commit changes
|
||||||
|
run: |
|
||||||
|
git config user.name "docs-bot"
|
||||||
|
git config user.email "docs-bot@local"
|
||||||
|
|
||||||
|
git add docs/generated docs/diagrams docs/public data/terraform/proxmox-inventory.json || true
|
||||||
|
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "No changes to commit"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
git commit -m "docs: regenerate documentation artifacts"
|
||||||
|
|
||||||
|
- name: Push to Gitea
|
||||||
|
run: |
|
||||||
|
git push origin HEAD:main
|
||||||
|
|
||||||
|
- name: Push to GitHub mirror
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_PUSH_TOKEN }}
|
||||||
|
GITHUB_MIRROR_REPO: ${{ vars.GITHUB_MIRROR_REPO }}
|
||||||
|
run: |
|
||||||
|
test -n "$GITHUB_TOKEN"
|
||||||
|
test -n "$GITHUB_MIRROR_REPO"
|
||||||
|
git remote add github "https://$GITHUB_TOKEN@github.com/$GITHUB_MIRROR_REPO.git" || true
|
||||||
|
git push github HEAD:main
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
name: Validate Docs (Gitea)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
paths:
|
||||||
|
- "docs/**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Validate docs
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
|
||||||
|
test -d docs/public
|
||||||
|
test -s docs/public/physical-topology.svg
|
||||||
|
|
||||||
|
! grep -R "Host inventory JSON not found" docs/public
|
||||||
|
! grep -R "Generate terraform inventory" docs/public
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
name: Validate committed public docs
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate-public-docs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Ensure committed docs/public exists
|
||||||
|
run: |
|
||||||
|
test -d docs/public
|
||||||
|
test -n "$(find docs/public -mindepth 1 -print -quit)"
|
||||||
|
- name: Install MkDocs
|
||||||
|
run: |
|
||||||
|
python3 -m pip install --user mkdocs
|
||||||
|
- name: Validate docs content
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
test -s docs/public/physical-topology.svg
|
||||||
|
test -s docs/public/docker-traefik-dynu.svg
|
||||||
|
! grep -R "Host inventory JSON not found" docs/public
|
||||||
|
! grep -R "Generate terraform inventory" docs/public
|
||||||
|
! rg -n -i "password|token|api[_-]?key|secret" docs/public
|
||||||
|
- name: Build MkDocs site
|
||||||
|
run: |
|
||||||
|
python3 -m mkdocs build -f mkdocs-public.yml --strict
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
name: Publish documentation site
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: github-pages
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Ensure committed docs/public exists
|
||||||
|
run: |
|
||||||
|
test -d docs/public
|
||||||
|
test -n "$(find docs/public -mindepth 1 -print -quit)"
|
||||||
|
|
||||||
|
- name: Install Graphviz
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y graphviz
|
||||||
|
dot -V
|
||||||
|
|
||||||
|
- name: Validate sanitized diagram artifacts
|
||||||
|
run: |
|
||||||
|
test -f docs/public/physical-topology.svg
|
||||||
|
test -f docs/public/docker-traefik-dynu.svg
|
||||||
|
! rg -n "Graphviz dot not found" docs/public/*.svg
|
||||||
|
! rg -n "lan\.ddnsgeek\.com" docs/public/*.svg docs/public/*.md
|
||||||
|
! rg -n -i "password|token|api_key|secret" docs/public/*.svg
|
||||||
|
|
||||||
|
- name: Install MkDocs
|
||||||
|
run: |
|
||||||
|
python3 -m pip install --user mkdocs
|
||||||
|
|
||||||
|
- name: Build public MkDocs site
|
||||||
|
run: |
|
||||||
|
python3 -m mkdocs build -f mkdocs-public.yml --strict
|
||||||
|
|
||||||
|
- name: Verify published content excludes internal/generated docs
|
||||||
|
run: |
|
||||||
|
test -d site-public
|
||||||
|
test ! -e site-public/generated
|
||||||
|
test ! -e site-public/docker
|
||||||
|
|
||||||
|
- name: Verify expected 404-only paths are not generated
|
||||||
|
run: |
|
||||||
|
test ! -e site-public/generated/compose-inventory/index.html
|
||||||
|
test ! -e site-public/generated/prometheus-rules/index.html
|
||||||
|
test ! -e site-public/docker/index.html
|
||||||
|
|
||||||
|
- name: Configure GitHub Pages
|
||||||
|
uses: actions/configure-pages@v5
|
||||||
|
|
||||||
|
- name: Upload GitHub Pages artifact
|
||||||
|
uses: actions/upload-pages-artifact@v3
|
||||||
|
with:
|
||||||
|
path: site-public
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v4
|
||||||
+28
-1
@@ -4,13 +4,14 @@
|
|||||||
#!**/Dockerfile
|
#!**/Dockerfile
|
||||||
#!docker-compose.yml
|
#!docker-compose.yml
|
||||||
**/data/
|
**/data/
|
||||||
|
apps/gitea/runner-data/
|
||||||
**/db/
|
**/db/
|
||||||
**/database/
|
**/database/
|
||||||
apps/nextcloud/config/
|
apps/nextcloud/config/
|
||||||
core/crowdsec/config/
|
core/crowdsec/config/
|
||||||
**/.env
|
**/.env
|
||||||
!monitoring/node-red/data/
|
!monitoring/node-red/data/
|
||||||
apps/stockfill/
|
apps/stockfill
|
||||||
apps/shift-recorder/
|
apps/shift-recorder/
|
||||||
|
|
||||||
!apps/searxng/
|
!apps/searxng/
|
||||||
@@ -21,6 +22,32 @@ apps/searxng/*
|
|||||||
venv/
|
venv/
|
||||||
core/authelia/users_database.yml
|
core/authelia/users_database.yml
|
||||||
monitoring/influxdb/*
|
monitoring/influxdb/*
|
||||||
|
!monitoring/influxdb/docker-compose.yml
|
||||||
secrets/*
|
secrets/*
|
||||||
!secrets/.env.secrets.example
|
!secrets/.env.secrets.example
|
||||||
|
!secrets/inventory.json
|
||||||
!.env.example
|
!.env.example
|
||||||
|
core/traefik/certs/*
|
||||||
|
!core/traefik/certs/.gitkeep
|
||||||
|
site/
|
||||||
|
|
||||||
|
# Docs generation artifacts intentionally tracked
|
||||||
|
!data/terraform/proxmox-inventory.json
|
||||||
|
!infrastructure/terraform/dynu/generated/
|
||||||
|
!infrastructure/terraform/dynu/generated/dynu_dns_records_inventory.json
|
||||||
|
!docs/generated/
|
||||||
|
!docs/generated/docker-compose.resolved.yml
|
||||||
|
!docs/generated/host-topology.md
|
||||||
|
!docs/diagrams/
|
||||||
|
!docs/diagrams/*.svg
|
||||||
|
!docs/public/
|
||||||
|
!docs/public/*.md
|
||||||
|
!docs/public/*.svg
|
||||||
|
|
||||||
|
# Terraform local/state artifacts
|
||||||
|
**/.terraform/
|
||||||
|
**/.terraform.lock.hcl
|
||||||
|
*.tfstate
|
||||||
|
*.tfstate.*
|
||||||
|
*.tfvars
|
||||||
|
*.tfvars.json
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
# Codex instructions for this repository
|
||||||
|
|
||||||
|
This repository contains:
|
||||||
|
- Docker Compose infrastructure
|
||||||
|
- Terraform configuration
|
||||||
|
- Ansible configuration
|
||||||
|
|
||||||
|
## General rules
|
||||||
|
|
||||||
|
Prefer validation and linting over execution.
|
||||||
|
Do not make assumptions about runtime access.
|
||||||
|
Do not run destructive commands.
|
||||||
|
Do not install repo changes unless explicitly requested.
|
||||||
|
|
||||||
|
## Docker / Compose rules
|
||||||
|
|
||||||
|
This environment does not have Docker daemon access.
|
||||||
|
Do not use commands that require `/var/run/docker.sock`.
|
||||||
|
|
||||||
|
Allowed:
|
||||||
|
- `docker compose config`
|
||||||
|
- `docker compose -f <file> config`
|
||||||
|
- `./services-up.sh --profile all config`
|
||||||
|
|
||||||
|
Not allowed:
|
||||||
|
- `docker compose up`
|
||||||
|
- `docker compose down`
|
||||||
|
- `docker compose run`
|
||||||
|
- `docker compose exec`
|
||||||
|
- `docker build`
|
||||||
|
- `docker pull`
|
||||||
|
|
||||||
|
When validating Docker changes:
|
||||||
|
1. Prefer `./services-up.sh --profile all config` if available.
|
||||||
|
2. If that does not fit the task, use `docker compose -f ... config`.
|
||||||
|
3. Only create temporary placeholder env files if validation requires them.
|
||||||
|
4. Do not commit placeholder env files unless explicitly requested.
|
||||||
|
|
||||||
|
## Terraform rules
|
||||||
|
|
||||||
|
Allowed:
|
||||||
|
- `terraform fmt -check -recursive`
|
||||||
|
- `terraform init -backend=false -input=false`
|
||||||
|
- `terraform validate`
|
||||||
|
- `tflint`
|
||||||
|
|
||||||
|
Do not apply infrastructure changes unless explicitly requested.
|
||||||
|
Do not run:
|
||||||
|
- `terraform apply`
|
||||||
|
- `terraform destroy`
|
||||||
|
|
||||||
|
If `terraform init` fails because access to `registry.terraform.io` is forbidden, do not summarize the error vaguely. Report the exact stderr. Continue with:
|
||||||
|
- `terraform fmt -check -recursive`
|
||||||
|
- static review of changed `.tf` files
|
||||||
|
|
||||||
|
Only run `terraform validate` when provider installation is available locally or registry access succeeds.
|
||||||
|
|
||||||
|
## Ansible rules
|
||||||
|
|
||||||
|
Allowed:
|
||||||
|
- `ansible-lint`
|
||||||
|
- `ansible-playbook --syntax-check <playbook>`
|
||||||
|
|
||||||
|
Do not run playbooks against real hosts unless explicitly requested.
|
||||||
|
|
||||||
|
## Shell / YAML rules
|
||||||
|
|
||||||
|
Allowed:
|
||||||
|
- `shellcheck`
|
||||||
|
- `yamllint`
|
||||||
|
- `yq`
|
||||||
|
- `jq`
|
||||||
|
|
||||||
|
## Expected workflow
|
||||||
|
|
||||||
|
When making changes:
|
||||||
|
1. Edit the smallest necessary set of files.
|
||||||
|
2. Run the safest available validation commands.
|
||||||
|
3. Report validation results clearly.
|
||||||
|
4. If validation is blocked by missing secrets, env files, or remote/provider access, say so explicitly instead of guessing.
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
# Deployment prerequisites (required)
|
|
||||||
|
|
||||||
Before running `docker compose up`, you **must** provision runtime secrets.
|
|
||||||
|
|
||||||
## 1) Create non-committed secret files
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp secrets/.env.secrets.example secrets/stack-secrets.env
|
|
||||||
chmod 600 secrets/stack-secrets.env
|
|
||||||
```
|
|
||||||
|
|
||||||
Create these Docker secret files (all ignored by git):
|
|
||||||
|
|
||||||
- `secrets/nextcloud_db_root_password.txt`
|
|
||||||
- `secrets/nextcloud_db_password.txt`
|
|
||||||
- `secrets/nextcloud_admin_password.txt`
|
|
||||||
- `secrets/nextcloud_smtp_password.txt`
|
|
||||||
- `secrets/nextcloud_redis_password.txt`
|
|
||||||
- `secrets/passbolt_db_password.txt`
|
|
||||||
- `secrets/gramps_db_password.txt`
|
|
||||||
- `secrets/influxdb_init_password.txt`
|
|
||||||
- `secrets/prometheus_kuma_basic_auth_password.txt`
|
|
||||||
|
|
||||||
Recommended permissions:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
chmod 600 secrets/*.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
## 2) Rotate previously committed credentials
|
|
||||||
|
|
||||||
These values were previously hardcoded and must be rotated in upstream systems immediately:
|
|
||||||
|
|
||||||
- Database credentials (Nextcloud, Passbolt, Gramps, InfluxDB).
|
|
||||||
- Nextcloud SMTP app password.
|
|
||||||
- Authelia reset JWT secret, session secret, storage encryption key.
|
|
||||||
- Traefik CrowdSec LAPI key.
|
|
||||||
- Gotify admin password.
|
|
||||||
- Prometheus Uptime Kuma basic-auth password.
|
|
||||||
|
|
||||||
## 3) Start stack
|
|
||||||
|
|
||||||
After secrets are provisioned:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker compose -f core/docker-compose.yml up -d
|
|
||||||
docker compose -f monitoring/prometheus/docker-compose.yml up -d
|
|
||||||
docker compose -f apps/nextcloud/docker-compose.yml up -d
|
|
||||||
```
|
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
# Homelab Docker + Terraform Inventory Repository
|
||||||
|
|
||||||
|
This repository is both:
|
||||||
|
|
||||||
|
1. **operational** (Docker Compose application/runtime definition), and
|
||||||
|
2. **documentary/inventory-oriented** (Terraform capture of Proxmox VMs, host metadata, and selected Docker objects).
|
||||||
|
|
||||||
|
If you only read one section, read **[Source-of-truth boundaries](docs/source-of-truth.md)** first.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Quick navigation
|
||||||
|
|
||||||
|
- Architecture overview: [docs/architecture.md](docs/architecture.md)
|
||||||
|
- Repository layout: [docs/repo-structure.md](docs/repo-structure.md)
|
||||||
|
- Source-of-truth boundaries and guardrails: [docs/source-of-truth.md](docs/source-of-truth.md)
|
||||||
|
- Docker environment composition and `services-up.sh`: [docs/docker-environment.md](docs/docker-environment.md)
|
||||||
|
- Terraform workflows (brownfield import/reconciliation): [docs/terraform-workflows.md](docs/terraform-workflows.md)
|
||||||
|
- Infrastructure inventory intent and outputs: [docs/infrastructure-inventory.md](docs/infrastructure-inventory.md)
|
||||||
|
- Dynu DNS read-only inventory workflow: [docs/dynu-dns-inventory.md](docs/dynu-dns-inventory.md)
|
||||||
|
- Generated host topology doc: [docs/generated/host-topology.md](docs/generated/host-topology.md)
|
||||||
|
- Ansible bootstrap workflows: [docs/ansible-workflows.md](docs/ansible-workflows.md)
|
||||||
|
- Deployment prerequisites and secrets setup: [docs/deployment-prerequisites.md](docs/deployment-prerequisites.md)
|
||||||
|
- Secrets inventory: [docs/security-secrets.md](docs/security-secrets.md)
|
||||||
|
|
||||||
|
Codex helper scripts:
|
||||||
|
|
||||||
|
- Initial Codex environment/bootstrap setup: [scripts/codex-setup.sh](scripts/codex-setup.sh)
|
||||||
|
- Codex environment maintenance/refresh: [scripts/codex-maintenance.sh](scripts/codex-maintenance.sh)
|
||||||
|
|
||||||
|
Infrastructure subtrees:
|
||||||
|
|
||||||
|
- Ansible foundation docs: [infrastructure/ansible/README.md](infrastructure/ansible/README.md)
|
||||||
|
- Terraform root docs: [infrastructure/terraform/README.md](infrastructure/terraform/README.md)
|
||||||
|
- Terraform Docker mirror: [infrastructure/terraform/docker/README.md](infrastructure/terraform/docker/README.md)
|
||||||
|
- Terraform Proxmox inventory: [infrastructure/terraform/proxmox/README.md](infrastructure/terraform/proxmox/README.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Operating model
|
||||||
|
|
||||||
|
### Docker Compose (runtime authority)
|
||||||
|
|
||||||
|
- Compose files under `core/`, `apps/`, and `monitoring/` describe runtime services.
|
||||||
|
- `services-up.sh` composes the environment by discovering compose files and applying common env/network inputs.
|
||||||
|
- For service runtime behavior, start from Compose files and `services-up.sh` (not Terraform).
|
||||||
|
|
||||||
|
|
||||||
|
### Ansible (bootstrap foundation)
|
||||||
|
|
||||||
|
- Ansible under `infrastructure/ansible/` is a phase-1 foundation for inventory/configuration scaffolding.
|
||||||
|
- It supports safe validation (inventory parsing and playbook syntax checks) while hosts/devices are onboarded gradually.
|
||||||
|
- It does not replace Compose runtime authority or Terraform reconciliation authority at this stage.
|
||||||
|
|
||||||
|
### Terraform (inventory and reconciliation authority)
|
||||||
|
|
||||||
|
- Terraform under `infrastructure/terraform/` is used to codify and reconcile existing infrastructure.
|
||||||
|
- Current repo usage emphasizes **brownfield import-first workflows** and safe reconciliation.
|
||||||
|
- Terraform captures:
|
||||||
|
- Proxmox VM configuration for existing VMs.
|
||||||
|
- Physical host metadata in locals/outputs.
|
||||||
|
- Documentation-oriented Docker container mirroring (limited, selective).
|
||||||
|
|
||||||
|
Terraform here is **not** a replacement for Docker Compose deployment.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Guardrails
|
||||||
|
|
||||||
|
- Do not run destructive Terraform commands casually.
|
||||||
|
- Do not treat generated Terraform config as final without manual review.
|
||||||
|
- Do not commit real secrets, credentials, or local state.
|
||||||
|
- Keep one-resource-per-file patterns where already established in Terraform subdirectories.
|
||||||
|
- Prefer shaping outputs for documentation/tooling consumption over dumping raw provider objects.
|
||||||
|
|
||||||
|
See [docs/source-of-truth.md](docs/source-of-truth.md) and [docs/terraform-workflows.md](docs/terraform-workflows.md) for concrete do/don't guidance.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## High-level architecture
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart TB
|
||||||
|
Internet((Internet Clients)) -->|HTTPS 443 / HTTP 80| Traefik[Traefik Ingress\nACME TLS + Security Middlewares]
|
||||||
|
|
||||||
|
subgraph DockerHost[Primary Docker Host]
|
||||||
|
Traefik
|
||||||
|
Authelia[Authelia SSO / ForwardAuth]
|
||||||
|
CrowdSec[CrowdSec + Traefik Bouncer]
|
||||||
|
ErrPages[Error Pages Fallback]
|
||||||
|
|
||||||
|
subgraph Apps[Business / User Applications]
|
||||||
|
Nextcloud[Nextcloud]
|
||||||
|
Passbolt[Passbolt]
|
||||||
|
Gitea[Gitea]
|
||||||
|
FamilyTree[Gramps Web]
|
||||||
|
Searxng[SearXNG]
|
||||||
|
end
|
||||||
|
|
||||||
|
subgraph Ops[Operations & Monitoring]
|
||||||
|
Grafana[Grafana]
|
||||||
|
Prometheus[Prometheus]
|
||||||
|
InfluxDB[InfluxDB]
|
||||||
|
NodeRED[Node-RED]
|
||||||
|
Portainer[Portainer]
|
||||||
|
UptimeKuma[Uptime Kuma]
|
||||||
|
Gotify[Gotify Notifications]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Traefik --> Apps
|
||||||
|
Traefik --> Ops
|
||||||
|
Traefik -->|ForwardAuth for selected routes| Authelia
|
||||||
|
Traefik -->|Threat decisions| CrowdSec
|
||||||
|
Traefik -->|4xx/5xx fallback| ErrPages
|
||||||
|
|
||||||
|
Prometheus --> Grafana
|
||||||
|
Prometheus --> Gotify
|
||||||
|
```
|
||||||
|
|
||||||
|
For request-flow and network detail, see [docs/architecture.md](docs/architecture.md).
|
||||||
|
|
||||||
|
## Public docs publication workflow
|
||||||
|
|
||||||
|
Public docs are generated on the Docker host and committed to this repository. GitHub Actions only publishes committed content from `docs/public`.
|
||||||
|
|
||||||
|
1. Generate public docs locally from the repository root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./scripts/generate-public-docs.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Inspect the generated changes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git diff -- docs/public docs/generated docs/diagrams
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Commit the generated public docs (and any supporting generated files you intend to version):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add docs/public docs/generated docs/diagrams
|
||||||
|
git commit -m "docs: regenerate public docs"
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Push your branch:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git push
|
||||||
|
```
|
||||||
|
|
||||||
|
Only files under `docs/public` are published by GitHub Pages. Internal/generated documentation is not published unless it is deliberately copied/sanitized into `docs/public`.
|
||||||
|
|
||||||
|
### Regenerating architecture docs (Prometheus + Dynu DNS)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Refresh Dynu live inventory and generated resources/import helpers
|
||||||
|
cd infrastructure/terraform/dynu
|
||||||
|
terraform apply -refresh-only
|
||||||
|
python3 scripts/generate-brownfield-records.py --overwrite
|
||||||
|
|
||||||
|
# Regenerate architecture docs from Prometheus + Dynu inventory
|
||||||
|
cd ../../..
|
||||||
|
python3 scripts/render_prometheus_docs.py \
|
||||||
|
--inventory-file docs/runtime/prometheus-inventory.json \
|
||||||
|
--dynu-dns-inventory-file infrastructure/terraform/dynu/generated/dynu_dns_records_inventory.json
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Codex setup and maintenance scripts
|
||||||
|
|
||||||
|
The repository includes helper scripts for Codex sessions that need local tooling and safe placeholder secret material for validation-only workflows:
|
||||||
|
|
||||||
|
- `scripts/codex-setup.sh`
|
||||||
|
- Installs baseline CLI dependencies (shell/yaml/terraform/ansible tooling).
|
||||||
|
- Prepares `secrets/stack-secrets.env` from templates and creates dummy file-based secret placeholders based on `secrets/inventory.json`.
|
||||||
|
- Installs/refreshed baseline Ansible collections when `infrastructure/ansible/collections/requirements.yml` is present.
|
||||||
|
- Runs safe Ansible bootstrap checks (version, inventory parse, playbook syntax check) without live connectivity operations.
|
||||||
|
- Prints installed tool versions for quick verification.
|
||||||
|
|
||||||
|
- `scripts/codex-maintenance.sh`
|
||||||
|
- Refreshes Python-based linting/automation tooling.
|
||||||
|
- Reconciles placeholder secret files against current `secrets/inventory.json` (creates missing, removes stale).
|
||||||
|
- Rebuilds `secrets/stack-secrets.env` with dummy values for compose-config validation.
|
||||||
|
- Refreshes Ansible collections and repeats safe inventory/syntax validation checks.
|
||||||
|
|
||||||
|
Both scripts are intended for local validation environments and should not be treated as production provisioning automation.
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
# Security Secrets Inventory
|
|
||||||
|
|
||||||
This inventory is aligned with `secrets/.env.secrets.example` and documents only the values that are expected to be set in the non-committed secrets env file (`secrets/stack-secrets.env`).
|
|
||||||
|
|
||||||
## Secrets expected in `secrets/.env.secrets.example`
|
|
||||||
|
|
||||||
| Variable | Used by | Purpose / Notes |
|
|
||||||
|---|---|---|
|
|
||||||
| `NEXTCLOUD_DB_USER` | `apps/nextcloud/docker-compose.yml` | Nextcloud database username (non-secret identifier but environment-specific). |
|
|
||||||
| `NEXTCLOUD_ADMIN_USER` | `apps/nextcloud/docker-compose.yml` | Initial Nextcloud admin username. |
|
|
||||||
| `NEXTCLOUD_SMTP_FROM_ADDRESS` | `apps/nextcloud/docker-compose.yml` | SMTP sender local-part for outbound mail configuration. |
|
|
||||||
| `NEXTCLOUD_SMTP_DOMAIN` | `apps/nextcloud/docker-compose.yml` | SMTP sender domain for outbound mail configuration. |
|
|
||||||
| `NEXTCLOUD_SMTP_NAME` | `apps/nextcloud/docker-compose.yml` | Derived from address + domain in the example file. |
|
|
||||||
| `PASSBOLT_DB_NAME` | `apps/passbolt/docker-compose.yml` | Passbolt database name. |
|
|
||||||
| `PASSBOLT_DB_USER` | `apps/passbolt/docker-compose.yml` | Passbolt database username. |
|
|
||||||
| `PASSBOLT_GPG_SERVER_KEY_FINGERPRINT` | `apps/passbolt/docker-compose.yml` | Passbolt server GPG key fingerprint. |
|
|
||||||
| `GRAMPS_DB_NAME` | `apps/gramps/docker-compose.yml` | Gramps database name. |
|
|
||||||
| `GRAMPS_DB_USER` | `apps/gramps/docker-compose.yml` | Gramps database username. |
|
|
||||||
| `GRAMPS_DB_PASSWORD` | `apps/gramps/docker-compose.yml` | Gramps database password. |
|
|
||||||
| `GRAMPS_INITIAL_ADMIN` | `apps/gramps/docker-compose.yml` | Gramps initial admin username/email (deployment-specific). |
|
|
||||||
| `GRAMPS_INITIAL_ADMIN_PASSWORD` | `apps/gramps/docker-compose.yml` | Gramps initial admin password. |
|
|
||||||
| `GRAMPS_DB_URI` | `apps/gramps/docker-compose.yml` | Derived connection string in the example file. |
|
|
||||||
| `GOTIFY_DEFAULTUSER_NAME` | `monitoring/gotify/docker-compose.yml` | Gotify default username. |
|
|
||||||
| `GOTIFY_DEFAULTUSER_PASS` | `monitoring/gotify/docker-compose.yml` | Gotify default user password. |
|
|
||||||
| `INFLUXDB_INIT_USERNAME` | `monitoring/prometheus/docker-compose.yml` | InfluxDB initial username. |
|
|
||||||
| `PIHOLE_PASSWORD` | `monitoring/prometheus/docker-compose.yml` | Exporter auth / Pi-hole integration password. |
|
|
||||||
|
|
||||||
## Managed outside `.env.secrets.example`
|
|
||||||
|
|
||||||
The following sensitive values are intentionally not duplicated in `secrets/.env.secrets.example` because they are provided via Docker secrets (`*_FILE`) or other mounted secret files:
|
|
||||||
|
|
||||||
- Database/root passwords for Nextcloud, Passbolt, and supporting services that are wired through Docker secrets.
|
|
||||||
- Redis runtime password (`--requirepass`) loaded from a Docker secret.
|
|
||||||
- `DOCKER_INFLUXDB_INIT_PASSWORD` loaded from Docker secret in monitoring.
|
|
||||||
- Uptime Kuma basic auth password loaded via `password_file` in Prometheus config.
|
|
||||||
- Core stack secrets injected via env substitution in committed config files, such as:
|
|
||||||
- `AUTHELIA_JWT_SECRET`
|
|
||||||
- `AUTHELIA_SESSION_SECRET`
|
|
||||||
- `AUTHELIA_STORAGE_ENCRYPTION_KEY`
|
|
||||||
- `CROWDSEC_LAPI_KEY`
|
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
# Gitea
|
||||||
|
|
||||||
|
## Gitea Actions
|
||||||
|
|
||||||
|
Gitea Actions is enabled by setting:
|
||||||
|
|
||||||
|
- `GITEA__actions__ENABLED=true`
|
||||||
|
|
||||||
|
## Runner service
|
||||||
|
|
||||||
|
The repository includes a dedicated Gitea Actions runner service named:
|
||||||
|
|
||||||
|
- `gitea-runner`
|
||||||
|
|
||||||
|
The runner uses Docker through the existing Docker socket proxy:
|
||||||
|
|
||||||
|
- `DOCKER_HOST=tcp://docker-socket-proxy:2375`
|
||||||
|
|
||||||
|
The runner intentionally **does not** mount:
|
||||||
|
|
||||||
|
- `/var/run/docker.sock`
|
||||||
|
|
||||||
|
## Registration token
|
||||||
|
|
||||||
|
Generate a runner registration token from the Gitea UI:
|
||||||
|
|
||||||
|
- Site Administration → Actions → Runners
|
||||||
|
- or Repo → Settings → Actions → Runners
|
||||||
|
|
||||||
|
Put the token in your env/secrets file:
|
||||||
|
|
||||||
|
- `GITEA_RUNNER_REGISTRATION_TOKEN=...`
|
||||||
|
|
||||||
|
## Start the runner
|
||||||
|
|
||||||
|
- `./services-up.sh --profile gitea up -d gitea-runner`
|
||||||
|
- or `./services-up.sh --profile all up -d gitea-runner`
|
||||||
|
|
||||||
|
## Logs
|
||||||
|
|
||||||
|
- `docker logs -f gitea-runner`
|
||||||
|
|
||||||
|
## Labels
|
||||||
|
|
||||||
|
Common workflow label:
|
||||||
|
|
||||||
|
- `runs-on: ubuntu-latest`
|
||||||
|
|
||||||
|
This should match the configured labels, for example:
|
||||||
|
|
||||||
|
- `GITEA_RUNNER_LABELS=ubuntu-latest:docker://node:20-bookworm,...`
|
||||||
|
|
||||||
|
## Security note
|
||||||
|
|
||||||
|
The runner can control Docker through `docker-socket-proxy`. This is safer than mounting the raw Docker socket directly, but workflows still have meaningful control over Docker. Only trusted repositories/users should be allowed to run workflows on this runner.
|
||||||
@@ -9,8 +9,10 @@ services:
|
|||||||
- USER_GID=${GITEA_USER_GID}
|
- USER_GID=${GITEA_USER_GID}
|
||||||
- GITEA__database__DB_TYPE=${GITEA_DB_TYPE}
|
- GITEA__database__DB_TYPE=${GITEA_DB_TYPE}
|
||||||
- GITEA__server__ROOT_URL=${GITEA_ROOT_URL}
|
- GITEA__server__ROOT_URL=${GITEA_ROOT_URL}
|
||||||
|
- GITEA__actions__ENABLED=true
|
||||||
volumes:
|
volumes:
|
||||||
- ${PROJECT_ROOT}/apps/gitea/data:/data
|
# - ${PROJECT_ROOT}/apps/gitea/data:/data
|
||||||
|
- ${DOCKER_VOLUMES}/gitea/data:/data
|
||||||
networks:
|
networks:
|
||||||
- traefik
|
- traefik
|
||||||
|
|
||||||
@@ -23,6 +25,7 @@ services:
|
|||||||
- "traefik.http.services.gitea.loadbalancer.server.port=3000"
|
- "traefik.http.services.gitea.loadbalancer.server.port=3000"
|
||||||
- "io.portainer.accesscontrol.public"
|
- "io.portainer.accesscontrol.public"
|
||||||
- "traefik.docker.network=core_traefik"
|
- "traefik.docker.network=core_traefik"
|
||||||
|
- "wud.watch=true"
|
||||||
|
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "curl -fsS http://localhost:3000/api/healthz >/dev/null"]
|
test: ["CMD-SHELL", "curl -fsS http://localhost:3000/api/healthz >/dev/null"]
|
||||||
@@ -31,6 +34,27 @@ services:
|
|||||||
retries: 6
|
retries: 6
|
||||||
start_period: 120s
|
start_period: 120s
|
||||||
|
|
||||||
|
gitea-runner:
|
||||||
|
profiles: ["apps","all","gitea","ci"]
|
||||||
|
container_name: gitea-runner
|
||||||
|
image: gitea/act_runner:latest
|
||||||
|
restart: always
|
||||||
|
depends_on:
|
||||||
|
- gitea
|
||||||
|
- docker-socket-proxy
|
||||||
|
environment:
|
||||||
|
- GITEA_INSTANCE_URL=${GITEA_ROOT_URL}
|
||||||
|
- GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_REGISTRATION_TOKEN}
|
||||||
|
- GITEA_RUNNER_NAME=${GITEA_RUNNER_NAME}
|
||||||
|
- GITEA_RUNNER_LABELS=${GITEA_RUNNER_LABELS}
|
||||||
|
- DOCKER_HOST=${DOCKER_SOCKET_PROXY_HOST}
|
||||||
|
volumes:
|
||||||
|
# - ${PROJECT_ROOT}/apps/gitea/runner-data:/data
|
||||||
|
- ${DOCKER_VOLUMES}/gitea/runner:/data
|
||||||
|
networks:
|
||||||
|
- traefik
|
||||||
|
- docker-socket-proxy
|
||||||
|
|
||||||
#volumes:
|
#volumes:
|
||||||
# gitea_data:
|
# gitea_data:
|
||||||
|
|
||||||
|
|||||||
+121
-49
@@ -1,58 +1,58 @@
|
|||||||
services:
|
services:
|
||||||
gramps-db:
|
|
||||||
profiles: ["apps","all","gramps"]
|
|
||||||
image: postgres:13
|
|
||||||
container_name: gramps-db
|
|
||||||
restart: always
|
|
||||||
env_file:
|
|
||||||
- ${SECRETS_ENV_FILE}
|
|
||||||
environment:
|
|
||||||
POSTGRES_USER: ${GRAMPS_DB_USER}
|
|
||||||
POSTGRES_PASSWORD_FILE: /run/secrets/gramps_db_password
|
|
||||||
POSTGRES_DB: ${GRAMPS_DB_NAME}
|
|
||||||
secrets:
|
|
||||||
- gramps_db_password
|
|
||||||
volumes:
|
|
||||||
- ${PROJECT_ROOT}/apps/gramps/db:/var/lib/postgresql
|
|
||||||
networks:
|
|
||||||
- gramps
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready -h gramps-db -p 5432 -U $$POSTGRES_USER -d $$POSTGRES_DB"]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 12
|
|
||||||
start_period: 30s
|
|
||||||
|
|
||||||
grampsweb:
|
grampsweb:
|
||||||
profiles: ["apps","all","gramps"]
|
profiles: ["apps","all","gramps"]
|
||||||
image: ghcr.io/gramps-project/grampsweb:latest
|
image: ghcr.io/gramps-project/grampsweb:latest
|
||||||
container_name: gramps-web
|
container_name: gramps-web
|
||||||
depends_on:
|
depends_on:
|
||||||
- gramps-db
|
- gramps-redis
|
||||||
|
- grampsweb_celery
|
||||||
restart: always
|
restart: always
|
||||||
env_file:
|
# env_file:
|
||||||
- ${SECRETS_ENV_FILE}
|
# - ${SECRETS_ENV_FILE}
|
||||||
environment:
|
environment:
|
||||||
DB_URI: ${GRAMPS_DB_URI}
|
TZ: ${TZ}
|
||||||
GRAMPSWEB_LOGLEVEL: ${GRAMPSWEB_LOGLEVEL}
|
GRAMPSWEB_TREE: ${GRAMPSWEB_TREE}
|
||||||
# default admin user created on first run:
|
GRAMPSWEB_BASE_URL: ${GRAMPSWEB_BASE_URL}
|
||||||
INITIAL_ADMIN: ${GRAMPS_INITIAL_ADMIN}
|
GRAMPSWEB_SECRET_KEY: ${GRAMPSWEB_SECRET_KEY}
|
||||||
INITIAL_ADMIN_PASSWORD: ${GRAMPS_INITIAL_ADMIN_PASSWORD}
|
GRAMPSWEB_REGISTRATION_DISABLED: ${GRAMPSWEB_REGISTRATION_DISABLED}
|
||||||
# optional: storage paths inside container
|
GRAMPSWEB_EMAIL_HOST: ${GRAMPSWEB_EMAIL_HOST}
|
||||||
GRAMPSWEB_MEDIAPATH: ${GRAMPSWEB_MEDIAPATH}
|
GRAMPSWEB_EMAIL_PORT: ${GRAMPSWEB_EMAIL_PORT}
|
||||||
GRAMPSWEB_TREE: "${GRAMPSWEB_TREE}"
|
GRAMPSWEB_EMAIL_HOST_USER: ${GRAMPSWEB_EMAIL_HOST_USER}
|
||||||
|
GRAMPSWEB_EMAIL_HOST_PASSWORD: ${GRAMPSWEB_EMAIL_HOST_PASSWORD}
|
||||||
|
GRAMPSWEB_EMAIL_USE_SSL: ${GRAMPSWEB_EMAIL_USE_SSL}
|
||||||
|
GRAMPSWEB_EMAIL_USE_STARTTLS: ${GRAMPSWEB_EMAIL_USE_STARTTLS}
|
||||||
|
GRAMPSWEB_DEFAULT_FROM_EMAIL: ${GRAMPSWEB_DEFAULT_FROM_EMAIL}
|
||||||
|
GRAMPSWEB_CELERY_CONFIG__broker_url: redis://gramps-redis:6379/0
|
||||||
|
GRAMPSWEB_CELERY_CONFIG__result_backend: redis://gramps-redis:6379/0
|
||||||
|
GRAMPSWEB_RATELIMIT_STORAGE_URI: redis://gramps-redis:6379/1
|
||||||
volumes:
|
volumes:
|
||||||
- ${PROJECT_ROOT}/apps/gramps/data/users:/app/users
|
# - ${PROJECT_ROOT}/apps/gramps/data/users:/app/users
|
||||||
- ${PROJECT_ROOT}/apps/gramps/data/media:/app/media
|
# - ${PROJECT_ROOT}/apps/gramps/data/index:/app/indexdir
|
||||||
- ${PROJECT_ROOT}/apps/gramps/data/cache:/app/cache
|
# - ${PROJECT_ROOT}/apps/gramps/data/thumbnail_cache:/app/thumbnail_cache
|
||||||
|
# - ${PROJECT_ROOT}/apps/gramps/data/cache:/app/cache
|
||||||
|
# - ${PROJECT_ROOT}/apps/gramps/data/secret:/app/secret
|
||||||
|
# - ${PROJECT_ROOT}/apps/gramps/data/db:/root/.gramps/grampsdb
|
||||||
|
# - ${PROJECT_ROOT}/apps/gramps/data/media:/app/media
|
||||||
|
# - ${PROJECT_ROOT}/apps/gramps/data/tmp:/tmp
|
||||||
|
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/users:/app/users
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/index:/app/indexdir
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/thumbnail_cache:/app/thumbnail_cache
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/cache:/app/cache
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/secret:/app/secret
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/db:/root/.gramps/grampsdb
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/media:/app/media
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/tmp:/tmp
|
||||||
|
|
||||||
labels:
|
labels:
|
||||||
- "traefik.http.routers.gramps.rule=Host(`familytree.lan.ddnsgeek.com`)"
|
- "traefik.http.routers.gramps.rule=Host(`familytree.lan.ddnsgeek.com`)"
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.gramps.entrypoints=websecure"
|
- "traefik.http.routers.gramps.entrypoints=websecure"
|
||||||
- "traefik.http.routers.gramps.tls.certresolver=myresolver"
|
- "traefik.http.routers.gramps.tls.certresolver=myresolver"
|
||||||
- "io.portainer.accesscontrol.public"
|
- "io.portainer.accesscontrol.public"
|
||||||
- "traefik.http.services.gramps.loadbalancer.server.port=5000"
|
- "traefik.http.services.gramps.loadbalancer.server.port=5000"
|
||||||
- "traefik.docker.network=core_traefik"
|
- "traefik.docker.network=core_traefik"
|
||||||
|
- "wud.watch=true"
|
||||||
networks:
|
networks:
|
||||||
- traefik
|
- traefik
|
||||||
- gramps
|
- gramps
|
||||||
@@ -65,9 +65,81 @@ services:
|
|||||||
retries: 6
|
retries: 6
|
||||||
start_period: 60s
|
start_period: 60s
|
||||||
|
|
||||||
|
grampsweb_celery:
|
||||||
|
profiles: ["apps","all","gramps"]
|
||||||
|
image: ghcr.io/gramps-project/grampsweb:latest
|
||||||
|
container_name: gramps-web-celery
|
||||||
|
command: celery -A gramps_webapi.celery worker --loglevel=INFO --concurrency=2
|
||||||
|
depends_on:
|
||||||
|
- gramps-redis
|
||||||
|
restart: always
|
||||||
|
# env_file:
|
||||||
|
# - ${SECRETS_ENV_FILE}
|
||||||
|
environment:
|
||||||
|
TZ: ${TZ}
|
||||||
|
GRAMPSWEB_TREE: ${GRAMPSWEB_TREE}
|
||||||
|
GRAMPSWEB_BASE_URL: ${GRAMPSWEB_BASE_URL}
|
||||||
|
GRAMPSWEB_SECRET_KEY: ${GRAMPSWEB_SECRET_KEY}
|
||||||
|
GRAMPSWEB_REGISTRATION_DISABLED: ${GRAMPSWEB_REGISTRATION_DISABLED}
|
||||||
|
GRAMPSWEB_EMAIL_HOST: ${GRAMPSWEB_EMAIL_HOST}
|
||||||
|
GRAMPSWEB_EMAIL_PORT: ${GRAMPSWEB_EMAIL_PORT}
|
||||||
|
GRAMPSWEB_EMAIL_HOST_USER: ${GRAMPSWEB_EMAIL_HOST_USER}
|
||||||
|
GRAMPSWEB_EMAIL_HOST_PASSWORD: ${GRAMPSWEB_EMAIL_HOST_PASSWORD}
|
||||||
|
GRAMPSWEB_EMAIL_USE_SSL: ${GRAMPSWEB_EMAIL_USE_SSL}
|
||||||
|
GRAMPSWEB_EMAIL_USE_STARTTLS: ${GRAMPSWEB_EMAIL_USE_STARTTLS}
|
||||||
|
GRAMPSWEB_DEFAULT_FROM_EMAIL: ${GRAMPSWEB_DEFAULT_FROM_EMAIL}
|
||||||
|
GRAMPSWEB_CELERY_CONFIG__broker_url: redis://gramps-redis:6379/0
|
||||||
|
GRAMPSWEB_CELERY_CONFIG__result_backend: redis://gramps-redis:6379/0
|
||||||
|
GRAMPSWEB_RATELIMIT_STORAGE_URI: redis://gramps-redis:6379/1
|
||||||
|
volumes:
|
||||||
|
# - ${PROJECT_ROOT}/apps/gramps/data/users:/app/users
|
||||||
|
# - ${PROJECT_ROOT}/apps/gramps/data/index:/app/indexdir
|
||||||
|
# - ${PROJECT_ROOT}/apps/gramps/data/thumbnail_cache:/app/thumbnail_cache
|
||||||
|
# - ${PROJECT_ROOT}/apps/gramps/data/cache:/app/cache
|
||||||
|
# - ${PROJECT_ROOT}/apps/gramps/data/secret:/app/secret
|
||||||
|
# - ${PROJECT_ROOT}/apps/gramps/data/db:/root/.gramps/grampsdb
|
||||||
|
# - ${PROJECT_ROOT}/apps/gramps/data/media:/app/media
|
||||||
|
# - ${PROJECT_ROOT}/apps/gramps/data/tmp:/tmp
|
||||||
|
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/users:/app/users
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/index:/app/indexdir
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/thumbnail_cache:/app/thumbnail_cache
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/cache:/app/cache
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/secret:/app/secret
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/db:/root/.gramps/grampsdb
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/media:/app/media
|
||||||
|
- ${DOCKER_VOLUMES}/gramps-data/tmp:/tmp
|
||||||
|
labels:
|
||||||
|
- "wud.watch=true"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
- gramps
|
||||||
|
healthcheck:
|
||||||
|
test:
|
||||||
|
- CMD-SHELL
|
||||||
|
- pgrep -f "celery.*gramps_webapi.celery.*worker" >/dev/null
|
||||||
|
interval: 30s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 6
|
||||||
|
start_period: 60s
|
||||||
|
|
||||||
|
gramps-redis:
|
||||||
|
profiles: ["apps","all","gramps"]
|
||||||
|
image: valkey/valkey:9-trixie
|
||||||
|
container_name: gramps-redis
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
- gramps
|
||||||
|
healthcheck:
|
||||||
|
test:
|
||||||
|
- CMD-SHELL
|
||||||
|
- valkey-cli -h 127.0.0.1 -p 6379 ping | grep -q PONG
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 6
|
||||||
|
start_period: 10s
|
||||||
|
labels:
|
||||||
|
- "wud.watch=true"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
gramps:
|
gramps:
|
||||||
|
|
||||||
secrets:
|
|
||||||
gramps_db_password:
|
|
||||||
file: ${PROJECT_ROOT}/secrets/gramps_db_password.txt
|
|
||||||
@@ -1,19 +1,5 @@
|
|||||||
FROM nextcloud:production
|
FROM nextcloud:production
|
||||||
|
|
||||||
#RUN groupadd -r doods && useradd -m -s /bin/bash -d /opt/doods -g doods doods
|
|
||||||
#RUN chsh -s /usr/sbin/nologin root
|
|
||||||
|
|
||||||
#RUN chown -R doods:doods /opt/doods
|
|
||||||
|
|
||||||
#ENV PATH "${PATH}:/opt/doods"
|
|
||||||
|
|
||||||
#ENV HOME /opt/doods
|
|
||||||
|
|
||||||
#USER root
|
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y ffmpeg && \
|
apt-get install -y ffmpeg && \
|
||||||
apt-get clean && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
#USER www-data
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
services:
|
services:
|
||||||
nextcloud-webapp:
|
nextcloud-webapp:
|
||||||
profiles: ["apps","all","nextcloud"]
|
profiles: ["apps","all","nextcloud"]
|
||||||
|
image: nextcloud:production
|
||||||
build:
|
build:
|
||||||
context: ${PROJECT_ROOT}/apps/nextcloud
|
context: ${PROJECT_ROOT}/apps/nextcloud
|
||||||
container_name: nextcloud-webapp
|
container_name: nextcloud-webapp
|
||||||
@@ -9,10 +10,15 @@ services:
|
|||||||
# env_file:
|
# env_file:
|
||||||
# - ${SECRETS_ENV_FILE}
|
# - ${SECRETS_ENV_FILE}
|
||||||
volumes:
|
volumes:
|
||||||
- ${PROJECT_ROOT}/apps/nextcloud/data:/var/www/html/data:rw
|
# - ${PROJECT_ROOT}/apps/nextcloud/data:/var/www/html/data:rw
|
||||||
- ${PROJECT_ROOT}/apps/nextcloud/config:/var/www/html/config:rw
|
- ${NEXTCLOUD_DATA}:/var/www/html/data:rw
|
||||||
|
# - ${PROJECT_ROOT}/apps/nextcloud/config:/var/www/html/config:rw
|
||||||
|
- ${DOCKER_VOLUMES}/nextcloud/config:/var/www/html/config:rw
|
||||||
- type: tmpfs
|
- type: tmpfs
|
||||||
target: /tmp:exec
|
target: /tmp:exec
|
||||||
|
# - ${PROJECT_ROOT}/apps/nextcloud/entrypoint.sh:/entrypoint.sh
|
||||||
|
# - ${PROJECT_ROOT}/apps/nextcloud/custom_apps:/var/www/html/custom_apps
|
||||||
|
- ${DOCKER_VOLUMES}/nextcloud/custom_apps:/var/www/html/custom_apps
|
||||||
depends_on:
|
depends_on:
|
||||||
- nextcloud-db
|
- nextcloud-db
|
||||||
- nextcloud-redis
|
- nextcloud-redis
|
||||||
@@ -34,11 +40,11 @@ services:
|
|||||||
- SMTP_PASSWORD_FILE=/run/secrets/nextcloud_smtp_password
|
- SMTP_PASSWORD_FILE=/run/secrets/nextcloud_smtp_password
|
||||||
- REDIS_HOST=${NEXTCLOUD_REDIS_HOST}
|
- REDIS_HOST=${NEXTCLOUD_REDIS_HOST}
|
||||||
- REDIS_HOST_PORT=${NEXTCLOUD_REDIS_HOST_PORT}
|
- REDIS_HOST_PORT=${NEXTCLOUD_REDIS_HOST_PORT}
|
||||||
- REDIS_HOST_PASSWORD_FILE=/run/secrets/nextcloud_redis_password
|
# - REDIS_HOST_PASSWORD_FILE=/run/secrets/nextcloud_redis_password
|
||||||
secrets:
|
secrets:
|
||||||
- nextcloud_db_password
|
- nextcloud_db_password
|
||||||
- nextcloud_smtp_password
|
- nextcloud_smtp_password
|
||||||
- nextcloud_redis_password
|
# - nextcloud_redis_password
|
||||||
networks:
|
networks:
|
||||||
- traefik
|
- traefik
|
||||||
- nextcloud
|
- nextcloud
|
||||||
@@ -57,6 +63,7 @@ services:
|
|||||||
- "traefik.http.middlewares.nextcloud-webfinger.redirectregex.regex=https://(.*)/.well-known/webfinger"
|
- "traefik.http.middlewares.nextcloud-webfinger.redirectregex.regex=https://(.*)/.well-known/webfinger"
|
||||||
- "traefik.http.middlewares.nextcloud-webfinger.redirectregex.replacement=https://$${1}/nextcloud/index.php/.well-known/webfinger"
|
- "traefik.http.middlewares.nextcloud-webfinger.redirectregex.replacement=https://$${1}/nextcloud/index.php/.well-known/webfinger"
|
||||||
- "traefik.docker.network=core_traefik"
|
- "traefik.docker.network=core_traefik"
|
||||||
|
- "wud.watch=true"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test:
|
test:
|
||||||
- CMD-SHELL
|
- CMD-SHELL
|
||||||
@@ -71,16 +78,17 @@ services:
|
|||||||
start_period: 180s
|
start_period: 180s
|
||||||
|
|
||||||
nextcloud-db:
|
nextcloud-db:
|
||||||
image: mariadb:11.4
|
image: mariadb:${NEXTCLOUD_DB_VERSION}
|
||||||
restart: always
|
restart: always
|
||||||
profiles: ["apps","all","nextcloud"]
|
profiles: ["apps","all","nextcloud"]
|
||||||
container_name: nextcloud-db
|
container_name: nextcloud-db
|
||||||
hostname: nextcloud_db
|
hostname: nextcloud_db
|
||||||
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
|
command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW --log_bin_trust_function_creators=true
|
||||||
# env_file:
|
# env_file:
|
||||||
# - ${PROJECT_ROOT}/secrets/stack-secrets.env
|
# - ${PROJECT_ROOT}/secrets/stack-secrets.env
|
||||||
volumes:
|
volumes:
|
||||||
- ${PROJECT_ROOT}/apps/nextcloud/database:/var/lib/mysql:rw
|
# - ${PROJECT_ROOT}/apps/nextcloud/database:/var/lib/mysql:rw
|
||||||
|
- ${DOCKER_DATABASES}/nextcloud/mysql:/var/lib/mysql:rw
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/nextcloud_db_root_password
|
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/nextcloud_db_root_password
|
||||||
- MYSQL_PASSWORD_FILE=/run/secrets/nextcloud_db_password
|
- MYSQL_PASSWORD_FILE=/run/secrets/nextcloud_db_password
|
||||||
@@ -97,30 +105,38 @@ services:
|
|||||||
- nextcloud
|
- nextcloud
|
||||||
labels:
|
labels:
|
||||||
- "io.portainer.accesscontrol.public"
|
- "io.portainer.accesscontrol.public"
|
||||||
|
- "wud.watch=true"
|
||||||
|
- 'wud.tag.include=^11\.4(?:\.\d+)?$'
|
||||||
|
# - "wud.tag.exclude=${NEXTCLOUD_DB_VERSION}-*"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "mariadb-admin ping -u $$MYSQL_USER --password=$$(cat /run/secrets/nextcloud_db_password) --silent"]
|
test: ["CMD-SHELL", "mariadb-admin ping -u $$MYSQL_USER --password=$$(cat /run/secrets/nextcloud_db_password) --silent"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 12
|
retries: 12
|
||||||
start_period: 60s
|
start_period: 60s
|
||||||
|
|
||||||
|
|
||||||
nextcloud-redis:
|
nextcloud-redis:
|
||||||
image: "redis"
|
image: "redis"
|
||||||
profiles: ["apps","all","nextcloud"]
|
profiles: ["apps","all","nextcloud"]
|
||||||
command: ["sh", "-c", "redis-server --requirepass \"$$(cat /run/secrets/nextcloud_redis_password)\" --appendonly yes --save 60 1000"]
|
# command: ["sh", "-c", "redis-server --requirepass \"$$(cat /run/secrets/nextcloud_redis_password)\" --appendonly yes --save 60 1000"]
|
||||||
|
command: ["sh", "-c", "redis-server --appendonly yes --save 60 1000"]
|
||||||
hostname: redis
|
hostname: redis
|
||||||
container_name: nextcloud-redis
|
container_name: nextcloud-redis
|
||||||
secrets:
|
# secrets:
|
||||||
- nextcloud_redis_password
|
# - nextcloud_redis_password
|
||||||
volumes:
|
volumes:
|
||||||
- ${PROJECT_ROOT}/apps/nextcloud/data/redis:/data:rw
|
# - ${PROJECT_ROOT}/apps/nextcloud/data/redis:/data:rw
|
||||||
|
- ${DOCKER_DATABASES}/nextcloud/redis:/data:rw
|
||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- nextcloud
|
- nextcloud
|
||||||
labels:
|
labels:
|
||||||
- "io.portainer.accesscontrol.public"
|
- "io.portainer.accesscontrol.public"
|
||||||
|
- "wud.watch=true"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "redis-cli -a \"$$(cat /run/secrets/nextcloud_redis_password)\" PING | grep -q PONG"]
|
# test: ["CMD-SHELL", "redis-cli -a \"$$(cat /run/secrets/nextcloud_redis_password)\" PING | grep -q PONG"]
|
||||||
|
test: ["CMD-SHELL", "redis-cli PING | grep -q PONG"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 6
|
retries: 6
|
||||||
@@ -138,5 +154,5 @@ secrets:
|
|||||||
file: ${PROJECT_ROOT}/secrets/nextcloud_admin_password.txt
|
file: ${PROJECT_ROOT}/secrets/nextcloud_admin_password.txt
|
||||||
nextcloud_smtp_password:
|
nextcloud_smtp_password:
|
||||||
file: ${PROJECT_ROOT}/secrets/nextcloud_smtp_password.txt
|
file: ${PROJECT_ROOT}/secrets/nextcloud_smtp_password.txt
|
||||||
nextcloud_redis_password:
|
# nextcloud_redis_password:
|
||||||
file: ${PROJECT_ROOT}/secrets/nextcloud_redis_password.txt
|
# file: ${PROJECT_ROOT}/secrets/nextcloud_redis_password.txt
|
||||||
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
OCC="/var/www/html/occ"
|
||||||
|
|
||||||
|
php $OCC app:install memories || true
|
||||||
|
php $OCC app:enable memories || true
|
||||||
|
|
||||||
|
php $OCC app:install recognize || true
|
||||||
|
php $OCC app:enable recognize || true
|
||||||
|
|
||||||
|
|
||||||
|
exec apache2-foreground
|
||||||
@@ -2,7 +2,7 @@ services:
|
|||||||
passbolt-db:
|
passbolt-db:
|
||||||
profiles: ["apps","all","passbolt"]
|
profiles: ["apps","all","passbolt"]
|
||||||
container_name: passbolt-db
|
container_name: passbolt-db
|
||||||
image: mariadb:12
|
image: mariadb:latest
|
||||||
restart: always
|
restart: always
|
||||||
# env_file:
|
# env_file:
|
||||||
# - ${PROJECT_ROOT}/secrets/stack-secrets.env
|
# - ${PROJECT_ROOT}/secrets/stack-secrets.env
|
||||||
@@ -14,7 +14,8 @@ services:
|
|||||||
secrets:
|
secrets:
|
||||||
- passbolt_db_password
|
- passbolt_db_password
|
||||||
volumes:
|
volumes:
|
||||||
- ${PROJECT_ROOT}/apps/passbolt/data/database:/var/lib/mysql
|
# - ${PROJECT_ROOT}/apps/passbolt/data/database:/var/lib/mysql
|
||||||
|
- ${DOCKER_DATABASES}/passbolt:/var/lib/mysql
|
||||||
networks:
|
networks:
|
||||||
- passbolt
|
- passbolt
|
||||||
healthcheck:
|
healthcheck:
|
||||||
@@ -24,7 +25,8 @@ services:
|
|||||||
retries: 12
|
retries: 12
|
||||||
start_period: 60s
|
start_period: 60s
|
||||||
labels:
|
labels:
|
||||||
- "io.portainer.accesscontrol.public"
|
- "io.portainer.accesscontrol.public"
|
||||||
|
- "wud.watch=true"
|
||||||
|
|
||||||
passbolt-webapp:
|
passbolt-webapp:
|
||||||
image: passbolt/passbolt:latest-ce
|
image: passbolt/passbolt:latest-ce
|
||||||
@@ -45,8 +47,12 @@ services:
|
|||||||
secrets:
|
secrets:
|
||||||
- passbolt_db_password
|
- passbolt_db_password
|
||||||
volumes:
|
volumes:
|
||||||
- ${PROJECT_ROOT}/apps/passbolt/data/gpg:/etc/passbolt/gpg
|
# - ${PROJECT_ROOT}/apps/passbolt/data/gpg:/etc/passbolt/gpg
|
||||||
- ${PROJECT_ROOT}/apps/passbolt/data/jwt:/etc/passbolt/jwt
|
# - ${PROJECT_ROOT}/apps/passbolt/data/jwt:/etc/passbolt/jwt
|
||||||
|
|
||||||
|
- ${DOCKER_VOLUMES}/passbolt-data/gpg:/etc/passbolt/gpg
|
||||||
|
- ${DOCKER_VOLUMES}/passbolt-data/jwt:/etc/passbolt/jwt
|
||||||
|
|
||||||
command:
|
command:
|
||||||
[
|
[
|
||||||
"/usr/bin/wait-for.sh",
|
"/usr/bin/wait-for.sh",
|
||||||
@@ -66,6 +72,7 @@ services:
|
|||||||
- "traefik.http.routers.passbolt.tls.certresolver=myresolver"
|
- "traefik.http.routers.passbolt.tls.certresolver=myresolver"
|
||||||
- "io.portainer.accesscontrol.public"
|
- "io.portainer.accesscontrol.public"
|
||||||
- "traefik.docker.network=core_traefik"
|
- "traefik.docker.network=core_traefik"
|
||||||
|
- "wud.watch=true"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "curl -fsS http://localhost/healthcheck/status | grep -qx OK"]
|
test: ["CMD-SHELL", "curl -fsS http://localhost/healthcheck/status | grep -qx OK"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
|
|||||||
@@ -13,13 +13,14 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- traefik
|
- traefik
|
||||||
labels:
|
labels:
|
||||||
- "traefik.http.routers.searxng.rule=Host(`searxng.lan.ddnsgeek.com`)"
|
- "traefik.http.routers.searxng.rule=Host(`searxng.lan.ddnsgeek.com`)"
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.searxng.entrypoints=websecure"
|
- "traefik.http.routers.searxng.entrypoints=websecure"
|
||||||
- "traefik.http.routers.searxng.tls.certresolver=myresolver"
|
- "traefik.http.routers.searxng.tls.certresolver=myresolver"
|
||||||
- "io.portainer.accesscontrol.public"
|
- "io.portainer.accesscontrol.public"
|
||||||
# - "traefik.http.routers.searxng.middlewares=crowdsec@file,secHeaders@file,error-pages-middleware"
|
# - "traefik.http.routers.searxng.middlewares=crowdsec@file,secHeaders@file,error-pages-middleware"
|
||||||
- "traefik.http.services.searxng.loadbalancer.server.port=8080"
|
- "traefik.http.services.searxng.loadbalancer.server.port=8080"
|
||||||
|
- "wud.watch=true"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "python3 -c \"import urllib.request,sys; r=urllib.request.urlopen('http://127.0.0.1:8080/', timeout=3); sys.exit(0 if 200<=r.status<400 else 1)\""]
|
test: ["CMD-SHELL", "python3 -c \"import urllib.request,sys; r=urllib.request.urlopen('http://127.0.0.1:8080/', timeout=3); sys.exit(0 if 200<=r.status<400 else 1)\""]
|
||||||
interval: 20s
|
interval: 20s
|
||||||
|
|||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+6
-2
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
docker-update-exporter:
|
docker-update-exporter:
|
||||||
profiles: ["monitoring","all","prometheus-exporters"]
|
profiles: ["monitoring","all","docker-exporter", "prometheus"]
|
||||||
build:
|
build:
|
||||||
context: ${PROJECT_ROOT}/monitoring/docker-exporter
|
context: ${PROJECT_ROOT}/monitoring/docker-exporter
|
||||||
container_name: docker-update-exporter
|
container_name: docker-update-exporter
|
||||||
@@ -16,7 +16,8 @@ services:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- ~/.docker/config.json:/root/.docker/config.json:ro
|
- ~/.docker/config.json:/root/.docker/config.json:ro
|
||||||
- ${PROJECT_ROOT}/monitoring/docker-exporter/data:/data:rw
|
# - ${PROJECT_ROOT}/monitoring/docker-exporter/data:/data:rw
|
||||||
|
- ${DOCKER_VOLUMES}/docker-update-exporter-data:/data:rw
|
||||||
- ${PROJECT_ROOT}:/compose:ro
|
- ${PROJECT_ROOT}:/compose:ro
|
||||||
# - ${PROJECT_ROOT}/default-environment.env:/compose/default-environment.env:ro
|
# - ${PROJECT_ROOT}/default-environment.env:/compose/default-environment.env:ro
|
||||||
# - ${PROJECT_ROOT}/default-network.yml:/compose/default-network.yml:ro
|
# - ${PROJECT_ROOT}/default-network.yml:/compose/default-network.yml:ro
|
||||||
@@ -53,3 +54,6 @@ services:
|
|||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
start_period: 10s
|
start_period: 10s
|
||||||
|
#volumes:
|
||||||
|
# docker-update-exporter-data:
|
||||||
|
# external: true
|
||||||
+52
-1
@@ -293,6 +293,18 @@ def get_compose_files_from_script(script_path):
|
|||||||
if not os.path.exists(script_path):
|
if not os.path.exists(script_path):
|
||||||
return files
|
return files
|
||||||
base_dir = get_project_root_from_script(script_path)
|
base_dir = get_project_root_from_script(script_path)
|
||||||
|
|
||||||
|
def _clean_compose_path(raw_path):
|
||||||
|
cleaned = str(raw_path).strip().strip(",")
|
||||||
|
if (cleaned.startswith('"') and cleaned.endswith('"')) or (
|
||||||
|
cleaned.startswith("'") and cleaned.endswith("'")
|
||||||
|
):
|
||||||
|
cleaned = cleaned[1:-1]
|
||||||
|
expanded = expand_compose_path(cleaned, base_dir)
|
||||||
|
if os.path.isabs(expanded):
|
||||||
|
return os.path.normpath(expanded)
|
||||||
|
return os.path.normpath(os.path.join(base_dir, expanded))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(script_path) as f:
|
with open(script_path) as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
@@ -303,8 +315,47 @@ def get_compose_files_from_script(script_path):
|
|||||||
if line.startswith("-f"):
|
if line.startswith("-f"):
|
||||||
path = line[2:].strip()
|
path = line[2:].strip()
|
||||||
if path:
|
if path:
|
||||||
full = os.path.normpath(os.path.join(base_dir, path))
|
full = _clean_compose_path(path)
|
||||||
files.append(full)
|
files.append(full)
|
||||||
|
|
||||||
|
# services-up.sh can append many compose files at runtime via:
|
||||||
|
# FILES+=(-f "$file") done < <(find "$PROJECT_ROOT/apps" ...)
|
||||||
|
# Mirror that behavior here so we can map service->compose image.
|
||||||
|
root_dirs = []
|
||||||
|
find_match = re.search(r'find\s+(.*?)\s+\\\s*\n', content)
|
||||||
|
if find_match:
|
||||||
|
for token in re.findall(r'"([^"]+)"|\'([^\']+)\'', find_match.group(1)):
|
||||||
|
candidate = token[0] or token[1]
|
||||||
|
if candidate:
|
||||||
|
root_dirs.append(_clean_compose_path(candidate))
|
||||||
|
else:
|
||||||
|
root_dirs = [
|
||||||
|
os.path.join(base_dir, "apps"),
|
||||||
|
os.path.join(base_dir, "monitoring"),
|
||||||
|
os.path.join(base_dir, "core"),
|
||||||
|
]
|
||||||
|
|
||||||
|
for root_dir in root_dirs:
|
||||||
|
if not os.path.isdir(root_dir):
|
||||||
|
continue
|
||||||
|
for candidate in sorted(os.listdir(root_dir)):
|
||||||
|
svc_dir = os.path.join(root_dir, candidate)
|
||||||
|
if not os.path.isdir(svc_dir):
|
||||||
|
continue
|
||||||
|
for compose_name in ("docker-compose.yml", "docker-compose.yaml"):
|
||||||
|
compose_path = os.path.join(svc_dir, compose_name)
|
||||||
|
if os.path.exists(compose_path):
|
||||||
|
files.append(compose_path)
|
||||||
|
|
||||||
|
# Preserve order while removing duplicates.
|
||||||
|
deduped = []
|
||||||
|
seen = set()
|
||||||
|
for path in files:
|
||||||
|
if path in seen:
|
||||||
|
continue
|
||||||
|
seen.add(path)
|
||||||
|
deduped.append(path)
|
||||||
|
files = deduped
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Failed parsing services-up.sh: {e}")
|
logger.warning(f"Failed parsing services-up.sh: {e}")
|
||||||
return files
|
return files
|
||||||
File renamed without changes.
+7
-1
@@ -7,7 +7,8 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- GF_SERVER_ROOT_URL=${GRAFANA_ROOT_URL}
|
- GF_SERVER_ROOT_URL=${GRAFANA_ROOT_URL}
|
||||||
volumes:
|
volumes:
|
||||||
- ${PROJECT_ROOT}/monitoring/grafana/data:/var/lib/grafana
|
# - ${PROJECT_ROOT}/monitoring/grafana/data:/var/lib/grafana
|
||||||
|
- ${DOCKER_VOLUMES}/grafana-data:/var/lib/grafana
|
||||||
networks:
|
networks:
|
||||||
# - traefik_reverse_proxy
|
# - traefik_reverse_proxy
|
||||||
# - prometheus_edge
|
# - prometheus_edge
|
||||||
@@ -18,6 +19,7 @@ services:
|
|||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.grafana.entrypoints=websecure"
|
- "traefik.http.routers.grafana.entrypoints=websecure"
|
||||||
- "traefik.http.routers.grafana.tls.certresolver=myresolver"
|
- "traefik.http.routers.grafana.tls.certresolver=myresolver"
|
||||||
|
- "traefik.http.routers.grafana.tls.options=mtls-private-admin@file"
|
||||||
- "io.portainer.accesscontrol.public"
|
- "io.portainer.accesscontrol.public"
|
||||||
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
|
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
|
||||||
- "traefik.docker.network=core_traefik"
|
- "traefik.docker.network=core_traefik"
|
||||||
@@ -47,3 +49,7 @@ services:
|
|||||||
# external: true
|
# external: true
|
||||||
# prometheus_edge:
|
# prometheus_edge:
|
||||||
# external: true
|
# external: true
|
||||||
|
|
||||||
|
#volumes:
|
||||||
|
# grafana-data:
|
||||||
|
# external: true
|
||||||
+11
-3
@@ -1,13 +1,14 @@
|
|||||||
services:
|
services:
|
||||||
influxdb:
|
influxdb:
|
||||||
profiles: ["monitoring","all","prometheus"]
|
profiles: ["monitoring","all","influxdb", "prometheus"]
|
||||||
image: influxdb:2.7
|
image: influxdb:2
|
||||||
container_name: influxdb
|
container_name: influxdb
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
# env_file:
|
# env_file:
|
||||||
# - ${PROJECT_ROOT}/secrets/stack-secrets.env
|
# - ${PROJECT_ROOT}/secrets/stack-secrets.env
|
||||||
volumes:
|
volumes:
|
||||||
- ${PROJECT_ROOT}/monitoring/influxdb:/var/lib/influxdb2
|
# - ${PROJECT_ROOT}/monitoring/influxdb:/var/lib/influxdb2
|
||||||
|
- ${DOCKER_DATABASES}/influxdb-data:/var/lib/influxdb2
|
||||||
environment:
|
environment:
|
||||||
DOCKER_INFLUXDB_INIT_MODE: ${INFLUXDB_INIT_MODE}
|
DOCKER_INFLUXDB_INIT_MODE: ${INFLUXDB_INIT_MODE}
|
||||||
DOCKER_INFLUXDB_INIT_USERNAME: ${INFLUXDB_INIT_USERNAME}
|
DOCKER_INFLUXDB_INIT_USERNAME: ${INFLUXDB_INIT_USERNAME}
|
||||||
@@ -21,11 +22,14 @@ services:
|
|||||||
# - traefik_reverse_proxy
|
# - traefik_reverse_proxy
|
||||||
- traefik
|
- traefik
|
||||||
- monitor
|
- monitor
|
||||||
|
ports:
|
||||||
|
- 8086:8086
|
||||||
labels:
|
labels:
|
||||||
- "traefik.http.routers.influxdb.rule=Host(`influxdb.lan.ddnsgeek.com`)"
|
- "traefik.http.routers.influxdb.rule=Host(`influxdb.lan.ddnsgeek.com`)"
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.influxdb.entrypoints=websecure"
|
- "traefik.http.routers.influxdb.entrypoints=websecure"
|
||||||
- "traefik.http.routers.influxdb.tls.certresolver=myresolver"
|
- "traefik.http.routers.influxdb.tls.certresolver=myresolver"
|
||||||
|
- "traefik.http.routers.influxdb.tls.options=mtls-private-admin@file"
|
||||||
- "io.portainer.accesscontrol.public"
|
- "io.portainer.accesscontrol.public"
|
||||||
- "traefik.http.services.influxdb.loadbalancer.server.port=8086"
|
- "traefik.http.services.influxdb.loadbalancer.server.port=8086"
|
||||||
- "traefik.http.routers.influxdb.middlewares=authelia"
|
- "traefik.http.routers.influxdb.middlewares=authelia"
|
||||||
@@ -40,3 +44,7 @@ services:
|
|||||||
secrets:
|
secrets:
|
||||||
influxdb_init_password:
|
influxdb_init_password:
|
||||||
file: ${PROJECT_ROOT}/secrets/influxdb_init_password.txt
|
file: ${PROJECT_ROOT}/secrets/influxdb_init_password.txt
|
||||||
|
|
||||||
|
#volumes:
|
||||||
|
# influxdb-data:
|
||||||
|
# external: true
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
FROM python:3.11-slim
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
COPY app.py .
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
CMD ["python", "app.py"]
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
# mTLS Bridge Service
|
||||||
|
|
||||||
|
Internal HTTP-to-mTLS bridge for services that cannot present client certificates directly (for example, Grafana webhooks).
|
||||||
|
|
||||||
|
## How it works
|
||||||
|
|
||||||
|
1. Accepts plain HTTP requests inside the Docker network.
|
||||||
|
2. Forwards requests to an upstream base URL.
|
||||||
|
3. Preserves the incoming request path/method/body/query string.
|
||||||
|
4. Presents a client certificate/key pair for mTLS authentication.
|
||||||
|
|
||||||
|
## Environment variables
|
||||||
|
|
||||||
|
- `TARGET_URL` (required): upstream base URL (for example `http://node-red:1880`).
|
||||||
|
- `CLIENT_CERT` (default `/certs/client.crt`): client certificate path.
|
||||||
|
- `CLIENT_KEY` (default `/certs/client.key`): client private key path.
|
||||||
|
- `UPSTREAM_CA_CERT` (optional, alias: `CA_CERT`): CA bundle path to verify upstream TLS. Use `false`/`0`/`no` to disable verification.
|
||||||
|
- `TIMEOUT` (default `5`): request timeout in seconds.
|
||||||
|
- `LOG_LEVEL` (default `INFO`): Python logging level.
|
||||||
|
- `HEALTH_ENDPOINT` (default `/_mtls_bridge/health`): local container health endpoint path.
|
||||||
|
- `ALLOWED_PATHS_FILE` (optional): file path containing one allowed endpoint path per line (for example `/health`). Blank lines and `#` comments are ignored. If unset, all paths are allowed.
|
||||||
|
- `MTLS_BRIDGE_BASIC_AUTH_USERS` (required for Traefik auth): value for `traefik.http.middlewares.*.basicauth.users` (e.g. `user:$$apr1$$...`).
|
||||||
|
- `MTLS_BRIDGE_CORS_ALLOW_ORIGIN` (default `https://grafana.lan.ddnsgeek.com`): origin allowed for browser-based panel actions.
|
||||||
|
|
||||||
|
## Endpoints
|
||||||
|
|
||||||
|
- `GET /_mtls_bridge/health` returns `200 OK` for container health checks.
|
||||||
|
- `/*` proxies requests to `${TARGET_URL}/*` with method/body/headers/query string preserved (subject to optional allow-list checks).
|
||||||
|
|
||||||
|
Examples with `TARGET_URL=http://node-red:1880`:
|
||||||
|
|
||||||
|
- `https://mtls-bridge.../docker-update-lockouts/clear` -> `http://node-red:1880/docker-update-lockouts/clear`
|
||||||
|
- `https://mtls-bridge.../health` -> `http://node-red:1880/health`
|
||||||
|
- `https://mtls-bridge.../uptime-kuma` -> `http://node-red:1880/uptime-kuma`
|
||||||
|
|
||||||
|
## Compose integration
|
||||||
|
|
||||||
|
This repository includes `monitoring/mtls-bridge/docker-compose.yml`:
|
||||||
|
|
||||||
|
- No public port exposure.
|
||||||
|
- Read-only cert mount (`${PROJECT_ROOT}/core/traefik/certs:/certs:ro`).
|
||||||
|
- Joined to internal monitoring/traefik networks.
|
||||||
|
|
||||||
|
## Example test
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl http://mtls-bridge:8080/_mtls_bridge/health
|
||||||
|
curl -X POST http://mtls-bridge:8080/docker-update-lockouts/clear
|
||||||
|
```
|
||||||
|
|
||||||
|
## Allow-list file example
|
||||||
|
|
||||||
|
```text
|
||||||
|
# one path per line
|
||||||
|
/docker-update-lockouts/clear
|
||||||
|
/health
|
||||||
|
/uptime-kuma
|
||||||
|
```
|
||||||
|
|
||||||
|
When `ALLOWED_PATHS_FILE` is set, any path not listed returns `403 Endpoint not allowed`.
|
||||||
@@ -0,0 +1,208 @@
|
|||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
|
import requests
|
||||||
|
from flask import Flask, Response, g, request
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
logging.basicConfig(
|
||||||
|
level=os.environ.get("LOG_LEVEL", "INFO"),
|
||||||
|
format="%(asctime)s %(levelname)s %(message)s",
|
||||||
|
)
|
||||||
|
logger = logging.getLogger("mtls-bridge")
|
||||||
|
logging.getLogger("werkzeug").setLevel(logging.WARNING)
|
||||||
|
|
||||||
|
# Config via env
|
||||||
|
TARGET_URL = (os.environ.get("TARGET_URL") or "").strip()
|
||||||
|
CLIENT_CERT = os.environ.get("CLIENT_CERT", "/certs/client.crt")
|
||||||
|
CLIENT_KEY = os.environ.get("CLIENT_KEY", "/certs/client.key")
|
||||||
|
UPSTREAM_CA_CERT = os.environ.get("UPSTREAM_CA_CERT", os.environ.get("CA_CERT", "")).strip()
|
||||||
|
TIMEOUT = int(os.environ.get("TIMEOUT", "5"))
|
||||||
|
HEALTH_ENDPOINT = os.environ.get("HEALTH_ENDPOINT", "/_mtls_bridge/health")
|
||||||
|
ALLOWED_PATHS_FILE = (os.environ.get("ALLOWED_PATHS_FILE") or "").strip()
|
||||||
|
|
||||||
|
|
||||||
|
def normalize_path(path: str) -> str:
|
||||||
|
if not path or path == "/":
|
||||||
|
return "/"
|
||||||
|
return f"/{path.lstrip('/')}"
|
||||||
|
|
||||||
|
|
||||||
|
def load_allowed_paths() -> set[str]:
|
||||||
|
if not ALLOWED_PATHS_FILE:
|
||||||
|
return set()
|
||||||
|
|
||||||
|
if not os.path.exists(ALLOWED_PATHS_FILE):
|
||||||
|
logger.warning("ALLOWED_PATHS_FILE does not exist: %s (allow-list disabled)", ALLOWED_PATHS_FILE)
|
||||||
|
return set()
|
||||||
|
|
||||||
|
allowed_paths = set()
|
||||||
|
with open(ALLOWED_PATHS_FILE, encoding="utf-8") as f:
|
||||||
|
for line in f:
|
||||||
|
entry = line.strip()
|
||||||
|
if not entry or entry.startswith("#"):
|
||||||
|
continue
|
||||||
|
allowed_paths.add(normalize_path(entry))
|
||||||
|
|
||||||
|
logger.info("loaded %s allowed path(s) from %s", len(allowed_paths), ALLOWED_PATHS_FILE)
|
||||||
|
return allowed_paths
|
||||||
|
|
||||||
|
|
||||||
|
def get_verify_setting():
|
||||||
|
if not UPSTREAM_CA_CERT:
|
||||||
|
return True
|
||||||
|
|
||||||
|
lowered = UPSTREAM_CA_CERT.lower()
|
||||||
|
if lowered in {"false", "0", "no"}:
|
||||||
|
logger.warning("TLS verification for upstream is disabled via UPSTREAM_CA_CERT=%s", UPSTREAM_CA_CERT)
|
||||||
|
return False
|
||||||
|
|
||||||
|
if not os.path.exists(UPSTREAM_CA_CERT):
|
||||||
|
logger.warning(
|
||||||
|
"Configured UPSTREAM_CA_CERT path does not exist: %s (falling back to system CA bundle)",
|
||||||
|
UPSTREAM_CA_CERT,
|
||||||
|
)
|
||||||
|
return True
|
||||||
|
|
||||||
|
return UPSTREAM_CA_CERT
|
||||||
|
|
||||||
|
|
||||||
|
VERIFY_SETTING = get_verify_setting()
|
||||||
|
ALLOWED_PATHS = load_allowed_paths()
|
||||||
|
|
||||||
|
if TARGET_URL and TARGET_URL.lower().startswith("http://"):
|
||||||
|
logger.warning("TARGET_URL uses http:// (plaintext): %s", TARGET_URL)
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
"mtls-bridge starting target_url=%s timeout=%ss cert=%s key=%s verify=%s health_endpoint=%s allow_list_file=%s allow_list_entries=%s log_level=%s",
|
||||||
|
TARGET_URL,
|
||||||
|
TIMEOUT,
|
||||||
|
CLIENT_CERT,
|
||||||
|
CLIENT_KEY,
|
||||||
|
VERIFY_SETTING,
|
||||||
|
HEALTH_ENDPOINT,
|
||||||
|
ALLOWED_PATHS_FILE,
|
||||||
|
len(ALLOWED_PATHS),
|
||||||
|
os.environ.get("LOG_LEVEL", "INFO"),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def build_upstream_url(path: str) -> str:
|
||||||
|
"""Map incoming path directly onto TARGET_URL origin/base path."""
|
||||||
|
if not TARGET_URL:
|
||||||
|
raise ValueError("TARGET_URL is not set")
|
||||||
|
|
||||||
|
normalized_target = TARGET_URL.rstrip("/") + "/"
|
||||||
|
normalized_path = path.lstrip("/")
|
||||||
|
upstream_url = urljoin(normalized_target, normalized_path)
|
||||||
|
|
||||||
|
if request.query_string:
|
||||||
|
upstream_url = f"{upstream_url}?{request.query_string.decode('utf-8', 'ignore')}"
|
||||||
|
|
||||||
|
return upstream_url
|
||||||
|
|
||||||
|
|
||||||
|
def is_path_allowed(request_path: str) -> bool:
|
||||||
|
if not ALLOWED_PATHS:
|
||||||
|
return True
|
||||||
|
return request_path in ALLOWED_PATHS
|
||||||
|
|
||||||
|
|
||||||
|
@app.route(HEALTH_ENDPOINT, methods=["GET"])
|
||||||
|
def health():
|
||||||
|
logger.debug("healthcheck request from %s", request.remote_addr)
|
||||||
|
return "OK", 200
|
||||||
|
|
||||||
|
|
||||||
|
@app.before_request
|
||||||
|
def before_request():
|
||||||
|
g.request_start = time.time()
|
||||||
|
|
||||||
|
|
||||||
|
@app.after_request
|
||||||
|
def after_request(response):
|
||||||
|
elapsed_ms = int((time.time() - g.request_start) * 1000)
|
||||||
|
if request.path != HEALTH_ENDPOINT:
|
||||||
|
logger.info(
|
||||||
|
"request complete method=%s path=%s status=%s elapsed_ms=%s",
|
||||||
|
request.method,
|
||||||
|
request.path,
|
||||||
|
response.status_code,
|
||||||
|
elapsed_ms,
|
||||||
|
)
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@app.route(
|
||||||
|
"/",
|
||||||
|
defaults={"path": ""},
|
||||||
|
methods=["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"],
|
||||||
|
provide_automatic_options=False,
|
||||||
|
)
|
||||||
|
@app.route(
|
||||||
|
"/<path:path>",
|
||||||
|
methods=["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"],
|
||||||
|
provide_automatic_options=False,
|
||||||
|
)
|
||||||
|
def proxy(path):
|
||||||
|
request_path = normalize_path(path)
|
||||||
|
request_size = len(request.get_data(cache=True))
|
||||||
|
logger.info(
|
||||||
|
"incoming request method=%s path=%s query=%s remote=%s bytes=%s",
|
||||||
|
request.method,
|
||||||
|
request_path,
|
||||||
|
request.query_string.decode("utf-8", "ignore"),
|
||||||
|
request.remote_addr,
|
||||||
|
request_size,
|
||||||
|
)
|
||||||
|
|
||||||
|
if not is_path_allowed(request_path):
|
||||||
|
logger.warning("request blocked by allow-list path=%s", request_path)
|
||||||
|
return Response("Endpoint not allowed", status=403)
|
||||||
|
|
||||||
|
try:
|
||||||
|
upstream_url = build_upstream_url(path)
|
||||||
|
|
||||||
|
headers = {k: v for k, v in request.headers if k.lower() != "host"}
|
||||||
|
headers["X-Forwarded-By"] = "mtls-bridge"
|
||||||
|
|
||||||
|
start_time = time.time()
|
||||||
|
resp = requests.request(
|
||||||
|
method=request.method,
|
||||||
|
url=upstream_url,
|
||||||
|
headers=headers,
|
||||||
|
data=request.get_data(cache=True),
|
||||||
|
cookies=request.cookies,
|
||||||
|
cert=(CLIENT_CERT, CLIENT_KEY),
|
||||||
|
verify=VERIFY_SETTING,
|
||||||
|
timeout=TIMEOUT,
|
||||||
|
allow_redirects=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
elapsed_ms = int((time.time() - start_time) * 1000)
|
||||||
|
logger.info(
|
||||||
|
"upstream response status=%s url=%s elapsed_ms=%s response_bytes=%s",
|
||||||
|
resp.status_code,
|
||||||
|
upstream_url,
|
||||||
|
elapsed_ms,
|
||||||
|
len(resp.content),
|
||||||
|
)
|
||||||
|
|
||||||
|
excluded_headers = {"content-encoding", "content-length", "transfer-encoding", "connection"}
|
||||||
|
response_headers = [(k, v) for k, v in resp.headers.items() if k.lower() not in excluded_headers]
|
||||||
|
|
||||||
|
return Response(resp.content, resp.status_code, response_headers)
|
||||||
|
|
||||||
|
except ValueError as exc:
|
||||||
|
logger.error("proxy request failed: %s", exc)
|
||||||
|
return Response(str(exc), status=500)
|
||||||
|
except Exception as exc: # noqa: BLE001
|
||||||
|
logger.exception("proxy request failed")
|
||||||
|
return Response(str(exc), status=500)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app.run(host="0.0.0.0", port=8080)
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
services:
|
||||||
|
mtls-bridge:
|
||||||
|
profiles: ["monitoring", "all", "mtls-bridge"]
|
||||||
|
build:
|
||||||
|
context: ${PROJECT_ROOT}/monitoring/mtls-bridge
|
||||||
|
container_name: mtls-bridge
|
||||||
|
hostname: mtls-bridge.lan.ddnsgeek.com
|
||||||
|
restart: unless-stopped
|
||||||
|
environment:
|
||||||
|
- TARGET_URL=${MTLS_BRIDGE_TARGET_URL}
|
||||||
|
- CLIENT_CERT=${MTLS_BRIDGE_CLIENT_CERT}
|
||||||
|
- CLIENT_KEY=${MTLS_BRIDGE_CLIENT_KEY}
|
||||||
|
- TIMEOUT=${MTLS_BRIDGE_TIMEOUT}
|
||||||
|
- LOG_LEVEL=${MTLS_BRIDGE_LOG_LEVEL:-INFO}
|
||||||
|
- UPSTREAM_CA_CERT=${MTLS_BRIDGE_UPSTREAM_CA_CERT:-}
|
||||||
|
- ALLOWED_PATHS_FILE=${MTLS_BRIDGE_ALLOWED_PATHS_FILE:-}
|
||||||
|
volumes:
|
||||||
|
- ${PROJECT_ROOT}/core/traefik/certs:/certs:ro
|
||||||
|
labels:
|
||||||
|
- "traefik.http.routers.mtls-bridge.rule=Host(`mtls-bridge.lan.ddnsgeek.com`)"
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.mtls-bridge.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.mtls-bridge.tls.certresolver=myresolver"
|
||||||
|
- "traefik.http.routers.mtls-bridge.middlewares=mtls-bridge-auth,mtls-bridge-cors"
|
||||||
|
- "traefik.http.middlewares.mtls-bridge-auth.basicauth.users=${MTLS_BRIDGE_BASIC_AUTH_USERS}"
|
||||||
|
- "traefik.http.routers.mtls-bridge-preflight.rule=Host(`mtls-bridge.lan.ddnsgeek.com`) && Method(`OPTIONS`)"
|
||||||
|
- "traefik.http.routers.mtls-bridge-preflight.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.mtls-bridge-preflight.tls.certresolver=myresolver"
|
||||||
|
- "traefik.http.routers.mtls-bridge-preflight.middlewares=mtls-bridge-cors"
|
||||||
|
- "traefik.http.routers.mtls-bridge-preflight.priority=100"
|
||||||
|
- "traefik.http.routers.mtls-bridge-preflight.service=mtls-bridge"
|
||||||
|
- "traefik.http.middlewares.mtls-bridge-cors.headers.accesscontrolalloworiginlist=${MTLS_BRIDGE_CORS_ALLOW_ORIGIN}"
|
||||||
|
- "traefik.http.middlewares.mtls-bridge-cors.headers.accesscontrolallowmethods=GET,POST,PUT,PATCH,DELETE,OPTIONS"
|
||||||
|
- "traefik.http.middlewares.mtls-bridge-cors.headers.accesscontrolallowheaders=authorization,content-type,x-grafana-action,x-grafana-device-id"
|
||||||
|
- "traefik.http.middlewares.mtls-bridge-cors.headers.accesscontrolallowcredentials=true"
|
||||||
|
- "traefik.http.middlewares.mtls-bridge-cors.headers.addvaryheader=true"
|
||||||
|
- "io.portainer.accesscontrol.public"
|
||||||
|
# - "traefik.http.routers.searxng.middlewares=crowdsec@file,secHeaders@file,error-pages-middleware"
|
||||||
|
- "traefik.http.services.mtls-bridge.loadbalancer.server.port=8080"
|
||||||
|
- "traefik.docker.network=core_traefik"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8080/_mtls_bridge/health', timeout=3).read()"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 3
|
||||||
|
start_period: 10s
|
||||||
|
networks:
|
||||||
|
- monitor
|
||||||
|
- traefik
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
flask
|
||||||
|
requests
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
node-exporter:
|
node-exporter:
|
||||||
profiles: ["monitoring","all","prometheus-exporters"]
|
profiles: ["monitoring","all","node-exporter", "prometheus"]
|
||||||
image: prom/node-exporter:latest
|
image: prom/node-exporter:latest
|
||||||
container_name: node-exporter
|
container_name: node-exporter
|
||||||
pid: host
|
pid: host
|
||||||
File renamed without changes.
File renamed without changes.
+7
-2
@@ -1,10 +1,10 @@
|
|||||||
services:
|
services:
|
||||||
node-red:
|
node-red:
|
||||||
|
profiles: ["monitoring","all","node-red"]
|
||||||
# image: nodered/node-red:latest
|
# image: nodered/node-red:latest
|
||||||
build:
|
build:
|
||||||
context: ${PROJECT_ROOT}/monitoring/node-red
|
context: ${PROJECT_ROOT}/monitoring/node-red
|
||||||
container_name: node-red
|
container_name: node-red
|
||||||
profiles: ["monitoring","all"]
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
depends_on:
|
depends_on:
|
||||||
- docker-socket-proxy
|
- docker-socket-proxy
|
||||||
@@ -19,7 +19,8 @@ services:
|
|||||||
# ports:
|
# ports:
|
||||||
# - "1880:1880"
|
# - "1880:1880"
|
||||||
volumes:
|
volumes:
|
||||||
- ${PROJECT_ROOT}/monitoring/node-red/data:/data
|
# - ${PROJECT_ROOT}/monitoring/node-red/data:/data
|
||||||
|
- ${DOCKER_VOLUMES}/node-red-data:/data
|
||||||
- ${PROJECT_ROOT}:/compose/docker:ro
|
- ${PROJECT_ROOT}:/compose/docker:ro
|
||||||
- /home/nixos/raspi:/compose/raspi:ro
|
- /home/nixos/raspi:/compose/raspi:ro
|
||||||
# - ${PROJECT_ROOT}:/usr/src/node-red:ro
|
# - ${PROJECT_ROOT}:/usr/src/node-red:ro
|
||||||
@@ -56,7 +57,11 @@ services:
|
|||||||
# - "traefik.http.routers.node-red.service=api@internal"
|
# - "traefik.http.routers.node-red.service=api@internal"
|
||||||
- "traefik.http.routers.node-red.entrypoints=websecure"
|
- "traefik.http.routers.node-red.entrypoints=websecure"
|
||||||
- "traefik.http.routers.node-red.tls.certresolver=myresolver"
|
- "traefik.http.routers.node-red.tls.certresolver=myresolver"
|
||||||
|
- "traefik.http.routers.node-red.tls.options=mtls-private-admin@file"
|
||||||
- "traefik.http.routers.node-red.middlewares=authelia"
|
- "traefik.http.routers.node-red.middlewares=authelia"
|
||||||
- "io.portainer.accesscontrol.public"
|
- "io.portainer.accesscontrol.public"
|
||||||
- "traefik.docker.network=core_traefik"
|
- "traefik.docker.network=core_traefik"
|
||||||
- "traefik.http.services.node-red.loadbalancer.server.port=1880"
|
- "traefik.http.services.node-red.loadbalancer.server.port=1880"
|
||||||
|
#volumes:
|
||||||
|
# node-red-data:
|
||||||
|
# external: true
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
pihole-exporter:
|
pihole-exporter:
|
||||||
profiles: ["monitoring","all","prometheus-exporters"]
|
profiles: ["monitoring","all","pihole-exporter", "prometheus"]
|
||||||
image: ekofr/pihole-exporter:latest
|
image: ekofr/pihole-exporter:latest
|
||||||
container_name: pihole-exporter
|
container_name: pihole-exporter
|
||||||
# env_file:
|
# env_file:
|
||||||
+1
@@ -20,6 +20,7 @@ services:
|
|||||||
- traefik.http.routers.portainer.entrypoints=websecure
|
- traefik.http.routers.portainer.entrypoints=websecure
|
||||||
- traefik.http.routers.portainer.tls=true
|
- traefik.http.routers.portainer.tls=true
|
||||||
- traefik.http.routers.portainer.tls.certresolver=myresolver
|
- traefik.http.routers.portainer.tls.certresolver=myresolver
|
||||||
|
- traefik.http.routers.portainer.tls.options=mtls-private-admin@file
|
||||||
- io.portainer.accesscontrol.public
|
- io.portainer.accesscontrol.public
|
||||||
# Service -> Portainer listens on 9000 inside the container
|
# Service -> Portainer listens on 9000 inside the container
|
||||||
- traefik.http.services.portainer.loadbalancer.server.port=9000
|
- traefik.http.services.portainer.loadbalancer.server.port=9000
|
||||||
+11
-2
@@ -20,8 +20,10 @@ services:
|
|||||||
# context: ${PROJECT_ROOT}/monitoring/prometheus
|
# context: ${PROJECT_ROOT}/monitoring/prometheus
|
||||||
volumes:
|
volumes:
|
||||||
- ${PROJECT_ROOT}/monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
- ${PROJECT_ROOT}/monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
||||||
- ${PROJECT_ROOT}/monitoring/prometheus/data:/prometheus
|
# - ${PROJECT_ROOT}/monitoring/prometheus/data:/prometheus
|
||||||
- ${PROJECT_ROOT}/monitoring/prometheus/rules:/etc/prometheus/rules:ro
|
# - ${PROJECT_ROOT}/monitoring/prometheus/rules:/etc/prometheus/rules:ro
|
||||||
|
- ${DOCKER_VOLUMES}/prometheus/data:/prometheus
|
||||||
|
- ${DOCKER_VOLUMES}/prometheus/rules:/etc/prometheus/rules:ro
|
||||||
- ${PROJECT_ROOT}/secrets/prometheus_kuma_basic_auth_password.txt:/run/secrets/prometheus_kuma_basic_auth_password:ro
|
- ${PROJECT_ROOT}/secrets/prometheus_kuma_basic_auth_password.txt:/run/secrets/prometheus_kuma_basic_auth_password:ro
|
||||||
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@@ -30,6 +32,7 @@ services:
|
|||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.prometheus.entrypoints=websecure"
|
- "traefik.http.routers.prometheus.entrypoints=websecure"
|
||||||
- "traefik.http.routers.prometheus.tls.certresolver=myresolver"
|
- "traefik.http.routers.prometheus.tls.certresolver=myresolver"
|
||||||
|
- "traefik.http.routers.prometheus.tls.options=mtls-private-admin@file"
|
||||||
- "io.portainer.accesscontrol.public"
|
- "io.portainer.accesscontrol.public"
|
||||||
- "traefik.http.services.prometheus.loadbalancer.server.port=9090"
|
- "traefik.http.services.prometheus.loadbalancer.server.port=9090"
|
||||||
- "traefik.http.routers.prometheus.middlewares=authelia"
|
- "traefik.http.routers.prometheus.middlewares=authelia"
|
||||||
@@ -45,3 +48,9 @@ services:
|
|||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
start_period: 30s
|
start_period: 30s
|
||||||
|
|
||||||
|
#volumes:
|
||||||
|
# prometheus-data:
|
||||||
|
# external: true
|
||||||
|
# prometheus-rules:
|
||||||
|
# external: true
|
||||||
+10
-5
@@ -109,6 +109,11 @@ scrape_configs:
|
|||||||
- kuma.lan.ddnsgeek.com
|
- kuma.lan.ddnsgeek.com
|
||||||
labels:
|
labels:
|
||||||
role: raspberrypi
|
role: raspberrypi
|
||||||
|
tls_config:
|
||||||
|
# ca_file: /prometheus/clients-ca.crt
|
||||||
|
cert_file: /prometheus/office-pc.crt
|
||||||
|
key_file: /prometheus/office-pc.key
|
||||||
|
# server_name: kuma.lan.ddnsgeek.com
|
||||||
|
|
||||||
# =========================
|
# =========================
|
||||||
# Proxmox Storage Exporters
|
# Proxmox Storage Exporters
|
||||||
@@ -122,11 +127,11 @@ scrape_configs:
|
|||||||
role: proxmox
|
role: proxmox
|
||||||
storage: lvm
|
storage: lvm
|
||||||
|
|
||||||
- targets:
|
# - targets:
|
||||||
- pbs.sweet.home:9102
|
# - pbs.sweet.home:9102
|
||||||
labels:
|
# labels:
|
||||||
role: backup
|
# role: backup
|
||||||
storage: datastore
|
# storage: datastore
|
||||||
|
|
||||||
# =========================
|
# =========================
|
||||||
# Docker Updates Exporter
|
# Docker Updates Exporter
|
||||||
File renamed without changes.
+4
-2
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
telegraf:
|
telegraf:
|
||||||
profiles: ["monitoring","all","prometheus"]
|
profiles: ["monitoring","all","telegraf", "prometheus"]
|
||||||
image: telegraf:latest
|
image: telegraf:latest
|
||||||
container_name: telegraf
|
container_name: telegraf
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@@ -12,7 +12,9 @@ services:
|
|||||||
- no-new-privileges:true
|
- no-new-privileges:true
|
||||||
volumes:
|
volumes:
|
||||||
- ${PROJECT_ROOT}/monitoring/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
|
- ${PROJECT_ROOT}/monitoring/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
|
||||||
- ${PROJECT_ROOT}/monitoring/node-red/data:/var/log/node-red:ro
|
# - ${PROJECT_ROOT}/monitoring/node-red/data:/var/log/node-red:ro
|
||||||
|
|
||||||
|
- ${DOCKER_VOLUMES}/node-red-data:/var/log/node-red:ro
|
||||||
networks:
|
networks:
|
||||||
# - edge
|
# - edge
|
||||||
- monitor
|
- monitor
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -3,7 +3,9 @@ server.address: tcp://0.0.0.0:9091
|
|||||||
log:
|
log:
|
||||||
level: info
|
level: info
|
||||||
|
|
||||||
identity_validation.reset_password.jwt_secret: T72Xcxa4d7xpQRypFDZpunlZt0IjqspojmBlxBr69gnkRjzR144YgjZsgFYZK0gS
|
identity_validation:
|
||||||
|
reset_password:
|
||||||
|
jwt_secret: T72Xcxa4d7xpQRypFDZpunlZt0IjqspojmBlxBr69gnkRjzR144YgjZsgFYZK0gS
|
||||||
|
|
||||||
session:
|
session:
|
||||||
secret: BYksO7YUAJ8gXx9Endgpe46RgB10nkeKpD1qcQPt0GuYGQm2pS2zjJtNOrCEqpav
|
secret: BYksO7YUAJ8gXx9Endgpe46RgB10nkeKpD1qcQPt0GuYGQm2pS2zjJtNOrCEqpav
|
||||||
|
|||||||
@@ -1,18 +1,21 @@
|
|||||||
services:
|
services:
|
||||||
authelia:
|
authelia:
|
||||||
profiles: ["core","all","traefik"]
|
profiles: ["core","all","authelia", "traefik"]
|
||||||
image: authelia/authelia
|
image: authelia/authelia
|
||||||
restart: always
|
restart: always
|
||||||
build:
|
# build:
|
||||||
context: ${PROJECT_ROOT}/core/authelia
|
# context: ${PROJECT_ROOT}/core/authelia
|
||||||
# env_file:
|
env_file:
|
||||||
# - ${PROJECT_ROOT}/secrets/stack-secrets.env
|
- ${PROJECT_ROOT}/secrets/stack-secrets.env
|
||||||
# environment:
|
# environment:
|
||||||
# - AUTHELIA_IDENTITY_VALIDATION_RESET_PASSWORD_JWT_SECRET:${AUTHELIA_JWT_SECRET}
|
# - AUTHELIA_IDENTITY_VALIDATION_RESET_PASSWORD_JWT_SECRET=${AUTHELIA_JWT_SECRET}
|
||||||
# - AUTHELIA_SESSION_SECRET:${AUTHELIA_SESSION_SECRET}
|
# - AUTHELIA_SESSION_SECRET=${AUTHELIA_SESSION_SECRET}
|
||||||
# - AUTHELIA_STORAGE_ENCRYPTION_KEY:${AUTHELIA_STORAGE_ENCRYPTION_KEY}
|
# - AUTHELIA_STORAGE_ENCRYPTION_KEY=${AUTHELIA_STORAGE_ENCRYPTION_KEY}
|
||||||
volumes:
|
volumes:
|
||||||
- ${PROJECT_ROOT}/core/authelia:/config
|
# - ${PROJECT_ROOT}/core/authelia:/config
|
||||||
|
- ${DOCKER_VOLUMES}/authelia-data:/config/data
|
||||||
|
- ${PROJECT_ROOT}/core/authelia/configuration.yml:/config/configuration.yml:ro
|
||||||
|
- ${PROJECT_ROOT}/core/authelia/users_database.yml:/config/users_database.yml:ro
|
||||||
networks:
|
networks:
|
||||||
# - reverse_proxy
|
# - reverse_proxy
|
||||||
- traefik
|
- traefik
|
||||||
@@ -28,3 +31,4 @@ services:
|
|||||||
- traefik.http.middlewares.authelia.forwardauth.trustForwardHeader=true
|
- traefik.http.middlewares.authelia.forwardauth.trustForwardHeader=true
|
||||||
- traefik.http.middlewares.authelia.forwardauth.authResponseHeaders=Remote-User,Remote-Groups
|
- traefik.http.middlewares.authelia.forwardauth.authResponseHeaders=Remote-User,Remote-Groups
|
||||||
- traefik.http.middlewares.authelia.forwardauth.maxResponseBodySize=2097152
|
- traefik.http.middlewares.authelia.forwardauth.maxResponseBodySize=2097152
|
||||||
|
- "wud.watch=true"
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
FROM crowdsecurity/crowdsec:latest
|
FROM crowdsecurity/crowdsec:latest
|
||||||
|
|
||||||
COPY config/ /etc/crowdsec
|
#COPY config/ /etc/crowdsec
|
||||||
# Install required components at build time
|
# Install required components at build time
|
||||||
RUN cscli hub update && \
|
#RUN cscli hub update && \
|
||||||
cscli collections install crowdsecurity/traefik --force
|
# cscli collections install crowdsecurity/traefik --force
|
||||||
@@ -1,17 +1,23 @@
|
|||||||
services:
|
services:
|
||||||
crowdsec:
|
crowdsec:
|
||||||
# image: crowdsecurity/crowdsec:latest
|
profiles: ["core","all","crowdsec", "traefik"]
|
||||||
profiles: ["core","all","traefik"]
|
image: crowdsecurity/crowdsec:latest
|
||||||
build: ${PROJECT_ROOT}/core/crowdsec
|
# build: ${PROJECT_ROOT}/core/crowdsec
|
||||||
container_name: crowdsec
|
container_name: crowdsec
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
- COLLECTIONS=crowdsecurity/traefik
|
- COLLECTIONS=crowdsecurity/traefik
|
||||||
# - CROWDSEC_LAPI_KEY=${CROWDSEC_LAPI_KEY}
|
# - CROWDSEC_LAPI_KEY=${CROWDSEC_LAPI_KEY}
|
||||||
volumes:
|
volumes:
|
||||||
- ${PROJECT_ROOT}/core/crowdsec/logs:/logs:ro
|
# - ${PROJECT_ROOT}/core/crowdsec/logs:/logs:ro
|
||||||
- ${PROJECT_ROOT}/core/crowdsec/data:/var/lib/crowdsec/data
|
# - ${PROJECT_ROOT}/core/crowdsec/data:/var/lib/crowdsec/data
|
||||||
- ${PROJECT_ROOT}/core/crowdsec/config:/etc/crowdsec
|
# - ${PROJECT_ROOT}/core/crowdsec/config:/etc/crowdsec
|
||||||
|
- ${DOCKER_VOLUMES}/crowdsec/logs:/logs:ro
|
||||||
|
- ${DOCKER_VOLUMES}/crowdsec/data:/var/lib/crowdsec/data
|
||||||
|
# - ${DOCKER_VOLUMES}/crowdsec/config.yaml:/etc/crowdsec/config.yaml
|
||||||
|
# - ${DOCKER_VOLUMES}/crowdsec/config:/etc/crowdsec
|
||||||
|
- ${PROJECT_ROOT}/core/crowdsec/acquis.d:/etc/crowdsec/acquis.d
|
||||||
|
- ${PROJECT_ROOT}/core/crowdsec/profiles.yaml:/etc/crowdsec/profiles.yaml
|
||||||
networks:
|
networks:
|
||||||
# - reverse_proxy
|
# - reverse_proxy
|
||||||
- traefik
|
- traefik
|
||||||
@@ -21,3 +27,5 @@ services:
|
|||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 3
|
retries: 3
|
||||||
start_period: 15s
|
start_period: 15s
|
||||||
|
labels:
|
||||||
|
- "wud.watch=true"
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
name: default_ip_remediation
|
||||||
|
#debug: true
|
||||||
|
filters:
|
||||||
|
- Alert.Remediation == true && Alert.GetScope() == "Ip"
|
||||||
|
decisions:
|
||||||
|
- type: ban
|
||||||
|
duration: 4h
|
||||||
|
#duration_expr: Sprintf('%dh', (GetDecisionsCount(Alert.GetValue()) + 1) * 4)
|
||||||
|
# notifications:
|
||||||
|
# - slack_default # Set the webhook in /etc/crowdsec/notifications/slack.yaml before enabling this.
|
||||||
|
# - splunk_default # Set the splunk url and token in /etc/crowdsec/notifications/splunk.yaml before enabling this.
|
||||||
|
# - http_default # Set the required http parameters in /etc/crowdsec/notifications/http.yaml before enabling this.
|
||||||
|
# - email_default # Set the required email parameters in /etc/crowdsec/notifications/email.yaml before enabling this.
|
||||||
|
on_success: break
|
||||||
|
---
|
||||||
|
name: default_range_remediation
|
||||||
|
#debug: true
|
||||||
|
filters:
|
||||||
|
- Alert.Remediation == true && Alert.GetScope() == "Range"
|
||||||
|
decisions:
|
||||||
|
- type: ban
|
||||||
|
duration: 4h
|
||||||
|
#duration_expr: Sprintf('%dh', (GetDecisionsCount(Alert.GetValue()) + 1) * 4)
|
||||||
|
# notifications:
|
||||||
|
# - slack_default # Set the webhook in /etc/crowdsec/notifications/slack.yaml before enabling this.
|
||||||
|
# - splunk_default # Set the splunk url and token in /etc/crowdsec/notifications/splunk.yaml before enabling this.
|
||||||
|
# - http_default # Set the required http parameters in /etc/crowdsec/notifications/http.yaml before enabling this.
|
||||||
|
# - email_default # Set the required email parameters in /etc/crowdsec/notifications/email.yaml before enabling this.
|
||||||
|
on_success: break
|
||||||
@@ -1 +0,0 @@
|
|||||||
services: {}
|
|
||||||
+8
-3
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
docker-socket-proxy:
|
docker-socket-proxy:
|
||||||
profiles: ["monitoring","all","prometheus","prometheus-exporters"]
|
profiles: ["monitoring","all","docker-socket-proxy", "core", "traefik", "uptime-kuma", "beszel", "wud", "apps"]
|
||||||
image: tecnativa/docker-socket-proxy:latest
|
image: tecnativa/docker-socket-proxy:latest
|
||||||
container_name: docker-socket-proxy
|
container_name: docker-socket-proxy
|
||||||
hostname: docker-socket-proxy
|
hostname: docker-socket-proxy
|
||||||
@@ -20,7 +20,7 @@ services:
|
|||||||
SYSTEM: 1
|
SYSTEM: 1
|
||||||
SERVICES: 1
|
SERVICES: 1
|
||||||
SWARM: 1
|
SWARM: 1
|
||||||
NODES: 1
|
NODES: 1
|
||||||
SECRETS: 1
|
SECRETS: 1
|
||||||
TASKS: 1
|
TASKS: 1
|
||||||
VERSION: 1
|
VERSION: 1
|
||||||
@@ -43,5 +43,10 @@ services:
|
|||||||
security_opt:
|
security_opt:
|
||||||
- no-new-privileges:true
|
- no-new-privileges:true
|
||||||
networks:
|
networks:
|
||||||
- monitor
|
# - monitor
|
||||||
- traefik
|
- traefik
|
||||||
|
- docker-socket-proxy
|
||||||
|
ports:
|
||||||
|
- 2375:2375
|
||||||
|
labels:
|
||||||
|
- "wud.watch=true"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
services:
|
services:
|
||||||
error-pages:
|
error-pages:
|
||||||
profiles: ["core","all","traefik"]
|
profiles: ["core","all","error-pages", "traefik"]
|
||||||
image: tarampampam/error-pages:3
|
image: tarampampam/error-pages:latest
|
||||||
restart: always
|
restart: always
|
||||||
container_name: error-pages
|
container_name: error-pages
|
||||||
read_only: true
|
read_only: true
|
||||||
@@ -19,9 +19,10 @@ services:
|
|||||||
- "traefik.http.routers.error-pages-router.entrypoints=web"
|
- "traefik.http.routers.error-pages-router.entrypoints=web"
|
||||||
- "traefik.http.routers.error-pages-router.middlewares=error-pages-middleware"
|
- "traefik.http.routers.error-pages-router.middlewares=error-pages-middleware"
|
||||||
# "errors" middleware settings
|
# "errors" middleware settings
|
||||||
- "traefik.http.middlewares.error-pages-middleware.errors.status=400-599"
|
- "traefik.http.middlewares.error-pages-middleware.errors.status=400,402-502,504-599"
|
||||||
- "traefik.http.middlewares.error-pages-middleware.errors.service=error-pages-service"
|
- "traefik.http.middlewares.error-pages-middleware.errors.service=error-pages-service"
|
||||||
- "traefik.http.middlewares.error-pages-middleware.errors.query=/{status}.html"
|
- "traefik.http.middlewares.error-pages-middleware.errors.query=/{status}.html"
|
||||||
# define service properties
|
# define service properties
|
||||||
- "traefik.http.services.error-pages-service.loadbalancer.server.port=8080"
|
- "traefik.http.services.error-pages-service.loadbalancer.server.port=8080"
|
||||||
- "io.portainer.accesscontrol.public"
|
- "io.portainer.accesscontrol.public"
|
||||||
|
- "wud.watch=true"
|
||||||
@@ -17,8 +17,8 @@ services:
|
|||||||
container_name: docker-update-exporter-test
|
container_name: docker-update-exporter-test
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
tty: true
|
tty: true
|
||||||
depends_on:
|
# depends_on:
|
||||||
- docker-socket-proxy
|
# - docker-socket-proxy
|
||||||
environment:
|
environment:
|
||||||
DOCKER_HOST: tcp://docker-socket-proxy:2375
|
DOCKER_HOST: tcp://docker-socket-proxy:2375
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
# Private-admin mTLS for Traefik
|
||||||
|
|
||||||
|
`private-admin` routers are configured to require client certificates via the Traefik TLS option `mtls-private-admin@file`.
|
||||||
|
|
||||||
|
## Certificate paths
|
||||||
|
|
||||||
|
- Trusted client CA bundle expected by Traefik:
|
||||||
|
- `core/traefik/certs/ca/clients-ca.crt`
|
||||||
|
- CA private key (keep secret, never commit):
|
||||||
|
- `core/traefik/certs/ca/clients-ca.key`
|
||||||
|
- Issued client certs:
|
||||||
|
- `core/traefik/certs/clients/<client-name>/`
|
||||||
|
|
||||||
|
## Bootstrap
|
||||||
|
|
||||||
|
From repository root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./core/traefik/scripts/init-mtls-ca.sh
|
||||||
|
./core/traefik/scripts/issue-mtls-client-cert.sh admin-laptop
|
||||||
|
```
|
||||||
|
|
||||||
|
The second command exports a PKCS#12 bundle (`.p12`) for browser import and also leaves PEM `.crt`/`.key` artifacts for CLI usage.
|
||||||
|
|
||||||
|
## Revocation workflow
|
||||||
|
|
||||||
|
Because Traefik is configured with `clientAuth.caFiles`, revoked cert serials are not enforced by default.
|
||||||
|
|
||||||
|
- Use `./core/traefik/scripts/revoke-mtls-client-cert.sh <client-name>` to quarantine a client cert bundle.
|
||||||
|
- For strict revocation, rotate the CA (`init-mtls-ca.sh` after removing old CA) and re-issue all trusted client certs.
|
||||||
|
|
||||||
|
## Deploy
|
||||||
|
|
||||||
|
After CA/certs are in place, restart Traefik to ensure updated files are loaded:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose -f core/traefik/docker-compose.yml up -d traefik
|
||||||
|
```
|
||||||
Whitespace-only changes.
@@ -1,7 +1,7 @@
|
|||||||
services:
|
services:
|
||||||
traefik:
|
traefik:
|
||||||
profiles: ["core","all","traefik"]
|
profiles: ["core","all","traefik"]
|
||||||
image: traefik:3
|
image: traefik:latest
|
||||||
container_name: traefik
|
container_name: traefik
|
||||||
restart: always
|
restart: always
|
||||||
read_only: true
|
read_only: true
|
||||||
@@ -16,18 +16,24 @@ services:
|
|||||||
- "80:80"
|
- "80:80"
|
||||||
- "443:443"
|
- "443:443"
|
||||||
|
|
||||||
build:
|
# build:
|
||||||
context: ${PROJECT_ROOT}/core
|
# context: ${PROJECT_ROOT}/core
|
||||||
# env_file:
|
# env_file:
|
||||||
# - ${PROJECT_ROOT}/secrets/stack-secrets.env
|
# - ${PROJECT_ROOT}/secrets/stack-secrets.env
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- ${PROJECT_ROOT}/core/traefik/data/letsencrypt:/letsencrypt
|
# - ${PROJECT_ROOT}/core/traefik/data/letsencrypt:/letsencrypt
|
||||||
- ${PROJECT_ROOT}/core/traefik/data/logs:/logs
|
# - ${PROJECT_ROOT}/core/traefik/data/logs:/logs
|
||||||
|
- ${PROJECT_ROOT}/core/traefik/certs:/etc/traefik/certs:ro
|
||||||
- ${PROJECT_ROOT}/core/traefik/dynamic.yml:/etc/traefik/dynamic.yml:ro
|
- ${PROJECT_ROOT}/core/traefik/dynamic.yml:/etc/traefik/dynamic.yml:ro
|
||||||
- ${PROJECT_ROOT}/core/traefik/traefik.yml:/etc/traefik/traefik.yml:ro
|
- ${PROJECT_ROOT}/core/traefik/traefik.yml:/etc/traefik/traefik.yml:ro
|
||||||
- ${PROJECT_ROOT}/core/traefik/data/plugins:/plugins-storage
|
# - ${PROJECT_ROOT}/core/traefik/data/plugins:/plugins-storage
|
||||||
|
- ${DOCKER_VOLUMES}/traefik-data/letsencrypt:/letsencrypt
|
||||||
|
- ${DOCKER_VOLUMES}/traefik-data/logs:/logs
|
||||||
|
# - ${PROJECT_ROOT}/core/traefik/certs:/etc/traefik/certs:ro
|
||||||
|
# - ${PROJECT_ROOT}/core/traefik/dynamic.yml:/etc/traefik/dynamic.yml:ro
|
||||||
|
# - ${PROJECT_ROOT}/core/traefik/traefik.yml:/etc/traefik/traefik.yml:ro
|
||||||
|
- ${DOCKER_VOLUMES}/traefik-data/plugins:/plugins-storage
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: traefik healthcheck --ping
|
test: traefik healthcheck --ping
|
||||||
|
|
||||||
@@ -37,12 +43,15 @@ services:
|
|||||||
- "traefik.http.routers.traefik.service=api@internal"
|
- "traefik.http.routers.traefik.service=api@internal"
|
||||||
- "traefik.http.routers.traefik.entrypoints=websecure"
|
- "traefik.http.routers.traefik.entrypoints=websecure"
|
||||||
- "traefik.http.routers.traefik.tls.certresolver=myresolver"
|
- "traefik.http.routers.traefik.tls.certresolver=myresolver"
|
||||||
|
- "traefik.http.routers.traefik.tls.options=mtls-private-admin@file"
|
||||||
- "traefik.http.routers.traefik.middlewares=authelia"
|
- "traefik.http.routers.traefik.middlewares=authelia"
|
||||||
- "io.portainer.accesscontrol.public"
|
- "io.portainer.accesscontrol.public"
|
||||||
- "traefik.docker.network=core_traefik"
|
- "traefik.docker.network=core_traefik"
|
||||||
- "traefik.http.routers.traefik.observability.tracing=true"
|
- "traefik.http.routers.traefik.observability.tracing=true"
|
||||||
|
- "wud.watch=true"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
# - reverse_proxy
|
# - reverse_proxy
|
||||||
# - prometheus_edge
|
# - prometheus_edge
|
||||||
- traefik
|
- traefik
|
||||||
|
- docker-socket-proxy
|
||||||
@@ -31,3 +31,70 @@ http:
|
|||||||
- crowdsec@file
|
- crowdsec@file
|
||||||
# - tracing-middleware@file
|
# - tracing-middleware@file
|
||||||
- error-pages-middleware@docker
|
- error-pages-middleware@docker
|
||||||
|
|
||||||
|
serversTransports:
|
||||||
|
insecureTransport:
|
||||||
|
insecureSkipVerify: true
|
||||||
|
|
||||||
|
routers:
|
||||||
|
pve1:
|
||||||
|
rule: "Host(`pve1.lan.ddnsgeek.com`)"
|
||||||
|
entryPoints:
|
||||||
|
- websecure
|
||||||
|
service: pve1
|
||||||
|
middlewares:
|
||||||
|
- authelia@docker
|
||||||
|
tls:
|
||||||
|
certResolver: myresolver
|
||||||
|
options: mtls-private-admin@file
|
||||||
|
|
||||||
|
pbs:
|
||||||
|
rule: "Host(`pbs.lan.ddnsgeek.com`)"
|
||||||
|
entryPoints:
|
||||||
|
- websecure
|
||||||
|
service: pbs
|
||||||
|
middlewares:
|
||||||
|
- authelia@docker
|
||||||
|
tls:
|
||||||
|
certResolver: myresolver
|
||||||
|
options: mtls-private-admin@file
|
||||||
|
|
||||||
|
pdm:
|
||||||
|
rule: "Host(`pdm.lan.ddnsgeek.com`)"
|
||||||
|
entryPoints:
|
||||||
|
- websecure
|
||||||
|
service: pdm
|
||||||
|
middlewares:
|
||||||
|
- authelia@docker
|
||||||
|
tls:
|
||||||
|
certResolver: myresolver
|
||||||
|
options: mtls-private-admin@file
|
||||||
|
|
||||||
|
services:
|
||||||
|
pve1:
|
||||||
|
loadBalancer:
|
||||||
|
serversTransport: insecureTransport
|
||||||
|
servers:
|
||||||
|
- url: "https://pve1.sweet.home:8006"
|
||||||
|
|
||||||
|
pbs:
|
||||||
|
loadBalancer:
|
||||||
|
serversTransport: insecureTransport
|
||||||
|
servers:
|
||||||
|
- url: "https://pbs.sweet.home:8007"
|
||||||
|
|
||||||
|
pdm:
|
||||||
|
loadBalancer:
|
||||||
|
serversTransport: insecureTransport
|
||||||
|
servers:
|
||||||
|
- url: "https://pdm.sweet.home:8443"
|
||||||
|
|
||||||
|
tls:
|
||||||
|
options:
|
||||||
|
mtls-private-admin:
|
||||||
|
minVersion: VersionTLS12
|
||||||
|
sniStrict: true
|
||||||
|
clientAuth:
|
||||||
|
caFiles:
|
||||||
|
- /etc/traefik/certs/ca/clients-ca.crt
|
||||||
|
clientAuthType: RequireAndVerifyClientCert
|
||||||
Executable
+38
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
TRAEFIK_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||||
|
CA_DIR="${TRAEFIK_ROOT}/certs/ca"
|
||||||
|
|
||||||
|
CA_KEY="${CA_DIR}/clients-ca.key"
|
||||||
|
CA_CERT="${CA_DIR}/clients-ca.crt"
|
||||||
|
CA_SERIAL="${CA_DIR}/clients-ca.srl"
|
||||||
|
|
||||||
|
DAYS="${DAYS:-3650}"
|
||||||
|
SUBJECT="${SUBJECT:-/CN=Traefik Private Admin Client CA/O=Homelab}"
|
||||||
|
|
||||||
|
mkdir -p "${CA_DIR}"
|
||||||
|
chmod 700 "${CA_DIR}"
|
||||||
|
|
||||||
|
if [[ -f "${CA_KEY}" || -f "${CA_CERT}" ]]; then
|
||||||
|
echo "Refusing to overwrite existing CA material in ${CA_DIR}."
|
||||||
|
echo "Delete existing files first if you intentionally want to rotate the CA."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
openssl genrsa -out "${CA_KEY}" 4096
|
||||||
|
chmod 600 "${CA_KEY}"
|
||||||
|
|
||||||
|
openssl req -x509 -new -nodes \
|
||||||
|
-key "${CA_KEY}" \
|
||||||
|
-sha256 \
|
||||||
|
-days "${DAYS}" \
|
||||||
|
-subj "${SUBJECT}" \
|
||||||
|
-out "${CA_CERT}"
|
||||||
|
chmod 644 "${CA_CERT}"
|
||||||
|
|
||||||
|
rm -f "${CA_SERIAL}"
|
||||||
|
|
||||||
|
echo "Created mTLS client CA: ${CA_CERT}"
|
||||||
|
echo "Use issue-mtls-client-cert.sh to issue client certificates signed by this CA."
|
||||||
+76
@@ -0,0 +1,76 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ $# -lt 1 ]]; then
|
||||||
|
echo "Usage: $0 <client-name> [days]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CLIENT_NAME="$1"
|
||||||
|
DAYS="${2:-825}"
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
TRAEFIK_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||||
|
CA_DIR="${TRAEFIK_ROOT}/certs/ca"
|
||||||
|
CLIENT_DIR="${TRAEFIK_ROOT}/certs/clients/${CLIENT_NAME}"
|
||||||
|
|
||||||
|
CA_KEY="${CA_DIR}/clients-ca.key"
|
||||||
|
CA_CERT="${CA_DIR}/clients-ca.crt"
|
||||||
|
CA_SERIAL="${CA_DIR}/clients-ca.srl"
|
||||||
|
|
||||||
|
CLIENT_KEY="${CLIENT_DIR}/${CLIENT_NAME}.key"
|
||||||
|
CLIENT_CSR="${CLIENT_DIR}/${CLIENT_NAME}.csr"
|
||||||
|
CLIENT_CERT="${CLIENT_DIR}/${CLIENT_NAME}.crt"
|
||||||
|
CLIENT_P12="${CLIENT_DIR}/${CLIENT_NAME}.p12"
|
||||||
|
OPENSSL_EXT="${CLIENT_DIR}/client.ext"
|
||||||
|
|
||||||
|
if [[ ! -f "${CA_KEY}" || ! -f "${CA_CERT}" ]]; then
|
||||||
|
echo "Missing CA material. Run init-mtls-ca.sh first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -d "${CLIENT_DIR}" ]]; then
|
||||||
|
echo "Client directory already exists (${CLIENT_DIR}); refusing to overwrite."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "${CLIENT_DIR}"
|
||||||
|
chmod 700 "${CLIENT_DIR}"
|
||||||
|
|
||||||
|
cat > "${OPENSSL_EXT}" <<EXT
|
||||||
|
basicConstraints=CA:FALSE
|
||||||
|
keyUsage = digitalSignature, keyEncipherment
|
||||||
|
extendedKeyUsage = clientAuth
|
||||||
|
subjectAltName = DNS:${CLIENT_NAME}
|
||||||
|
EXT
|
||||||
|
|
||||||
|
openssl genrsa -out "${CLIENT_KEY}" 2048
|
||||||
|
chmod 600 "${CLIENT_KEY}"
|
||||||
|
|
||||||
|
openssl req -new -key "${CLIENT_KEY}" -subj "/CN=${CLIENT_NAME}" -out "${CLIENT_CSR}"
|
||||||
|
|
||||||
|
openssl x509 -req \
|
||||||
|
-in "${CLIENT_CSR}" \
|
||||||
|
-CA "${CA_CERT}" \
|
||||||
|
-CAkey "${CA_KEY}" \
|
||||||
|
-CAcreateserial \
|
||||||
|
-out "${CLIENT_CERT}" \
|
||||||
|
-days "${DAYS}" \
|
||||||
|
-sha256 \
|
||||||
|
-extfile "${OPENSSL_EXT}"
|
||||||
|
chmod 644 "${CLIENT_CERT}"
|
||||||
|
|
||||||
|
openssl pkcs12 -export \
|
||||||
|
-inkey "${CLIENT_KEY}" \
|
||||||
|
-in "${CLIENT_CERT}" \
|
||||||
|
-certfile "${CA_CERT}" \
|
||||||
|
-name "${CLIENT_NAME}" \
|
||||||
|
-out "${CLIENT_P12}"
|
||||||
|
chmod 600 "${CLIENT_P12}"
|
||||||
|
|
||||||
|
rm -f "${CLIENT_CSR}" "${OPENSSL_EXT}"
|
||||||
|
|
||||||
|
echo "Issued client certificate for ${CLIENT_NAME}."
|
||||||
|
echo "CRT: ${CLIENT_CERT}"
|
||||||
|
echo "KEY: ${CLIENT_KEY}"
|
||||||
|
echo "P12: ${CLIENT_P12}"
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ $# -lt 1 ]]; then
|
||||||
|
echo "Usage: $0 <client-name>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CLIENT_NAME="$1"
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
TRAEFIK_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||||
|
CLIENT_DIR="${TRAEFIK_ROOT}/certs/clients/${CLIENT_NAME}"
|
||||||
|
REVOKED_DIR="${TRAEFIK_ROOT}/certs/revoked"
|
||||||
|
|
||||||
|
if [[ ! -d "${CLIENT_DIR}" ]]; then
|
||||||
|
echo "No certificate directory found for client '${CLIENT_NAME}'."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "${REVOKED_DIR}"
|
||||||
|
|
||||||
|
STAMP="$(date -u +%Y%m%dT%H%M%SZ)"
|
||||||
|
mv "${CLIENT_DIR}" "${REVOKED_DIR}/${CLIENT_NAME}-${STAMP}"
|
||||||
|
|
||||||
|
echo "Moved client certificate material to ${REVOKED_DIR}/${CLIENT_NAME}-${STAMP}."
|
||||||
|
echo "Note: Traefik clientAuth with a CA file does not enforce revocation lists by default."
|
||||||
|
echo "For immediate hard revocation, rotate the client CA and re-issue trusted client certificates."
|
||||||
Loaded 100 of 313 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user