Menu

#4479 Webmin and Usermin do not properly record logins and logouts in Utmp.

All
closed-fixed
nobody
5
2014-10-01
2014-09-30
No

When using the option "Webmin Configuration->Authentication->Record logins and logouts in Utmp?" logins and logouts are not properly recorded in Utmp. Both Webmin and Usermin are affected. If I login to Webmin or Usermin and then run "who" command in shell, I get something like this:

user1 pts/0 2014-09-30 22:04 (XXX.XXX.XXX.XXX)

Only the shell login is shown, no Webmin/Usermin login. If I look at "/var/run/utmp" in hex editor I can see that there is a record but it is ignored by "who", "w", "users" and similar commands. I've located the problem in "miniserv.pl" at the following line in "sub write_login_utmp" and "sub write_logout_utmp":

'ut_pid' => $main_process_id,

For whatever reason, "$main_process_id" is not initialized (it's empty) at this point. If I hard code some value (proper pid of some running process) like this:

'ut_pid' => 1379,

login is properly recorded in Utmp which can be seen with "who" command:

user1 pts/0 2014-09-30 22:04 (XXX.XXX.XXX.XXX)
user2 usermin 2014-10-01 01:17 (XXX.XXX.XXX.XXX)

With "w" command I can see this:

01:18:33 up 3:24, 3 users, load average: 0.01, 0.07, 0.09
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
user1 pts/0 XXX.XXX.XXX.XXX 22:04 1.00s 29.39s 0.21s sshd: user1 [priv]
user2 usermin XXX.XXX.XXX.XXX 01:17 0.00s 0.00s 0.20s cron

I hardcoded the pid of cron for this example.

The system I'm using is Ubuntu 12.04 and, of course, I have installed the User::Utmp perl module.

Thanks in advance.

Discussion

  • Jamie Cameron

    Jamie Cameron - 2014-10-01

    Thanks for finding this - the PID should really be that of the miniserv.pl process. I will fix this in the next release.

     
  • Jamie Cameron

    Jamie Cameron - 2014-10-01
    • status: open --> closed-fixed
     

Log in to post a comment.