Removed dead links
[openafs-wiki.git] / AFSLore / SMBtoAFS.mdwn
1 <div>
2   <ul>
3     <li><a href="#Using Samba as an AFS gateway"> Using Samba as an AFS gateway</a><ul>
4         <li><a href="#Plain text passwords sent over n"> Plain text passwords sent over network</a><ul>
5             <li><a href="#Compile Samba 2 --with-pam"> Compile Samba 2 --with-pam</a></li>
6             <li><a href="#Compile Samba 2 --with-afs"> Compile Samba 2 --with-afs</a></li>
7           </ul>
8         </li>
9         <li><a href="#No plain text passwords sent ove"> No plain text passwords sent over network</a><ul>
10             <li><a href="#kSAMBA"> kSAMBA</a></li>
11             <li><a href="#SMBKlog"> SMBKlog</a></li>
12             <li><a href="#FOKSTRAUT"> FOKSTRAUT</a></li>
13           </ul>
14         </li>
15         <li><a href="#New: More secure options"> New: More secure options</a><ul>
16             <li><a href="#Samba 3 built-in AFS support"> Samba 3 built-in AFS support</a></li>
17             <li><a href="#kimpersonate"> kimpersonate </a></li>
18           </ul>
19         </li>
20         <li><a href="#Random Links"> Random Links</a></li>
21         <li><a href="#Attachments"> Attachments</a></li>
22       </ul>
23     </li>
24   </ul>
25 </div>
26
27 # <a name="Using Samba as an AFS gateway"></a> Using Samba as an AFS gateway
28
29 Recently I've been researching methods of using Samba as an AFS gateway. Below are my findings so far. Please feel free to add/correct stuff. -- [[DanielClark]] - 04 Aug 2002
30
31 ## <a name="Plain text passwords sent over n"></a> Plain text passwords sent over network
32
33 In these solutions the plain text password is sent over the network. This requires [[EnablePlainTextPassword]] be set on your Windows hosts. Plain text passwords are necessary with stock Samba because the method that SMB uses for secure authentication is not compatible with Kerberos. Therefore the Samba server must have your plain text password so it can in turn get you AFS tokens using your password.
34
35 Advantages:
36
37 - No new software needs to be installed on clients
38 - Only required change on clients is to set a registry key
39
40 Disadvantages:
41
42 - Passwords sent in plain text over the network
43 - Clients may initially try to use plain text passwords to login to SMB servers other than the AFS gateway
44 - Client gets no warning before AFS tokens expire
45 - To get new tokens, client must unmap and then remap the drive letter corresponding to the AFS gateway
46
47 ### <a name="Compile Samba 2 --with-pam"></a> Compile Samba 2 --with-pam
48
49 This causes Samba to use pluggable authentication modules (PAM) for authentication. PAM is available on many Unix variants, notably Linux and Solaris. There are PAM modules for the various Kerberos implementations that work with AFS; the module for the default kaserver comes with [[OpenAFS]]. For some more info on PAM see the [Samba doc](http://de.samba.org/samba/ftp/docs/htmldocs/Samba-HOWTO-Collection.html#PAM). Many precompiled versions of Samba are built with this option (i.e. Redhat's Samba RPMs)
50
51 Advantages:
52
53 - The only method that is integrated into Samba core and pretty much guaranteed to be maintained and work with all future Samba releases, as it is generally useful to people for purposes other then using Samba as an AFS gateway. There seem to be no people on the Samba core team that have an active interest in AFS.
54
55 Disadvantages:
56
57 - Doesn't work with operating systems that do not support PAM.
58
59 ### <a name="Compile Samba 2 --with-afs"></a> Compile Samba 2 --with-afs
60
61 This links Samba against AFS authentication code directly.
62
63 Advantages:
64
65 - May work with systems that do not support PAM.
66
67 Disadvantages:
68
69 - Not actively maintained. Author states the option may be suffering from bit rot.
70 - Several people have mentioned difficulty getting the library and header paths right, mentioning conflicts between [[OpenAFS]], [[OpenSSL]] and non-AFS Kerberos libraries and header files. It is unclear if this code is works with the latest Samba and [[OpenAFS]] releases at all.
71 - May need to hunt around on the internet for a patch to make this work against a specific OS type and Samba version, and then use that older Samba version.
72   - Patch for AIX / Samba 2.0.4b: <http://www.mail-archive.com/info-afs@transarc.com/msg02493.html>
73
74 ## <a name="No plain text passwords sent ove"></a> No plain text passwords sent over network
75
76 These are methods that avoid sending plain text passwords over the network.
77
78 Advantages:
79
80 - Increased security
81
82 Disadvantages:
83
84 - Requires modifications to stock Samba distribution
85 - Requires additional infrastructure beyond Samba
86 - All are primarily internal projects that people did for their employers, support may be minimal to nonexistent.
87
88 ### <a name="kSAMBA"></a> kSAMBA
89
90 kSamba is used for AFS translation in University of Michigan Campus sites. It also allows Windows workstations to authenticate and connect to UNIX SMB (Server Message Block) servers via a Kerberos out-of-band negotiation. This allows users to connect without entering a SMB password. A version of Samba 2.0.6 modified to support AFS and Kerberos is implemented on the server side.
91
92 <table border="1" cellpadding="0" cellspacing="0">
93   <tr>
94     <td> URL </td>
95     <td><a href="http://rsug.itd.umich.edu/software/ksamba.html" target="_top">http://rsug.itd.umich.edu/software/ksamba.html</a></td>
96   </tr>
97   <tr>
98     <td> Email </td>
99     <td><a href="mailto:ifs.via.samba@umich.edu">ifs.via.samba@umich.edu</a></td>
100   </tr>
101 </table>
102
103 Advantages:
104
105 - Very good security. Plain text passwords are not required to be sent over the network or kept on the Samba server.
106 - Has been in active use by a good number of clients for several years.
107 - Looks like it might have an interface to manipulate AFS permissions - see <http://lists.samba.org/pipermail/samba/1997-November/033982.html>
108
109 Disadvantages:
110
111 - Seems to be pretty specific to UMich's site - unclear if anyone else is using it.
112 - Requires each Windows client to install some software
113   - Windows client software doesn't seem to be open source
114   - Windows client software won't install on Windows 2000 or XP
115 - Looks like it may be tied to a specific Kerberos implementation
116 - Must run Samba 2.0.6 or do some porting to newer version
117
118 ### <a name="SMBKlog"></a> SMBKlog
119
120 SMBKlog uses out-of-band authentication over SSL. The server sends the client an RSA public key - the client encrypts the password with the public key and sends it to the server, which then decrypts it. There is an email explaining it at <http://samba.cadcamlab.org/lists/samba-technical/Jul2001/00363.html> .
121
122 <table border="1" cellpadding="0" cellspacing="0">
123   <tr>
124     <td> URL </td>
125     <td><a href="http://www22.brinkster.com/jvrobert" target="_top">http://www22.brinkster.com/jvrobert</a></td>
126   </tr>
127   <tr>
128     <td> Email </td>
129     <td> Jason Robertson <a href="mailto:jason.v.robertson@intel.com">jason.v.robertson@intel.com</a></td>
130   </tr>
131 </table>
132
133 Advantages:
134
135 - Password not sent over network in plain text
136 - Not specific to any particular Kerberos/AFS implementation [ Transarc/OpenAFS OK ]
137 - Uses [[OpenSSL]] so probably relatively easy to write new Windows clients
138 - Successfully used at Intel to comply with corporate security requirements
139
140 Disadvantages:
141
142 - Password exists in plain text form on Samba server, at least in memory, for some period of time (Samba server decrypts password to plaintext form and uses that to get AFS tokens)
143 - Requires each Windows client to install some software
144   - Windows client software dies on Windows 2000 and XP [ May be fixed in current version ]
145 - Must run specific Samba version or do some porting to newer version [ Should be straightforward ]
146 - Not under heavy active development.
147
148 Updates:
149
150 - Frank Cameron (<cameron@ctc.com>) updated Jason's smbklog patches to work with Samba 2.2.7
151   - [[samba-2.2.7-afstoken.patch]]: Updated smbklog patch for Samba 2.2.7
152 - Also available is a patch to compile Samba 2.2.7 on [[RedHat]] 8
153   - [[samba-2.2.7_afstoken.spec]]: Spec file to build Samba 2.2.7 w/ SMBKlog on RH 8
154
155 ### <a name="FOKSTRAUT"></a> FOKSTRAUT
156
157 **Fokstraut and Samba - Dealing with Authentication and Performance Issues On A Large Scale Samba Service**
158
159 Robert Beck &amp; Steve Holstead, _University of Alberta_
160
161 **Abstract**
162
163 At the University of Alberta, we have approximately 55,000 user id's using central services authenticated by Kerberos. We use AFS for central file service. We use Samba to provide Windows compatible access to much of our central file service. Samba contains a number of useful features for Microsoft Windows compatibility, including a kludge to deal with the problem of Windows sending an all uppercase version of a user's password. We observed that when Windows connects to a share, it frequently attempts many incorrect passwords repeatedly before trying the correct one. This created a very heavy authentication load on our central Samba service when users would connect every morning and authenticate. We observed this load and noticed that most of our problems were caused by repeated attempts to authenticate, and the high cost of checking these attempts.
164
165 To help reduce the load due to authentication, we implemented FOKSTRAUT, a set of modifications to Samba to cache recent password failures and successes in a DBM database built by the Samba server as it runs. By caching the recent failures we avoid expensive re-checks of the (many) other passwords Windows likes to send us. We also cache the correct case of the real password, and by doing so we avoid the expensive overhead of "cracking" an all uppercase password When Windows decides to send one. We also use FOKSTRAUT to cache the NT and LanMan password hashes of a users password once we see a successful authentication. This then allows us to use the newer Windows NT password hash after the user has connected once, without having to centrally convert and maintain a large SMB password file, and while maintaining the ability of our server to access services such as AFS which can not be authenticated against using the Windows password hash alone. Performance on our service has been drastically improved since the implementation of FOKSTRAUT.
166
167 <table border="1" cellpadding="0" cellspacing="0">
168   <tr>
169     <td> URL </td>
170     <td colspan="2"><a href="http://www.usenix.org/events/lisa2000/full_papers/beck/beck_html/" target="_top">http://www.usenix.org/events/lisa2000/full_papers/beck/beck_html/</a></td>
171   </tr>
172   <tr>
173     <td>   </td>
174     <td><a href="http://www.ualberta.ca/~sholstea/patches.tar" target="_top">http://www.ualberta.ca/~sholstea/patches.tar</a></td>
175     <td> Patches against Samba 2.2.4 </td>
176   </tr>
177   <tr>
178     <td> Email </td>
179     <td colspan="2"> Steve Holstead <a href="mailto:Steve.Holstead@ualberta.ca">Steve.Holstead@ualberta.ca</a></td>
180   </tr>
181   <tr>
182     <td>   </td>
183     <td colspan="2"> Robert Beck <a href="mailto:beck@bofh.ucs.ualberta.ca">beck@bofh.ucs.ualberta.ca</a> or <a href="mailto:beck@obtuse.com">beck@obtuse.com</a></td>
184   </tr>
185 </table>
186
187 Advantages:
188
189 - Password not sent over network in plain text
190 - In use for several years with a large number of clients
191 - Has advantages other than secure AFS login
192 - Seems to be under active development
193   - Support for automatic reauthentication before token lifetime ends recently added
194 - Requires no changes to Windows Clients. This is a unique feature of this method.
195 - Everything is under BSD style license terms
196
197 Disadvantages:
198
199 - Requires some out-of-band secure infrastructure for users to change their passwords.
200   - Authors mention using a simple script on a login server in which a user can make an SMB connect and authenticate themselves. Unsure of the security of this solution.
201   - Another possibility would be a web application behind an SSL server running on the same host as the Samba server.
202 - Passwords must be stored in cleartext on the Samba server.
203
204 ## <a name="New: More secure options"></a> New: More secure options
205
206 ### <a name="Samba 3 built-in AFS support"></a> Samba 3 built-in AFS support
207
208 It looks like Samba 3.0.4 has built-in AFS support (perhaps only for the Kerberos 4 kaserver on GNU/Linux with [[OpenAFS]] however). The relevant configure option looks like:
209
210       --with-fake-kaserver    Include AFS fake-kaserver support (default=no)
211
212 References:
213
214 - <http://www.samba.org/samba/docs/man/smb.conf.5.html#AFSSHARE>
215 - <news://news.gmane.org:119/E19sNzf-0002uv-00@intern.SerNet.DE>
216 - <http://www.dragoninc.on.ca/mail-archives/samba-technical/2003-10/0339.html>
217 - [http://marc.theaimsgroup.com/?l=samba&amp;m=108238783519493&amp;w=2](http://marc.theaimsgroup.com/?l=samba&m=108238783519493&w=2)
218 - [http://marc.theaimsgroup.com/?l=samba&amp;m=108119099330691&amp;w=2](http://marc.theaimsgroup.com/?l=samba&m=108119099330691&w=2)
219 - <http://lists.samba.org/archive/samba/2004-April/084693.html>
220
221 Also based on <http://us4.samba.org/samba/ftp/pre/WHATSNEW-3-0-5pre1.txt> it looks like Samba 3.0.5 will have support to display and set AFS acls via the NT security editor.
222
223 Here are some relevant comments from the Samba 3.0.4 code (author's homepage is at <http://www.sernet.de/vl/> ):
224
225     ./source/lib/afs.c:
226     /*
227       This routine takes a radical approach completely bypassing the
228       Kerberos idea of security and using AFS simply as an intelligent
229       file backend. Samba has persuaded itself somehow that the user is
230       actually correctly identified and then we create a ticket that the
231       AFS server hopefully accepts using its KeyFile that the admin has
232       kindly stored to our secrets.tdb.
233
234       Thanks to the book "Network Security -- PRIVATE Communication in a
235       PUBLIC World" by Charlie Kaufman, Radia Perlman and Mike Speciner
236       Kerberos 4 tickets are not really hard to construct.
237
238       For the comments "Alice" is the User to be auth'ed, and "Bob" is the
239       AFS server.
240     */
241
242     ./source/lib/afs_settoken.c:
243     /*
244       Put an AFS token into the Kernel so that it can authenticate against
245       the AFS server. This assumes correct local uid settings.
246
247       This is currently highly Linux and OpenAFS-specific. The correct API
248       call for this would be ktc_SetToken. But to do that we would have to
249       import a REALLY big bunch of libraries which I would currently like
250       to avoid.
251     */
252
253 ### <a name="kimpersonate"></a> kimpersonate
254
255 The major problem when exporting the AFS filespace read-write to SMB (Windows fileshareing) using Samba is the transfer of the user token to the smb-server. The simple may is to use clear-text password between the Windows client and the samba-server, and then to get tokens for the user with this password. This solution is clearly not acceptable for security aware AFS administrators.
256
257 On solution is to use \`kimpersonate' + store afs key on fileserver. To obtain the kimersonate code contact "Love H�rnquist-�strand" &lt; lha () stacken ! kth ! se &gt;
258
259 Here are some references to this technique:
260
261 - <https://lists.openafs.org/pipermail/openafs-info/2003-July/010026.html>
262 - <http://www.mail-archive.com/openafs-info@openafs.org/msg08471.html>
263 - <http://openbsd.mirrors.pair.com/src/usr.sbin/afs/src/doc/arla.info>
264 - <http://www.it.kth.se/~aep/licentiate/PB-lanman2001.pdf>
265
266 Here is the kimpersonate **README**:
267
268     kimpersonate
269     ============
270
271     kimpersonate takes a keytab/srvtab/AFS KeyFile and impersonates
272     kerberos credental case for a user. See manpage for documentation.
273
274     Very useful when using with samba.
275
276     Using kimpersonate with SAMBA
277     =============================
278
279     entry in smb.conf
280
281             root preexec = /usr/samba/bin/su-user-login '%u'
282
283     Also see the su-user-login file, note that this file contains hacks
284     that parses the %u for samba 3.0-alpha22 something using domain
285     logins. Check that is matches your usage.
286
287     You need to make sure that somehow the samba does a afs setpag call
288     before calling afslog/aklog. See the patch
289     samba-setpag-patch-linux-and-freebsd above.
290
291 Here is a text rendition the kimpersonate-1.0 **man page**:
292
293     KERBEROS(SECTION)                    LOCAL                   KERBEROS(SECTION)
294
295     NAME
296          kimpersonate - impersonate a user when there exist a srvtab, keyfile or
297          KeyFile
298
299     SYNOPSIS
300          kimpersonate [-s string | --server=string] [-c string | --client=string]
301                       [-k string | --keytab=string] [-4 | --krb4] [-5 | --krb5]
302                       [-e integer | --expire-time=integer] [-a string |
303                       --client-address=string] [-t string | --enc-type=string] [-f
304                       string | --ticket-flags=string] [--verbose] [--version]
305                       [--help]
306
307     DESCRIPTION
308          The kimpersonate program create a "fake" ticket using the service-key of
309          the service, the service key can be read from a Kerberos 5 keytab, AFS
310          KeyFile or (if compiled with support for Kerberos 4) a Kerberos 4 srvtab.
311          Supported options:
312
313          -s string, --server=string
314                  name of server principal
315
316          -c string, --client=string
317                  name of client principal
318
319          -k string, --keytab=string
320                  name of keytab file
321
322          -4, --krb4
323                  create a kerberos 4 ticket
324
325          -5, --krb5
326                  create a kerberos 5 ticket
327
328          -e integer, --expire-time=integer
329                  lifetime of ticket in seconds
330
331          -a string, --client-address=string
332                  address of client
333
334          -t string, --enc-type=string
335                  encryption type
336
337          -f string, --ticket-flags=string
338                  ticket flags for krb5 ticket
339
340          --verbose
341                  Verbose output
342
343          --version
344                  Print version
345
346          --help
347
348     FILES
349          Uses /etc/krb5.keytab, /etc/srvtab and /usr/afs/etc/KeyFile when avalible
350          and the the -k is used with appropriate prefix.
351
352     EXAMPLES
353          kimpersonate can be used in samba root preexec option or for debugging.
354          kimpersonate -s host/hummel.e.kth.se@E.KTH.SE -c lha@E.KTH.SE -5 --no-
355          krb4 will create a Kerberos 5 ticket for lha@E.KTH.SE for the host hum-
356          mel.e.kth.se if there exist a keytab entry for it in /etc/krb5.keytab
357
358          kimpersonate -k krb4:/etc/srvtab -s host/hummel.e.kth.se@E.KTH.SE -c
359          lha@E.KTH.SE --no-krb5 -4 will create a Kerberos 4 ticket for
360          lha@E.KTH.SE for the host hummel.e.kth.se if there exist a srvtab entry
361          for it in /etc/srvtab Note the Kerberos 5 syntax of the server.
362
363     SEE ALSO
364          kinit(1)
365
366     AUTHORS
367          Love H�rnquist-�strand < lha () stacken ! kth ! se >
368
369     Heimdal                          July 30, 2000                         Heimdal
370
371 ## <a name="Random Links"></a> Random Links
372
373 - 2002-05 discussion on samba-technical: [http://marc.theaimsgroup.com/?l=samba-technical&amp;m=102214554108308&amp;w=2](http://marc.theaimsgroup.com/?l=samba-technical&m=102214554108308&w=2)
374 - 2004 Samba XP Conference talk - "08 - Volker Lendecke (Samba Team / [[SerNet]]): Samba AFS extensions [30:40 min]" - <http://www.sambaxp.org/index.php?id=40>
375
376 ## <a name="Attachments"></a> Attachments
377
378
379 [[samba-2.2.7-afstoken.patch]]
380 [[samba-2.2.7_afstoken.spec]]