Mục tiêu chương / Learning objectives
- Phân biệt 5 trạng thái dữ liệu trong đám mây và biện pháp bảo vệ tương ứng cho từng trạng thái (at-rest, in-transit, in-use, in-process, in-archive).
- Giải thích và so sánh các mô hình mã hóa: CSE (Client-Side Encryption), SSE (Server-Side Encryption), CMEK, BYOK, và HYOK theo use case và compliance requirement.
- Triển khai và quản lý Key Management Service (AWS KMS, Azure Key Vault, GCP Cloud KMS) theo best practices: key rotation, access policies, HSM backing.
- Áp dụng Data Loss Prevention (DLP) với Google DLP API, AWS Macie, Azure Purview để phát hiện và bảo vệ dữ liệu nhạy cảm tự động.
- Cấu hình bảo mật object storage (S3, Azure Blob, GCP Storage) với bucket policies, access control, versioning, và MFA delete.
- Thiết kế Information Lifecycle Management (ILM) trong đám mây: tiering, archival, retention policies, và secure deletion verification.
1. Lý thuyết cốt lõi / Core theory
1.1. Phân loại dữ liệu trong đám mây (Data classification in cloud)
Phân loại dữ liệu là bước đầu tiên và bắt buộc của data security. Trong môi trường đám mây, có hai phương pháp chính:
- Manual classification: Người dùng/owner gán nhãn (label) cho dữ liệu. Azure Information Protection (AIP) labels: Public, General, Confidential, Highly Confidential. AWS: Resource Tags với key="DataClassification".
- Auto-classification: Dùng ML/pattern matching để tự động phát hiện và gán nhãn. AWS Macie phát hiện PII (SSN, credit card, passport numbers) trong S3. Google DLP API có 150+ built-in infoTypes (PERSON_NAME, EMAIL_ADDRESS, CREDIT_CARD_NUMBER, VN_SOCIAL_SECURITY_NUMBER). Azure Purview quét databases, storage accounts, và on-premises data sources.
Khái niệm CCSP then chốt — Data Custody vs. Data Ownership: Trong cloud, Data Owner (tổ chức/cá nhân tạo dữ liệu) vẫn chịu trách nhiệm pháp lý về dữ liệu, dù Data Custodian (CSP) là người lưu trữ vật lý. GDPR Article 28 quy định CSP là "Data Processor" phải ký Data Processing Agreement (DPA) với customer là "Data Controller."
1.2. Mã hóa đám mây — CSE, SSE, CMEK, BYOK, HYOK (Cloud encryption models)
CCSP yêu cầu hiểu sâu các mô hình mã hóa và khi nào dùng mô hình nào:
- CSE (Client-Side Encryption): Dữ liệu được mã hóa trước khi gửi lên cloud. CSP chỉ thấy ciphertext. Khóa do customer hoàn toàn kiểm soát. Use case: dữ liệu tối mật không muốn CSP tiếp cận. Downside: mất khả năng dùng cloud-native services (search, indexing).
- SSE (Server-Side Encryption): CSP mã hóa dữ liệu sau khi nhận. Ba variants:
- SSE-S3/SSE-Azure/SSE-GCP: CSP quản lý keys hoàn toàn. Dễ nhất, nhưng CSP có thể access keys.
- SSE-KMS (CMEK): Keys trong AWS KMS/Azure Key Vault/GCP KMS. Customer có audit trail và có thể revoke.
- SSE-C: Customer cung cấp key với mỗi request. CSP không lưu key.
- BYOK (Bring Your Own Key): Customer tạo key (thường từ HSM on-prem) rồi import vào cloud KMS. Customer kiểm soát key material nhưng key "sống" trong cloud.
- HYOK (Hold Your Own Key): Key không bao giờ rời khỏi on-premises HSM. Cloud service gọi về on-prem HSM để thực hiện mã hóa/giải mã. Latency cao hơn nhưng maximum control. Dùng cho dữ liệu chủ quyền quốc gia hoặc regulated heavily.
⚠️ So sánh BYOK vs HYOK cho đề thi: BYOK = key nhập vào cloud (CSP có thể lý thuyết access). HYOK = key luôn on-prem (CSP chỉ dùng key qua API call, không có key material). HYOK = maximum sovereignty, BYOK = good balance. Ngân hàng Việt Nam thường cần HYOK hoặc CMEK với HSM.
1.3. Key Management Services — AWS KMS, Azure Key Vault, GCP KMS (Key management)
Quản lý khóa là trụ cột của data security. Ba KMS chính:
- AWS KMS: Tích hợp với 100+ AWS services. Keys là AES-256. Automatic key rotation mỗi 365 ngày (configurable). Key policies + IAM policies = double-layer access control. CloudHSM cho dedicated HSM (FIPS 140-2 Level 3).
- Azure Key Vault: Lưu secrets, keys, và certificates. Premium tier dùng FIPS 140-2 Level 2 HSM. Managed HSM (Dedicated HSM) là Level 3. Key Vault Firewall giới hạn access từ specific VNets/IPs. Soft-delete và purge protection ngăn xóa nhầm.
- GCP Cloud KMS: Customer-Managed Encryption Keys (CMEK). Cloud EKM (External Key Manager) cho HYOK — key trên Thales/Fortanix HSM on-prem. Key Access Justifications: AI model giải thích mỗi lần Google infrastructure access key.
1.4. Data Residency, Sovereignty & DLP (Residency, sovereignty & DLP)
Data Residency: Dữ liệu phải lưu trữ trong biên giới địa lý nhất định. GDPR Art. 46 quy định transfer dữ liệu EU sang nước thứ ba cần SCC (Standard Contractual Clauses) hoặc adequacy decision. Việt Nam: Luật An ninh mạng 2018 Điều 26 yêu cầu dữ liệu quan trọng của công dân VN phải lưu tại VN.
Data Sovereignty: Dữ liệu phải tuân theo luật của quốc gia nơi dữ liệu được xử lý/lưu trữ. CLOUD Act (Clarifying Lawful Overseas Use of Data) cho phép US authorities yêu cầu CSP Mỹ cung cấp dữ liệu dù lưu ở nước ngoài — rủi ro với dữ liệu EU/VN trên AWS/Azure.
Cloud DLP Tools:
- Google DLP API: Inspect, de-identify (masking/tokenization/pseudonymization), re-identify. 150+ infoTypes. Cost per request.
- AWS Macie: Tự động phát hiện PII trong S3. ML-powered, phân loại theo độ nhạy cảm. Findings gửi về Security Hub.
- Microsoft Purview: Data governance platform: data catalog, data map, và data loss prevention. DLP policies áp dụng trên M365, Teams, SharePoint, Exchange, và endpoints.
1.5. Object Storage Security & Data Lifecycle Management (Storage security & ILM)
Object Storage Security:
- AWS S3: Block Public Access (account-level và bucket-level), bucket policies (JSON), ACLs (legacy, không khuyến nghị), S3 Object Lock (WORM: Write Once Read Many cho compliance), Versioning + MFA Delete ngăn ransomware.
- Azure Blob Storage: Shared Access Signatures (SAS tokens) với time-limited access, Blob immutability (time-based + legal hold), private endpoints để loại bỏ public internet exposure.
- GCP Cloud Storage: IAM conditions cho fine-grained access, Uniform bucket-level access (disable legacy ACLs), Retention policies và object holds.
ILM (Information Lifecycle Management): Dữ liệu có lifecycle: Create → Store → Use → Share → Archive → Destroy. Trong cloud:
- Tiering: AWS S3 Intelligent-Tiering tự động di chuyển objects giữa Standard, Infrequent Access, và Glacier dựa trên access patterns.
- Archival: AWS S3 Glacier Instant/Flexible/Deep Archive; Azure Archive Blob (1-15 giờ rehydrate); GCP Coldline/Archive.
- Secure Deletion: Trong cloud, "delete" không đảm bảo dữ liệu bị xóa vật lý khỏi hardware CSP. Giải pháp: Crypto-shredding — xóa encryption key thì dữ liệu trở thành gibberish vô dụng. AWS Key Deletion có minimum 7-30 ngày waiting period.
2. Bài thực hành / Hands-on lab
Lab 1 — Tạo Azure Key Vault, quản lý keys, và cấu hình Storage encryption
OS: Any · Tool: Azure CLI.
- Tạo Key Vault với soft-delete và purge protection (bắt buộc cho production):
# Tạo Resource Group và Key Vault
az group create --name SecLab --location southeastasia
az keyvault create \
--name myKeyVault-$(date +%s) \
--resource-group SecLab \
--location southeastasia \
--sku premium \
--enable-soft-delete true \
--enable-purge-protection true
# Tạo RSA-2048 key (CMEK key)
az keyvault key create \
--vault-name myKeyVault \
--name myDataKey \
--kty RSA \
--size 2048 \
--ops encrypt decrypt wrapKey unwrapKey
# Kiểm tra key đã tạo
az keyvault key list --vault-name myKeyVault -o table
# Cấu hình Storage Account chỉ cho phép traffic từ private network
az storage account update \
--name mystorageacct \
--resource-group SecLab \
--default-action Deny \
--bypass AzureServices
# Kiểm tra encryption settings của Storage Account
az storage account show \
--name mystorageacct \
--query "encryption.{KeySource:keySource,Services:services}" -o json
✅ Kết quả mong đợi / Expected output: Key Vault tạo thành công với enableSoftDelete: true và enablePurgeProtection: true. Key list hiển thị key ID, type RSA-2048, và status Enabled. Storage encryption hiển thị keySource: Microsoft.Storage (SSE với Microsoft-managed keys) — sau đó có thể chuyển sang CMEK bằng cách chỉ định Key Vault key ID. Purge protection ngăn xóa vault trong ít nhất 90 ngày — critical for compliance.
Lab 2 — Kiểm tra S3 Security, AWS KMS, và AWS Macie findings
OS: Any · Tool: AWS CLI.
# Kiểm tra bucket policy (phát hiện misconfiguration)
aws s3api get-bucket-policy --bucket mybucket 2>/dev/null || echo "No bucket policy set"
# Kiểm tra server-side encryption của bucket
aws s3api get-bucket-encryption --bucket mybucket
# Kiểm tra versioning (bảo vệ khỏi ransomware)
aws s3api get-bucket-versioning --bucket mybucket
# Liệt kê tất cả KMS keys trong account
aws kms list-keys --query "Keys[].KeyId" --output text | tr '\t' '\n' | head -5
# Xem thông tin chi tiết về AWS managed key cho S3
aws kms describe-key \
--key-id alias/aws/s3 \
--query "KeyMetadata.{KeyId:KeyId,Enabled:Enabled,KeyUsage:KeyUsage,CreationDate:CreationDate}" \
-o json
# Xem Macie findings (nếu Macie đã được bật)
DETECTOR=$(aws macie2 list-findings --query "findingIds[0]" --output text 2>/dev/null)
if [ "$DETECTOR" != "None" ] && [ -n "$DETECTOR" ]; then
aws macie2 get-findings --finding-ids "$DETECTOR" \
--query "findings[].{Type:type,Severity:severity.description,Resource:resourcesAffected.s3Bucket.name}" \
-o table
else
echo "No Macie findings or Macie not enabled. Run: aws macie2 enable-macie"
fi
✅ Kết quả mong đợi / Expected output: Bucket encryption hiển thị SSEAlgorithm: aws:kms với KMS key ID — nếu hiển thị AES256 (SSE-S3) thì chưa đạt CMEK level. Versioning Status = Enabled là best practice. Macie findings liệt kê buckets chứa PII với severity HIGH/MEDIUM. KMS key aws/s3 là AWS-managed key — recommend chuyển sang customer-managed key cho regulated data.
3. Tình huống doanh nghiệp / Real-world scenario
Bối cảnh:
Một công ty fintech Việt Nam lưu trữ 2 triệu hồ sơ khách hàng (CCCD, ngày sinh, số tài khoản ngân hàng) trên AWS S3. Audit team phát hiện một bucket S3 không bật encryption và policy cho phép GetObject từ * (public). CISO yêu cầu remediation khẩn cấp trong 24 giờ và lập kế hoạch data security toàn diện.
Phân tích & Giải pháp:
- Immediate response (0-2h): Block public access ngay lập tức:
aws s3api put-public-access-block --bucket BUCKET --public-access-block-configuration "BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true". Revoke bucket policy cho phép public access. - Encryption remediation (2-8h): Tạo Customer Managed Key (CMK) trong AWS KMS với key policy chỉ cho phép specific IAM roles. Enable SSE-KMS trên bucket. Dùng S3 Batch Operations để re-encrypt tất cả objects hiện có.
- Classification & DLP (8-24h): Bật AWS Macie để scan bucket. Cấu hình findings export về Security Hub và SNS notification. Thêm S3 Object Lock với compliance mode 7 năm (theo yêu cầu tài chính VN).
- Long-term ILM policy: S3 Lifecycle: active data (Standard) → 90 ngày → Infrequent Access → 2 năm → Glacier Deep Archive. Sau 7 năm (retention period): crypto-shredding bằng cách xóa CMK.
Bài học CCSP: Misconfigured S3 bucket là "misconfiguration" threat — shared responsibility rõ ràng: CSP không ngăn customer tạo public bucket, đây hoàn toàn là customer responsibility. Defense-in-depth: encryption + access control + monitoring + DLP là 4 lớp bảo vệ cần thiết.
4. Tự kiểm tra / Knowledge check
- Giải thích sự khác biệt giữa BYOK và HYOK. Khi nào một tổ chức tài chính nên chọn HYOK thay vì BYOK?
- Crypto-shredding là gì và tại sao đây là cách tiếp cận secure deletion tốt nhất trong cloud? Rủi ro nào cần cân nhắc khi dùng crypto-shredding?
- Phân biệt Data Owner, Data Custodian, và Data Processor trong bối cảnh GDPR và cloud. Ai chịu trách nhiệm gì khi xảy ra data breach?
- AWS Macie, Google DLP API, và Microsoft Purview phục vụ use case nào khác nhau? Lấy ví dụ cụ thể cho từng tool.
- Một công ty có S3 bucket với SSE-S3 (AES256). CISO yêu cầu nâng cấp lên CMEK mà không downtime và không mất dữ liệu. Mô tả các bước thực hiện.
- Data residency requirement của NHNN Việt Nam ảnh hưởng đến lựa chọn AWS Region như thế nào? Có giải pháp nào để satisfy requirement này không?