Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add freeradius vendor specific dictionary #88

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

stamp
Copy link

@stamp stamp commented Dec 2, 2020

FreeRADIUS has this builtin feature where you are able to query some statistics from the server. I added the FreeRADIUS vendor dictionary to be able to both read and write those attributes.

There are a already existing monitoring tools that support the FreeRADIUS statistics query. I wanted to be able to re-use those very tools instead of building something custom of my own.

Here are an example of a test query using radclient that is a part of the FreeRADIUS toolbox.

echo "Message-Authenticator = 0x00, FreeRADIUS-Statistics-Type = 1, Response-Packet-Type = Access-Accept" | radclient -x localhost:18121 status secret
Sent Status-Server Id 32 from 0.0.0.0:36075 to 127.0.0.1:18121 length 50
	Message-Authenticator = 0x00
	FreeRADIUS-Statistics-Type = Authentication
	Response-Packet-Type = Access-Accept
Received Access-Accept Id 32 from 127.0.0.1:18121 to 0.0.0.0:0 length 140
	FreeRADIUS-Total-Access-Requests = 123
	FreeRADIUS-Total-Access-Accepts = 321
	FreeRADIUS-Total-Access-Rejects = 321
	FreeRADIUS-Total-Access-Challenges = 321
	FreeRADIUS-Total-Auth-Responses = 321
	FreeRADIUS-Total-Auth-Duplicate-Requests = 321
	FreeRADIUS-Total-Auth-Malformed-Requests = 321
	FreeRADIUS-Total-Auth-Invalid-Requests = 321
	FreeRADIUS-Total-Auth-Dropped-Requests = 321
	FreeRADIUS-Total-Auth-Unknown-Types = 321

And some source code for my test query:

          switch freeradius.StatisticsType_Get(r.Packet) {
          case freeradius.StatisticsType_Value_Authentication:
              resp = r.Response(radius.CodeAccessAccept)
              freeradius.TotalAccessRequests_Add(resp, 123)
              freeradius.TotalAccessAccepts_Add(resp, 321)
              freeradius.TotalAccessRejects_Add(resp, 321)
              freeradius.TotalAccessChallenges_Add(resp, 321)
              freeradius.TotalAuthResponses_Add(resp, 321)
              freeradius.TotalAuthDuplicateRequests_Add(resp, 321)
              freeradius.TotalAuthMalformedRequests_Add(resp, 321)
              freeradius.TotalAuthInvalidRequests_Add(resp, 321)
              freeradius.TotalAuthDroppedRequests_Add(resp, 321)
              freeradius.TotalAuthUnknownTypes_Add(resp, 321)
          default:
              resp = r.Response(radius.CodeAccessReject)
          }

I was not able to generate code for the FreeRADIUS v4 version of the statistics attributes. They have the type TLV and the generator fails at dictionarygen/generator.go:193. I'm to much of a novice on the radius mechanics so I commented out the V4 part in the dictionary file for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant