How to use sanitize fields for json output
Hi all, I want to use the linelog module to print logs in a machine readable format for my ELK stack, I would like to print them in json. I would like to have user controlled fields (like the username) sanitized, from an old discussion[1] in this mailing list I find out that there is a "jsonquote" xlat expansion available, so I tried to use it but with little success since the module is unknown. (0) linelog: ERROR: %T request [%{jsonquote:request:User-Name}] ....
(0) linelog: ERROR: ^ Unknown module
After a quick search in the wiki[2] I found out that the jsonquote xlat is provided by the rlm_rest module. So I tried to enable it adding in `mods-enabled` a symlink to the configuration file, but then the freeradius server fails to start since the module is not configured (for example it tries to connect to localhost but i have no web services enabled on the VM). Is "jsonquote" the right way to achieve this? If it is, how can I use it without configuring properly (and pointing to a real web server) the rest module? Thank you, Enrico Polesel [1] http://lists.freeradius.org/pipermail/freeradius-users/2017-January/086317.h... [2] https://wiki.freeradius.org/config/Xlat#provided-by-modules_rlm_rest
hi, just comment out the connection part and set the start to 0 in the pool. however, are you sure your server was built with json support? alan
Hi, I'll reply inline. On Sun, Nov 11, 2018 at 2:08 PM Alan Buxey <alan.buxey@gmail.com> wrote:
hi,
just comment out the connection part and set the start to 0 in the pool.
That was also written in the comments, sorry for not seeing that. I did it and now it works. Thank you! Just for completeness (for future readers), the right way to use the xlat is "%{jsonquote:%{request:User-Name}}".
however, are you sure your server was built with json support?
I think so because jsonquote is working, but I should check the build process. I compile myself the deb packages using the instruction of this page: https://wiki.freeradius.org/building/Debian%20and%20Ubuntu Just as a note, it may be useful to move the jsonquote xlat from the rest module to the server core since I think that uses like mine aren't too exotic. Thank you for all, best regards, Enrico Polesel
On 12-11-18 08:35, Enrico Polesel wrote:
however, are you sure your server was built with json support?
I think so because jsonquote is working, but I should check the build process. I compile myself the deb packages using the instruction of this page: https://wiki.freeradius.org/building/Debian%20and%20Ubuntu
Building Debian packages requires you to have all the development libraries available, so this ensures JSON support
Just as a note, it may be useful to move the jsonquote xlat from the rest module to the server core since I think that uses like mine aren't too exotic.
Version 4.0 has (will have) this extracted to a rlm_json. I don't think if would be a very bad idea to backport this to v3.0.x. -- Herwin Weststrate
On Mon, 2018-11-12 at 10:29 +0100, Herwin Weststrate wrote:
On 12-11-18 08:35, Enrico Polesel wrote:
Just as a note, it may be useful to move the jsonquote xlat from the rest module to the server core since I think that uses like mine aren't too exotic.
Version 4.0 has (will have) this extracted to a rlm_json. I don't think if would be a very bad idea to backport this to v3.0.x.
Which may break configs which already use rlm_rest for that xlat, and don't include the new module when they upgrade. It already works in v3 with the right configuration; I don't really see a good reason to change it. -- Matthew
participants (4)
-
Alan Buxey -
Enrico Polesel -
Herwin Weststrate -
Matthew Newton