Linelog fails when attribute does not exist

classic Classic list List threaded Threaded
6 messages Options
| Threaded
Open this post in threaded view
|

Linelog fails when attribute does not exist

R3DNano
I'm tryin to implement linelog so I can send information to a remote syslog
server.
It seems to work perfectly unless I try to send an attribute that is not
defined or used at the time.
For this reason, the linelog module fails to send any data.
Is there any way to make it default to something else like an empty value
so it does not crash instead?
Regards
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
| Threaded
Open this post in threaded view
|

Re: Linelog fails when attribute does not exist

Jorge Pereira-2
Please, https://wiki.freeradius.org/guide/radiusd-X <https://wiki.freeradius.org/guide/radiusd-X>

> On 29 Jul 2019, at 15:17, R3DNano <[hidden email]> wrote:
>
> I'm tryin to implement linelog so I can send information to a remote syslog
> server.
> It seems to work perfectly unless I try to send an attribute that is not
> defined or used at the time.
> For this reason, the linelog module fails to send any data.
> Is there any way to make it default to something else like an empty value
> so it does not crash instead?
> Regards
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
| Threaded
Open this post in threaded view
|

Re: Linelog fails when attribute does not exist

Alan DeKok-2
In reply to this post by R3DNano
On Jul 29, 2019, at 2:17 PM, R3DNano <[hidden email]> wrote:
>
> I'm tryin to implement linelog so I can send information to a remote syslog
> server.
> It seems to work perfectly unless I try to send an attribute that is not
> defined or used at the time.
> For this reason, the linelog module fails to send any data.
> Is there any way to make it default to something else like an empty value
> so it does not crash instead?

  It shouldn't *crash*.  It should just fail.

  See "man unlang".  You can use optional expansions:

        %{%{User-Name}:-?}

  Will expand to %{User-Name} if it exists, otherwise to "?"

  Alan DeKok.


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
| Threaded
Open this post in threaded view
|

Re: Linelog fails when attribute does not exist

R3DNano
 Sorry,  yeah, I meant fail, not crash: you're right.

I completely forgot I could default to anything else.

Thanks fort the reply!!

On Mon, Jul 29, 2019 at 8:28 PM Alan DeKok <[hidden email]>
wrote:

> On Jul 29, 2019, at 2:17 PM, R3DNano <[hidden email]> wrote:
> >
> > I'm tryin to implement linelog so I can send information to a remote
> syslog
> > server.
> > It seems to work perfectly unless I try to send an attribute that is not
> > defined or used at the time.
> > For this reason, the linelog module fails to send any data.
> > Is there any way to make it default to something else like an empty value
> > so it does not crash instead?
>
>   It shouldn't *crash*.  It should just fail.
>
>   See "man unlang".  You can use optional expansions:
>
>         %{%{User-Name}:-?}
>
>   Will expand to %{User-Name} if it exists, otherwise to "?"
>
>   Alan DeKok.
>
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
| Threaded
Open this post in threaded view
|

Re: Linelog fails when attribute does not exist

R3DNano
Hi!
What can I do when I have a bunch of attributes on a linelog module and
some of them are not on the standard dictionaries?
Is there a way to default to something and avoid freeradius to crash (well,
it's just the module what crashes)

Let me explain: Previously, I asked how can I default to a value in case an
attribute was empty: That part is fixed.
Now, I have a bunch (like 50 or 60) attributes on a linelog and some of
them are not on the standard dictionaries (Those values have been handed
down to me, so I have no easy way of finding out which device could they
correspond to)
Of course, because some of those values are unknown to freeradius, the
module crashes and it's reject time!
The log does not specify which specific attribute is the offending one,
since they are all concatenated with a comma on this fashion:
"%{%{User-Name}:-},%{%{NAS-IP-Address}:-},%{%{NAS-Port}:-},....."

Appart from finding out which is the correct dictionary and importing it to
my setup, is there a magic way to say to freeradius "no, if you don't know
what this attribute is, show nothing, but don't crash"
Knowing which attribute is failing would be superb.

Thanks!


On Mon, Jul 29, 2019 at 9:03 PM R3DNano <[hidden email]> wrote:

> Sorry,  yeah, I meant fail, not crash: you're right.
>
> I completely forgot I could default to anything else.
>
> Thanks fort the reply!!
>
> On Mon, Jul 29, 2019 at 8:28 PM Alan DeKok <[hidden email]>
> wrote:
>
>> On Jul 29, 2019, at 2:17 PM, R3DNano <[hidden email]> wrote:
>> >
>> > I'm tryin to implement linelog so I can send information to a remote
>> syslog
>> > server.
>> > It seems to work perfectly unless I try to send an attribute that is not
>> > defined or used at the time.
>> > For this reason, the linelog module fails to send any data.
>> > Is there any way to make it default to something else like an empty
>> value
>> > so it does not crash instead?
>>
>>   It shouldn't *crash*.  It should just fail.
>>
>>   See "man unlang".  You can use optional expansions:
>>
>>         %{%{User-Name}:-?}
>>
>>   Will expand to %{User-Name} if it exists, otherwise to "?"
>>
>>   Alan DeKok.
>>
>>
>> -
>> List info/subscribe/unsubscribe? See
>> http://www.freeradius.org/list/users.html
>
>
-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
| Threaded
Open this post in threaded view
|

Re: Linelog fails when attribute does not exist

Alan DeKok-2
On Aug 6, 2019, at 7:23 AM, R3DNano <[hidden email]> wrote:
> What can I do when I have a bunch of attributes on a linelog module and
> some of them are not on the standard dictionaries?

  Add them to the dictionaries.

> Is there a way to default to something and avoid freeradius to crash (well,
> it's just the module what crashes)

  As I said before, it doesn't "crash".  Stop using the wrong word to describe a problem.

> Let me explain: Previously, I asked how can I default to a value in case an
> attribute was empty: That part is fixed.
> Now, I have a bunch (like 50 or 60) attributes on a linelog and some of
> them are not on the standard dictionaries (Those values have been handed
> down to me, so I have no easy way of finding out which device could they
> correspond to)
> Of course, because some of those values are unknown to freeradius, the
> module crashes and it's reject time!
> The log does not specify which specific attribute is the offending one,
> since they are all concatenated with a comma on this fashion:
> "%{%{User-Name}:-},%{%{NAS-IP-Address}:-},%{%{NAS-Port}:-},....."
>
> Appart from finding out which is the correct dictionary and importing it to
> my setup, is there a magic way to say to freeradius "no, if you don't know
> what this attribute is, show nothing, but don't crash"
> Knowing which attribute is failing would be superb.

  Edit the configuration so that it only contains attributes that are in the dictionaries.

  This isn't difficult.   If you add random garbage to the configuration, it won't work.  The solution is NOT to have the server "work around" the garbage.  The solution is to not put garbage into the configuration.

  Alan DeKok.


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html