pyrad icon indicating copy to clipboard operation
pyrad copied to clipboard

server Unreachable

Open FahadNaim opened this issue 5 years ago • 3 comments

Hi dears, I am doing my project for authentications. I do implement two python scripts for pyrad RADIUS Server and Clints. Both are run, the message sent from the client, however it's do not reach the server, where i run the wireshark which show me the ICMP (port unreachable, UDP RADIUS 1812). Can any one help me please. Thanks in advance.

FahadNaim avatar Jan 31 '20 23:01 FahadNaim

Maybe you bound the server to wrong address?

GIC-de avatar Feb 05 '20 23:02 GIC-de

Thank You Mr. GIC-de Note: I do run the code in Ubuntu installed at VirtualBox. I have used several available blogs on the internet, one of them was this: Example

Here is an example of doing an authentication request:

import pyrad.packet from pyrad.client import Client from pyrad.dictionary import Dictionary

srv=Client(server="radius.my.domain", secret="s3cr3t", dict=Dictionary("dicts/dictionary", "dictionary.acc"))

req=srv.CreateAuthPacket(code=pyrad.packet.AccessRequest, User_Name="wichert", NAS_Identifier="localhost") req["User-Password"]=req.PwCrypt("password")

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])

And an example for a trivial RADIUS server:

from pyrad import dictionary, packet, server

class FakeServer(server.Server): def _HandleAuthPacket(self, fd, pkt): server.Server._HandleAuthPacket(self, fd, pkt)

      reply=self.CreateReplyPacket(pkt)
      reply.code=packet.AccessAccept
      self.SendReplyPacket(fd, reply)

srv=FakeServer(dict=dictionary.Dictionary("dictionary")) srv.hosts["127.0.0.1"]=server.RemoteHost("127.0.0.1", "s3cr3t", "localhost") srv.BindToAddress("") srv.Run()

from: https://mail.python.org/pipermail/python-announce-list/2004-August/003328.html however, all are the same problem.

FahadNaim avatar Feb 08 '20 13:02 FahadNaim

I have also encountered this. Unless I'm missing something, leaving an empty string to indicate listening on all interfaces is currently broken. Specify an interface in your call to BindToAddress for now.

mbish avatar Feb 27 '20 17:02 mbish