Ich verwende das rlm_python
Modul in Radius und es erhalten die DHCP-Position option82
von covachilli im Hex- oder Binärformat.python entpacken Pufferdaten
es Fangen als Zeichenfolge als dieser Wert zeigt \001\027\002\025\001+\001\024
, sieht aber den Wert, den Python zeigt abgeschnitten ist, wie die option82
suboptions
in TLVs-type,length,values
codiert enthält, die das Feld bedeutet, beginnt mit Typ 0x01(circuit ID, per RFC 3046)
, gefolgt von einer Byte-Länge.
Irgendeine Idee, wie ich das fangen und die Optionen richtig auspacken kann?
Ich habe die Zeichenfolge mit struct.unpack
ausgepackt aber ist nicht sinnvoll..wie es nicht über die gepackten suboptions
in option82
Feld erzählt.
Python 2.4.3 (#1, May 5 2011, 16:39:10)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from struct import *
>>> unpack('=hhl',"\001\027\002\025\001+\001\024")
(5889, 5378, 335620865)
irgendwelche ideen?
UPDATE:
Coovachilli mit --locationopt82
kompiliert und sendet Position als ein Attribut, so etwas wie dieses ...
rad_recv: Accounting-Request packet from host 10.66.53.49 port 53178, id=101, length=342
ChilliSpot-Version = "1.3.0"
ChilliSpot-Acct-View-Point = ChilliSpot-Client-View-Point
Event-Timestamp = "Apr 18 2013 11:59:16 BST"
User-Name = "3C-D0-F8-4A-05-68"
Acct-Input-Octets = 0
Acct-Output-Octets = 22851
Acct-Input-Gigawords = 0
Acct-Output-Gigawords = 0
Acct-Input-Packets = 0
Acct-Output-Packets = 370
Acct-Session-Time = 5401
ChilliSpot-Session-State = Authorized
Acct-Status-Type = Interim-Update
Acct-Session-Id = "516fbceb00000002"
Framed-IP-Address = 10.75.33.46
NAS-Port-Type = Wireless-802.11
NAS-Port = 2
NAS-Port-Id = "00000002"
Calling-Station-Id = "3C-D0-F8-4A-05-68"
Called-Station-Id = "00-50-56-B7-66-00"
NAS-IP-Address = 10.75.32.7
ChilliSpot-Location = "\001\030\002\026\001+\001\024"
ChilliSpot-Location-Change-Count = 15
NAS-Identifier = "VLAN299-REGENT"
WISPr-Location-ID = "isocc=GR,cc=44,ac=01200,network=mywifi,my_Network_regent"
WISPr-Location-Name = "REGENT"
das Freeradius hat das rlm_python
-Modul, das für die Buchhaltung
def accounting(p):
file = open("/tmp/test.log","a")
username = None
chillilocation = None
output = StringIO.StringIO()
for t in p:
if t[0] == 'User-Name':
username = t[1]
elif t[0] == 'ChilliSpot-Location':
chillilocation = t[1]a
output.write(t[1])
content = output.getvalue()
file.write("I am being called in radius accouting section as %s and location is %s \n" % (username,content))
file.close()
print "---Accounting---"
radiusd.radlog(radiusd.L_INFO, '*** radlog call in accounting (0) ***')
print
print p
return radiusd.RLM_MODULE_OK
Ich habe versucht, die ChilliSpot-Locati zu speichern in string
und stringIO
, entpackt mit struct ohne Erfolg, Es sieht aus wie seine im TLV-Format ...
irgendwelche Ideen, wie man es auszieht?
Wie fangen Sie den Wert als Zeichenfolge mit rlm_python und covachilli? – RedBaron
Ich habe es aktualisiert – krisdigitx
Nicht sicher über die ganze Sache, aber 'ChilliSpot-Location' soll eine menschenlesbare Zeichenfolge sein. Siehe [specs] (http://wiki-robin.meshroot.com/@api/deki/files/220/=dictionary.chillispot) und [ein Beispiel] (http://coova.org/node/4170) (Suchen Sie nach einer Stelle in der Mitte, wo 'RADIUS Access-Request von CoovaChilli' steht. – RedBaron