mirror of
https://github.com/luxfi/mpc.git
synced 2026-09-24 00:26:24 +00:00
- Add bearer token auth to internal MPC API (port 9800): /keygen, /keys, /backup now require Authorization header. Token from MPC_INTERNAL_API_KEY env (KMS-synced) or derived from Ed25519 node identity. - Replace DualModeListener with TLSOnlyListener: plaintext peer connections are rejected. TLS 1.3 with PQ key exchange is mandatory. - Add dedicated 20 RPM rate limiter on bridge signing and intent signing endpoints (separate from global 100 RPM). - Add body size limit (1MB), read/write timeouts, and 10 RPM rate limiter to internal MPC API server. - Restrict K8s NetworkPolicy egress for MPC nodes to peers, postgres, valkey, DNS, and HTTPS only (was unrestricted). - Wire cluster-api-key in api-deployment for authenticated proxy to internal MPC API. Forward as Authorization: Bearer header. - Remove hardcoded dev JWT_SECRET default from compose.yml (now required). - Add internal-api-key to KMSSecret CRD and StatefulSet env.
100 lines
2.5 KiB
YAML
100 lines
2.5 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: mpc-api
|
|
namespace: lux-mpc
|
|
labels:
|
|
app: mpc-api
|
|
app.kubernetes.io/part-of: lux-mpc
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: mpc-api
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: mpc-api
|
|
app.kubernetes.io/part-of: lux-mpc
|
|
spec:
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 1000
|
|
runAsGroup: 1000
|
|
fsGroup: 1000
|
|
seccompProfile:
|
|
type: RuntimeDefault
|
|
imagePullSecrets:
|
|
- name: registry-hanzo
|
|
containers:
|
|
- name: mpc-api
|
|
image: ghcr.io/luxfi/mpc-api:latest
|
|
securityContext:
|
|
allowPrivilegeEscalation: false
|
|
readOnlyRootFilesystem: true
|
|
capabilities:
|
|
drop: ["ALL"]
|
|
args:
|
|
- api
|
|
- --db
|
|
- $(DATABASE_URL)
|
|
- --listen
|
|
- ":8081"
|
|
- --jwt-secret
|
|
- $(JWT_SECRET)
|
|
- --cluster-url
|
|
- http://mpc-node-0.mpc-node-headless.lux-mpc.svc:9800
|
|
- --cluster-api-key
|
|
- $(MPC_CLUSTER_API_KEY)
|
|
ports:
|
|
- containerPort: 8081
|
|
name: api
|
|
protocol: TCP
|
|
env:
|
|
- name: DATABASE_URL
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mpc-secrets
|
|
key: DATABASE_URL
|
|
- name: JWT_SECRET
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mpc-secrets
|
|
key: jwt-secret
|
|
- name: MPC_CLUSTER_API_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: mpc-secrets
|
|
key: internal-api-key
|
|
optional: true
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: 8081
|
|
initialDelaySeconds: 15
|
|
periodSeconds: 30
|
|
timeoutSeconds: 5
|
|
failureThreshold: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: 8081
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
failureThreshold: 3
|
|
volumeMounts:
|
|
- name: tmp
|
|
mountPath: /tmp
|
|
resources:
|
|
requests:
|
|
cpu: 100m
|
|
memory: 256Mi
|
|
limits:
|
|
cpu: 500m
|
|
memory: 512Mi
|
|
volumes:
|
|
- name: tmp
|
|
emptyDir:
|
|
sizeLimit: 50Mi
|