VMware

This Question is Possibly Answered

1 "correct" answer available (10 pts) 1 "helpful" answer available (6 pts)
9 Replies Last post: Jun 4, 2009 7:47 AM by BacMan  

How to enable last failed login message during logon? posted: Dec 10, 2007 4:28 AM

Click to view Erwin Zoer's profile Novice 15 posts since
Dec 6, 2004
Hello,

For a project I am working on, one of the requirements is to log the previous succesful and unsuccesful logon sothat users have a means to verify that their account has not been misused. The desired result would show something like this after logging on:

Last login: Mon Dec 10 12:56:13 2007 from mymachine.cust.com
Last failed login: Mon Dec 10 12:20:28 2007 from 193.12.23.8

The product used during the project is VMware ESX server 3.02 with update patch 1. Enabling the previous succesful logon has been fairly simple by specifying the following option in /etc/login.defs:

LASTLOG_ENAB yes

After reading various (man) pages on the subject, I added the following lines to /etc/login.defs to enable displaying the previous failed login information:

FAILLOG_ENAB yes
LOG_UNKFAIL_ENAB yes

However, this did not yield the desired result.

Thinking that this information must be coming from somewhere, I researched various possibilities and found that one of the following sources would probably be used:

  • /var/log/btmp
  • /var/log/faillog

I setup /var/log/btmp by touch-ing it. This did not yield the desired result. The file remained empty and no bad login information was displayed at logon time. After that, I modified /etc/pam.d/system-auth and added the following lines to enable logging to /var/log/faillog:

account required /lib/security/$ISA/pam_tally.so deny=3 no_magic_root
auth required /lib/security/$ISA/pam_tally.so no_magic_root

Although, faillog now functioned correctly, the bad login information still was not displayed at login time. For example:

root@esxhost etc# faillog -u useraccount
Username Failures Maximum Latest
useraccount 1 0 Mon Dec 10 14:24:22 +0100 2007 on mymachine.cust.com

At this point I am clueless how to resolve this issue and would appreciate some suggestions.

Best regards,

Erwin

Click to view Texiwill's profile Guru 10,205 posts since
Jan 13, 2004
Hello,

To get the information you require you will have to do some scripting around faillog so that it reports the proper information. YOu could do something like:

$fai = `faillog -u $USERNAME`
$foo=`last|grep $USERNAME|tail -1`

You would then format the strings as appropriate... $fai holds the last failed attempt and $foo holds the last login.... Faillog itself will not display what you want. the -u $USERNAME outputs the last failed login while the last displays the last login for the user. You will need to use both faillog and last to get the appropriate information and then format it appropriately.

Be aware that the wtmp file gets rotated monthly so the on the cusp logins will be ignored, you can not find the last login if there is a month boundary. Also, this is in reality more a Linux question than a ESX question and you should refer to the redhat documentation/forums for more information.

Best regards,
Edward L. Haletky, author of the forthcoming 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', publishing January 2008, (c) 2008 Pearson Education. Available on Rough Cuts at http://safari.informit.com/9780132302074
Click to view Texiwill's profile Guru 10,205 posts since
Jan 13, 2004
Hello,

VMware provided this interface and, according to it's own sources, customized it heavily in order to make it more robust and secure than a default installation of Linux. This customization may be at the heart of the problem as it should be possible to have the last failed login displayed by just setting ...

Actually, they did not modify the Service Console RPMs very much, they just chose those that are within RedHat RHEL3 U6, which I would imagine also suffers from this without first patching the environment. The provided more commands and a better firewall script and some changes to the RHEL kernel, but all the other packages are the same, just less of them.

You have four possibilities: Upgrade to a version of OpenSSH that has the patch, use a script to work around the issue, open a request for enhancement with VMware, or try ESX v3.5. I would open a case with VMware and still upgrade OpenSSH. Tomorrow or thursday, I will upgrade to ESX v3.5 and let you know the result, perhaps there is a new version of OpenSSH.

Best regards,
Edward L. Haletky, author of the forthcoming 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', publishing January 2008, (c) 2008 Pearson Education. Available on Rough Cuts at http://safari.informit.com/9780132302074
Click to view Texiwill's profile Guru 10,205 posts since
Jan 13, 2004
Hello,

The version of OpenSSH for ESX is still v3.6. Granted it is a VMware RPM most likely to add in new ciphers, however, they did not include btmp support. The suggestion is to put in a request for enhancement to VMware for them to upgrade to OpenSSH v4.

Best regards,
Edward L. Haletky, author of the forthcoming 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', publishing January 2008, Copyright 2008 Pearson Education. Available on Rough Cuts at http://safari.informit.com/9780132302074
Click to view Tech_carrefour's profile Novice 4 posts since
May 14, 2007
Is the "FAILLOG_ENAB" directive is now supported in ESX3.5 U3?
Click to view Texiwill's profile Guru 10,205 posts since
Jan 13, 2004
Hello,

I have not seen it available. I still think you will need to use a work around.


Best regards,
Edward L. Haletky
VMware Communities User Moderator, VMware vExpert 2009
====
Author of the book 'VMWare ESX Server in the Enterprise: Planning and Securing Virtualization Servers', Copyright 2008 Pearson Education.
Blue Gears and SearchVMware Pro Blogs -- Top Virtualization Security Links -- Virtualization Security Round Table Podcast
Click to view BacMan's profile Hot Shot 210 posts since
Aug 17, 2005

Edward,

I am running ESX 3.5 update 3 and I wonder how do I find out what version of openssh that ESX running? Do you know how?

Note, I used the #openssl version -v and it works for OpenSSL. But, try it for openssh is no go? Thanks.

Cheers,

Click to view Texiwill's profile Guru 10,205 posts since
Jan 13, 2004
Hello,

rpm -q openssh

that should give you the version of the RPM.


Best regards, Edward L. Haletky VMware Communities User Moderator, VMware vExpert 2009
Now Available on Rough-Cuts: 'VMware vSphere(TM) and Virtual Infrastructure Security: Securing ESX and the Virtual Environment'
Also available 'VMWare ESX Server in the Enterprise'
SearchVMware Pro|Blue Gears|Top Virtualization Security Links|Virtualization Security Round Table Podcast
Click to view BacMan's profile Hot Shot 210 posts since
Aug 17, 2005

Thanks much.

Cheers,

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities