AAA Framework: Authentication, Authorization, Accounting - หน้าที่ของ Accounting
AAA คืออะไร?
AAA (Authentication, Authorization, Accounting) เป็นเฟรมเวิร์กควบคุมการเข้าถึงเครือข่าย 3 กระบวนการ:
- Authentication (การยืนยันตัวตน): คุณคือใคร? (Username/Password, Certificate, MFA, Biometric)
- Authorization (การอนุญาต): คุณได้ทำอะไรบ้าง? (Privileges, ACLs, RBAC, Policy)
- Accounting (การบันทึกบัญชี/ตรวจสอบ): คุณทำอะไรไป? เมื่อไหร่? นานแค่ไหน? ใช้ทรัพยากรเท่าไหร่?
วัตถุประสงค์หลักของ Accounting Function
| วัตถุประสงค์ | รายละเอียด | ตัวอย่างข้อมูลที่บันทึก |
| Audit Trail / Forensics | บันทึกประวัติการกระทำเพื่อสืบสวนเหตุการณ์ความปลอดภัย | User, Command, Timestamp, Source IP, Result (Success/Fail) |
| Billing / Chargeback | คิดค่าใช้จ่ายตามการใช้ทรัพยากร (ISP, Cloud, Managed Services) | Session Duration, Bytes In/Out, Packets, Service Type |
| Capacity Planning | วิเคราะห์การใช้ทรัพยากรเพื่อวางแผนขยายระบบ | Peak Usage, Average Bandwidth, Concurrent Sessions, Trends |
| Compliance / Regulatory | ปฏิบัติตามกฎระเบียบ (PCI-DSS, HIPAA, SOX, GDPR) | Access Logs, Admin Actions, Data Access Records, Retention |
| Security Monitoring | ตรวจจับพฤติกรรมผิดปกติ (Anomaly Detection) | Failed Logins, Privilege Escalation, Unusual Hours, Data Exfil |
| Troubleshooting | ช่วยวินิจฉัยปัญหาเครือข่าย/การเชื่อมต่อ | Session Start/Stop, Disconnect Reason, Error Codes |
Accounting Data Attributes (RADIUS Accounting - RFC 2866)
- Acct-Session-Id: Unique Session Identifier
- Acct-Status-Type: Start, Stop, Interim-Update, Accounting-On, Accounting-Off
- Acct-Authentic: RADIUS, Local, Remote, Diameter
- User-Name, NAS-IP-Address, NAS-Port, Calling-Station-Id (MAC/Phone)
- Acct-Session-Time: ระยะเวลา Session (วินาที)
- Acct-Input-Octets / Acct-Output-Octets: Bytes Received/Sent
- Acct-Input-Packets / Acct-Output-Packets: Packets Received/Sent
- Acct-Terminate-Cause: User Request, Lost Carrier, Admin Reset, Session Timeout, Idle Timeout
AAA Protocols ที่รองรับ Accounting
| Protocol | Accounting Support | 특징 |
| RADIUS (UDP 1813) | Yes (RFC 2866) | Standard, Widely Supported, UDP (Unreliable), Limited Command Accounting |
| TACACS+ (TCP 49) | Yes (Cisco Proprietary) | TCP (Reliable), Full Command Accounting, Separate Authz/Acc, Encryption (Full Packet) |
| Diameter (TCP/SCTP 3868) | Yes (RFC 6733) | Next-gen RADIUS, Reliable, TLS/DTLS, Mobile/3GPP/4G/5G, Extensible |
Cisco IOS AAA Accounting Configuration Example
! Enable AAA
aaa new-model
! Define RADIUS Server Group
aaa group server radius RADIUS_GROUP
server 192.168.1.10 auth-port 1812 acct-port 1813
server 192.168.1.11 auth-port 1812 acct-port 1813
! Accounting Methods
aaa accounting exec default start-stop group RADIUS_GROUP
aaa accounting commands 15 default start-stop group RADIUS_GROUP ! Privileged commands
aaa accounting network default start-stop group RADIUS_GROUP ! VPN/Network Access
aaa accounting connection default start-stop group RADIUS_GROUP ! Outbound connections
aaa accounting system default start-stop group RADIUS_GROUP ! System events (reload)
! Apply to VTY Lines
line vty 0 4
accounting exec default
accounting commands 15 default
login authentication default
transport input ssh
Best Practices สำหรับ AAA Accounting
- Enable Command Accounting (TACACS+): บันทึกทุกคำสั่ง CLI ที่ Privilege 15 (หรือทุกระดับ)
- Use Interim Accounting: ส่ง Update เป็นระยะ (เช่น ทุก 15 นาที) สำหรับ Session ยาว (VPN, Dial-up)
- Secure Transport: RADIUS over DTLS (RADSEC) หรือ TACACS+ over TCP/TLS, Diameter over TLS
- Centralized Log Storage: ส่งไป SIEM/Log Collector (Retention ตาม Compliance: 1-7 ปี)
- Alert on Anomalies: Failed Logins > Threshold, Admin Commands at Odd Hours, New Device Types
- Regular Review: Audit Reports, Exception Reports, Compliance Evidence
สรุป
Accounting ใน AAA ไม่ใช่แค่ "นับเงิน" แต่เป็น การบันทึกหลักฐาน (Audit Trail) สำหรับ Forensics, Billing, Compliance, Capacity Planning, Security Monitoring, Troubleshooting - เป็นองค์ประกอบสำคัญของ Non-repudiation และ Governance ใน Network Security