1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<title>Using MD5 for Authentication</title>
<meta name="GENERATOR" content=
"Modular DocBook HTML Stylesheet Version 1.71 ">
<link rel="HOME" title=" LPRng-HOWTO" href="index.htm">
<link rel="UP" title="Permissions and Authentication " href=
"permsref.htm">
<link rel="PREVIOUS" title=
"Using Kerberos 4 for Authentication" href="x9264.htm">
<link rel="NEXT" title="Adding Authentication Support" href=
"x9357.htm">
</head>
<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link=
"#0000FF" vlink="#840084" alink="#0000FF">
<div class="NAVHEADER">
<table summary="Header navigation table" width="100%" border=
"0" cellpadding="0" cellspacing="0">
<tr>
<th colspan="3" align="center">LPRng-HOWTO: 1 Apr 2002
(For LPRng-3.8.10)</th>
</tr>
<tr>
<td width="10%" align="left" valign="bottom"><a href=
"x9264.htm" accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom">Chapter
17. Permissions and Authentication</td>
<td width="10%" align="right" valign="bottom"><a href=
"x9357.htm" accesskey="N">Next</a></td>
</tr>
</table>
<hr align="LEFT" width="100%">
</div>
<div class="SECT1">
<h1 class="SECT1"><a name="AEN9290">17.16. Using MD5 for
Authentication</a></h1>
<p><b class="APPLICATION">LPRng</b> has built-in support for
using MD5 digests as an authentication method. The
implementation is provided as an example of how to add user
level authentication into the <b class=
"APPLICATION">LPRng</b> system.</p>
<p>The method used to do authentication is very simple. Each
user has a file containing a set of keys that are used to
salt an md5 hash. The information being transferred has its
md5 checksum calculated using this salt, and is then
transferred to the destination, along with the md5 hash
result. At the destination the server will get the user id,
obtain the salt value from a key file, and then calculate the
md5 hash value. If the two are in agreement, authentication
is successful.</p>
<p>The keyfile used for md5 authentication contains an id
followed by a text string whose binary value is used as a
hash key:</p>
<div class="INFORMALEXAMPLE">
<a name="AEN9297"></a>
<pre class="SCREEN">
id1=key
id2=key
Example:
lpr@h2=tadf79asd%^1asdf
lpr@h1=fdfa%$^&^%$
</pre>
</div>
<br>
<br>
<div class="SECT2">
<h2 class="SECT2"><a name="AEN9299">17.16.1. Printcap
Entries</a></h2>
<p>Options used:</p>
<ul>
<li>
<p><tt class="LITERAL">auth=md5</tt><i class=
"EMPHASIS">use MD5 authentication</i></p>
</li>
<li>
<p><tt class="LITERAL">auth_forward=md5</tt><i class=
"EMPHASIS">forward using MD5 authentication</i></p>
</li>
<li>
<p><tt class="LITERAL">md5_id=</tt><i class=
"EMPHASIS">id for server</i></p>
</li>
<li>
<p><tt class="LITERAL">md5_forward_id=</tt><i class=
"EMPHASIS">id for server</i></p>
</li>
<li>
<p><tt class="LITERAL">md5_server_keyfile=</tt><i
class="EMPHASIS">server keyfile</i></p>
</li>
</ul>
<br>
<br>
<p>Example printcap entry:</p>
<div class="INFORMALEXAMPLE">
<a name="AEN9324"></a>
<pre class="SCREEN">
pr:
:lp=pr@wayoff
:auth=md5
:md5_id=lpr@wayoff.com
pr:server
:auth_forward=md5
:md5_id=lpr@wayoff.com
:md5_server_keyfile
:md5_forward_id=lpr@faroff.com
</pre>
</div>
<br>
<br>
<p>The <tt class="LITERAL">md5_id</tt> value is used by the
client to obtain a hash key that is used to salt the md5
calculation for client to server transfers. The <tt class=
"LITERAL">md5_forward_id</tt> value is used by the server
to obtain a hash key that is used to salt the md5
calculation for server to server transfers.</p>
<p>The <tt class="LITERAL">md5_server_keyfile</tt> contains
the keys of users; the id sent as the connection
information is used to obtain the key from the file.</p>
<p>To set up md5 authentication, all that is needed is the
following.</p>
<ul>
<li>
<p>For each user generate a key and place it in the
server keyfile. This file should have the form:</p>
<div class="INFORMALEXAMPLE">
<a name="AEN9335"></a>
<pre class="SCREEN">
user1@host1=asdfasdfadf
user2@host2=a8789087asddasdf
</pre>
</div>
<br>
<br>
</li>
<li>
<p>Assign a key to the server, and set its printcap
entry to this key.</p>
<div class="INFORMALEXAMPLE">
<a name="AEN9339"></a>
<pre class="SCREEN">
pr:
:lp=pr@wayoff
:auth=md5
:md5_id=lpr@wayoff.com
</pre>
</div>
<br>
<br>
</li>
<li>
<p>For each user, create a user key file with the
following format:</p>
<div class="INFORMALEXAMPLE">
<a name="AEN9343"></a>
<pre class="SCREEN">
lpr@wayoff = user1@host1 asdfasdfadf
</pre>
</div>
The first entry corresponds to the <tt class=
"LITERAL">md5_id</tt> value in the printcap. The second
field is the <span class="ACRONYM">AUTHUSER</span>
value supplied to the server and which will be used to
look up the key in the servers key file. Finally, the
last field is the salt value for the md5
calculation.<br>
<br>
</li>
</ul>
<br>
<br>
</div>
<div class="SECT2">
<h2 class="SECT2"><a name="AEN9347">17.16.2. User
Environment Variables and Files</a></h2>
<p>Options used:</p>
<ul>
<li>
<p><tt class="LITERAL">MD5KEYFILE=5</tt><i class=
"EMPHASIS">location of user keyfile</i></p>
</li>
</ul>
<br>
<br>
<p>The <tt class="LITERAL">MD5KEYFILE</tt> environment
variable contains the path to the user keytab file.</p>
</div>
</div>
<div class="NAVFOOTER">
<hr align="LEFT" width="100%">
<table summary="Footer navigation table" width="100%" border=
"0" cellpadding="0" cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href=
"x9264.htm" accesskey="P">Prev</a></td>
<td width="34%" align="center" valign="top"><a href=
"index.htm" accesskey="H">Home</a></td>
<td width="33%" align="right" valign="top"><a href=
"x9357.htm" accesskey="N">Next</a></td>
</tr>
<tr>
<td width="33%" align="left" valign="top">Using Kerberos
4 for Authentication</td>
<td width="34%" align="center" valign="top"><a href=
"permsref.htm" accesskey="U">Up</a></td>
<td width="33%" align="right" valign="top">Adding
Authentication Support</td>
</tr>
</table>
</div>
</body>
</html>
|