Code Monkey home page Code Monkey logo

Comments (4)

GIC-de avatar GIC-de commented on June 11, 2024

@l2isbad is this issue still open?

It seems that freeRADIUS is expecting an authenticator with all bits set to zero? This can be done as described below:

client = Client(server="localhost", secret=b"adminsecret", dict=Dictionary("/tmp/dictionaries"))
req = client.CreateAuthPacket(code=pyrad.packet.AccessRequest, authenticator=16 * six.b('\x00'))
req["FreeRADIUS-Statistics-Type"] = "Authentication"
reply = client.SendPacket(req)

I have not tested but should work.

In general CreateAuthPacket is the right approach!

from pyrad.

alexs20 avatar alexs20 commented on June 11, 2024

Yes this issue is still open. It creates broken Status-Server request without Message-Authenticator.

from pyrad.

yishiashia avatar yishiashia commented on June 11, 2024

Here is a status-server request example which works for me:

import pyrad.packet
from pyrad.client import Client
from pyrad.dictionary import Dictionary
import six
import hmac
import hashlib

dicts=Dictionary("/tmp/dictionaries")

srv=Client(server='localhost',secret='adminsecret',dict=dicts)

req=srv.CreateAuthPacket(code=pyrad.packet.StatusServer)

# 1. set the default Message-Authenticator as 16-bytes zero.
req["Message-Authenticator"] = 16*six.b("\x00")

# 2. get the raw packet binary
raw_packet = req.RequestPacket()

# 3. calculate the hmac-md5 with shared secret
digest = hmac.new('adminsecret', raw_packet, hashlib.md5)

# 4. write back the Message-Authenticator
req["Message-Authenticator"] = digest.hexdigest().decode('hex')

reply=srv.SendPacket(req)

from pyrad.

GIC-de avatar GIC-de commented on June 11, 2024

This should work with version 2.2 as shown below:

srv = Client(server="127.0.0.1", authport=18121, secret=b"foobar", dict=Dictionary("dictionary"))

req = srv.CreateAuthPacket(code=pyrad.packet.StatusServer)
req["FreeRADIUS-Statistics-Type"] = "All"
req.add_message_authenticator()
reply = srv.SendPacket(req)

from pyrad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.