0
pyrad 라이브러리 pyrad (https://github.com/wichert/pyrad)를 사용하여 간단한 Radius 서버를 만들려고합니다. 그러나 나는 그것에 몇 가지 문제가있었습니다. 내가 서버를 시작하고 연결 한 경우Pyrad에 대한 몇 가지 질문
from __future__ import print_function
from pyrad.client import Client
from pyrad.dictionary import Dictionary
import pyrad.packet
srv = Client(server="192.168.3.183", secret=b"Kah3choteereethiejeimaeziecumi",
dict=Dictionary("dictionary/dictionary"))
# create request
req = srv.CreateAuthPacket(code=pyrad.packet.AccessRequest, User_Name="test",
NAS_IP_Address="192.168.2.101")
req["User-Password"] = req.PwCrypt("password")
# send request
reply = srv.SendPacket(req)
if reply.code == pyrad.packet.AccessAccept:
print("access accepted")
else:
print("access denied")
print("Attributes returned by server:")
for i in reply.keys():
print("%s: %s" % (i, reply[i]))
:
from pyrad import dictionary, packet, server
class FakeServer(server.Server):
def _HandleAuthPacket(self, pkt):
server.Server._HandleAuthPacket(self, pkt)
print('Received an authentication request')
print("Attributes: ")
for attr in pkt.keys():
print("%s: %s" % (attr, pkt[attr]))
# print
username = pkt['User-Name'][0]
password = pkt['User-Password'][0]
password = pkt.PwDecrypt(password)
device_ip = pkt['NAS-IP-Address'][0]
reply = self.CreateReplyPacket(pkt)
# Default to refuse
reply.code = packet.AccessReject
reply['Reply-Message'] = 'You are unable to login'
return self.SendReplyPacket(pkt.fd, reply)
def _HandleAcctPacket(self, pkt):
server.Server._HandleAcctPacket(self, pkt)
print("Received an accounting request")
print("Attributes: ")
for attr in pkt.keys():
print("%s: %s" % (attr, pkt[attr]))
# print
reply = self.CreateReplyPacket(pkt)
self.SendReplyPacket(pkt.fd, reply)
if __name__ == '__main':
srv = FakeServer(dict=dictionary.Dictionary("dictionary/dictionary"))
srv.hosts["192.168.3.183"] = server.RemoteHost("192.168.3.183",
b"Kah3choteereethiejeimaeziecumi",
"192.168.3.183")
srv.BindToAddress("")
print('Radius server is ready to start!')
srv.Run()
이 내가 서버를 연결하기 위해 사용하고있는 코드는 다음과 같습니다
이
내가 Radius 서버를 만드는 데 사용하고있는 코드입니다 현지에서, 그것은 일이다! 나는 다른 PC에서 연결하는 경우 the screenshot, 그것은 시간이 초과되고 pyrad.log이를 보여줍니다 나는 그물에 오랜 시간 동안 검색하고
Dropping packet: Received packet from unknown host
. 그러나 사용하지 마십시오. 이를 달성하는 방법을 알려주십시오.