---
# System prepended metadata

title: 'Ch03 Authentication, Authorization, and Accounting'

---

Ch03 Authentication, Authorization, and Accounting
===

* AAA
    * 最早見於美國汽車的協會
    * triple A
        * Authentication: 你是誰
        * Authorization: 授權
        * Accounting: 做了什麼
    * local AAA authentication
        * 用 local database 驗證身分
    * server-based AAA authentication
        * 用另一台 remote server 驗證身分
    * 驗證完成後就會和 AAA server 建立 session
        * 然後就可以開始 request AAA server 上的服務
        * AAA server 再回傳 PASS/FAIL
    * RADIUS(Remote Authentication Dial In User Service)
        * 傳送 configuration information
        * 原本只是用來 dial-in 連接網路
        * 後來拓展成其他應用的 access 方式
        * UDP Port 1812
        * RADIUS server 有個 user database 驗證身分
        * 密碼用 MD5 儲存
        * NAS 和 RADIUS 會有共同的 secret
    * IEEE 802.1X
        * IEEE 802.1X(Port-based Network Access Control): 這個 port 不是 TCP/IP 的 port，而是硬體的 port
        * supplicant: 一般使用者
        * Authenticator: AAA client，NAS(Network Access Server)，跟私有雲的那個 NAS(Network Attached Storage) 不一樣
        * Authentication Server: 後端可能用 Radius、Diameter
    * RADIUS for Roaming(漫遊) user
        * 多層的 RADIUS，問了第一個 RADIUS，它確認使用者是哪個 RADIUS server 管的，再把 RADIUS packet forward 到第二個 RADIUS server
    * NAS 驗證身分
        * Password Authentication Protocol; PAP
        * Challenge-handshake Authentication Protocol; CHAP
        * RADIUS 可能會回傳 access、reject、challenge(繼續驗證)
        * 沒有 secret 的 client 的封包會直接被丟掉
    * 封包格式
        ![](https://i.imgur.com/knr4Ttp.png)
        * Authenticator: 驗證使用者密碼
        * 其中的 Attribute 是 authentication、authorization、configuration 資訊，也可以用來擴充 RADIUS，ex. EAP-message
    * EAP(RFC 3579)
        * 在封包的 Attributes 中，type 79 是 EAP-message，可以讓 attribute 的長度大於 253 bytes。如果有多個 EAP-message，可以合併
        * type 80 是用來 integrity check，用 secret