Earlier in this series, I wrote about creating password policies and using password cracking utilities. (See Establishing Good Password Policies and Cracking Passwords to Enhance Security.) You may recall that it can be challenging to create a password policy that balances ease of use with effectiveness. Also, utilities exist which are capable of cracking even the most hard to guess passwords. In today's article, I'd like to demonstrate an alternative authentication system which is available on your FreeBSD system.
By default, when you login to your FreeBSD system, you are prompted for a password. This is known as a "reusable password" because you can input the same password whenever you login, until you either change the password on your own or are forced to change an expired password. This provides a measure of security: someone who doesn't know your password won't be able to access the resources on your system. However, this security is jeopardized if another user discovers your password.
There is another authentication system known as One Time Passwords (OTP). As the name suggests, you can only use a password once; you aren't allowed to reuse it. An OTP system ensures that a discovered password is useless to the person who discovers it. This can provide a bit more security in a world that contains password crackers, packet sniffers, and keyloggers.
OTP was developed at Bellcore (now Telcordia). Originally, it was a freely available software program known as S/Key. If you're interested, you can read the original paper on S/Key.
Bellcore went on to trademark the term S/Key in order to develop a commercial product. Software development continued elsewhere under the name One-time Passwords In Everything (OPIE). OTP eventually evolved into hardware products as well. For an overview of the development of both software and hardware OTP, see this overview (PDF).
I won't show you how to integrate hardware OTP with your FreeBSD system as I'll assume that, like me, you don't have the budget to go out and purchase hardware tokens and proprietary authentication servers.
Fortunately, software OTP comes with your FreeBSD system and is easily
configured. If you're using FreeBSD 4.x or lower, you already have both
considered to be more secure as it uses MD5, whereas
uses the less secure MD4. (See Cryptographic Terminology
101.) Starting with FreeBSD 5.0,
s/key will be phased
out and only
opie will be supported. I will cover the
opie in this article.
Before you can begin to use
opie, you must add yourself
opie database in
default this database is empty, which means you should just get your
prompt back if you run this command:
$ more /etc/opiekeys
To add yourself to the database, use the
command with the console switch:
$ opiepasswd -c Adding dlavigne6: Only use this method from the console; NEVER from remote. If you are using telnet, xterm, or a dial-in, type ^C now or exit with no password. Then run opiepasswd without the -c parameter. Using MD5 to compute responses. Enter new secret pass phrase: Secret pass phrases must be between 10 and 127 characters long. Enter new secret pass phrase: Again new secret pass phrase: ID dlavigne6 OTP key is 499 dh0391 CHUG ROSA HIRE MALT DEBT EBEN
Also in FreeBSD Basics:
Let's take a closer look at what happened when I ran this
command. Notice the warning at the beginning. When you run
opiepasswd -c you want to be either physically sitting at the
machine you normally login to or connected to the machine via
ssh. Otherwise, your secret pass phrase and resulting
one-time password will be sent over the network in clear text, defeating
the purpose of the exercise.
I was then prompted for a secret pass phrase, and I received a warning
because my original pass phrase was too short. This pass phrase is similar
in concept to the pass phrase we saw when we generated a public/private
key pair in The SSH
Cryptosystem. This pass phrase isn't used as a password per se;
instead, it is used to prove that I am the person who added the
dlavigne6 account to the database and the rightful owner of
the resulting "response" or one-time password. That response is comprised
of those six uppercase nonsense words.
At this point, I can verify that I am indeed in the
$ more /etc/opiekeys dlavigne6 0499 dh0391 669a4a62db6714f3 Jan 18,2003 15:25:44
Notice that there is one entry in the database which contains my username, followed by a counter (499), followed by a seed (dh0391), followed by a key (669a4a62db6714f3), followed by the date and time the entry was added to the database. The counter and the seed are very important as they are used whenever I need to generate a one-time password.
If I ever need to verify my counter and seed, I should use this command:
$ opieinfo 498 dh0391
opieinfo command displays the count that will be used
the next time I login. Note that it is expecting the response associated
with "498", but I only know the response for "499". To figure out what
response is expected, I use an OTP calculator, which is really the
Pages: 1, 2