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