Remove double quotes from variable
We are calling %{Module-Failure-Message} in linelog and trying to create JSON logs. But we are getting sometime error with double quotes, which is creating issue on JSON spec. For example, In linelog messages we have below entry Access-Reject = "{\"Datetime\":\"%t\",\ \"Packet-Type\":\"%{reply:Packet-Type}\",\ \"User-Name\":\"%{User-Name}\",\ \"Module-Failure-Message\":\"%{Module-Failure-Message}\"\ }" We are getting the logs as {"Datetime":"Fri Oct 26 09:07:17 2018","Packet-Type":"Access-Reject","User-Name":"CONSUMER4.TATA","Module-Failure-Message":"pap: Cleartext password "WRONG-PASSWORD" does not match "known good" password"} In the Module-Failure-Message output we are receiving the message with double quotes which is not as per JSON standard. Please let me know how I can solve the issue without doing any coding. Regards, Raghu.
On Fri, 2018-10-26 at 15:41 +0530, Raghu nathan wrote:
Access-Reject = "{\"Datetime\":\"%t\",\ \"Packet-Type\":\"%{reply:Packet-Type}\",\ \"User-Name\":\"%{User-Name}\",\ \"Module-Failure-Message\":\"%{Module-Failure-Message}\"\ }" ... In the Module-Failure-Message output we are receiving the message with double quotes which is not as per JSON standard. Please let me know how I can solve the issue without doing any coding.
Use the jsonquote xlat on any untrusted data that comes in the request (e.g. User-Name as well, as that can be controlled by the connecting device). ..., \"Module-Failure-Message\":\"%{jsonquote:%{Module-Failure-Message}}\", ... -- Matthew
Thanks Matthew, We are using centos 7 and freeRADIUS 3.0.13 Now we are missing "/usr/lib64/freeradius/rlm_rest.so" , I have installed using stable release. Please let us know how we can install this library? Error: /etc/raddb/mods-enabled/rest[1]: Failed to link to module 'rlm_rest': /usr/lib64/freeradius/rlm_rest.so: cannot open shared object file: No such file or directory
..., \"Module-Failure-Message\":\"%{jsonquote:%{Module-Failure-Message}}\", ...
-- Matthew
On Fri, Oct 26, 2018 at 3:41 PM Raghu nathan <raghu.vdm@gmail.com> wrote:
We are calling %{Module-Failure-Message} in linelog and trying to create JSON logs.
But we are getting sometime error with double quotes, which is creating issue on JSON spec.
For example, In linelog messages we have below entry
Access-Reject = "{\"Datetime\":\"%t\",\ \"Packet-Type\":\"%{reply:Packet-Type}\",\ \"User-Name\":\"%{User-Name}\",\ \"Module-Failure-Message\":\"%{Module-Failure-Message}\"\ }" We are getting the logs as
{"Datetime":"Fri Oct 26 09:07:17 2018","Packet-Type":"Access-Reject","User-Name":"CONSUMER4.TATA","Module-Failure-Message":"pap: Cleartext password "WRONG-PASSWORD" does not match "known good" password"}
In the Module-Failure-Message output we are receiving the message with double quotes which is not as per JSON standard. Please let me know how I can solve the issue without doing any coding.
Regards, Raghu.
On 29-10-18 05:52, Raghu nathan wrote:
Thanks Matthew,
We are using centos 7 and freeRADIUS 3.0.13
Now we are missing "/usr/lib64/freeradius/rlm_rest.so" , I have installed using stable release. Please let us know how we can install this library?
There probably is a freeradius-rest-package you need to install. -- Herwin Weststrate
participants (3)
-
Herwin Weststrate -
Matthew Newton -
Raghu nathan