Project

General

Profile

AFS Server » History » Version 2

Joseph Foley, 2015-09-05 02:55
link to client documentation updated

1 1 Joseph Foley
h1. AFS Server
2
3
These directions were originally on the Centipede project on https://projects.cs.ru.is
4
5
Will be running [[OpenLDAP]], Kerberos5 server, and AFS.  We will be using 3 of the IBM servers on top of the Cisco Catalyst.
6
7
{{toc}}
8
9
h2. Tasks
10
11
* Joe: 
12
** Interface with IT (*done*)
13
** install Kerberos server (*done*)
14
** install AFS db server gryla (*done*)
15
** install AFS cell server 0 gryla
16
*** vicepa is installed 8GB
17
** install AFS cell server 1 (stekkjarstaur)
18
** install AFS db server 2 stekkjarstaur (*mostly done, need db sync*)
19
*** vicepa is installed 500GB USB
20
** INstall AFS db server 3 giljagaur
21
** install AFS cell server 2 (samvinna.ru.is)
22
*** vicepa is installed 100GB (lvm)
23
* Stephan: [[install]] Ubuntu 10.4.3 server on the machines (*done*)
24
* Ute: Look into proper imaging under linux
25
26
h2. Desired Hardware
27
28
* Drobo (automated raid system with iSCSI) http://www.drobo.com/products/business/b1200i/index.php#!prettyPhoto
29
30
h2. Instructions
31
32
* [[devnet-documentation:AFS_Client_Installation]]
33
* [[How To Add Users]]
34
35
h3. Guides/links
36
37
* OpenAFS Official Documentation http://docs.openafs.org/
38
* OpenAFS Detailed Guide http://techpubs.spinlocksolutions.com/dklar/afs.html
39
* slapd documentation https://help.ubuntu.com/community/OpenLDAPServer
40
* Kerberos/LDAP on Ubuntu (outdated) http://bobcares.com/blog/?p=435
41
* OpenAFS on Ubuntu (outdated) http://bobcares.com/blog/?p=501
42
* IBM AFS 3.6 Documentation http://www-01.ibm.com/software/stormgmt/afs/manuals/Library/unix/en_US/HTML/index.htm
43
* Interrealm AFS http://www.cs.cmu.edu/~help/afs/cross_realm.html
44
* AFS on Linux Presentation http://www.dia.uniroma3.it/~afscon09/docs/wiesand.pdf
45
* mod_waklog (apache integration with AFS) [[mod_waklog]]
46
* Kerberos and DNS http://www.faqs.org/faqs/kerberos-faq/general/section-47.html
47
* Adding another fileserver https://lists.openafs.org/pipermail/openafs-info/2006-September/023495.html
48
* Kerberos and AFS tutorial (Secure endpoints) http://www.secure-endpoints.com/talks/Kerberos_Tutorial_BPW2007.pdf
49
* Key security issues
50
** http://openafs.org/pages/security/OPENAFS-SA-2013-003.txt
51
** http://www.openafs.org/pages/security/install-rxkad-k5-1.6.txt
52
53
h3. Getting started
54
55
* Install Ubuntu 12.04LTS
56
* Install Kerberos KDC (directions at [[Kerberos]])
57
* Setup DNS autodiscovery
58
<pre>
59
dev.ru.is.		IN	AFSDB	1 afsdb1.dev.ru.is.
60
</pre>
61
62
* Ubuntu
63
** client configuration is in @/etc/openafs@
64
** server configuration is in @/etc/openafs/server@
65
* CentOS
66
** client configuration is in @/var/vice/etc@ (the traditional)
67
** server configuration is in @/usr/afs/etc@
68
69
70
h3. Client
71
72
*Important!  Do this first!*
73
74 2 Joseph Foley
see [[AFS_Client_Installation]]
75 1 Joseph Foley
76
h3. Server
77
78
# Packages
79
<pre>sudo apt-get install openafs-krb5 openafs-{fileserver,dbserver}</pre>
80
81
h3. Keys and accounts
82
83
# Add entries to @/etc/openafs/CellServDB@ and @/etc/openafs/server/CellServDB@
84
## Note that the AFS cell *MUST* be lowercase
85
<pre>
86
>dev.ru.is			# Reykjavik University
87
130.208.209.37			#afsdb1.dev.objid.net 
88
130.208.209.39			#afsdb2.dev.objid.net 
89
130.208.209.40			#afsdb3.dev.objid.net 
90
</pre>
91
# Edit your @/etc/krb5.conf@
92
<pre>       
93
[libdefaults]
94
dns_lookup_kdc = true
95
dns_lookup_realm = true
96
97
[realms]
98
DEV.RU.IS = {
99
                kdc = kerberos.dev.ru.is
100
                kdc = kerberos-1.dev.ru.is
101
                kdc = kerberos-2.dev.ru.is
102
                admin_server = kerberos.dev.ru.is
103
</pre>
104
105
# Add principal “afs/dev.ru.is” and import the key to /etc/openafs/afs.keytab.  This is also a good time to setup the normal keytab.  Replace HOSTNAME with the reverse resolvable hostname.  If this is on greenqloud, you will need to make both the external name and the internal and add it to the keytab.
106
## WARNING:  If you run the kadmin, it will increment the kerberos version number, which will not allow the new servers to talk to the old.  Instead, copy the afs.keytab using scp to all of the machines!
107
<pre>
108
kadmin.local
109
kadmin: addprinc -policy service -randkey -e des-cbc-crc:normal afs/dev.ru.is
110
kadmin: ktadd -k /etc/openafs/afs.keytab -e des-cbc-crc:normal afs/dev.ru.is
111
kadmin: ank -policy host -randkey host/HOSTNAME
112
kadmin: ktadd host/HOSTNAME
113
kadmin: ank -policy host -randkey host/HOSTNAME
114
kadmin: ktadd host/INTERNALHOSTNAME
115
</pre>
116
# Remember the KVNO (key version number)
117
<pre>klist -ke /etc/openafs/afs.keytab</pre>
118
# Import the secret key into the AFS system.  Replace KVNO with the version number
119
<pre>asetkey add KVNO /etc/openafs/afs.keytab afs/dev.ru.is
120
</pre>
121
#Now test with bos (afs-fileserver must be running, possibly restarted)
122
<pre>sudo service openafs-fileserver restart
123
sudo bos listkeys afsdb1 -localauth
124
#key 3 has cksum 2586520638
125
#Keys last changed on Fri Mar 30 02:10:25 2012.
126
#All done.
127
</pre> 
128
# Setup kerberized root shell access.  Replace my principal with yours or add it to the list.
129
<pre>
130
sudo vi /root/.krb5login
131
foley@DEV.RU.IS
132
</pre>
133
# Test
134
<pre>ksu</pre>
135
136
h3. Partitions for vice (AFS cell)
137
138
# Make the partitions in your filesystem (as an image)
139
<pre>cd /home
140
sudo dd if=/dev/zero of=vicepa.img bs=100M count=80   # (8 GB partition)
141
sudo mkfs.ext4 vicepa.img
142
sudo sh -c "echo '/home/vicepa.img /vicepa ext4 defaults,loop 0 2' >> /etc/fstab"
143
sudo tune2fs -c 0 -i 0 -m 0 vicepa.img
144
</pre>
145
# Now we mount it
146
<pre>sudo mkdir -p /vicepa
147
sudo mount /vicepa
148
</pre>
149
To add more disks, see [[AFS Server#Adding-More-disks|Adding More disks]]
150
151
152
h3. Firewall settings
153
154
# Need to poke holes in the firewall also (http://security.fnal.gov/cookbook/KerberosPorts.html)
155
## Login to the firewall  @bridge.objid.net@
156
## Open these ports in @/etc/shorewall/rules@
157
<pre>## AFS and kerberos 
158
## From http://security.fnal.gov/cookbook/KerberosPorts.html
159
ACCEPT all    net:130.208.209.37-130.208.209.40 tcp,udp 88 #krb
160
ACCEPT all    net:130.208.209.37-130.208.209.40 tcp 749
161
ACCEPT all    net:130.208.209.37-130.208.209.40 tcp,udp 464
162
ACCEPT all    net:130.208.209.37-130.208.209.40 udp 749,4444
163
ACCEPT all    net:130.208.209.37-130.208.209.40 udp 9878
164
ACCEPT all    net:130.208.209.37-130.208.209.40 udp 7000:7007
165
166
</pre>
167
168
h3. Make the new cell
169
170
# If you get issues with the case on the afs cell (all UPPERCASE is bad)
171
## sudo dpkg-reconfigure openafs-client
172
## sudo dpkg-reconfigure openafs-fileserver
173
# Make the Cell!
174
<pre>sudo afs-newcell</pre>
175
## Yes, we meet the requirements
176
##Principal: root/admin
177
## If you have problems with the ip address in the CellServDB, make sure it matches in @/etc/hosts@!
178
## If you see issues about network connections, you probably have an orphan process or something running on that port.
179
## if you have to clear out the user database, it is in @/etc/openafs/server/ThisUser@
180
181
h3. Testing out the cell and making the root volume
182
183
# Test out kinit and tokens
184
<pre>sudo su # (We want to switch to the root user)
185
186
kinit root/admin
187
188
Password for root/admin@SPINLOCK.HR: PASSWORD
189
190
aklog
191
</pre>
192
## if you get errors, it means that weak crypto is not enabled
193
# Check out your tokens with @kinit -5f@ and @tokens@
194
# Now create the root volume
195
<pre>afs-rootvol
196
...
197
4) The AFS client must be running pointed at the new cell.
198
Do you meet these conditions? (y/n) y
199
200
You will need to select a server (hostname) and AFS partition on which to
201
create the root volumes.
202
203
What AFS Server should volumes be placed on? gryla.dev.objid.net
204
What partition? [a] a
205
</pre>
206
# Everything should now be happy!
207
# Add the update server to distribute config files over encrypted channel
208
<pre>sudo bos create localhost upserveretc simple  "/usr/lib/openafs/upserver  -crypt /etc/openafs" -localauth </pre>
209
# Add the backup server (database servers need this process)
210
<pre>sudo bos create localhost buserver simple "/usr/lib/openafs/buserver" -localauth</pre>
211
h3. Standard partitions
212
213
# Now we create some of the "standard" partitions.  This is based upon the MIT configuration.  Note that these all start with very small quota! and are their own "class".  You will need to schedule backup partitions for them individually.  Note that you will need to go to the read-write of the root which is /afs/.dev.ru.is
214
<pre>
215
cd /afs/.dev.ru.is
216
vos create afsdb1 a activity
217
vos create afsdb1 a course
218
vos create afsdb1 a project
219
vos create afsdb1 a software
220
vos create afsdb1 a system
221
vos create afsdb1 a dept
222
vos create afsdb1 a org
223
vos create afsdb1 a reference
224
</pre>
225
# Now we mount them in the root area
226
<pre>
227
fs mkmount activity activity
228
fs mkmount course course
229
fs mkmount project project
230
fs mkmount software software
231
fs mkmount system system
232
fs mkmount dept dept
233
fs mkmount org org
234
fs mkmount reference reference
235
</pre>
236
# Finally, since this is a read-only volume, we have to "release" it
237
<pre>vos release root.cell</pre>
238
# And check to make sure the new directories show up in /afs/dev.ru.is
239
240
h3. Administrative users
241
242
* Login to the kerberos server as root and create an afsadm user
243
<pre>kadmin.local
244
addprinc addprinc -policy user <user>/afsadm
245
quit</pre>
246
* If you need super-super user capability, you will need to run this command with root/admin
247
<pre>kinit root/admin
248
aklog
249
bos adduser afsdb1 <user>/afsadm
250
</pre>
251
* Now you are a super-super user and can make the afs server dance.  Sometimes it takes a few minutes for the protection database to update, so you might have to wait.  Unfortunately, you are not done, you still need to add them to the group system:administrators so they can do other useful operations.
252
* Create an equivalent user to the Kerberos user
253
<pre>pts createuser <user>.afsadm</pre>
254
* Add them to the group system:administrators.  You may need to wait for the ptserver to sync up
255
<pre>pts adduser <user>.afsadm system:administrators</pre>
256
257
258
h3. Backup partitions
259
260
* Create all backup partitions everywhere!
261
<pre> vos backupsys </pre>
262
* Automate backup of user partitions at 1:00 and the temp partition at 0:01
263
<pre>bos create afsdb1 backupusers cron -cmd "/usr/bin/vos backupsys -prefix user -localauth" "1:00"
264
bos create afsdb1 backuptemp cron -cmd "/usr/bin/vos backupsys -prefix temp -localauth" "0:01"
265
</pre>
266
* now go create Oldfiles in the appropriate places
267
<pre>cd /afs/dev.ru.is/user/f/fo/foley
268
fs mkmount Oldfiles user.foley.backup
269
</pre>
270
271
h3. Adding More disks
272
273
http://docs.openafs.org/AdminGuide/ch03s08.html
274
275
# Get administrator tickets and tokens/var/lib/openafs/local
276
<pre> kinit <something>/afsadm; aklog
277
</pre>
278
# format and partition them with ext4 and give them a useful name for later.  For example
279
## figure out the next /vicep?? name, in this case it is /vicepb
280
<pre>fdisk /dev/sdb1
281
mkfs.ext4 -L grylavicepb /dev/sdb1</pre>
282
# Add the appropriate entry to /etc/fstab
283
<pre>echo "/dev/sdb1 /vicepb ext4 defaults 0 2" >> /etc/fstab</pre>
284
# See if it gets mounted properly
285
<pre>sudo mount -a </pre>
286
# Kick the fs service to get it to rescan and notice the disk
287
<pre>bos restart <machine name>  fs</pre>
288
# it should now show up  on the list of partitions
289
<pre>vos listpart afsdb1</pre>
290
# now you can make new volumes
291
292
h3. Multihomed servers
293
294
It can be a problem if one of the network interfaces is on a private network (like gryla).  You can restrict which network interfaces the server interfaces by putting NetInfo and NetRestrict files in @/var/lib/openafs/local@
295
296
More info at http://docs.openafs.org/AdminGuide/ch03s09.html
297
298
h3. Installing another server
299
300
These instructions were from examining the afs-newcell script by Sam Hartmans. Make sure you are logged in as root.
301
*Also, make sure that you do not have the hostname as 127.0.0.1 in /etc/hosts!*
302
# Stop the client
303
<pre>service openafs-client stop</pre>
304
# Stop the server
305
<pre>service openafs-fileserver stop</pre>
306
# Copy the afs.keytab from a running server
307
<pre>scp root@gryla.dev.ru.is:/etc/openafs/server/afs.keytab /etc/openafs/server/afs.keytab</pre>
308
# Install the key
309
<pre>asetkey add 3 /etc/openafs/server/afs.keytab afs/dev.ru.is</pre>
310
# Edit the CellServDB in @/etc/openafs/server/CellServDB@ and append it to the end of @/etc/openafs/CelServDB@ if it isn't already in there.
311
# Secure, but possibly database corrupting:
312
## STart up the server
313
<pre> service openafs-fileserver start </pre>
314
## Add the admin user through bos
315
<pre>bos adduser afscell1 root.admin -localauth</pre>
316
## Create initial protection database by hand.  Bit of a hack
317
<pre>pt_util -p /var/lib/openafs/db/prdb.DB0 -w</pre>
318
### start typing in these commands exactly.  Note the space before the last line!
319
<pre>root.admin 128/20 1 -204 -204
320
system:administrators 130/20 -204 -204 -204
321
 root.admin 1</pre>
322
## start up the ptserver and vlserver
323
<pre>bos create afscell1 ptserver simple /usr/lib/openafs/ptserver -localauth
324
bos create afscell1 vlserver simple /usr/lib/openafs/vlserver -localauth
325
</pre>
326
# Less secure, but more traditional
327
## Shutdown the server
328
<pre> service openafs-fileserver stop </pre>
329
## Startup in noauth mode
330
<pre>/usr/sbin/bosserver -noauth</pre>
331
## Add the admin user through bos
332
<pre>bos adduser localhost root.admin -noauth</pre>
333
## Protection database and vlserver
334
<pre>bos create localhost ptserver simple /usr/lib/openafs/ptserver -noauth
335
bos create localhost vlserver simple /usr/lib/openafs/vlserver -noauth
336
</pre>
337
## Make sure that systems:administrators has root.admin in it
338
<pre>pts membership system:administrators -noauth</pre>
339
## Kill the unauthenticated bosserver
340
<pre>pkill bosserver</pre>
341
## Start the bos server
342
<pre> service openafs-fileserver start </pre>
343
# start up the fileserver
344
<pre>bos create localhost fs fs -cmd /usr/lib/openafs/fileserver -cmd /usr/lib/openafs/volserver -cmd /usr/lib/openafs/salvager -localauth</pre>
345
# setup the backup server
346
<pre>sudo bos create localhost buserver simple "/usr/lib/openafs/buserver" -localauth</pre>
347
# setup the update clients to make /etc/openafs sync correctly every 2 hours
348
<pre>sudo bos create -server localhost -instance upclientetc -type simple -cmd "/usr/lib/openafs/upclient afsdb1.dev.ru.is -crypt -t 120 /etc/openafs"</pre>
349
# Wait for a while (30 sec) for the ubik to sync up
350
# Start up the client
351
<pre>service openafs-client start</pre>
352
# Check to make sure the servers are still running
353
<pre>bos status localhost</pre>
354
# You are ready to make volumes in the partition and mount them!
355
356
h3. Replication
357
358
It is a good idea to replicate files that are changed infrequently, particularly the root.afs and other bottom level directories.  Remember that you will need to only change things in the read-write /afs/.dev.ru.is then do a <pre>vos release <id></pre>.
359
foley has created a script example in @/afs/dev.ru.is/project/devnet/Scripts/afs-replicate-vols.sh@
360
361
# Create the replications on the various servers
362
<pre>vos addsite afsdb2.dev.ru.is a root.afs
363
vos addsite samvinna.dev.ru.is a root.afs
364
</pre>
365
# Now setup a bos job to release them on a regular schedule http://docs.openafs.org/AdminGuide/ch04s05.html
366
<pre>
367
bos create afsdb1.dev.ru.is releaserootafs cron "/usr/bin/vos release root.afs -local" 0:00
368
bos create afsdb1.dev.ru.is releaserootcell cron "/usr/bin/vos release root.cell -local" 0:00
369
</pre>
370
371
h2.  Shared keys and multiple Kerberos realms
372
373
h3.  Shared keys
374
375
Log into the servers and create matching krbtgt principals with matching KVNO.  (Make sure the kvno matches or it will not work.)
376
Copies of the magic passwords are on the servers at @/etc/krb5kdc/sharedpw.txt@
377
378
Commands for crossrealm between CS.RU.IS and DEV.RU.IS
379
<pre>kadmin.local  -e "des3-hmac-sha1:normal des-cbc-crc:v4"
380
addprinc -requires_preauth krbtgt/DEV.RU.IS@CS.RU.IS
381
addprinc -requires_preauth krbtgt/CS.RU.IS@DEV.RU.IS
382
</pre>
383
384
You will then need to modify the @/etc/krb5.conf@ files on the clients.  (or setup DNS)
385
<pre>[capath]
386
DEV.RU.IS = {
387
          CS.RU.IS = .
388
}
389
CS.RU.IS = {
390
         DEV.RU.IS = .
391
}</pre>
392
393
To test it, get keys in one realm and see if you can kvno in the other
394
<pre>kinit foley@CS.RU.IS
395
kvno foley@DEV.RU.IS</pre>
396
397
Once it is properly working, you can get service keys (such as AFS) in the other realm.
398
<pre>kinit foley@CS.RU.IS
399
aklog dev.ru.is
400
 klist
401
Ticket cache: FILE:/tmp/krb5cc_7812_A14864
402
Default principal: foley@CS.RU.IS
403
404
Valid starting    Expires           Service principal
405
17/04/2013 02:09  18/04/2013 02:09  krbtgt/CS.RU.IS@CS.RU.IS
406
17/04/2013 02:09  18/04/2013 02:09  krbtgt/DEV.RU.IS@CS.RU.IS
407
17/04/2013 02:09  18/04/2013 02:09  afs/dev.ru.is@DEV.RU.IS
408
</pre>
409
410
411
h3. Multiple realms
412
413
# put a space separated list of the valid kerberos realms to map into @/etc/openafs/server/krb.conf@ then restart.
414
** If you're feeling lazy, login to the DB servers and run:
415
<pre>cp /afs/dev.ru.is/project/devnet/SVN/Machines/AFSDB1/etc/openafs/server/krb.conf /etc/openafs/server/.
416
bos restart localhost -localauth -all
417
</pre>
418
# then add the afs service keys into the KeyList
419
420
421
h1. CentOs setup
422
423
* https://www.sit.auckland.ac.nz/Installing_OpenAFS_on_Red_Hat_distributions_including_Fedora
424
425
h2. AFS Client
426
427
# add this to /usr/vice/etc/CellServDB
428
<pre>>ru.is          #Reykjavik University
429
130.208.209.47  #njord.dev.ru.is
430
</pre>
431
432
h2. AFS Server 
433
434
# sudo yum install -y openafs-server
435
# edit /usr/afs/etc/CellServDB
436
<pre>ru.is #Reykjavik University
437
njord.dev.ru.is   130.208.209.47
438
</pre>
439
440
h1. Active Directory
441
442
Go here for the [[ActiveDirectory KDC]] setup
443
444
h1. Status
445
446
* Machines number 1, 3 and 5 on the stack above the catalyst (counted from the top) have ubuntu 10.04 installed and sshd running.
447
* root password: 100feet
448
* Number 2 and 4 are broken. 2 does not boot and 4 has errors in RAM and does not detect a disk.
449
* Network is set up and Ubuntu installed.
450
** gryla (130.208.209.37)  kerberos server, kadmin server, AFSDB server (dev.ru.is), AFSCELL server (dev.ru.is a and b)
451
** stekkjastaur (130.208.209.39)
452
** giljagaur (130.208.209.40).
453
* No proper DNS for now, so they are in Joe's dev.objid.net domain (e.g., gryla.dev.objid.net).
454
455
h1. Frequently Asked Questions
456
457
h2. I set it up, but the bos commands aren't working and the filserver isn't starting.  The FileLog says something about "Couldn't get CPS for AnyUser"
458
459
Chances are good that your keys aren't properly setup.  https://lists.openafs.org/pipermail/openafs-info/2001-December/002736.html
460
Make sure that the kvno is correct for all of the AFS keys installed on all of the servers.