Operating System - HP-UX
1832152 Members
3094 Online
110038 Solutions
New Discussion

reusing disabling mechanism for login

 
mango_1
Frequent Advisor

reusing disabling mechanism for login

hello all! I have created a login program and I would like to find out if it's possible to reuse the login mechanism of the operating system (i.e. its way of logging bad login attempts and disabling a user when a certain number of times has been reached) Is there a command of function call I could use to be able to do this?

thanks for any help. :)

4 REPLIES 4
RAC_1
Honored Contributor

Re: reusing disabling mechanism for login

Don't think this is possible without the use of perl or something similar.

If you convert your system to trusted mode, you can controls things like logindelay between logins, no. of unsuccessful logins and many other things.

In order to use the login mechanism, you would have to interupt it and use your own stuff and log the details. I happened to come across similar posting on itrc where it was suggested to replace passwd and other login related commands with perl scripts that do the chekcing you want and log details.
There is no substitute to HARDWORK
Mark Grant
Honored Contributor

Re: reusing disabling mechanism for login

Be interesting to know what language you used for your login program.

There are no generic authorization functions that "login" uses (that would not be the unix way ;)). However, there are routines for accessing utmp, btmp and wtmp and, if you are using 'C' it is a simple matter to read and write to these files. The functions you need to look at are of the "getutent()" family. They all work on utmp like files so will be able to work with the bad login (btmp) file for example.
Never preceed any demonstration with anything more predictive than "watch this"
mango_1
Frequent Advisor

Re: reusing disabling mechanism for login

Hello! thanks for the info. I'm developing the program with C. What it does is authenticate the users logging into the program. The problem is that it doesn't limit the number of login attempts currently and I think this is a security problem since any user can try 100 times or more and maybe get lucky guessing the password.

I'm not sure which is the best way of implementing the solution to this problem. I thought of using the built-in mechanisms of the OS if that is possible since it is able to do so using the login service. Is this the getutent() you were talking about. I'm not that familiar but I think utmp is for accounting purposes and doesn't log in failed login attempts. Can anybody please give me more information?

thanks in advance for any help. :)
Eric Buckner
Regular Advisor

Re: reusing disabling mechanism for login

Look at btmp. It is database for bad login attempts.

You can log your users bad attempts into btmp and then read on each attempt to see if they have had X number of attempts in a set time period.

If you don't have a /var/adm/btmp file, just touch it and it will start logging for you. Look at the manpage though. It cautions you that both btmp and wtmp grow w/o bound. So you may have to have some sort of purge routine every so often.
Time is not a test of the truth.