我已經創建了 python auth 模組。當嘗試使用 radtest 執行測試時,回復是:
User-Password = "testing123"
NAS-IP-Address = 127.0.1.1
NAS-Port = 0
Message-Authenticator = 0x00
Cleartext-Password = "testing123"
Received Access-Accept Id 188 from 127.0.0.1:1812 to 0.0.0.0:0 length 48
ERX-Service-Activate:0 = "srs-local-ipoe"
如您所看到的,ERX-Service-Activate 只有一個零標記屬性。
但 radiusd -X 顯示了另一個輸出:
authorize - 'reply:ERX-Service-Activate:1' = 'srs-local-ipoe'
authorize - 'reply:ERX-Service-Activate:2' = 'srs-localnet-ipoe(110000)'
authorize - 'reply:ERX-Service-Activate:3' = 'srs-foreignnet-ipoe(110000,110000)'
authorize - 'config:Auth-Type' = 'Accept'
authorize - 'config:Cleartext-Password' = 'testing123'
如何取得所有 ERX-Service-Activate 標記屬性。
Python構造回覆:
reply = (('Framed-IP-Address', str(client.ipv4)),
('ERX-Service-Activate:1', 'srs-local-ipoe'),
('ERX-Service-Activate:2',
'srs-localnet-ipoe(%s)' % str(client.s_localnet)),
('ERX-Service-Activate:3',
'srs-foreign-ipoe(%s,%s)' % (str(client.s_foreign),
str(client.s_localnet))),)
Wireshark 中的 PS Reply 也只有一個 ERX-Service-Activate 屬性。
答案1
freeradius 版本 3.0.17 中修復的問題
另外回覆應該稍微修改一下:
reply = (('Framed-IP-Address', str(client.ipv4)), ('ERX-Service-Activate:1', 'srs-local-ipoe'), ('ERX-Service-Activate:2', '+=', 'srs-localnet-ipoe(%s)' % str(client.s_localnet)), ('ERX-Service-Activate:3', '+=', 'srs-foreign-ipoe(%s,%s)' % (str(client.s_foreign), str(client.s_localnet))),)