Project

General

Profile

AFS Client Installation » History » Version 2

Joseph Foley, 2015-11-13 23:17
fixed kernel module issue

1 1 Joseph Foley
{{toc}}
2
3
h1. AFS Client Installation
4
5
Originally at the DevNet project pages.
6
A very nice guide can be found at Cornell https://confluence.cornell.edu/display/CNF/Installing+AFS
7
8
h1. Windows
9
10
Some good instructions at http://claymore.rfmh.org/public/computer_resources/winAFSclientinstall.html
11
12
# Install the Kerberos for Windows 3.2.2
13
## *IMPORTANT: Do NOT install version 4.X.  It does not work with AFS*
14
## *IMPORTANT: If you install the 64 bit version, you will also need to install the 32 bit tools*
15
## http://www.secure-endpoints.com/netidmgr/roadmap.html
16
# Install the latest version of Network Identity Manager
17
## https://www.secure-endpoints.com/netidmgr/v2/#download
18
## When asked, the kerberos realm is @CS.RU.IS@ *Note the uppercase letters*
19
## If you are not a RU student or staff, then your realm will be @RND.RU.IS@
20
# Download the latest OpenAFS version, preferably 1.7 or higherD
21
## *IMPORTANT: If you install the 64 bit version, you will also need to install the 32 bit tools*
22
## http://www.openafs.org/windows.html
23
## The AFS realm is @rnd.ru.is@  *Note the lowercase letters and that it is NOT cs.ru.is*
24
# Then reboot the computer
25
# You will notice after rebooting a new context menu "AFS" when you right click anywhere.  This is how you will interact with AFS to get information and change access control.
26
# You will need to get Kerberos Tickets from the "Network Identity Manager".  This will also show up in the little icons in the bottom right.  If you can't find it, you can also run it from the start menu
27
## You need to create a new credential.  Replace "username" in these instructions with your username
28
## Menubar Credential > New Credentials > Obtain new credentials...
29
## Click on the top bar where it says Kerberos Principal > New Identity
30
## Username:  (whatever your username was) and click "Next >"
31
## Realm: CS.RU.IS "Next >"
32
## Keep the default options. click "Next >"  
33
## Make sure "Obtain AFS credentials" is clicked.  The Cell should be "rnd.ru.is".  Note that this must be in lowercase and different than your kerberos realm.  Click on "Add/Update" then "Next >"
34
## If you are presented with Kerberos 4 options, disable them.  Click "Next >"
35
## You should now type in your password and "Finish"
36
### You will have to get new credentials and type in your password every 8 hours.
37
## If all goes well, you will see that the username@CS.RU.IS entry will say you have "Kerberos v5 tickets (s) AFS tokens (1)"
38
# To find AFS, goto the "Network" in an explorer window.  There should be an AFS entry.  
39
## Double click on it, then double click on "rnd.ru.is"
40
41
h1. Linux 
42
43
After you have followed the directions below, if you have local users, you will need to adjust the minimum UID in the pam settings or it won't let you change the password.  In debian, look under @/etc/pam.d/common-password@
44
<pre>
45
password        [success=2 default=ignore]      pam_krb5.so minimum_uid=2000
46
</pre>
47
Make sure that all of your local (non-kerberos) users have a UID that is lower than the minimum_uid.
48
49
h2. Raspberry Pi (Debian)
50
51
These instructions are not completely tested.
52
You will need at least a 4GB card to download all the necessary software and linux kernel
53
54
Much of this is taken from http://www.raspberrypi.org/phpBB3/viewtopic.php?f=71&t=17666
55
56
Other guides:
57
* rpi-update https://github.com/Hexxeh/rpi-update/
58
59
# Install the latest dist and necessary tools
60
<pre>sudo bash
61
apt-get update
62
apt-get -y dist-upgrade
63
apt-get -y install gcc make git build-essential dkms
64
</pre>
65
# Install rpi-update and grab the latest firmware
66
<pre>
67
cd rpi-update
68
apt-get install ca-certificates
69
sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update
70
</pre>
71
# Grab latest kernel
72
<pre>cd /usr/src
73
wget  https://github.com/raspberrypi/linux/tarball/rpi-3.2.27 -O rpi-3.2.27.tgz
74
tar xzf rpi-3.2.27.tgz
75
</pre>
76
# Grab the configs from the kernel
77
<pre>cd raspberrypi-linux-*
78
zcat /proc/config.gz > .config
79
make oldconfig
80
make modules_prepare
81
</pre>
82
# Get the 
83
<pre>wget https://github.com/raspberrypi/firmware/raw/master/extra/Module.symvers</pre>
84
# Make symlinks for the build system
85
<pre>KSRC=`pwd`
86
pushd /lib/modules/`uname -r`
87
ln -s ${KSRC} source
88
ln -s ${KSRC} build
89
popd
90
91
pushd /usr/src
92
ln -s ${KSRC} linux-`uname -r`
93
ln -s ${KSRC} linux
94
popd</pre>
95
# Install kerberos packages
96
<pre>apt-get install krb5-auth-dialog krb5-user krb5-clients libpam-ccreds libpam-krb5</pre>
97
# Install the afs client and related modules
98
<pre>apt-get install  openafs-modules-dkms openafs-{client,krb5}</pre> 
99
## if it doesn't go successfuly, you can re-run it with:
100
<pre>dpkg-reconfigure openafs-modules-dkms</pre>
101
102
h2. Debian/Ubuntu
103
104
Note!  AFS and Keberos will mostly autoconfig on the client side unless RU's DNS is broken.  It is very important that you never let the disk that has the AFS cache fill up.  If that happens, bad things may occur.  See directions about how to setup a fixed cache if you are concerned about this.  In some installations, people put the cache in a separate partition to eliminate the risk.
105
106
h3. Kerberos Client
107
108
* see e.g., Spinlock Guide on Kerberos http://techpubs.spinlocksolutions.com/dklar/kerberos.html
109
110
# Install packages for Kerberos and AFS
111
<pre>sudo apt-get install krb5-auth-dialog krb5-user libpam-ccreds libpam-krb5 build-essential dkms linux-headers-`uname -r` libpam-afs-session openafs-modules-dkms openafs-{client,krb5}</pre>
112
# The kerberos config will ask you questions, you should answer:
113
** realm: @RND.RU.IS@
114
** Kerberos server: @kerberos.rnd.ru.is@
115
** Kerberos administrative server: @kerberos.rnd.ru.is@
116
** If you need to fix this later, run @dpkg-reconfigure krb5-config@
117
# Check DNS and hostnames
118
* Make sure that the hostname is not listed in @/etc/hosts@
119
* Make sure that the @hostname@ command returns the full hostname e.g. gryla.rnd.ru.is
120
# Edit the @/etc/krb5.conf@
121
** search for @[domain_realm]@ and add these lines after
122
<pre>
123
.rnd.ru.is = RND.RU.IS
124
rnd.ru.is = RND.RU.IS
125
</pre>
126
** After @[libdefaults]@ add
127
<pre> allow_weak_crypto = true </pre>
128
# if you do not have a Kerberos user name: ask Joe (foley@ru.is) or Stephan (stephans@ru.is) to give you one
129
# check if it works <pre>
130
$ kinit YOUR_KERBEROS_USERNAME
131
Password for YOUR_KERBEROS_USERNAME@RND.RU.IS:
132
$ klist
133
Ticket cache: FILE:/tmp/krb5cc_1000
134
Default principal: YOUR_KERBEROS_USERNAME@RND.RU.IS
135
136
Valid starting     Expires            Service principal
137
03/30/12 13:53:15  03/30/12 23:53:15  krbtgt/RND.RU.IS@RND.RU.IS
138
        renew until 03/31/12 13:53:11
