0

I'm upgrading from FreeRadius 2 to FreeRadius 3 and changing some integration point from sql to rest module.

Actually, I have two accounting points: accounting_start_query and accounting_start_query, which are calls to procedures.

Now, I need to configure accounting in rlm_rest module FreeRadius.

This code didn't mention the start/stop operations. Should I implement both ?

Can someone help me ?

1 Answers1

1

rlm_rest is designed to be a transport for AVPs it doesn't really implement session management logic in the same way as rlm_sql.

When rlm_sql gets an interim it hasn't seen a start for it'll automatically create a record for that session.

With rlm_rest all that logic is up to the rest API you're calling. All rlm_rest will do is serialize the attributes that FreeRADIUS received in the Access-request and send them to an API endpoint.

It's up to you whether you use different endpoints for start/interim/stop packets. If you do want to, you can use the expansion %{Acct-Status-Type} in the URL string to get what type of packet it was.

At a high level RADIUS accounting doesn't really map to RESTfull design perfectly. You don't know whether you need to PUT or POST requests, because you don't know whether you're creating an object or updating a pre-existing one.

The most robust design would be one that used a single endpoint with %{Acct-Unique-Session-ID} as the object identifier, accepted PUT or POST methods interchangeably, and did the REST equivalent of "upserts", ignoring requests where Event-Timestamp is older than the last received Event-Timestamp.

Arran Cudbard-Bell
  • 1,514
  • 1
  • 9
  • 18
  • I didn't get how accept both methods as you suggested, because I configure in the module the (only) http method to be dispatched. I think PUT is the best choice in this case. – Paulo Ricardo May 05 '17 at 12:40
  • Accepting both HTTP methods would be something specific to the REST framework you're using. – Arran Cudbard-Bell May 05 '17 at 17:25