forked from mtusi2026/mtusi2026lab7
fix(security): enforce S3 boundaries and configure persistent audit
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
disable_mlock = true
|
||||
ui = false
|
||||
api_addr = "https://openbao:8200"
|
||||
storage "file" { path = "/data/storage" }
|
||||
cluster_addr = "https://openbao:8201"
|
||||
storage "raft" {
|
||||
path = "/data/storage"
|
||||
node_id = "messenger-local"
|
||||
}
|
||||
listener "tcp" {
|
||||
address = "0.0.0.0:8200"
|
||||
tls_min_version = "tls13"
|
||||
@@ -12,3 +15,12 @@ listener "tcp" {
|
||||
tls_auto_reload = true
|
||||
tls_auto_reload_interval = "5s"
|
||||
}
|
||||
|
||||
audit "file" "file" {
|
||||
description = "Persistent service identity audit"
|
||||
options {
|
||||
file_path = "/data/audit/audit.log"
|
||||
mode = "0600"
|
||||
log_raw = "false"
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ LABEL org.opencontainers.image.revision=9e49d5e7a648f00e26f2246f4dc28e6b07f8c84a
|
||||
COPY --from=minio-build /out/minio /usr/local/bin/minio
|
||||
COPY --from=minio-build /source/LICENSE /licenses/minio.LICENSE
|
||||
COPY --chmod=755 infra/s3-entrypoint.sh /usr/local/bin/s3-entrypoint
|
||||
RUN mkdir /data && chown 10001:10001 /data
|
||||
RUN python -m pip uninstall -y pip && mkdir /data && chown 10001:10001 /data
|
||||
USER 10001:10001
|
||||
ENTRYPOINT ["/usr/local/bin/s3-entrypoint"]
|
||||
EXPOSE 9000
|
||||
|
||||
@@ -389,7 +389,13 @@ func runHTTP(c Config, b Boundary) error {
|
||||
}
|
||||
}
|
||||
if !allowed {
|
||||
http.Error(w, "Operation denied", 403)
|
||||
if c.Role == "s3" {
|
||||
w.Header().Set("Content-Type", "application/xml")
|
||||
w.WriteHeader(http.StatusForbidden)
|
||||
io.WriteString(w, "<Error><Code>AccessDenied</Code><Message>Operation denied</Message><RequestId>tls-boundary</RequestId><HostId>local</HostId></Error>")
|
||||
} else {
|
||||
http.Error(w, "Operation denied", http.StatusForbidden)
|
||||
}
|
||||
return
|
||||
}
|
||||
r.Header.Del("X-Forwarded-Client-Cert")
|
||||
|
||||
+12
-3
@@ -17,13 +17,22 @@
|
||||
"protocol": "http",
|
||||
"allow": {
|
||||
"spiffe://messenger/api": [
|
||||
"* /"
|
||||
"GET /messenger/objects/",
|
||||
"HEAD /messenger/objects/",
|
||||
"PUT /messenger/objects/staging/",
|
||||
"GET /minio/health/"
|
||||
],
|
||||
"spiffe://messenger/worker": [
|
||||
"* /"
|
||||
"GET /messenger/objects/",
|
||||
"HEAD /messenger/objects/",
|
||||
"PUT /messenger/objects/",
|
||||
"GET /minio/health/"
|
||||
],
|
||||
"spiffe://messenger/reconciler": [
|
||||
"* /"
|
||||
"GET /messenger",
|
||||
"HEAD /messenger/objects/",
|
||||
"DELETE /messenger/objects/",
|
||||
"GET /minio/health/"
|
||||
],
|
||||
"spiffe://messenger/operator": [
|
||||
"* /"
|
||||
|
||||
Reference in New Issue
Block a user