[EXT] Integration GO language into Freeradius

Arran Cudbard-Bell a.cudbardb at freeradius.org
Mon Mar 21 21:49:03 UTC 2022



> On Mar 21, 2022, at 1:09 PM, Martin Gignac <martin.gignac at gmail.com> wrote:
> 
>> As I can see there is no possibility to process/manipulate the whole
>> REQUEST ( in case the rlm_perl module is RLM_REQUEST ) attributes ( because
>> the module sends only a limited attribute set via uri ).
>> And I assume the rest module won't send any attribute CONFIG ( in case the
>> rlm_perl mode is RLM_CONFIG ).
>> Therefore this module I can use only for basic authentication, not for
>> complex business logic.
> 
> You can modify the default rlm_rest config file
> (https://github.com/FreeRADIUS/freeradius-server/blob/master/raddb/mods-available/rest)
> to use the POST method at the authenticate step to get attributes from
> the RADIUS request:
> 
>    authenticate {
>            uri =
> "${..connect_uri}/user/%{User-Name}/mac/%{Called-Station-ID}?action=authenticate"
>            method = 'post'
>            body = 'post'
>            tls = ${..tls}
>    }
> 
> Using Gin, you can extract the attributes of interest for later use in logic:
> 
>    r.POST("/user/:username/mac/*calledStationID?action=authenticate",
> func(c *gin.Context) {
>        // Extract all of the expected data that FreeRADIUS sends
>        username := c.PostForm("User-Name")
>        password := c.PostForm("User-Password")
>        callingStationID := c.PostForm("Calling-Station-Id")
>        calledStationID := c.PostForm("Called-Station-Id")
>        nasPortType := c.PostForm("NAS-Port-Type")
>        nasPort := c.PostForm("NAS-Port")
>        nasPortID := c.PostForm("NAS-Port-Id")
>        nasIPAddress := c.PostForm("NAS-IP-Address")
>        nasIdentifier := c.PostForm("NAS-Identifier")
> -

Note sure what the issue here is with Go... You can already write FreeRADIUS modules in Go
you just export the same symbols as one of the C modules.  There's a Stack Overflow post
https://stackoverflow.com/questions/32215509/using-go-code-in-an-existing-c-project
here.

-Arran

Arran Cudbard-Bell <a.cudbardb at freeradius.org>
FreeRADIUS Development Team

FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20220321/caa9c406/attachment-0001.sig>


More information about the Freeradius-Users mailing list