hi, configure postauth_query in dialup.conf, postauth_query="UPDATE POSTREPLY SET REPLYMESSAGE='%{reply:Reply-Message}' WHERE USERNAME='%{SQL-User-Name}' " than , you can query the message from DB SERVER. BTW: if reject user, then ... # # Access-Reject packets are sent through the REJECT sub-section of the # post-auth section. # # Post-Auth-Type REJECT { %{sql:UPDATE POSTREPLY SET REPLYMESSAGE='%{reply:Reply-Message}' WHERE USERNAME='%{SQL-User-Name}' } }
Message: 1 Date: Sat, 16 Jan 2010 20:55:45 -0000 From: "Neville" <nev@itsnev.co.uk> Subject: Reply-Message To: <freeradius-users@lists.freeradius.org> Message-ID: <1C54F0ABDAFE4EF7B9F3F9D4EC3EFBAC@NevPC> Content-Type: text/plain; charset="iso-8859-1"
Hi,
Is there any way to get the reply message loaded into a SQL TABLE, which a user can then query on to see the last reply based on there username?
Thx Nev
Thanks, this works a treat and its just what I needed. Is there anyway to strip the "\r\n" at the start and end of the Reply-Message before writing the TABLE, as it ends up in the tables as:- "=0D=0AYou are already logged in - access denied=0D=0A=0A" Thx Nev
hi, configure postauth_query in dialup.conf,
postauth_query="UPDATE POSTREPLY SET REPLYMESSAGE='%{reply:Reply-Message}' WHERE USERNAME='%{SQL-User-Name}' "
than , you can query the message from DB SERVER.
BTW: if reject user, then ...
# # Access-Reject packets are sent through the REJECT sub-section of the # post-auth section. # # Post-Auth-Type REJECT { %{sql:UPDATE POSTREPLY SET REPLYMESSAGE='%{reply:Reply-Message}' WHERE USERNAME='%{SQL-User-Name}' } }
Message: 1 Date: Sat, 16 Jan 2010 20:55:45 -0000 From: "Neville" <nev@itsnev.co.uk> Subject: Reply-Message To: <freeradius-users@lists.freeradius.org> Message-ID: <1C54F0ABDAFE4EF7B9F3F9D4EC3EFBAC@NevPC> Content-Type: text/plain; charset="iso-8859-1"
Hi,
Is there any way to get the reply message loaded into a SQL TABLE, which a user can then query on to see the last reply based on there username?
Thx Nev
Neville, my postauth_query is: postauth_query = "INSERT INTO ${postauth_table} (username, reply, accttime, message) VALUES ('%{SQL-User-Name}', '%{reply:Packet-Type}', TO_DATE(' %S','yyyy-mm-dd hh24:mi:ss'), '%{%{Module-Failure-Message}:-%{%{reply:Reply-Message}:-Your generic message}}')" ----> Adjust accttime for MySQL with this you can catch the error message of the module that reject the user, then the reply message and as last chance a generic message. you can swap %{Module-Failure-Message} with %{reply:Reply-Message} if your reply message is more important to strip "\r\n" in modules/attr_rewrite I added: attr_rewrite sanereplymessage { attribute = Reply-Message # may be "packet", "reply", "proxy", "proxy_reply" or "config" searchin = reply searchfor = "\n|\r" replacewith = "" ignore_case = no new_attribute = no max_matches = 10 ## If set to yes then the replace string will be ## appended to the original string append = no } and in sites-enables/default Post-Auth-Type REJECT { .. sanereplymessage sql .. } Andrea Neville ha scritto:
Thanks, this works a treat and its just what I needed.
Is there anyway to strip the "\r\n" at the start and end of the Reply-Message before writing the TABLE, as it ends up in the tables as:-
"=0D=0AYou are already logged in - access denied=0D=0A=0A"
Thx Nev
hi, configure postauth_query in dialup.conf,
postauth_query="UPDATE POSTREPLY SET REPLYMESSAGE='%{reply:Reply-Message}' WHERE USERNAME='%{SQL-User-Name}' "
than , you can query the message from DB SERVER.
BTW: if reject user, then ...
# # Access-Reject packets are sent through the REJECT sub-section of the # post-auth section. # # Post-Auth-Type REJECT { %{sql:UPDATE POSTREPLY SET REPLYMESSAGE='%{reply:Reply-Message}' WHERE USERNAME='%{SQL-User-Name}' } }
Message: 1 Date: Sat, 16 Jan 2010 20:55:45 -0000 From: "Neville" <nev@itsnev.co.uk> Subject: Reply-Message To: <freeradius-users@lists.freeradius.org> Message-ID: <1C54F0ABDAFE4EF7B9F3F9D4EC3EFBAC@NevPC> Content-Type: text/plain; charset="iso-8859-1"
Hi,
Is there any way to get the reply message loaded into a SQL TABLE, which a user can then query on to see the last reply based on there username?
Thx Nev
Neville,您好! so, security reasons. 8-( 1,modify the " sql_escape_func(char *out, size_t outlen, const char *in)" in rlm_sql.c, but there is bad idea. 2, expand rlm_sql and db driver,support parameter binding , and skip convert parameter. ======= 2010-01-18 您在来信中写道:=======
Thanks, this works a treat and its just what I needed.
Is there anyway to strip the "\r\n" at the start and end of the Reply-Message before writing the TABLE, as it ends up in the tables as:-
"=0D=0AYou are already logged in - access denied=0D=0A=0A"
Thx Nev
participants (3)
-
Andrea Gabellini -
Neville -
zhongwei feng