Project

General

Profile

Greenqloud AFS » History » Version 1

Joseph Foley, 2015-09-05 02:45

1 1 Joseph Foley
h1. Greenqloud AFS
2
3
This is a project to make it easy to add more storage to an AFS cell (in this case dev.ru.is) using the "greenqloud":https://my.greenqloud.com/ service.  Idea inception by Joe Foley <foley@ru.is> on Friday Feb 8 at the "greenqloud-RU hackathon":http://hackathon.greenqloud.com/
4
5
h2. References/Links
6
7
* DevNet AFS Server page. Needs DevNet developer access:  [[devnet:AFS Server]]
8
* Greenqloud https://my.greenqloud.com
9
* Hackathon wiki http://hackathonwiki.greenqloud.com/index.php/Main_Page
10
* OpenAFS forum post on adding fileserver https://lists.openafs.org/pipermail/openafs-info/2006-September/023495.html
11
* DNS and Kerberos issues http://www.faqs.org/faqs/kerberos-faq/general/section-47.html
12
13
h2. Installation
14
15
h3. Server basics
16
17
# Create a greenqloud instance.  Minimum suggested settings: 
18
## Image: Ubuntu Server 12.04.1 LTS
19
## Size: Milli (1 CPU, 1024MB memory)
20
## Additional disk: Nano (10GB)
21
## Reserved IP Address
22
## Security group: (if you've already setup the AFS ports in a group, use them.  Otherwise default)
23
## Name: afsfs<NUM>
24
# setup the ports if you didn't have a security group setup
25
## TCP: 22, 88, 464, 749
26
## UDP: 88, 464, 749, 4444, 9878, 7000-7007
27
# Attach some additional storage for the AFS partition.  This can be whatever you need.  Remember what the partition name is.
28
# Login to the server and update the packages
29
<pre>apt-get -y update; apt-get -y upgrade</pre>
30
31
h3. DNS
32
33
We'll be creating a convenience DNS name @afsfs6.dev.ru.is@ for the server.  This is optional, but very helpful.  The rest of the instructions assume that you have completed this step.
34
35
# Login to the DevNet DNS server: @ns1.dev.ru.is@
36
# Become root
37
<pre>ksu</pre>
38
# Add a CNAME pointer at the bottom of the file to the server e.g.:
39
<pre>afsfs6         in        a     46.149.19.79   ; greenqloud afstest2</pre>
40
# Restart the named
41
<pre>service named restart</pre>
42
43
h3. Kerberos
44
45
You can skip this part if you're not going to login to the machine much, but it's rather useful.  The rest of these instructions assume you have completed this step.  If you haven't, you will need to replace @ksu@ with @sudo su -@
46
# Become root
47
<pre>sudo su -</pre>
48
# Install the kerberos packages (clients and user utilities)
49
<pre>apt-get -y install krb5-user krb5-clients</pre>
50
## When it asks, put your Kerberos realm.  This is @DEV.RU.IS@ for our system.
51
# Copy over the kerberos config from one of the DevNet servers.  This can be downloaded using wget from our AFS web gateway.
52
<pre>cd /etc
53
rm krb5.conf
54
wget http://afs.dev.ru.is/project/devnet/Public/Workstation/etc/krb5.conf</pre>
55
# Now get srvtabs for the internal and external names of the machine
56
<pre>
57
ifconfig | grep inet | head -1
58
          inet addr:10.1.1.205  Bcast:10.1.1.255  Mask:255.255.255.0
