Security List là gì? (Oracle Cloud Infrastructure - OCI)
Security List trong OCI là tập hợp các quy tắc (rules) kiểm soát traffic ingress (vào) và egress (ra) áp dụng cho tất cả VNIC trong một Subnet. Mỗi Subnet có thể gán tối đa 5 Security Lists.
Network Security Group (NSG) là gì?
| Đặc điểm | Security List (OCI) | Network Security Group - NSG (OCI/Azure) |
|---|---|---|
| Áp dụng cho | Cả Subnet (tất cả VNIC) | Nhóm VNIC cụ thể (chọn lọc) |
| Độ chi tiết (Granularity) | Coarse-grained | Fine-grained |
| Stateful | Có (mặc định) | Có (mặc định) |
| Số lượng rule tối đa | Tùy quota tenancy | OCI: 1200/NSG | Azure: 200 mặc định, 1000 với support ticket |
| Ưu tiên | Rule priority (thấp hơn = ưu tiên cao hơn) | Priority number (thấp hơn = ưu tiên cao hơn) |
Ingress vs Egress
- Ingress: Traffic vào VNIC/Subnet (ví dụ: cho phép TCP 443 từ Internet vào Web Server)
- Egress: Traffic ra khỏi VNIC/Subnet (ví dụ: cho phép Server truy cập Internet cập nhật package)
Cấu trúc Rule (OCI & Azure)
// OCI Security List Rule
{
"direction": "INGRESS", // hoặc EGRESS
"protocol": "6", // TCP=6, UDP=17, ICMP=1, All=all
"source": "0.0.0.0/0", // CIDR source (INGRESS) hoặc destination (EGRESS)
"sourceType": "CIDR_BLOCK", // CIDR_BLOCK, SERVICE, NETWORK_SECURITY_GROUP
"tcpOptions": { // nếu TCP/UDP
"destinationPortRange": { "min": 443, "max": 443 }
},
"isStateless": false, // true = stateless (cần rule 2 chiều)
"description": "Allow HTTPS from Internet"
}
Mặc định của Security List (OCI)
- Mặc định: DENY ALL (chặn tất cả ingress & egress)
- Phải thêm rule ALLOW rõ ràng cho traffic cần thiết
- Rule ưu tiên thấp hơn (số lớn hơn) được đánh giá sau
Tạo Security List / NSG
OCI Console
- Menu → Networking → Virtual Cloud Networks → Chọn VCN
- Resources → Security Lists → Create Security List
- Nhập Name, Compartment, Thêm Ingress/Egress Rules
- Create → Gán vào Subnet (Subnet → Edit → Security Lists)
Azure Portal (NSG)
- Search "Network Security Groups" → Create
- Subscription, Resource Group, Name, Region
- Create → Vào NSG → Inbound/Outbound security rules → Add
- Gán NSG vào Subnet hoặc Network Interface (NIC)
Application Security Group (ASG) - Azure
ASG cho phép gom nhóm VM theo ứng dụng (ví dụ: "WebTier", "AppTier", "DBTier") và viết rule NSG tham chiếu ASG thay vì IP/CIDR – dễ quản trị khi scale out/in.
Best Practices
- Ưu tiên NSG hơn Security List (OCI) – linh hoạt, granular hơn
- Naming convention:
nsg-[env]-[app]-[tier](vd: nsg-prod-web-fe) - Default deny → Explicit allow (least privilege)
- Tách rule theo protocol/port rõ ràng, có description
- Dùng Service Tags (Azure) / Service CIDR (OCI) thay vì hardcode IP cloud provider
- Audit định kỳ: nsgs without rules, overly permissive rules (0.0.0.0/0 trên port 22/3389)
- Log flow (NSG Flow Logs Azure / VCN Flow Logs OCI) → SIEM
Tóm tắt: Lấy danh sách Security List/NSG
| Nền tảng | CLI Command |
|---|---|
| OCI | oci network security-list list --compartment-id |
| Azure | az network nsg list --resource-group |
| AWS (Security Group) | aws ec2 describe-security-groups --region |