📘 Tuần 7 – User-ID, Authentication và kiểm soát theo danh tính
📘 Tuần 7 – User-ID, Authentication và kiểm soát theo danh tính
🗺️ Sơ đồ – User-ID Integration với Active Directory
📚 Lý thuyết cơ bản
🔰 User-ID là gì?
User-ID = Tính năng nhận dạng người dùng theo tên (thay vì chỉ theo IP).
💡 Vấn đề của firewall truyền thống: - "IP 10.10.10.100 đang truy cập Server" → Ai đang ngồi ở máy đó? Với User-ID: - "DOMAIN\nguyenvana đang truy cập Server từ 10.10.10.100" → Biết chính xác người dùng! Lợi ích: Policy dựa vào tên người dùng/nhóm AD thay vì IP có thể thay đổi.
🔰 Cách User-ID hoạt động
Palo Alto đọc Security Event Log từ Domain Controller:
- Event 4768/4769: User đăng nhập Kerberos → biết IP nào đang dùng bởi user nào.
- Xây dựng bảng IP-to-User Mapping: IP ↔ Username ↔ Group AD.
🔰 Các phương thức User-ID
| Phương thức | Mô tả | Dùng khi |
|---|---|---|
| Windows-based | Đọc Security Event Log từ DC | Môi trường Windows AD |
| Syslog-based | Nhận syslog từ DHCP/VPN/802.1X | Môi trường không có AD |
| XML API | API tích hợp với hệ thống khác | Tích hợp custom |
| GlobalProtect | Lấy từ VPN client | Remote users |
| Captive Portal | Yêu cầu đăng nhập web | Guest network |
🔰 Authentication Policy
Authentication Policy = Yêu cầu user đăng nhập trước khi truy cập tài nguyên (Captive Portal).
🛠️ Thực hành
Bật User-ID trên Zone Trust
textadmin@PA-LAB-01> configure
# Bật User-ID cho zone Trust
admin@PA-LAB-01# set zone Trust enable-user-identification yes
admin@PA-LAB-01# commit
Cấu hình kết nối tới Domain Controller
text# GUI: Device → User Identification → User-ID Agents
# Hoặc dùng built-in Windows agent:
# Cấu hình WMI/WinRM để đọc log từ DC
admin@PA-LAB-01# set user-id-collector setting wmi-client enabled yes
# Thêm server monitor account (đọc Security Event Log)
admin@PA-LAB-01# set user-id-collector setting server-monitor account domain lab.local
admin@PA-LAB-01# set user-id-collector setting server-monitor account username svc_paloalto
admin@PA-LAB-01# set user-id-collector setting server-monitor account password <password>
# Thêm DC để monitor
admin@PA-LAB-01# set user-id-collector server-monitor "DC-Lab" server 10.10.20.50
admin@PA-LAB-01# set user-id-collector server-monitor "DC-Lab" type Windows Active Directory
admin@PA-LAB-01# commit
Cấu hình LDAP Server Profile (kết nối AD)
text# GUI: Device → Server Profiles → LDAP → Add
admin@PA-LAB-01# set shared server-profile ldap "AD-LAB" server "dc01" address 10.10.20.50
admin@PA-LAB-01# set shared server-profile ldap "AD-LAB" server "dc01" port 389
admin@PA-LAB-01# set shared server-profile ldap "AD-LAB" base "DC=lab,DC=local"
admin@PA-LAB-01# set shared server-profile ldap "AD-LAB" bind-dn "CN=svc_paloalto,OU=ServiceAccounts,DC=lab,DC=local"
admin@PA-LAB-01# set shared server-profile ldap "AD-LAB" bind-password <password>
admin@PA-LAB-01# set shared server-profile ldap "AD-LAB" type active-directory
admin@PA-LAB-01# set shared server-profile ldap "AD-LAB" ssl no
admin@PA-LAB-01# commit
Tạo User Group và áp dụng vào Security Policy
text# GUI: Objects → Address Groups (User based)
# Tạo group IT-Staff từ AD
admin@PA-LAB-01# set shared user-group "IT-Staff" filter "(samaccountname=*)"
# Áp dụng User Group vào Security Policy
admin@PA-LAB-01# set rulebase security rules "IT-to-Server" from Trust
admin@PA-LAB-01# set rulebase security rules "IT-to-Server" to Trust
admin@PA-LAB-01# set rulebase security rules "IT-to-Server" source any
admin@PA-LAB-01# set rulebase security rules "IT-to-Server" source-user IT-Staff
admin@PA-LAB-01# set rulebase security rules "IT-to-Server" destination VLAN20-SERVER
admin@PA-LAB-01# set rulebase security rules "IT-to-Server" application ssh ms-rdp
admin@PA-LAB-01# set rulebase security rules "IT-to-Server" action allow
admin@PA-LAB-01# commit
Kiểm tra User-ID mapping
text# Xem bảng mapping IP → User hiện tại
admin@PA-LAB-01> show user ip-user-mapping all
# Xem user group mapping
admin@PA-LAB-01> show user group-mapping all
# Debug User-ID
admin@PA-LAB-01> debug user-id log-ip-user-mapping yes
🔒 Bảo mật cần nhớ
- ✅ Dùng service account riêng (không dùng Domain Admin) để Palo Alto đọc log DC.
- ✅ Bật LDAPS (port 636) thay vì LDAP plain text.
- ✅ Giới hạn IP nào được query User-ID Agent.
- ✅ Log mọi traffic có User-ID để audit.
📖 Case thực tế
Công ty phát hiện có người trong nhóm HR đang dùng SSH vào server sản xuất (ngoài giờ hành chính). Policy cũ dùng IP → không phân biệt được. Sau khi bật User-ID + gán Group Policy: - HR-Group → bị chặn SSH/RDP vào server. - IT-Group → vẫn được phép. - Threat Log ghi rõ "DOMAIN\tranthib cố truy cập server ngoài giờ → DENY". 👉 User-ID giúp kiểm soát theo danh tính thật, không phụ thuộc IP.
📅 Tuần 7/12 – PAN-OS Administration Lab trên PnetLab