Home » PKI (Public Key Infrastructure): Certificate Lifecycle Management
PKI (Public Key Infrastructure): Certificate Lifecycle Management
PKI (Public Key Infrastructure): Certificate Lifecycle Management
PKI (Public Key Infrastructure) เป็น framework สำหรับ manage digital certificates ที่ใช้ใน encryption, authentication และ digital signatures PKI ประกอบด้วย Certificate Authority (CA), Registration Authority (RA), certificate store และ revocation mechanisms Certificate Lifecycle Management ครอบคลุมตั้งแต่ request, issue, renew จนถึง revoke
Certificates หมดอายุ ถูก revoke หรือ misconfigure เป็นสาเหตุหลักของ outages หลายครั้ง เช่น expired certificate ทำให้ website ใช้ไม่ได้ หรือ VPN ล่มเพราะ CA certificate หมดอายุ Certificate Lifecycle Management ที่ดีป้องกันปัญหาเหล่านี้โดยติดตาม certificates ทั้งหมดและ automate renewal
PKI Components
| Component |
Role |
| CA (Certificate Authority) |
Issue + sign certificates (trusted entity) |
| Root CA |
Top-level CA (self-signed, offline, most trusted) |
| Intermediate/Subordinate CA |
CA ที่ signed โดย Root CA (online, issue end-entity certs) |
| RA (Registration Authority) |
Verify identity ก่อนส่ง request ไป CA |
| Certificate Store |
Database เก็บ issued certificates |
| CRL (Certificate Revocation List) |
List ของ certificates ที่ถูก revoke |
| OCSP (Online Certificate Status Protocol) |
Real-time certificate status check |
Certificate Types
| Type |
ใช้สำหรับ |
Validation |
| DV (Domain Validation) |
Website SSL/TLS |
ยืนยันแค่ domain ownership (ง่าย, เร็ว) |
| OV (Organization Validation) |
Website + organization identity |
ยืนยัน domain + organization (moderate) |
| EV (Extended Validation) |
High-trust websites (banks, e-commerce) |
ยืนยัน domain + organization + legal entity (strict) |
| Wildcard |
*.example.com (all subdomains) |
DV/OV level |
| SAN (Multi-domain) |
หลาย domains ใน 1 certificate |
DV/OV level |
| Code Signing |
Sign software/executables |
ยืนยัน publisher identity |
| Client Certificate |
Authenticate clients (mutual TLS) |
User/device identity |
Certificate Lifecycle
| Phase |
Action |
Detail |
| 1. Request (CSR) |
Generate key pair + CSR |
Certificate Signing Request มี public key + subject info |
| 2. Validation |
CA verify identity |
DV: domain control, OV: organization, EV: legal entity |
| 3. Issuance |
CA sign + issue certificate |
CA signs CSR กับ CA’s private key → certificate |
| 4. Installation |
Install cert + key บน server |
Configure web server/app กับ cert + chain + key |
| 5. Monitoring |
Track expiration + health |
Alert ก่อนหมดอายุ (30-60 days before) |
| 6. Renewal |
Renew ก่อนหมดอายุ |
Generate new CSR → CA issue new cert |
| 7. Revocation |
Revoke ถ้า compromised |
Add to CRL หรือ update OCSP |
CRL vs OCSP
| Feature |
CRL |
OCSP |
| คืออะไร |
List ของ revoked serial numbers |
Real-time query per certificate |
| Update |
Periodic (hours-days) |
Real-time (per request) |
| Size |
ใหญ่ขึ้นเรื่อยๆ (list grows) |
Small response (per cert) |
| Bandwidth |
Download full list |
Single request-response |
| Privacy |
Client downloads all (no privacy issue) |
CA knows which certs client checks |
| OCSP Stapling |
– |
Server pre-fetches OCSP response → ส่งให้ client (solves privacy) |
Certificate Automation
| Tool/Protocol |
วิธีทำงาน |
| ACME (Let’s Encrypt) |
Automated certificate issuance + renewal (free DV certs) |
| Certbot |
ACME client สำหรับ Let’s Encrypt (auto-renew) |
| SCEP |
Simple Certificate Enrollment Protocol (network devices) |
| EST |
Enrollment over Secure Transport (successor to SCEP) |
| Microsoft AD CS |
Windows PKI — auto-enroll certificates via GPO |
| HashiCorp Vault |
PKI secrets engine — dynamic short-lived certificates |
Certificate Management Tools
| Tool |
Type |
จุดเด่น |
| Venafi |
Enterprise CLM |
Full lifecycle, discovery, policy, automation |
| DigiCert CertCentral |
CA + management |
Public CA + management portal |
| Keyfactor |
Enterprise PKI + CLM |
PKI-as-a-Service, certificate automation |
| Let’s Encrypt + Certbot |
Free automation |
Free DV certs, ACME, auto-renew |
| Microsoft AD CS |
Internal CA |
Windows integration, GPO auto-enrollment |
| Smallstep |
Open-source CA |
Modern internal CA, ACME, short-lived certs |
Common Issues
| Issue |
สาเหตุ |
Prevention |
| Certificate expired |
ไม่ renew ก่อนหมดอายุ |
Monitoring + auto-renewal (ACME/Certbot) |
| Chain incomplete |
ไม่ install intermediate CA cert |
Always install full chain (root → intermediate → leaf) |
| CN/SAN mismatch |
Certificate ไม่ match domain name |
Include all domains ใน SAN field |
| Weak key |
ใช้ RSA 1024-bit หรือ SHA-1 |
RSA 2048+ หรือ ECDSA P-256 + SHA-256 |
| Private key compromised |
Key ถูกขโมยหรือ leaked |
Revoke immediately + re-issue + protect keys |
| Root CA compromise |
Root CA private key compromised |
Offline Root CA + HSM + strict access control |
Best Practices
| Practice |
รายละเอียด |
| Inventory all certs |
Discovery + catalog ทุก certificate ใน organization |
| Automate renewal |
ACME/Certbot/AD CS auto-enroll (ไม่ renew manual) |
| Short-lived certs |
90 days (Let’s Encrypt) หรือสั้นกว่า (Vault) — ลด exposure |
| Monitor expiration |
Alert ≥ 30 days before expiry |
| Offline Root CA |
Root CA offline + HSM (Hardware Security Module) |
| Strong algorithms |
RSA 2048/4096 หรือ ECDSA P-256 + SHA-256/384 |
| Protect private keys |
HSM, secrets manager, restrict access |
ทิ้งท้าย: PKI = Trust Infrastructure
PKI = CA + certificates + revocation (CRL/OCSP) Lifecycle: Request → Validate → Issue → Install → Monitor → Renew → Revoke Automate: ACME/Certbot สำหรับ public, AD CS/Vault สำหรับ internal Short-lived certs + auto-renewal = best practice Inventory + monitor + alert ก่อนหมดอายุ = ป้องกัน outages
อ่านเพิ่มเติมเกี่ยวกับ SSL TLS Deep Dive และ DNSSEC ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com