Server Security Baseline: cấu hình bảo mật tối thiểu trước khi đưa Web Server lên production

Server Security Baseline là release gate trước production: kiểm tra owner, patch, attack surface, firewall, SSH, privilege, secrets, logging, backup và quyết định GO/NO-GO.

Server Security Baseline trước Production - checklist bảo mật Web Server

Server Security Baseline là bộ trạng thái bảo mật tối thiểu mà một web server phải đạt trước khi được release lên production. Bài này sở hữu một nhiệm vụ duy nhất: đưa ra quyết định GO / NO-GO / GO-WITH-EXCEPTION dựa trên expected state và evidence trước go-live.

Baseline không phải checklist bảo trì định kỳ. Sau khi server đã production, việc so trạng thái hiện tại với baseline, tìm configuration drift và đặt cadence review thuộc Server Security Maintenance Checklist.

Baseline khác hardening checklist thế nào?

Checklist chỉ liệt kê “cần xem gì”; baseline định nghĩa state phải đạt, evidence chứng minh state đó và blocking criteria trước release.

Checklist itemRelease-gate baseline
Kiểm tra SSHEffective SSH policy có owner, authentication/root policy và login validation
Bật firewallAllowed inbound khớp intended architecture và observed socket
Update serverOS còn support, blocking security updates đã xử lý hoặc exception được duyệt
Có backupBackup có owner và restore evidence phù hợp trước release

13 security gates trước production

Gate 1: Server identity và ownership

Trước go-live phải khóa hostname, environment, application, provider/project, public/private IP, business owner và technical owner. Không có owner thì exception, incident và rollback sau này không có người chịu trách nhiệm.

Gate 2: OS/runtime còn support và patch state chấp nhận được

Server không nên bắt đầu vòng đời production với OS/runtime đã hết support. Ghi release, package source, pending security update và restart/reboot requirement.

cat /etc/os-release
apt list --upgradable 2>/dev/null

Đây chỉ là ví dụ cho Debian/Ubuntu. Quy trình ưu tiên, rollout và rollback patch chi tiết thuộc Linux Patch Management.

Gate 3: Attack surface đã được inventory

Release gate cần biết mọi service/socket/account/control plane quan trọng đã được inventory và có owner/purpose. Không cần thực hiện inventory chi tiết trong bài này; sử dụng Attack Surface Web Server làm evidence source. Một failure mode cần đưa vào release review là dịch vụ và port không cần thiết làm tăng Server Attack Surface.

Blocking finding là exposure quan trọng chưa có owner/purpose hoặc service/admin path public ngoài intended design mà chưa có exception.

Gate 4: Firewall và network path khớp architecture

Allowed inbound phải được tài liệu hóa; host firewall và cloud/security-group state không mâu thuẫn. Admin/database service không public ngoài nhu cầu. Với remote management change, rollback/console path phải tồn tại.

Gate 5: SSH remote administration đã xác minh

SSH baseline cần effective authentication policy, root policy, user/group restriction khi dùng và login test thực tế. Không dùng “đổi port SSH” làm acceptance criterion chính. Để kiểm failure mode trước go-live, đối chiếu case SSH Brute Force dẫn tới truy cập trái phép.

sudo sshd -T | egrep 'permitrootlogin|passwordauthentication|maxauthtries|allowusers|allowgroups'

Chi tiết config/rollback thuộc SSH Hardening.

Gate 6: Root, sudo và privileged access

Human admin phải có identity rõ; full sudo chỉ dành cho vai trò thật sự cần. Service/automation account có owner và privilege scope. Shared root/admin credential là finding cần xử lý hoặc exception trước release.

Chi tiết privilege path thuộc Root, sudo & Least Privilege.

Gate 7: File permission và writable path

Source/config/secret không world-writable; runtime chỉ ghi đúng path cần thiết; deploy và runtime identity được tách khi architecture yêu cầu. Không dùng chmod -R 777 như acceptance fix.

Gate 8: Web server và runtime đã harden theo role

Nginx/Apache/PHP-FPM hoặc runtime khác phải dùng package còn support, chỉ expose interface/path cần thiết, process identity phù hợp và config test PASS. Mỗi stack có owner page riêng; baseline chỉ thu evidence cuối.

Gate 9: Database/internal services không overexposed

Database/cache/search/queue/admin API bind đúng network path. Application account và remote-admin path được kiểm soát. Nếu cùng host, public DB exposure thường cần justification rõ.

Gate 10: Secrets và deployment credential có owner

SSH key, DB credential, API token, cloud token và environment secret có owner, consumer, storage và rotation/revocation path. Secret không nằm trong public web root hoặc log. Failure mode cần kiểm trước production là API Key và file cấu hình bị lộ.