139
</pre>
140
# if the Kerberos principal and the local username differ
141
** create the file @~/.k5login@ with the content <pre>MYPRINCIPAL@RND.RU.IS</pre>
142
** instruct pam-krb5 to read your principal from @~/.k5login@ by adding the following to @/etc/krb5.conf@:
143
<pre>
144
[appdefaults]
145
        pam = {
146
                search_k5login = true
147
        }
148
</pre>
149
150
Now use the Kerberos principal's password when asked for a password on login at your computer and you should automatically get a Kerberos ticket (check with @klist@ after login). If not connected to the Internet, the local password is active/requested again.
151
152
h3. AFS Client
153
154
# Install packages
155
<pre>sudo apt-get 
156
</pre> 
157
## Cell: @rnd.ru.is@
158
## Cache: @500000@ (choose depending on your hard disk space, more cache = less network traffic)
159
# Now setup the cache so it can never overfill (very bad things happen).  If you have already setup a partition for the cache then this step is unnecessary.
160
<pre>
161
cd /var/cache
162
sudo dd if=/rnd/zero of=openafs-cache.img bs=10M count=55   # (~550 MB partition)
163
sudo mkfs.ext4 openafs-cache.img
164
sudo sh -c "echo '/var/cache/openafs-cache.img /var/cache/openafs ext4 defaults,loop 0 2' >> /etc/fstab"
165
sudo tune2fs -c 0 -i 0 -m 0 openafs-cache.img
166
</pre>
167
# test by mounting the cache
168
<pre>sudo mount /var/cache/openafs</pre>
169
# Add entries to @/etc/openafs/CellServDB@
170
## Note that the AFS cell *MUST* be lowercase
171
<pre>>rnd.ru.is         # Reykjavik University Research and Development Network
172
130.208.242.66          #afsdb1.rnd.ru.is
173
130.208.242.67		#afsdb2.rnd.ru.is
174
130.208.242.68          #afsdb3.rnd.ru.is  
175
</pre>
176
# enable the AFS client (not always needed)
177
<pre>sudo perl -pi -e's/AFS_CLIENT=false/AFS_CLIENT=true/' /etc/openafs/afs.conf.client</pre>
178
# (re-)start the client
179
<pre>sudo invoke-rc.d openafs-client restart</pre>
180
# Get AFS tokens upon login (from pam-afs)
181
## Note that this will only automatically get tokens if you add this line in @/etc/pam.d/common-session@ after the @pam_krb5.so@ line
182
<pre>session required                        pam_afs_session.so program=/usr/bin/aklog</pre>
183
# have fun at @/afs/rnd.ru.is/@
184
# If you want to make it a little simpler, do a symlink from /afs/rnd.ru.is/<.,..>/<username> to /home/username
185
# then you don't have to change /etc/password to start using the homedirectory!
186
# To automatically get Kerberos tickets and AFStokens, grab this auth-client-config file http://afs.rnd.ru.is/project/rndnet/Public/Workstation/etc/auth-client-config/profile.d/rndnet and put it into @/etc/auth-client-config@.  You can also grab them via afs:
187
<pre>cp /afs/rnd.ru.is/project/rndnet/Public/Workstation/etc/auth-client-config/profile.d/rndnet /etc/auth-client-config/profile.d/.</pre>
188
# Then run it to set your machine to configure PAM and NSS for kerberos/afs
189
<pre>sudo auth-client-config -a -p rndnet_workstation</pre>
190
191
h3. Debian 7 on a KVM/Proxmox VM
192
193
The VMs need a fix for a module compile problem with struct dentry, which is fixed in openafs 1.6.11, which is sadly not in the stable distribution.
194
195
After you follow the main debian instructions, you need to:
196
197
# Switch to sid (unstable
198
<pre>zile /etc/apt/sources.list
199
#replace wheezy with sid
200
</pre>
201
# select 1.6.11
202
<pre>apt-get update; apt-get install openafs-modules-dkms=1.6.11.1-1</pre>
203
# Now the kernel module will build properly.
204
205
h2. Redhat Varients
206
207
h3. Fedora
208
209
Openafs has binary builds for up to Fedora 20.  Follow the centos instructions.
210
211
For Fedora 21 (or others) you will need to do a source build.  Get the src.rpm and follow these instructions on the wiki
212
http://wiki.openafs.org/HowToBuildOpenAFSFromSource/
213
Alternatively use the copr packages from jsbillings
214
* https://copr.fedoraproject.org/coprs/jsbillings/openafs/
215
* https://copr.fedoraproject.org/coprs/jsbillings/openafs-kmod/
216 2 Joseph Foley
Generally this is a better idea
217 1 Joseph Foley
218
Let's get started
219
220
* Grab the appropriate .repo files and put them into /etc/yum.repos.d
221
* Update yum
222
<pre>yum -y update</pre>
223
* Prerequisites and the packages
224
<pre>
225
yum install git-core gcc autoconf automake libtool make flex bison glibc-devel krb5-devel perl-devel ncurses-devel pam-devel kernel-devel-$(uname -r) wget perl-devel perl-ExtUtils-Embed rpm-build krb5-libs krb5-workstation dkms rpmbuild kernel-headers dkms openafs-client openafs-krb5 dkms-openafs
226
</pre>
227
* Make sure that the /var/cache/openafs got labeled for selinux
228
<pre>restorecond -r -v /var/cache/openafs</pre>
229
* Sometimes dkms does not run for newer kernels, check in /var/lib/dkms/openafs.  Check which version e.g. 1.6.11-1.fc21 if you need to force it
230
<pre>dkms --verbose install -m openafs -v 1.6.11-1.fc21</pre>
231
* Start it up!
232
<pre>service openafs-client start</pre>
233
* Update your /etc/krb5.conf.  The stock version is missing a lot of entries.
234 2 Joseph Foley
235
If you have problems, it is most likely that the cache is the wrong size.
236
237
Another problem is if DKMS refuses to build because you don't have the latest kernel-dev installed or an older kernel build in the way
238
<pre>
239
dnf -y install kernel-devel-$(uname -r) --allowerasing
240
dnf reinstall dkms-openafs
241
</pre>
242 1 Joseph Foley
243
h3. Centos
244
245
From http://docs.openafs.org/QuickStartUnix/ch02s09.html
246
247
* Install EPAL repos
248
** i386 (32 bit) <pre>rpm -U http://www.fedora.is/epel/6/i386/epel-release-6-8.noarch.rpm</pre>
249
** 64(bit) <pre>rpm -U http://www.fedora.is/epel/6/x86_64/epel-release-6-8.noarch.rpm</pre>
250
* Grab the openafs repositories file 
251
<pre>wget http://dl.openafs.org/dl/openafs/1.6.6/openafs-repository-rhel-1.6.1-5.noarch.rpm</pre>
252
* Install the source repositories
253
<pre>rpm -U openafs-repository*.rpm</pre>
254
* Make sure that the source repositories are enabled in @/etc/yum.repos.d@.
255
* Edit @/etc/yum.conf.d/openafs-rhel.repo@
256
** change $basearch to $arch in <pre>baseurl=http://dl.openafs.org/dl/openafs/1.6.6/rhel$releasever/$arch/</pre>
257
** set <pre>gpgcheck=0</pre>  because the rpms are currently not signed
258
* Install kerberos
259
<pre>sudo yum -y install krb5-libs krb5-workstation
260
</pre>
261
* Install rndelopment packages
262
<pre>sudo yum -y groupinstall "Rndelopment Tools"</pre>
263
* Install the packages
264
<pre>sudo yum -y install kernel-headers kernel-rndel-`uname -r` dkms openafs-client openafs-krb5 dkms-openafs</pre>
265
* Now go edit @/etc/krb5.conf@
266
<pre>[libdefaults]
267
 default_realm = RND.RU.IS