59
host 10.1.1.205
60
205.1.1.10.in-addr.arpa domain name pointer i-88917dc6.greenqloud.internal.
61
kadmin
62
Authenticating as principal foley/admin@DEV.RU.IS with password.
63
Password for foley/admin@DEV.RU.IS: 
64
kadmin:  ank -policy host -randkey host/i-46-149-19-79.compute.is-1.greenqloud.com
65
Principal "host/i-46-149-19-79.compute.is-1.greenqloud.com@DEV.RU.IS" created.
66
kadmin:  ktadd host/i-46-149-19-79.compute.is-1.greenqloud.com
67
Entry for principal host/i-46-149-19-79.compute.is-1.greenqloud.com with kvno 2, encryption type aes256-cts-hmac-sha1-96 added to keytab FILE:/etc/krb5.keytab.
68
Entry for principal host/i-46-149-19-79.compute.is-1.greenqloud.com with kvno 2, encryption type arcfour-hmac added to keytab FILE:/etc/krb5.keytab.
69
Entry for principal host/i-46-149-19-79.compute.is-1.greenqloud.com with kvno 2, encryption type des3-cbc-sha1 added to keytab FILE:/etc/krb5.keytab.
70
Entry for principal host/i-46-149-19-79.compute.is-1.greenqloud.com with kvno 2, encryption type des-cbc-crc added to keytab FILE:/etc/krb5.keytab.
71
kadmin:  ank -policy host -randkey host/i-88917dc6.greenqloud.internal
72
Principal "host/i-88917dc6.greenqloud.internal@DEV.RU.IS" created.
73
kadmin:  ktadd host/i-88917dc6.greenqloud.internal
74
Entry for principal host/i-88917dc6.greenqloud.internal with kvno 2, encryption type aes256-cts-hmac-sha1-96 added to keytab FILE:/etc/krb5.keytab.
75
Entry for principal host/i-88917dc6.greenqloud.internal with kvno 2, encryption type arcfour-hmac added to keytab FILE:/etc/krb5.keytab.
76
Entry for principal host/i-88917dc6.greenqloud.internal with kvno 2, encryption type des3-cbc-sha1 added to keytab FILE:/etc/krb5.keytab.
77
Entry for principal host/i-88917dc6.greenqloud.internal with kvno 2, encryption type des-cbc-crc added to keytab FILE:/etc/krb5.keytab.
78
kadmin: quit
79
</pre>
80
# Give your user permission to @ksu@ as root.  Edit @/root/.k5login@ and add your kerberos principal, e.g. foley@DEV.RU.IS.
81
# Now test @ksu@
82
<pre>ksu
83
Authenticated foley@DEV.RU.IS
84
Account root: authorization for foley@DEV.RU.IS successful
85
Changing uid to root (0)</pre>
86
87
# Note, there is some weird issue with getting GSSAPI ssh to work from external connections.  I'm looking into it.
88
89
h3. AFS Server
90
91
# Login to the server and become root
92
<pre>ksu</pre>
93
# Install packages (debian/ubuntu).  This may take a while because DKMS needs to compile the openafs kernel module.
94
<pre>apt-get install -y openafs-krb5 openafs-fileserver</pre>
95
## The cell for DevNet is @dev.ru.is@  *Note!  This is lower-case!*
96
## Accept the default cache size on the server
97
# Start the AFS client on the machine.  It will start on reboot also
98
<pre>service openafs-client start</pre>
99
# Check that you can see the dev.ru.is cell
100
<pre>ls /afs/dev.ru.is
101
activity  dept  org      reference   service   system
102
course    host  project  robots.txt  software  user
103
</pre>
104
# Partition our data partition.  Just make a standard linux primary partition
105
<pre> fdisk /dev/vdb</pre>
106
# Format the partition.  Ext2 or Ext3 work well.  Ext4 apparently has issues.
107
<pre>mkfs.ext3 -m 0 -L vicepa /dev/vdb1</pre>
108
# Make the vicepa directory.  AFS uses any /vice?? directories available to store volume data.
109
<pre>mkdir /vicepa</pre>
110
# Add a line to @/etc/fstab@ that will automount it
111
<pre>echo "/dev/vdb1 /vicepa ext3 defaults 0 3" >> /etc/fstab</pre>
112
# Test the automount
113
<pre>mount -a
114
ls /vicepa
115
lost+found
116
</pre>
117
# Copy over the files needed to properly configure the AFS server
118
<pre>cp -r /afs/dev.ru.is/project/devnet/Public/AFS-server/etc/openafs/* /etc/openafs/.</pre>
119
# Copy over the key (encrypted)
120
<pre>scp root@afsdb1.dev.ru.is:/etc/openafs/server/KeyFile /etc/openafs/server/.</pre>
121
# Check that the key is installed properly
122
<pre>setkey list
123
kvno    5: key is: 3476928054b676e3
124
All done.
125
</pre>
126
# Install a fileserver instance using the @bos@ utility
127
<pre>bos create localhost fs fs -cmd /usr/lib/openafs/fileserver -cmd /usr/lib/openafs/volserver -cmd /usr/lib/openafs/salvager -localauth</pre>
128
# Make sure that the instance appears happy
129
<pre> bos status localhost -localauth
130
Instance fs, currently running normally.
131
    Auxiliary status is: file server running.</pre>
132
# Also look into the vicepa for the new data files
133
<pre>ls /vicepa
134
AFSIDat  Lock  lost+found
135
</pre>
136
137
h3. Creating and mounting volumes
138
139
# Become an AFS administrator and get tokens
140
<pre>kinit foley/afsadm@DEV.RU.IS; aklog</pre>
141
# Create a volume of size 3GB(3000000KB) on partition a (/vicepa) of server afsfs6
142
<pre>vos create afsfs6.dev.ru.is a tmp.greenqloud 3000000</pre>
143
# Mount the volume somewhere sensible
144
<pre>fs mkmount /afs/dev.ru.is/service/greenqloud tmp.greenqloud</pre>
145
# Put someone on the access list for the new volume
146
<pre>fs setacl  /afs/dev.ru.is/service/greenqloud foley all </pre>
147
148
149
h2. Later stuff learned from the first try
150
151
* Make sure that your superusers are in /etc/openafs/server/UserList e.g.
152
<pre>root.admin
153
foley.afsadm</pre>