Закрыть внешний вход TLS и выдавать секреты через OpenBao.

LB ходит в API только с клиентским сертификатом нужной identity, остальные связи проверяют серверный сертификат, root token в приложение не попадает.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-26 19:48:38 +03:00
co-authored by Cursor
parent fb566d874c
commit 9b501b2020
33 changed files with 1243 additions and 221 deletions
+33 -19
View File
@@ -1,34 +1,48 @@
#!/bin/sh
# One SeaweedFS process: master, volume, filer, S3. The filer UI is off.
# Anonymous identity has no actions. The API user is limited to one bucket.
# One SeaweedFS process bound to localhost. HAProxy in this network namespace
# is the TLS endpoint other containers use.
set -eu
: "${S3_BUCKET:?}"
: "${S3_ACCESS_KEY_ID:?}"
: "${S3_SECRET_ACCESS_KEY:?}"
admin_key=$(cat /run/secrets/s3_admin_access)
admin_secret=$(cat /run/secrets/s3_admin_secret)
api_key=$(cat /run/secrets/s3_api_access)
api_secret=$(cat /run/secrets/s3_api_secret)
worker_key=$(cat /run/secrets/s3_worker_access)
worker_secret=$(cat /run/secrets/s3_worker_secret)
cat > /tmp/s3.json <<EOF
{
"identities": [
{"name": "anonymous", "actions": []},
{
"name": "anonymous",
"actions": []
"name": "s3-admin",
"credentials": [{"accessKey": "${admin_key}", "secretKey": "${admin_secret}"}],
"actions": ["Admin:${S3_BUCKET}"]
},
{
"name": "messenger-app",
"credentials": [
{
"accessKey": "${S3_ACCESS_KEY_ID}",
"secretKey": "${S3_SECRET_ACCESS_KEY}"
}
],
"name": "messenger-api",
"credentials": [{"accessKey": "${api_key}", "secretKey": "${api_secret}"}],
"actions": [
"Read:${S3_BUCKET}",
"Read:${S3_BUCKET}/*",
"Write:${S3_BUCKET}",
"Write:${S3_BUCKET}/*",
"List:${S3_BUCKET}",
"Tagging:${S3_BUCKET}/*",
"Admin:${S3_BUCKET}"
"Write:${S3_BUCKET}/staging/*",
"Write:${S3_BUCKET}/originals/*",
"Tagging:${S3_BUCKET}/*"
]
},
{
"name": "messenger-worker",
"credentials": [{"accessKey": "${worker_key}", "secretKey": "${worker_secret}"}],
"actions": [
"Read:${S3_BUCKET}/staging/*",
"Read:${S3_BUCKET}/originals/*",
"Read:${S3_BUCKET}/variants/*",
"List:${S3_BUCKET}",
"Write:${S3_BUCKET}/originals/*",
"Write:${S3_BUCKET}/variants/*",
"Write:${S3_BUCKET}/staging/*",
"Tagging:${S3_BUCKET}/*"
]
}
]
@@ -37,12 +51,12 @@ EOF
exec weed server \
-dir=/data \
-ip.bind=0.0.0.0 \
-ip.bind=127.0.0.1 \
-master.port=9333 \
-volume.port=8080 \
-filer \
-filer.port=8888 \
-filer.exposeDirectoryData=false \
-s3 \
-s3.port=9000 \
-s3.port=19000 \
-s3.config=/tmp/s3.json