initial commit
This commit is contained in:
77
05-Bezpieczeństwo/Efemeryczny RBAC per-run.md
Normal file
77
05-Bezpieczeństwo/Efemeryczny RBAC per-run.md
Normal file
@@ -0,0 +1,77 @@
|
||||
# Efemeryczny RBAC per-run
|
||||
|
||||
#sympozium #security #rbac
|
||||
|
||||
## Koncepcja
|
||||
|
||||
Odpowiednik **temporary IAM session credentials** w Kubernetes (patrz [[RBAC]] dla wyjaśnienia systemu). Credentials istnieją TYLKO przez czas trwania AgentRun.
|
||||
|
||||
## Lifecycle
|
||||
|
||||
```
|
||||
AgentRun CREATED
|
||||
↓
|
||||
Controller tworzy:
|
||||
├── Role (namespace-scoped)
|
||||
│ ├── ownerRef → AgentRun
|
||||
│ └── rules: [z SkillPack.sidecar.rbac]
|
||||
├── RoleBinding
|
||||
│ ├── ownerRef → AgentRun
|
||||
│ └── subject → ServiceAccount "sympozium-agent"
|
||||
├── ClusterRole (cluster-scoped)
|
||||
│ ├── labels: sympozium.ai/agentrun: <name>
|
||||
│ └── rules: [z SkillPack.sidecar.clusterRBAC]
|
||||
└── ClusterRoleBinding
|
||||
├── labels: sympozium.ai/agentrun: <name>
|
||||
└── subject → ServiceAccount "sympozium-agent"
|
||||
↓
|
||||
[CREDENTIALS ACTIVE - sidecar can use them]
|
||||
↓
|
||||
AgentRun COMPLETED
|
||||
↓
|
||||
Controller czyści:
|
||||
├── Namespace RBAC → auto via ownerReference (K8s GC)
|
||||
└── Cluster RBAC → manual via label selector (controller)
|
||||
↓
|
||||
[CREDENTIALS DELETED - no standing access]
|
||||
```
|
||||
|
||||
## Dlaczego nie standing role?
|
||||
|
||||
### Problem standing god-role:
|
||||
```
|
||||
ServiceAccount z cluster-admin → ZAWSZE ma pełne uprawnienia
|
||||
→ Compromised pod = pełny dostęp do klastra
|
||||
→ Brak auditu "kto kiedy co robił"
|
||||
```
|
||||
|
||||
### Ephemeral RBAC:
|
||||
```
|
||||
Run #1: Role [get pods] → exists for 30s → deleted
|
||||
Run #2: Role [get deployments] → exists for 45s → deleted
|
||||
→ Credentials istnieją minimum possible time
|
||||
→ Każdy run ma TYLKO te uprawnienia które potrzebuje
|
||||
→ Pełny audit trail (RBAC resources w etcd)
|
||||
```
|
||||
|
||||
## Controller privilege
|
||||
|
||||
Controller sam potrzebuje `cluster-admin` bo:
|
||||
- Tworzy dowolne Role/ClusterRole (definiowane w SkillPacks)
|
||||
- K8s RBAC escalation prevention wymaga tego
|
||||
- To jedyny komponent z takimi uprawnieniami
|
||||
|
||||
## Namespace vs Cluster scope
|
||||
|
||||
| Typ | Mechanizm cleanup | Scope |
|
||||
|-----|-------------------|-------|
|
||||
| Role + RoleBinding | ownerReference → AgentRun | Namespace |
|
||||
| ClusterRole + ClusterRoleBinding | Label selector → controller cleanup | Cluster |
|
||||
|
||||
[[Namespace]]-scoped RBAC jest automatycznie garbage-collected przez K8s gdy AgentRun jest usunięty ([[ownerReference|ownerRef]] chain).
|
||||
|
||||
Cluster RBAC nie może mieć cross-namespace ownerRef (ograniczenie K8s - patrz [[ownerReference]]), więc [[Controller i Reconciler|controller]] czyści ręcznie po labelach.
|
||||
|
||||
---
|
||||
|
||||
Powiązane: [[Skill Sidecars i auto-RBAC]] | [[Model bezpieczeństwa Defence-in-Depth]] | [[SkillPack]]
|
||||
Reference in New Issue
Block a user