Freeraadius stale sessions (no SQL scenario)

Roman romeo.r at
Thu Nov 3 12:18:50 CET 2016


Sometimes I do some networking downtimes and during these periods I'm
getting pretty much stale sessions in radwho output. I understand why it
happens, but all I want to do is to clear them automatically, when user
logs in.

So what I've done is added this line:

   *exec("/usr/bin/radzap", "-u", $ARGV[3], "", "secret");*

to this part of checkrad code for mikrotik sub.

  #lets return something
  if ($username_seen > 0) {
    return 1;
  } else {
    exec("/usr/bin/radzap", "-u", $ARGV[3], "", "secret");
    return 0;

If I understand it right, this code works like:
if there is a username logged in on NAS, then we return 1, which means
error, I guess?
if there are none, we return 0, which is OK I guess? So I just want to
clear (if there any) the stale session for user, if he's not logged in on
NAS, but for some reason has stale session on freeradius server (visible in

But.. nothing happens. If I execute the command from the shell, it works..
So as I'm not a programmer, I think, that I must be added this line to the
wrong place of radcheck script. Any help?

Best regards,

More information about the Freeradius-Users mailing list