Computer >> Hướng Dẫn Máy Tính >  >> Kết Nối Mạng >> An Ninh Mạng

Danh sách kiểm soát truy cập (ACL) trong an ninh mạng: Vai trò, loại, cấu hình, best practice

ACL (Access Control List) là gì?

Access Control List (ACL - Danh sách kiểm soát truy cập) là tập hợp các quy tắc (rules) có thứ tự, được áp dụng trên thiết bị mạng (router, switch, firewall) để cho phép (permit) hoặc từ chối (deny) lưu lượng dựa trên tiêu chí: địa chỉ IP nguồn/đích, giao thức (TCP/UDP/ICMP), cổng nguồn/đích, flags TCP, DSCP/ToS, interface.

ACL hoạt động như "người gác cổng" (gatekeeper) - kiểm tra từng gói tin vào/ra interface, so sánh với quy tắc từ trên xuống, hành động theo quy tắc khớp đầu tiên (first-match).

Vai trò của ACL trong an ninh mạng

  • Lọc gói tin (Packet Filtering) - kiểm soát luồng truy cập
  • Giảm bề mặt tấn công (Attack Surface Reduction)
  • Phân đoạn mạng (Segmentation) - ngăn chặn lateral movement
  • Bảo vệ control plane (Control Plane Policing - CoPP)
  • QoS classification, Policy-based Routing (PBR), NAT, VPN traffic selection
  • Mitigation: Chặn DDoS source, block known malicious IP (threat intel feed)

Các loại ACL (Types of ACL)

Loại ACLPhạm vi lọcSố hiệu (Cisco)Ứng dụng điển hình
Standard ACLChỉ Source IP1-99, 1300-1999Lọc đơn giản, gần destination, VTY access-class
Extended ACLSrc/Dst IP, Protocol, Src/Dst Port, TCP flags, ICMP type, DSCP, Time-range100-199, 2000-2699Chính sách bảo mật chi tiết, ranh giới, segmentation
Named ACLGiống Extended nhưng dùng tên (dễ quản lý, chèn sửa quy tắc)Tên tùy chọnBest practice hiện nay, hỗ trợ remark, sequence number
Dynamic ACL (Lock-and-Key)Tạm thời mở quyền sau khi user xác thực (SSH/Telnet/HTTP)DynamicRemote access tạm thời, vendor support
Reflexive ACLTự động tạo rule cho traffic trả lời (stateful-like)ReflexiveThay thế stateful firewall đơn giản trên router
Time-based ACLÁp dụng theo lịch (giờ/ngày/tuần)Time-rangeChặn truy cập sau giờ làm việc, giới hạn trẻ em
IPv6 ACLTương tự Extended nhưng cho IPv6Named onlyMạng dual-stack, IPv6 only

ACL trên các nền tảng

Cisco IOS/IOS-XE (Router/Switch)

! Standard ACL
access-list 10 permit 192.168.10.0 0.0.0.255
interface Gig0/0
 ip access-group 10 in

! Extended Named ACL (Best Practice)
ip access-list extended WAN_INBOUND
  10 permit tcp any host 203.0.113.10 eq 443 log
  20 permit tcp any host 203.0.113.10 eq 80 log
  30 permit udp any host 203.0.113.10 eq 500
  40 permit udp any host 203.0.113.10 eq 4500
  50 permit icmp any host 203.0.113.10 echo-reply
  60 permit icmp any host 203.0.113.10 unreachable
  999 deny ip any any log
interface Gig0/1
 ip access-group WAN_INBOUND in

Cisco ASA / Firepower (Firewall)

access-list OUTSIDE_IN extended permit tcp any host 203.0.113.10 eq 443
access-list OUTSIDE_IN extended deny ip any any log
access-group OUTSIDE_IN in interface outside

AWS Network ACL (Stateless, Subnet-level)

  • Stateless: Phải cho phép CẢ inbound VÀ outbound (ephemeral ports 1024-65535)
  • Quy tắc đánh số: 100, 200, 300... (dễ chèn)
  • Mặc định: Allow all. Custom: Deny explicit

Azure Network Security Group (NSG)

  • Stateful: Chỉ cần rule inbound, outbound tự động cho phép return traffic
  • Priority: 100, 200, 300... (số nhỏ = ưu tiên cao)
  • Áp dụng cho Subnet hoặc NIC

Best Practice cấu hình ACL

  1. Dùng Named ACL (dễ đọc, sửa, chèn, remark)
  2. Đặt quy tắc cụ thể (specific) TRƯỚC, chung (general) SAU
  3. Implicit Deny All ở cuối (mặc định từ chối tất cả chưa khớp) - log để audit
  4. Áp dụng gần nguồn (ingress) cho traffic xuất phát, gần đích (egress) cho traffic đến
  5. Một ACL per direction per interface (1 inbound, 1 outbound)
  6. Dùng Sequence Number (10, 20, 30...) để chèn quy tắc mới không cần rewrite
  7. Remark (comment) cho mọi quy tắc: `10 remark Allow HTTPS to Web Server`
  8. Log denials quan trọng (deny ... log) - nhưng chặn log flood với rate-limit
  9. Test trước khi apply production (labs, `access-list compile` trên ASA)
  10. Document & Version control (Git, NetBox, Nautobot, Ansible)

Ưu và Nhược điểm của ACL

Ưu điểmNhược điểm
Đơn giản, nhẹ, chạy trên hardware (ASIC/FPGA) - line rateStateless (trừ Reflexive) - không theo dõi state connection như firewall
Không cần license thêm trên hầu hết thiết bị mạngKhó quản lý khi số lượng rule lớn (hundreds+)
Linh hoạt, granular (L3/L4)Không inspect L7 (application), không DPI
Dùng cho CoPP, QoS, PBR, NAT, VPN selectDễ sai cấu hình: lockout management, asymmetric routing break
Baseline cho Zero Trust network segmentationKhông thay thế được Next-Gen Firewall / IPS / WAF

ACL vs Firewall vs Security Group

Đặc điểmACL (Router/Switch)Stateful FirewallCloud Security Group (AWS SG / Azure NSG)
StatefulKhông (mặc định)CóCó
LayerL3/L4L3-L7L3/L4 (SG), L3-L7 (NSG + Azure Firewall)
Áp dụngInterface (L3)Zone/InterfaceENI/NIC (SG), Subnet/NIC (NSG)
Quản lýCLI/NETCONF/AnsibleGUI/CLI/APIConsole/CLI/API/IaC
Phù hợpInfrastructure, Transit, CoPPPerimeter, Data Center, BranchCloud workload, Micro-segmentation

Kết luận

ACL là khối xây dựng cơ bản (building block) của an ninh mạng. Mặc dù không thay thế được firewall trạng thái (stateful) hay NGFW, ACL vẫn không thể thiếu cho: Control Plane Protection, Infrastructure ACL (iACL), Network Segmentation tại Layer 3, CoPP, QoS, và là nền tảng của Zero Trust Network Access ở mức hạ tầng. Hãy master Named Extended ACL với sequence numbers, remarks, logging, và test kỹ trước khi deploy.