added; Do lots of parallel volume lookups, exercising volcache
[arla.git] / doc / real-world.texi
blobff28c2de68cb1f34f5c0a69802aabea900481510
1 @c Copyright (c) 2000, 2001 Kungliga Tekniska Högskolan
2 @c (Royal Institute of Technology, Stockholm, Sweden).
3 @c All rights reserved.
5 @c $Id$
7 @node AFS and the real world, Parts of Arla, Organization of data, Top
8 @comment  node-name,  next,  previous,  up
10 @chapter AFS and the real world
12 This chapter tries to describe problems that you see in the real (not
13 that perfect) world and show possible solutions to these problems.
15 @menu
16 * NAT::                         Truly evil stuff.
17 * Samba::                       Export AFS to Windows computers.
18 * Integration with Kerberos::   How to integrate Kerberos with AFS.
19 * Kerberos tickets and AFS tokens:: History and tools
20 @end menu
22 @node NAT, Samba, AFS and the real world, AFS and the real world
23 @comment  node-name,  next,  previous,  up
24 @section NAT
26 @cindex NAT
27 @cindex Masquerading
28 @cindex PAT
29 @cindex ALG
30 There's something evil out there that's called NAT, which stands for
31 Network Address Translation. For whatever reasons, people are using it
32 and will continue doing so.
34 First of all, it seemed like AFS should work just fine through NAT, you
35 just appear to be coming from the NAT-address and some random port
36 instead.  Looking closer at different NAT implementations it seems like
37 they have a rather short timeout:
39 @table @samp
40 @item FreeBSD natd
41 60 seconds
42 @item Cisco IOS
43 300 seconds
44 @item NetBSD ipf (ipnat)
45 600 seconds
46 @item Linux Nat (masq)
47 300 seconds
48 @end table
50 If the client doesn't transmit any traffic to a particular host for that
51 amount of time, it will get mapped to one of the IP address of the
52 NAT-server (if you happen to run PAT, the port will be randomized too).
54 The authors of Rx realized that keeping a Rx connection associated with
55 (IP-address,port) pair was a bad idea. One example is that you get
56 problems with multi-homed hosts. So Rx keeps its own connection id data in
57 the packet. With this feature client and server should be able to detect
58 address changes.
60 Unfortunately, the use of the orignal Rx-code stops this from happening
61 in Transarc/OpenAFS code. The code keeps track of incoming packets and
62 keeps track of the right peer (client). But it never updates the
63 IP-address,port pair in its data structure, so the answer packet will go
64 to the old IP-address,port pair.
66 If you can control your NAT machine you can have static mapping for
67 your AFS hosts. Transarc/OpenAFS and Arla uses source port 7001 (Arla
68 older then 0.36 uses source port 4711). You can also try to use
69 Natkeep @url{http://mit.edu/zacheiss/www/natkeep/} if you run an old
70 Arla or Transarc/OpenAFS client. Arla 0.36 and later have support for
71 polling the servers at the right interval to prevent NAT from dropping
72 information about your session.
74 @node Samba, Integration with Kerberos, NAT, AFS and the real world
75 @comment  node-name,  next,  previous,  up
76 @section Samba
78 @cindex Samba
80 The major problem when exporting the AFS filespace read-write to SMB
81 (Windows fileshareing) using Samba is the transfer of the user token to
82 the smb-server. The simple may is to use clear-text password between the
83 Windows client and the samba-server, and then to get tokens for the user
84 with this password. This solution is clearly not acceptable for security
85 aware AFS administrators.
87 Describe here how to make AFS work "securely" with samba.
89 On solution is to use @code{kimpersonate} + store afs key on
90 fileserver (talk to Love).
92 @node Integration with Kerberos, Kerberos tickets and AFS tokens, Samba, AFS and the real world
93 @comment  node-name,  next,  previous,  up
94 @section Integration with Kerberos
96 @cindex ThisCell
97 @cindex TheseCells
98 @cindex KeyFile
99 @cindex kaserver
100 @cindex kerberosserver
102 Kerberos 4 and 5 can be integrated quite well with AFS. This is mainly
103 due to the fact that the security model used in AFS is Kerberos. The
104 kaserver is a Kerberos 4 server with pre-authentication. The kaserver
105 also provides a feature that limits the number of password retries, and
106 after that you are locked out for half an hour. This feature can only be
107 used in the ka interface as it requires pre-authentication, but since
108 the kaserver provides a Kerberos 4 interface (without pre-authentication
109 and without this limitation) it is quite worthless.
111 Many sites indeed use a kerberosserver instead of a kaserver. One of
112 the reasons is that they want to use Kerberos 5 (which is required
113 for Windows 2000).
115 To use a kerberosserver, you have to put the same key into the AFS
116 KeyFile and the principal named afs of your kerberos realm. If you have
117 a cell which has another name than lowercase of your realmname, the
118 instance is the cellname. As the cellname often contains dots, this can
119 be quite confusing in Kerberos 4: afs.stacken.kth.se@@STACKEN.KTH.SE. The
120 first dot is the seperator between principal and instance, the other
121 dots are part of the name. The simplest way to do create a KeyFile on
122 your AFS server is to use heimdal's kadmin to generate and extract a
123 KeyFile. It has an option designed to do so. Be aware that the serial
124 number of the afs principal must match on all kerberos servers and
125 all KeyFiles on all AFS servers.
127 The default cellname to get a kerberos ticket for is contained in the
128 configuration file @file{ThisCell}. If you got more than one cell, you
129 want to list all cells to get tickets for in the @file{TheseCells} file.
131 @comment Still more text here on KeyFile and TheseCells?
133 @node Kerberos tickets and AFS tokens, , Integration with Kerberos, AFS and the real world
134 @comment  node-name,  next,  previous,  up
135 @section Kerberos tickets and AFS tokens
137 @cindex Tickets
138 @cindex Tokens
139 @cindex kinit
140 @cindex kauth
141 @cindex afslog
142 @cindex aklog
143 @cindex klog
144 @cindex kalog
146 To further confuse the poor user, AFS and Kerberos programmers decided
147 that they wanted to store their credentials at different places. In AFS,
148 the kernel was a natural place to store the credentials (named token)
149 since the CMU/Transarc AFS/OpenAFS implementation lives in the
150 kernel. The Kerberos people on the other hand thought that storing the
151 credentials (named ticket) in a file would be a good idea.
153 So know you have to synchronize the credentials if you just want to
154 enter your password once. There are several tools that can do that for
155 you. The question is what tools to use for what problem.
157 To add to the confusion not all tools talk to both Kerberos and
158 kaservers. There is also a bogus user-id in the token that is supposed
159 to be the same as your pts-user-id. Not that it makes any difference,
160 but some people get confused when unknown numbers show up in the token.
161 The easily confused people are often the ones that have more than one
162 principal in the same realm/cell (read sysadmins).
164 If you want to get your ticket from your Kerberos server, you use
165 @code{kinit}, and then use @code{afslog} or @code{aklog} to get AFS
166 tokens and push them to the kernel (and AFS daemon). Some @code{kinit}
167 (and @code{kauth}) can do both for you, use @code{kinit --afslog} or
168 simply @code{kauth}. Note that @code{kinit} and @code{kauth} don't
169 get set your AFS-token user-id right, and thus can be confusing
170 for people who think that this is important.
172 The @code{klog} program that you get with Transarc/OpenAFS talks to the
173 kaserver and behaves just-right in the sense that it talks to the pts
174 server to get the AFS-token user-id right, but @code{klog} talks only to
175 the kaserver which will not work for people with a Kerberos server.
176 @code{Klog} in Arla was written by Chris Wing
177 @email{wingc@@engin.umich.edu} as a part of a packet called
178 @code{afsutils}, they did the right thing and talked to the pts-server
179 to get the user-id. However, it uses Kerberos libs to talk to the
180 server. These libraries require the files @file{/etc/krb.conf} and
181 @file{/etc/krb.realms} to be setup correctly for their cell/realm. Not
182 that easy.
184 A long time ago Ken Hornstein @email{kenh@@cmf.nrl.navy.mil} wrote the
185 AFS Migration Kit that helped you to migrate from AFS to MIT Kerberos 5.
186 It included a tool named aklog that could convert a Kerberos tickets to
187 tokens. This tool was also rewritten in Arla by Brandon S. Allbery
188 @email{allbery@@ece.cmu.edu}. @code{aklog} can't get you new
189 credentials, it just converts old ones to new ones.
191 Then Transarc decided that they needed to fix a security hole in their
192 kaserver, and while doing that, they managed to break a part in the 
193 kaserver so it ceased to work for kerberos requests. 
195 First the defect existed unnoticed for a long time, later Transarc has
196 not managed to distribute a working version of the kaserver. Due to this,
197 a lot of sites run a kaserver with this defect. Instead of installing
198 working authentification servers from another sources, people started to
199 whine again and Love @email{lha@@stacken.kth.se} wrote the tool
200 @code{kalog} that talked the ka-protocol (but didn't do the AFS user-id
201 right) to work around that problem.
203 All tools that use Kerberos 4 need a working @file{/etc/krb.conf} and
204 @file{/etc/krb.realms}. Kerberos 5 programs need @file{/etc/krb5.conf}.
205 AFS aware tools need @file{/usr/arla/etc/CellServDB} or
206 @file{/usr/vice/etc/CellServDB}.
208 Also the Kerberos implementations from KTH (kth-krb and Heimdal) include
209 AFS support to make your life more pleasant. One thing is that you can
210 have a file @file{$HOME/.TheseCells} that lists the cells you use and the
211 Kerberos tools will try to get tickes and tokens for those cells.
212 Heimdal contains support for converting a Kerberos 4 srvtab to an AFS
213 KeyFile.
215 Below is a table that describes what tools does what, what
216 inheritance(s) they have, and what protocol(s) they speak. From the
217 inheritance (also in a table below) it is possible to deduct what
218 configuration files the tools use.
220 @multitable {Transarc/OpenAFS klog} {MIT Kerberos} {Kerberos} {Converts tickets}
221 @item Tool
222 @tab Inheritance
223 @tab Protocol
224 @tab Produces
226 @item Transarc/OpenAFS klog
227 @tab afs authlib
228 @tab KA
229 @tab Ticket and tokens
231 @item Arla klog
232 @tab Kerberos and libkafs
233 @tab Kerberos
234 @tab Ticket and tokens
236 @item AFS Migration kit's aklog
237 @tab MIT Kerberos and Ken Hornstein's afslib
238 @tab Kerberos
239 @tab Converts Kerberos tickets to tokens
241 @item Arla's aklog
242 @tab Kerberos and libkafs
243 @tab Kerberos
244 @tab Converts Kerberos tickets to tokens
246 @item kth-krb's and Heimdal's afslog
247 @tab Kerberos and libkafs
248 @tab Kerberos
249 @tab Converts Kerberos tickets to tokens
251 @item kalog
252 @tab arla and libkafs
253 @tab KA
254 @tab Get initial ticket, store tokens and tickets
256 @end multitable
258 Inheritance table
260 @table @samp
262 @item afs authlib
263 Reads @file{CellServDB} and @file{ThisCell} in @file{/usr/vice/etc}
265 @item Kerberos and libkafs
266 Kerberos 4 uses @file{/etc/krb.conf} and
267 @file{/etc/krb.realms}. Kerberos 5 uses @file{/etc/krb5.conf}.
269 @item arla
270 Arla uses @file{CellServDB} and @file{ThisCell} in @file{/usr/vice/etc}
271 and @file{/usr/arla/etc}
273 @item libkafs
274 Libkafs uses DNS and @file{CellServDB} in @file{/usr/vice/etc} and
275 @file{/usr/arla/etc} to figure out what ticket it should convert into
276 tables. The file @file{TheseCells} and @file{$HOME/.TheseCells} is used
277 to get extra tokens.
279 @end table