]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/opie/opie.4
This commit was generated by cvs2svn to compensate for changes in r56639,
[FreeBSD/FreeBSD.git] / contrib / opie / opie.4
1 .\" opie.4: Overview of the OPIE software.
2 .\"
3 .\" %%% portions-copyright-cmetz-96
4 .\" Portions of this software are Copyright 1996-1997 by Craig Metz, All Rights
5 .\" Reserved. The Inner Net License Version 2 applies to these portions of
6 .\" the software.
7 .\" You should have received a copy of the license with this software. If
8 .\" you didn't get a copy, you may request one from <license@inner.net>.
9 .\"
10 .\" Portions of this software are Copyright 1995 by Randall Atkinson and Dan
11 .\" McDonald, All Rights Reserved. All Rights under this copyright are assigned
12 .\" to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
13 .\" License Agreement applies to this software.
14 .\"
15 .\"     History:
16 .\"
17 .\"     Modified by cmetz for OPIE 2.2. Removed MJR DES documentation. Removed
18 .\"         references to the old square brackets challenge delimiters.
19 .\"     Modified at NRL for OPIE 2.01. Updated UNIX trademark credit.
20 .\"     Definition of "seed" written by Neil Haller of Bellcore
21 .\"     Written at NRL for OPIE 2.0.
22 .\"
23 .\"     $FreeBSD$
24 .\"
25 .TH OPIE 4 "January 10, 1995"
26 .SH NAME
27 .B OPIE \- One-time Passwords In Everything
28 .SH DESCRIPTION
29 .LP
30 OPIE is a package derived from the Bellcore S/Key Version 1 distribution
31 that helps to secure a system against replay attacks (see below). It does so
32 using a secure hash function and a challenge/response system. It provides
33 replacements for the 
34 .IR login (1),
35 .IR su (1), 
36 and 
37 .IR ftpd (8) 
38 programs that use OPIE
39 authentication as well as demonstrate how a program might be adapted to use
40 OPIE authentication. OPIE was developed at and for the United States Naval
41 Research Laboratory (NRL). OPIE is derived in part from Berkeley Standard
42 Distribution UNIX and the Bellcore S/Key Version 1 distribution.
43 .LP
44 From the average user's perspective, OPIE is a nuisance that prevents their
45 account from being broken into. The first time a user wishes to use OPIE,
46 (s)he needs to use the 
47 .IR opiepasswd (1) 
48 command to put an entry for them into
49 the OPIE database. The user can then use OPIE to authenticate themselves
50 with any program that supports it. If no other clients are being used,
51 this means they can use OPIE to 
52 .I telnet,
53 .I rlogin, 
54 or 
55 .I ftp
56 into the system,
57 log in on a terminal port (like a modem), or switch to another user's
58 account. When they would normally be asked for a password, they will get
59 a challenge from the server. They then need to copy that challenge (or
60 re-type, if they don't have the ability to copy and paste through something
61 like a window system) to their calculator program, enter their password,
62 then copy (or re-type) the response from the calculator as their password.
63 While this will seem cumbersome at first, with some practice, it becomes
64 easy.
65
66 .SH TERMS
67 .TP 
68 .I user name
69 The name that the system knows you as. For example, "jdoe".
70 .TP
71 .I secret password
72 A password, usually selected by the user, that is needed to gain access to the 
73 system. For example, "SEc1_rt".
74 .TP
75 .I challenge
76 A packet of information output by a system when it wishes to authenticate a 
77 user. In OPIE, this is a three-item group consisting of a hash identifier,
78 a sequence number, and a seed. This 
79 information is needed by the OPIE calculator to generate a proper response. 
80 For example, "otp-md5 95 wi14321".
81 .TP
82 .I response
83 A packet of information generated from a challenge that is used by a system to 
84 authenticate a user. In OPIE, this is a group of six words that is generated by
85 the calculator given the challenge and the secret password. For example, 
86 "PUP SOFT ROSE BIAS FLAG END".
87 .TP
88 .I seed
89 A piece of information that is used in conjunction with the secret password
90 and sequence numer to compute the response. Its purpose is to allow the same
91 secret password to be used for multiple sequences, by changing the seed, or
92 for authentication to multiple machines by using different seeds.
93 .TP
94 .I sequence number
95 A counter used to keep track of key iterations. In OPIE, each time a successful
96 response is received by the system, the sequence number is decremented. For 
97 example, "95".
98 .TP
99 .I hash identifier
100 A piece of text that identifies the actual algorithm that needs to be used to 
101 generate a proper response. In OPIE, the only two valid hash identifiers are 
102 "otp-md4", which selects MD4 hashing, and "otp-md5", which selects MD5.
103
104 .SH REPLAY ATTACKS
105 When you use a network terminal program like 
106 .IR telnet (1)
107 or even use a modem to log into a
108 computer system, you need a user name and a secret password. Anyone who can 
109 provide those to the system is recognized as you because, in theory, only you 
110 would have your secret password. Unfortunately, it is now easy to listen in
111 on many computer communications media. From modem communication to many 
112 networks, your password is not usually safe over remote links. If a
113 cracker can listen in when you send your password, (s)he then has a copy
114 of your password that can be used at any time in the future to access your
115 account. On more than one occasion, major sites on the Internet have been
116 broken into exactly this way. 
117 .LP
118 All an attacker has to
119 do is capture your password once and then replay it to the server when it's
120 asked for. Even if the password is communicated between machines in encoded
121 or encrypted form, as long as a cracker can get in by simply replaying
122 a previously captured communication, you are at risk. Up until very recently,
123 Novell NetWare was vulnerable this way. A cracker couldn't find out what your
124 password actually is, but (s)he didn't need to -- all that was necessary to
125 get into your account was to capture the encrypted password and send that
126 back to the server when asked for it.
127
128 .SH ONE-TIME PASSWORDS
129 One solution to the problem of replay attacks
130 is to keep changing the way that a password is being encoded so that what is
131 sent over the link to another system can only be used once. If you can do that,
132 then a cracker can replay it as many times as (s)he wants -- it's just not
133 going to get them anywhere. It's important, however, to make sure you encode
134 the password in such a way that the cracker can't use the encoded version to
135 figure out what the password is or what a future encoded password will be.
136 Otherwise, while still an improvement over no encoding or a fixed encoding,
137 you can still be broken into. 
138
139 .SH THE S/KEY ALGORITHM
140
141 A solution to this whole problem was invented by Lamport in 1981. This
142 technique was implemented by Haller, Karn, and Walden at Bellcore. They
143 created a free software package called "S/Key" that used an algorithm
144 called a cryptographic checksum. A cryptographic checksum is a strong one-way
145 function such that, knowing the result of such a function, an attacker still
146 cannot feasably determine the input. Further, unlike cyclic redundancy
147 checksums (CRCs), cryptographic checksums have few inputs that result in the
148 same output.
149 .LP
150 In S/Key, what changes is the number of
151 times the password is run through the secure hash. The password is run through
152 the secure hash once, then the output of the hash is run through the secure
153 hash again, that output is run through the secure hash again, and so on until
154 the number of times the password has been run through the secure hash is equal 
155 to the desired sequence number. This is much slower than just, say, putting
156 the sequence number in before the password and running that through the secure
157 hash once, but it gains you one significant benefit. The server machine you
158 are trying to connect to has to have some way to determine whether the output
159 of that whole mess is right. If it stores it either without any encoding or
160 with a normal encoding, a cracker could still get at your password. But if it
161 stores it with a secure hash, then how does it account for the response 
162 changing every time because the sequence number is changing? Also what if you 
163 can never get to the machine any way that can't be listened in on? How do you
164 change your password without sending it over the link?
165 .LP
166 The clever solution
167 devised by Lamport is to keep in mind that the sequence number is
168 always decrementing by one and that, in the S/Key system, simply by running any
169 response with a sequence number N through the secure hash, you can get the
170 response with a sequence number N+1, but you can't go the other way. At any
171 given time, call the sequence number of the last valid response that the 
172 system got N+1 and the sequence number of the response you are giving it N.
173 If the password that generated the response for N is the same as the one for
174 N+1, then you should be able to run the response for N through the secure hash
175 one more time, for a total of N+1 times, and get the same response as you got
176 back for N+1. Once you compare the two and find that they are the same, you
177 subtract one from N so that, now, the key for N that you just verified becomes
178 the new key for N+1 that you can store away to use the next time you need to
179 verify a key. This also means that if you need to change your password but
180 don't have a secure way to access your machine, all the system really needs to
181 have to verify your password is a valid response for one more than the sequence
182 number you want to start with.
183 .LP
184 Just for good measure, each side of
185 all of this uses a seed in conjunction with your password when it actually 
186 generates and verifies the responses. This helps to jumble things up a little
187 bit more, just in case. Otherwise, someone with a lot of time and disk space
188 on their hands could generate all the responses for a lot of frequent passwords
189 and defeat the system.
190 .LP
191 This is not, by any means, the best explanation of how the S/Key algorithm
192 works or some of the more minor details. For that, you should go to some of
193 the papers now published on the topic. It is simply a quick-and-dirty
194 introduction to what's going on under the hood.
195
196 .SH OPIE COMPONENTS
197
198 The OPIE distribution has been incorporated into three standard client
199 programs:
200 .IR login (1), 
201 .IR su (1), 
202 and 
203 .IR ftpd (8),
204 .LP
205 There are also three programs in the OPIE distribution that are specific to
206 the OPIE system: 
207 .IR opiepasswd (1),
208 which allows a user to set and change their
209 OPIE password, 
210 .IR opieinfo (1),
211 which allows a user to find out what their current
212 sequence number and seed are, and 
213 .IR opiekey(1),
214 which is an OPIE key calculator.
215
216 .SH ADDING OPIE TO OTHER PROGRAMS
217
218 Adding OPIE authentication to programs other than the ones included as clients
219 in the OPIE distribution isn't very difficult. First, you will need to make
220 sure that the program includes <stdio.h> somewhere. Then, below the other
221 includes such as <stdio.h>, but before variable declarations, you need to
222 include <opie.h>. You need to add a variable of type "struct opie" to your
223 program, you need to make sure that the buffer that you use to get a password
224 from the user is big enough to hold OPIE_RESPONSE_MAX+1 characters, and you
225 need to have a buffer in which to store the challenge string that is big enough
226 to hold OPIE_CHALLENGE_MAX+1 characters.
227 .LP
228 When you are ready to output the challenge string and know the user's name,
229 you would use a call to opiechallenge. Later, to verify the response received,
230 you would use a call to opieverify. For example:
231 .sp 0
232
233 .sp 0
234         #include <stdio.h>
235 .sp 0
236                 .
237 .sp 0
238                 .
239 .sp 0
240         #include <opie.h>
241 .sp 0
242                 .
243 .sp 0
244                 .
245 .sp 0
246         char *user_name;
247 .sp 0
248         /* Always remember the trailing null! */
249 .sp 0
250         char password[OPIE_RESPONSE_MAX+1];
251 .sp 0
252                 .
253 .sp 0
254                 .
255 .sp 0
256         struct opie opiedata;
257 .sp 0
258         char opieprompt[OPIE_CHALLENGE_MAX+1];
259 .sp 0
260                 .
261 .sp 0
262                 .
263 .sp 0
264         opiechallenge(&opiedata, user_name, opieprompt);
265 .sp 0
266                 .
267 .sp 0
268                 .
269 .sp 0
270         if (opieverify(&opiedata, password)) {
271 .sp 0
272                 printf("Login incorrect");
273 .sp 0
274 .SH TERMINAL SECURITY AND OPIE
275
276 When using OPIE, you need to be careful not to allow your password to be
277 communicated over an insecure channel where someone might be able to listen
278 in and capture it. OPIE can protect you against people who might get your
279 password from snooping on the line, but only if you make sure that the password
280 itself never gets sent over the line. The important thing is to always run the
281 OPIE calculator on whichever machine you are actually using - never on a machine
282 you are connected to by network or by dialup. 
283 .LP
284 You need to be careful about the
285 X Window System, because it changes things quite a bit. For instance, if you
286 run an xterm (or your favorite equivalent) on another machine and display it
287 on your machine, you should not run an OPIE calculator in that window. When you
288 type in your secret password, it still gets transmitted over the network to go
289 to the machine the xterm is running on. People with machines such as
290 X terminals that can only run the calculator over the network are in an
291 especially precarious position because they really have no choice. Also, with
292 the X Window System, as with some other window system (NeWS as an example),
293 it is sometimes possible for people to read your keystrokes and capture your
294 password even if you are running the OPIE calculator on your local machine.
295 You should always use the best security mechanism available on your system to
296 protect your X server, be it XDM-AUTHORIZATION-1, XDM-MAGIC-COOKIE-1, or host
297 access control. *Never* just allow any machine to connect to your server
298 because, by doing so, you are allowing any machine to read any of your windows
299 or your keystrokes without you knowing it.
300
301 .SH SEE ALSO
302 .BR ftpd (8)
303 .BR login (1),
304 .BR opie (4),
305 .BR opiekeys (5),
306 .BR opieaccess (5),
307 .BR opiekey (1),
308 .BR opieinfo (1),
309 .BR opiepasswd (1),
310 .sp
311 Lamport, L. "Password Authentication with Insecure Communication",
312 Communications of the ACM 24.11 (November 1981), pp. 770-772.
313 .sp
314 Haller, N. "The S/KEY One-Time Password System", Proceedings of the ISOC
315 Symposium on Network and Distributed System Security, February 1994, 
316 San Diego, CA.
317 .sp
318 Haller, N. and Atkinson, R, "On Internet Authentication", RFC-1704,
319 DDN Network Information Center, October 1994.
320 .sp
321 Rivest, R. "The MD5 Message Digest Algorithm", RFC-1321,
322 DDN Network Information Center, April 1992.
323 .sp
324 Rivest, R. "The MD4 Message Digest Algorithm", RFC-1320,
325 DDN Network Information Center, April 1992.
326
327 .SH AUTHOR
328 Bellcore's S/Key was written by Phil Karn, Neil M. Haller, and John S. Walden
329 of Bellcore. OPIE was created at NRL by Randall Atkinson, Dan McDonald, and
330 Craig Metz.
331
332 S/Key is a trademark of Bell Communications Research (Bellcore).
333 UNIX is a trademark of X/Open.
334
335 .SH CONTACT
336 OPIE is discussed on the Bellcore "S/Key Users" mailing list. To join,
337 send an email request to:
338 .sp
339 skey-users-request@thumper.bellcore.com