Protocol có chạy trên target này?
Application gửi intent; exact loaded package báo capability/effective backend. API có enum không chứng minh provider tồn tại.
Product knowledge · Advanced · Security boundary
Chọn protocol, xác thực transport peer và authorize business action là ba quyết định riêng. CoAkka HTTP Runtime sở hữu hai quyết định đầu ở HTTP edge; application luôn sở hữu quyết định cuối.
01 · Three decisions
Application gửi intent; exact loaded package báo capability/effective backend. API có enum không chứng minh provider tồn tại.
Runtime validate TLS material, thực hiện handshake và fail closed khi identity/trust không hợp lệ.
Application dùng verified peer facts cùng token/session/business policy để authorize route và action.
TLS không thay authorization. mTLS có thể chứng minh client mang certificate được trust, nhưng Core không quyết định certificate đó thuộc customer nào hoặc được charge, đọc hồ sơ hay gọi admin route nào.
02 · Security modes
| Mode | Server identity | Client identity | Listener material |
|---|---|---|---|
| Plaintext | Không | Không | TLS fields rỗng; credential generation bằng 0. |
| TLS | Client verify server certificate | Không bắt buộc | Nonzero generation, credential ID, certificate chain và private key. |
| mTLS | Client verify server certificate | Server verify client certificate | TLS material cộng trust roots cho client identity. |
Nếu TLS terminate ở reverse proxy, proxy sở hữu certificate và rotation đó. Ghi rõ backend hop dùng plaintext, TLS hay mTLS; một handshake thành công ở proxy không chứng minh CoAkka listener reload.
03 · Listener declaration
HTTP_1_1 là portable baseline. Chỉ chọn HTTP/2 hoặc HTTP/3 khi exact package/target báo capability tương ứng.partner-api; không chứa secret.listener intent
address + port
protocol + security mode
credential ID + generation
certificate chain + private key
trust roots (mTLS only)
↓ copy / freeze / validate / bind
accepted → effective listener facts
rejected → typed startup failure; never report ready
04 · Capability before configuration
Built-in baseline. Vẫn kiểm tra handshake, response, bounds và resource return trên matching host.
Shared contract nhưng feature-gated theo target. Không suy support từ enum hoặc package presence.
Security API tồn tại không làm provider tự xuất hiện. Unsupported combination phải fail, không downgrade im lặng.
Đọc protocol/backend runtime đã accept. Linux io_uring chỉ là lựa chọn cho eligible HTTP/2/3 config, không phải nhãn HTTP/1.1.
06 · Fail closed by stage
| Stage | Ví dụ | Kết luận an toàn |
|---|---|---|
| Startup | Malformed PEM, key mismatch, missing material, unsupported protocol/security | Listener không ready; sửa declaration/package/deployment. |
| Handshake | Unknown CA, expired/not-yet-valid cert, name/policy mismatch, missing client cert | Fail closed trước application handler. |
| Authorization | Verified peer nhưng không có quyền với route/action | Application trả refusal an toàn; transport identity vẫn có thể hợp lệ. |
| Reload | Stale generation hoặc incomplete/invalid candidate | Refuse candidate; effective credential cũ không đổi. |
| Rollout | New instance start được nhưng handshake/request verification fail | Không đưa vào ingress; old instance tiếp tục phục vụ. |
07 · Nạp lại chứng chỉ · SDK 2.3.0
Quy trình này áp dụng cho listener đơn. Listener V1 chưa hỗ trợ mTLS hoặc thay chứng chỉ khi đang chạy trong bản này.
Dùng distinct paths cho chain, matching key và intended trust roots; không mutate file bên dưới live listener.
Lấy generation hiện tại từ running listener; không đoán số tiếp theo từ local state.
Submit complete set. Stale/invalid candidate bị refuse và effective state cũ được giữ nguyên.
Thực hiện real handshake và request; với mTLS, kiểm tra cả trusted client accept và untrusted client reject.
Chỉ remove old deployment material sau retirement outcome. Existing connection không tự re-authenticate với trust mới.
Đổi file không phải reload. Overwrite PEM, replace symlink, tăng generation hoặc swap handler đều không tự thay identity của live listener.
08 · Replacement service
prepare new service at a distinct endpoint
→ start and read effective facts
→ real handshake + request (+ negative mTLS case)
→ admit replacement to ingress
→ stop selecting old instance
→ finite close old service
→ remove old resources only after successful convergence
Dùng replacement khi package/listener không hỗ trợ reload hoặc khi đổi address/protocol. Hai service không mặc nhiên bind cùng endpoint; một process slot duy nhất có thể tạo interruption. Zero downtime không được suy từ recipe. Credential bị compromise có thể cần terminate old sessions thay vì drain bình thường.
09 · Verification checklist