HTTP headers

Stjepan Roić roic27 at gmail.com
Tue Nov 30 16:32:51 CET 2021


There is no debug because the server isn't starting (copy pasting random
string to config causes syntax error which I assumed you knew).

Believe it or not I have read the documentation, especially
mods-available/rest and can't understand the syntax for this. It says:

Additional HTTP headers may be specified with control:REST-HTTP-Header.
        #  The values of those attributes should be in the format:
        #    <attribute>: <value>

So I tried this:

        control:REST-HTTP-Header :+secret:
1f215f4a27653bd17ddc54e320a1c61e37949fe5
        control:REST-HTTP-Header :+uuid:
84ce0574-5074-4b53-9ddc-fcb2c935a1b1
        control:REST-HTTP-Header :+Content-Type: application/json

Debug error:
 /etc/freeradius/3.0/mods-enabled/rest[160]: Expecting section start brace
 '{' after "control:REST-HTTP-Header :+secret:"

Than this:
         control:REST-HTTP-Header :+"secret:
1f215f4a27653bd17ddc54e320a1c61e37949fe5"
         control:REST-HTTP-Header :+"uuid:
84ce0574-5074-4b53-9ddc-fcb2c935a1b1"
         control:REST-HTTP-Header :+"Content-Type: application/json"
Debug error:
 /etc/freeradius/3.0/mods-enabled/rest[160]: Expecting section start brace
'{' after "control:REST-HTTP-Header :+"secret:"

Than this:

         control:REST-HTTP-Header {
        :+secret: 1f215f4a27653bd17ddc54e320a1c61e37949fe5
        :+uuid: 84ce0574-5074-4b53-9ddc-fcb2c935a1b1
        :+Content-Type: application/json
        }

Debug error:
 /etc/freeradius/3.0/mods-enabled/rest[161]: Expecting section start brace
'{' after ":+secret: 1f215f4a27653bd17ddc54e320a1c61e37949fe5"

Than this:

         control:REST-HTTP-Header {
        secret: 1f215f4a27653bd17ddc54e320a1c61e37949fe5
        uuid: 84ce0574-5074-4b53-9ddc-fcb2c935a1b1
        Content-Type: application/json
        }

Debug error:
 /etc/freeradius/3.0/mods-enabled/rest[161]: Expecting section start brace
'{' after "secret: 1f215f4a27653bd17ddc54e320a1c61e37949fe5"

Than this:
        control {
         REST-HTTP-Header :+"secret:
1f215f4a27653bd17ddc54e320a1c61e37949fe5"
         REST-HTTP-Header :+"uuid: 84ce0574-5074-4b53-9ddc-fcb2c935a1b1"
         REST-HTTP-Header :+"Content-Type: application/json"
        }

 /etc/freeradius/3.0/mods-enabled/rest[161]: Expecting section start brace
'{' after "REST-HTTP-Header :+"secret:"

And only thing I can find in unlang docs is similar to what I sent in a
previous email.

So can you provide some examples how it's used or at least a link to the
docs where it's shown?


On Tue, 30 Nov 2021 at 14:55, Alan DeKok <aland at deployingradius.com> wrote:

> On Nov 30, 2021, at 8:13 AM, Stjepan Roić <roic27 at gmail.com> wrote:
> > I'm trying to set up EAP-TTLS wifi auth to REST API endpoint. I started
> > with basic config and have local auth working but stuck on getting
> > Access-Accept from the API. I have set up rest module but struggling to
> > insert HTTP headers into the request. Can't find it in the docs and only
> > previous topic I found is this one:
> >
> >
> http://lists.freeradius.org/pipermail/freeradius-users/2020-July/098472.html
>
>   Which suggests that you read mods-available/rest.  Which has all of the
> information you need.
>
> > where you suggested how to insert headers in post auth methods. I tried
> the
> > same in my authenticate just before "rest" but this doesn't work.
>
>   I have no idea what that means.  Saying "it doesn't work" is pretty much
> content-free.
>
>   If only there was some kind of debug output... or endless pages of
> documentation telling people to use the debug output.  Or messages every
> day on this mailing list asking people to post the debug output.
>
> >        update control {
> >         &REST-HTTP-Header :="secret:
> > 1f215f4a27653bd17ddc54e320a1c61e37949fe5"
> >         &REST-HTTP-Header :="uuid: 84ce0574-5074-4b53-9ddc-fcb2c935a1b1"
> >         &REST-HTTP-Header :="Content-Type: application/json"
> >        }
> >        rest
>
>   Well, if you want *all* of those to show up, then ":=" is the wrong
> thing to use.  See "man unlang".  The operators are documented.  You want
> to use "+=".
>
> > What is the correct way to insert HTTP header in the request for
> > authentication sent to external REST server and what syntax should be
> used
> > for multiple headers (I just multiplied rows here but not sure it should
> be
> > like that)?
>
>   Read and follow the documentation.  The file mods-available/rest
> documents what headers to add.  The "unlang" documentation describes how to
> add attributes.
>
>   Alan DeKok.
>
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>


More information about the Freeradius-Users mailing list