268
 dns_lookup_realm = true
269
 dns_lookup_kdc = true
270
 allow_weak_crypto = true
271
</pre>
272
* Edit @/etc/ntp.conf@ and set time.rnd.ru.is as the server
273
* Restart ntpd
274
<pre>sudo service ntpd restart</pre>
275
* Edit @/etc/vice/etc/ThisCell@ and put rnd.ru.is in it
276
* Start the services
277
<pre>sudo service openafs-client start</pre>
278
279
280
h1. OSX
281
282
Guides:
283
* General guide http://www.spy-hill.com/~myers/help/apple/OpenAFS.html
284
* Server and tool guide http://workshop.openafs.org/afsbpw06/talks/kula-afsbpw06.pdf
285
286
h3. Install
287
288
# Install the client at http://openafs.org/macos.html
289
# Install the MIT Kerberos extras http://web.mit.edu/macdev/www/osx-kerberos-extras.html
290
# Reboot
291
292
h3. Where is the @krb5.conf@?
293
294
From: http://support.apple.com/kb/TS3265
295
296
Kerberos looks for configuration options in these locations (in this order):
297
# ODbundle (magic DNS)
298
# @~/Library/Preferences/edu.mit.Kerberos@
299
# @/Library/Preferences/edu.mit.Kerberos@
300
# @/etc/krb5.conf@
301
302
If you have not installed the MIT Kerberos extras, the files will not exist.
303
304
h2. Testing
305
306
# Notice the lock icon on the top of the Finder window that allows you to start and stop AFS
307
# To get tickets, you need to open a terminal
308
## Use Spotlight and type "Terminal" or goto Applications > Utilities > Terminal
309
# Use @kinit@ to get tickets.  Replace @user@ with your username
310
## <pre>kinit user@RND.RU.IS</pre>
311
# Use @aklog@ to get AFS tokens
312
## <pre>aklog rnd.ru.is</pre>
313
314
h2. Useful stuff
315
316
The AFS tools are in  @/Library/OpenAFS/Tools/bin/@  You may want to make a symlink to /usr/bin so that you don't have to type the name in all the time
317
<pre>sudo ln -s /Library/OpenAFS/Tools/bin/* /usr/bin/.</pre>
318
319
h1. Common
320
321
At some point in the install, you will may need to adjust the kerberos configuration file.  In the those instructions, you will be referred back to here.  You don't need to do so until instructed.
322
323
On windows systems, this file is @c:\Windows\krb5.ini@.  On OSX and Linux, it is @/etc/krb5.conf@.  See the OSX instructions for alternatives.
324
You can grab a copy at http://afs.rnd.ru.is/project/rndnet/Public/Workstation/etc/krb5.conf
325
Make sure it contains these lines.  There will be more entries in the file, don't delete them. Also, don't copy the ... lines
326
<pre>
327
[libdefaults]
328
default_realm = RND.RU.IS
329
dns_lookup_realm = true
330
dns_lookup_kdc = true
331
# The following krb5.conf variables are only for MIT Kerberos.
332
        krb4_config = /etc/krb.conf
333
        krb4_realms = /etc/krb.realms
334
        kdc_timesync = 1
335
#       ccache_type = 4
336
        forwardable = true
337
        proxiable = true
338
# need this for AFS and MIT
339
        allow_weak_crypto = yes
340
341
#... other stuff ...
342
343
[realms]
344
	RND.RU.IS = {
345
		kdc = kerberos.rnd.ru.is
346
		kdc = kerberos-1.rnd.ru.is
347
		kdc = kerberos-2.rnd.ru.is                
348
		admin_server = kerberos.rnd.ru.is
349
                default_domain = rnd.ru.is
350
	}
351
        CS.RU.IS = {
352
                kdc = ipa.cs.ru.is
353
                admin_server = ipa.cs.ru.is
354
                default_domain = cs.ru.is
355
        }
356
#... more stuff ...
357
358
[domain_realm]
359
        .cs.ru.is = CS.RU.IS
360
        cs.ru.is = CS.RU.IS
361
        .rnd.ru.is = RND.RU.IS
362
        rnd.ru.is = RND.RU.IS
363
364
#... more stuff ...
365
</pre>
366
367
368
h3. Debugging problems in windows
369
370
http://webchat.freenode.net and connect to channel #openafs
371
372
If you need to adjust the Kerberos or CellSrvDB settings.  This is *optional* and only necessary if you can't see the AFS folders after the above directions.
373
* Remember that you need to right-click on your editor first and "Run as administrator" *DO NOT OPEN IN NOTEPAD!  IT WILL MANGLE THE FILE!!!!*
374
* CellServDB is in @c:\Program Files\OpenAFS\Client@
375
<pre>>rnd.ru.is         # Reykjavik University Research and Development Network
376
130.208.242.66          #afsdb1.rnd.ru.is
377
130.208.242.67		#afsdb2.rnd.ru.is
378
130.208.242.68          #afsdb3.rnd.ru.is  
379
</pre>
380
* Now edit @c:\Windows\krb5.ini@.  You shouldn't need to do this if DNS is working right.  Refer to the [[AFS_Client_Installation#Common|Test]] section above for what should go into that file.
381
382
383
Tools:
384
385
* http://technet.microsoft.com/en-us/sysinternals/bb896653
386
* http://technet.microsoft.com/en-us/sysinternals/bb896655
387
388
389
h1. Frequently Asked Questions (FAQ)
390
391
Lots of issues and suggestions here:
392
* http://docs.oracle.com/cd/E19253-01/816-4557/trouble-6/index.html
393
* http://www.ncsa.illinois.edu/UserInfo/Resources/Software/kerberos/troubleshooting.html
394
395
A good place to get help is the #openafs channel at freenode IRC:  https://webchat.freenode.net/
396
397
h2. How do I calculate the maximum cache size?
398
399
See this page:  https://wiki.mageia.org/en/Installing_OpenAFS_Client#Check_correct_cache_size_is_defined
400
401
h2. AFS's module loaded but there is nothing in /afs.  What went wrong?
402
403
You might have a cache size issue or something else stopping the client.
404
Check the logs.  On a systemd/journald system <pre>systemctl status openafs-client</pre>
405
406
h2. I can see the AFS cell, but I can't access my files in my home directory/folder
407
408
This probably means you are not getting tokens.  make sure you see "AFS tokens(1)" next to your name on the Network Identity Manager.
409
If you don't:
410
411
# Menubar: Options > Identities
412
# Click on the username@RND.RU.IS entry
413
# Select the AFS tab
414
# Make sure "rnd.ru.is" is listed in the table.  Make sure that "openafs.org" is not listed.  You can use the "Add/Update" and "Delete" buttons to adjust the list.
415
# Click "Apply"
416
417
Another possibility is that AFS has old data in that particular folder.  This is where the "flush" commands can be useful.  Try these things in this order (it may start working after any of them)
418
419
# Click on the folder, then right-click AFS > Volume/Partition > Refresh name/ID map
420
# Click on the folder, then right-click AFS > Flush File/Dir
421
# Click on the folder, then right-click AFS > Flush Volume
422
# If that doesn't work, restart AFS through the Control Panel or rebooting
423
424
425
h2. "kinit: KDC has no support for encryption type while getting initial credentials"
426
427
This means you need to manually enable weak encryption.  This is needed by AFs in order to get an authentication token.  Older Kerberos servers only use the old encryption types.  Information at https://bugzilla.redhat.com/show_bug.cgi?id=573968
428
429
Solution:  Enable weak crypto
430
# Edit @/etc/krb5.conf@ (or equivalent) 
431
## Add @allow_weak_crypto = yes@ on the @[libdefaults]@ section
432
433
h2. While upgrading Kerberos, you get the need to restart the Kerberos Cache RPC SErver
434
435
Solution: Find the Process ID and kill it on the terminal
436
# Start Menu > Run > @taskkill /F /PID@ PID-number
437
438
h2. AFS appears to be running (windows) but no \\AFS directory
439
440
Oh boy, there are many things that can be wrong here.  First run a virus checker to look for rootkits.
441
442
A problem that we discovered was if the TEMP registry entries are set to a non-absolute path.  (e.g. c:\temp is good foo\bar\temp is bad)
443
444
# open a cmd.exe as administrator
445
# regedit.exe
446
# goto HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
447
# Change the TMP and TEMP entries to a valid path that everyone can access, particularly SYSTEM
448
# Make sure that these (and windir) are all type REG_EXPAND_SZ
449
h1. Reference
450
451
* Ubuntu Serverguide to Kerberos https://help.ubuntu.com/12.04/serverguide/kerberos.html
452
453
h2. Kerberos complains about a generic error and seeing e-text
454
455
Not sure what causes this.  Some google searching implies problems with the directory lookup.  Simplest solution is to just delete the user and re-create