[EXT] Integration GO language into Freeradius

Martin Gignac martin.gignac at gmail.com
Mon Mar 21 17:09:50 UTC 2022


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


More information about the Freeradius-Users mailing list