Management plane cũng phải nằm trong baseline: control panel public, MFA yếu hoặc admin path không được giới hạn có thể thay đổi host ngoài SSH. Xem case aaPanel/Control Panel Exposure dẫn tới Server Compromise.

Gate 11: Logging và time sync sẵn sàng

Clock phải đúng; auth/system/web logs cần đủ để điều tra login, privilege, service failure và web incident. Baseline không yêu cầu log mọi event vô hạn; chỉ yêu cầu evidence source thiết yếu tồn tại và có owner.

Gate 12: Backup và recovery có evidence

Backup production có owner, storage/access policy và restore path. Job “success” không đủ nếu chưa có evidence rằng dữ liệu có thể phục hồi theo nhu cầu dịch vụ.

Gate 13: Blocking controls và exceptions đã đóng

Trước release, mọi finding phải có final state:

  • PASS: expected state đã được chứng minh.
  • FAIL/BLOCK: chưa được release.
  • EXCEPTION: risk owner chấp nhận, có compensating control và expiry/review date.

Không dùng trạng thái “tạm thời” không owner/deadline cho production release.

Quy trình GO / NO-GO trước production

  1. Read current state.
  2. Snapshot các control quan trọng.
  3. Thu evidence cho 13 gate.
  4. Đánh dấu PASS/FAIL/EXCEPTION.
  5. Xử lý blocking finding theo owner page chuyên biệt.
  6. Read-back effective/runtime state.
  7. Functional test website, deploy, cron, backup và monitoring.
  8. Risk owner duyệt exception nếu có.
  9. Ra quyết định GO / NO-GO / GO-WITH-EXCEPTION.

Server Security Baseline worksheet

Đây là template release gate, không phải audit result của SecureWebOps.

GateExpected stateEvidenceOwnerResultException/Next action
OS/PatchSupported + no blocking overdue riskRelease/package/advisoryPlatformPASS/FAILPatch/upgrade plan
ExposureOnly intended servicesAttack Surface Register + firewallPlatform/NetworkPASS/FAILRestrict/remediate
PrivilegeNamed admin + least privilegeUser/sudo/key inventoryIdentity/OpsPASS/FAILRevoke/reduce
LoggingRequired evidence sources readyLog/read testOps/SecurityPASS/FAILEnable/route
BackupRecovery path verifiedBackup + restore evidenceService ownerPASS/FAILFix before release

Sau khi GO-LIVE thì dùng bài nào?

Baseline là snapshot/expected state tại release. Sau go-live, patch, deploy, account changes và automation có thể làm trạng thái drift. Từ thời điểm đó, dùng Server Security Maintenance Checklist để so previous baseline → observed state → delta → action → final state.

Như vậy owner boundary rõ: Baseline = release decision trước production; Maintenance = recurring drift review sau production.

Checklist Release Gate

  1. Server identity/owner đầy đủ.
  2. OS/runtime còn support.
  3. Blocking patch risk đã xử lý/exception.
  4. Attack surface inventory hoàn tất.
  5. Firewall/network path khớp architecture.
  6. SSH effective state đã test.
  7. Privileged access đã review.
  8. File permission/write path hợp lý.
  9. Web stack/runtime validation PASS.
  10. Database/internal service không overexposed.
  11. Secrets có owner/storage/rotation path.
  12. Logging/time sync sẵn sàng.
  13. Backup/recovery có evidence.
  14. Exception có risk owner + expiry.
  15. Functional test sau hardening PASS.
  16. Quyết định GO/NO-GO được ghi.

Nguồn kỹ thuật tham khảo

Kết luận

Server Security Baseline là release gate trước production. Nó không sở hữu việc maintenance định kỳ hay configuration-drift review sau go-live.

Một server chỉ nên GO khi các control blocking có evidence PASS hoặc exception đã được risk owner chấp nhận. Sau release, baseline này trở thành mốc để bài Maintenance đo drift theo thời gian.

◇
Cần hỗ trợ kiểm tra và xử lý website?Đội ngũ SecureWebOps sẵn sàng hỗ trợ theo phạm vi phù hợp.
Liên hệ ngay →
Đoàn Trình Dục
Về tác giả Đoàn Trình Dục TD Digital · Website Operations & Security

Đoàn Trình Dục là tác giả nội dung trên SecureWebOps. Các bài viết tập trung vào bảo mật WordPress, giám sát an ninh website, malware/backdoor, hardening, backup/recovery và Incident Response theo hướng thực hành, có bước kiểm tra, bằng chứng, validation và rollback khi phù hợp.

Xem hồ sơ tác giả →