OpenAFS is a distributed file system that can share file system resources efficiently across a LAN or WAN. Some of the features that make OpenAFS standout from the crowd, are:
-
- Improved security: OpenAFS makes use of Kerberos to authenticate users. User passwords are no longer sent across the network as plain text. The encrypted passwords need not be visible either.
- Scalability: OpenAFS files are location independent. This means, the users need not know which server contains the files, they just need to know the file path. Location independence makes OpenAFS highly scalable since the files can be spread across multiple servers, and the client need not keep track of which server holds the file.
- Client side caching: Cache manager at the client side stores files retrieved from the server in disk, there by improving response time and reducing network traffic. It communicates with the server and ensures that the cache contains all the latest files.
- Improved system management capability: The administrator can move user volumes from one server to another, without causing any interruption to service. Also, if configured, users can retrieve files from backup, without intervention from the administrator.
Hire Bobcares Linux Server Administrators
Get super reliable servers and delighted customers
In this article, I will demonstrate how to install and configure the OpenAFS server and client in Ubuntu 9.04. Before going ahead with the OpenAFS installation, install and setup Kerberos and OpenLDAP as per steps given in my previous article on integrating Kerberos and OpenLDAP. It is assumed that the OpenAFS, Kerberos, and OpenLDAP servers are installed in the same server – srv.example.com.
IMPLEMENTATION
1. Install and Setup OpenAFS DB server
-
- Install the required packages
apt-get install openafs-krb5 openafs-dbserver
Copy Code
kadmin: addprinc -randkey afs/example.com
Copy Code
kadmin: ktadd -k /etc/openafs/afs.keytab -e des-cbc-crc:afs3 afs/example.com
Copy Code
-
- Note down the key version number (KVNO).
klist -ke /etc/openafs/afs.keytab
Copy Code
-
- Import the secret key into the AFS security system. Replace “” with the key version number from the above step.
asetkey add
Copy Code
/etc/openafs/afs.keytab afs/example.com
Copy Code
-
- Start bos server with “-noauth” switch and create server instances. It will create and populate the bos server configuration file,
./etc/openafs/BosConfig
Copy Code
- Start bos server with “-noauth” switch and create server instances. It will create and populate the bos server configuration file,
/usr/sbin/bosserver -noauth
Copy Code
bos create srv.example.com ptserver simple /usr/lib/openafs/ptserver -noauth
Copy Code
bos create srv.example.com vlserver simple /usr/lib/openafs/vlserver -noauth
Copy Code
-
- Cross check by listing users in the administrators group.
pts membership system:administrators -noauth
Copy Code
-
- To list all users and groups, use the following commands.
pts listentries -users -noauth #lists users
Copy Code
pts listentries -groups -noauth #lists groups in protection database
Copy Code
-
- Shutdown and restart bos server in auth mode.
$ pkill bosserver
Copy Code
$ /etc/init.d/openafs-fileserver start
Copy Code
2. Configure file server
-
- Install the required packages
apt-get install openafs-fileserver
Copy Code
-
- Create file server instance
bos create srv.example.com fs fs -cmd /usr/lib/openafs/fileserver -cmd /usr/lib/openafs/volserver -cmd /usr/lib/openafs/salvager -localauth
Copy Code
Note: Required only if file server is in a different machine
The following steps are required only if the file server is to be hosted in a different server, say filesrv.example.com.
-
- Install the required packages
apt-get install openafs-fileserver krb5-user openafs-krb5
Copy Code
-
- Use scp command to transfer /etc/openafs/afs.keytab from master database server and import the keys
klist -ke /etc/openafs/afs.keytab #note down KVNO
Copy Code
asetkey add /etc/openafs/afs.keytab afs/cpiv.com
Copy Code
-
- Add the sysadmin user and restart file server
bos adduser filesrv.example.com sysadmin -localauth bos listuser filesrv.example.com -localauth
Copy Code
-
- Create file server instance
bos create filesrv.example.com fs fs -cmd /usr/lib/openafs/fileserver -cmd /usr/lib/openafs/volserver -cmd /usr/lib/openafs/salvager -localauth
Copy Code
3. Create and mount volumes
Volumes are the logical equivalent of local partitions in the network – a space where files and directories are stored with the appearance of a directory.
At least two volumes are required to manage a cell – root volume and cell volume
root volume – contains all other volumes (may be used to mount other cells)
cell volume – contains volumes and files belonging to the cell.
Volumes are held in partitions such as /vicepa, /vicepb, …., /vicepXY (/vicepaa, /vicepyz, /vicepzz, etc..)
Assuming that the file server is in the same server as that of the OpenAFS DB server srv.example.com and /vicepa partition exists, add the volumes using the following commands:
vos create srv vicepa root.afs -localauth
vos create srv vicepa root.cell -localauth
vos create srv vicepa home.user -localauth
Copy Code
#Create volume to contain user home directories
If the file server is in a different server, say filesrv.example.com, replace “srv” with “filesrv” in the above commands.
Install OpenAFS client in the server, so that the volumes can be mounted from within the server.
-
- Install OpenAFS client in the server, so that the volumes can be mounted from within the server.
apt-get install openafs-client
Copy Code
-
- Build the openafs client module
module-assistant auto-install openafs
Copy Code
Remove the unwanted entries from
/etc/openafs/CellServDB
Copy Code
and retain only the servers for example.com realm.
-
- Disable AFS_DYNROOT in
and forcefully start the openafs client./etc/openafs/afs.conf.client
Copy Code
- Disable AFS_DYNROOT in
/etc/init.d/openafs-client force-start
Copy Code
-
- Mount volumes and set the access control list (ACL).
kinit sysadmin
Copy Code
#obtain and cache Kerberos ticket-granting ticketaklog
Copy Code
#Obtain tokens for authentication to AFS
fs listacl /afs
Copy Code
# List ACLfs setacl /afs system:authuser rl
Copy Code
# Allow read permission for authorized users
fs mkmount /afs/example.com root.cell
Copy Code
#mount cell volume to /afs/example.comfs setacl /afs/example.com system:authuser rl
Copy Code
fs mkmount /afs/example.com/home home.user
Copy Code
fs setacl /afs/example.com/home system:authuser rl
Copy Code
4. Adding a user
Create a user in kerberos/LDAP and note down the UID and GID and add the user to OpenAFS with the same UID and GID.
pts createuser vishnu -id 1101
Copy Code
#Add user vishnupts creategroup systems -id -1100
Copy Code
#Create group systemspts adduser vishnu systems
Copy Code
# Add user vishnu to “systems” group
-
- Create user home volume with 3G quota
vos create srv.example.com vicepa user.vishnu -maxquota 3145728 -localauth
Copy Code
-
- Mount the user volume to /afs/example.com/home
fs mkmount /afs/example.com/home/vishnu user.vishnu
Copy Code
-
- Give all permission for user vishnu to the corresponding home directory.
fs setacl /afs/example.com/home/vishnu vishnu all
Copy Code
-
- Chown the home directory as administrative user.
chown vishnu.pivusers /afs/example.com/home/vishnu
Copy Code
chmod 700 /afs/example.com/home/vishnu
Copy Code
5. Setting up the client machine
Test the OpenAFS server by installing OpenAFS client and accessing the mounted folders. Install and configure Kerberos and OpenLDAP clients as per steps given in my previous article on integrating Kerberos and OpenLDAP.
Install OpenAFS client and libpam, required to get tokens upon login.
-
- Install OpenAFS client and libpam, required to get tokens upon login.
apt-get install openafs-client libpam-openafs-session
Copy Code
-
- Build openafs client module.
module-assistant auto-install openafs
Copy Code
Remove the unwanted entries from
/etc/openafs/CellServDB
Copy Code
, and retain only the servers for example.com realm. Client machine is all set, and the OpenAFS user can now login and access the files in his home directory.
REFERENCES
Distributed Services with OpenAFS: for Enterprise and Education
http://docs.openafs.org/index.html
About the Author:
Vishnu Ram is an MTech. in Communication Systems from IIT Madras. He joined Bobcares in 2003, and has been working for Poornam since then. He is currently the Information Security Manager of the company. His areas of interest are Performance tuning, Server monitoring, and Security. During his past time, Vishnu practices Karate, or read books or listen to music.
0 Comments