CVSPermissions

Author: Vivek Venugopalan

Revision History
Revision 0.5 2003-06-29 vv
Added support for CVS Tags
Revision 0.4 2003-06-17 vv
Pointed to sarovar.org
Revision 0.3 2002-12-14 vv
Added more information to the ‘how’ section
Revision 0.2 2002-12-07 vv
Revised the documentation to be in sync with the code
Revision 0.1 2002-09-29 vv
Initial version of the document created

Table of Contents

1. Introduction to CVSPermissions
2. Why CVSPermissions
3. Pre-requisites
4. Getting the toolkit
5. Installing CVSPermissions
6. Configuring CVSPermissions
6.1. One time configuration
6.2. Setting up User privileges
6.3. Setting up access rights for Restricted Users
7. How does CVSPermissions work
7.1. Background
7.2. Key Configuration Files
7.3. Mechanism
8. Conclusion

Abstract

This is the detailed documentation for the CVSPermissions toolkit. This will contain all relevant and necessary information for deploying and using the CVSPermissions toolkit.

1. Introduction to CVSPermissions

CVSPermissions is a toolkit that will allow CVS administrators to setup directory level access permissions in CVS. This toolkit is a collection of shell scripts and few CVS configuration information to achieve the said functionality.

CVS, for the uninitiated, is a source code version control tool that is very popular in the open source world. The tool is extremely stable and robust with good scalability for large products. More information about CVS can be found at the following sites.

2. Why CVSPermissions

CVS supports the concept of multiple users. These users are allowed to commit and checkout files in all directories in the repository. The ability read and write access for each user in the repository is a built-in capability of CVS and is controlled by the files. CVSROOT/readers and CVSROOT/writers files.

CVS does not have the capability to restrict commits by users at the directory/sub-directory level in a repository. There is a need by more than one user of CVS for fine grained access control in CVS at the directory/sub-directory level. Thus was born the CVSPermissions toolkit.

3. Pre-requisites

The pre-requisites for using the CVSPermissions toolkit are

  1. CVS server must be running on a *NIX system (all the scripts have been written in /bin/sh). The clients can be on any platform though.

  2. System Authentication must be used (SystemAuth=yes in CVSROOT/config)

4. Getting the toolkit

The toolkit can be downloaded the open source software site Sarovar.org. The latest version of the toolkit is Version 0.3 and can be downloaded from the following link CVSPermissions Download page

5. Installing CVSPermissions

  1. Login as root in your *NIX system

  2. create the directory /usr/local/bin/cvstools to host the files

  3. untar the file cvspermissions-0.3.tar.gz in /usr/local/bin/cvstools

  4. Ensure that all the shell scripts have execute permission chmod +x *.sh

6. Configuring CVSPermissions

6.1. One time configuration

CVSPermissions requires a one-time configuration that can be done anytime after a CVS repository has been created. This configuration is done using the configuration script cvspermsetup.sh. This script must be executed after you have logged into CVS. The sequence of steps is shown below.

<div>

vivek@chintu>export CVSROOT=:pserver:vivek@chintu:/cvsroot
vivek@chintu>cvs login
(Logging in to vivek@chintu)
CVS password:
vivek@chintu>cvspermsetup.sh
</div>

This script will create/modify the necessary files in the CVSROOT module of the repository to enable CVSPermissions.

6.2. Setting up User privileges

New users in CVSPermissions belong to three categories.

  1. Regular users: Users who have complete commit and tagging privileges for all the directories in the repository.

  2. Restricted users: Users who have restricted commit and tagging privileges to some of the directories in the repository.

  3. Read only users: Users who have read-only access privileges to the entire repository. They will not be able to commit/tag files to the repository.

6.2.1. Adding a New User

For all the three types of users, the first step is to create an Operating system (OS) user. After an OS user has been created, the cvspermuseradd.sh script will help setup the different kinds of users

  1. Regular Users: Regular users can be setup using the following command

     <div>

    vivek@chintu>cvspermuseradd.sh -n USERNAME </div>
  2. Restricted Users: Restricted users can be added using the following command

     <div>

    vivek@chintu>cvspermuseradd.sh -s USERNAME </div>

    Note

    This will setup a restricted user but the actual directory level permissions for the user is not setup now. The default setup will create a user with NO commit permission to the entire repository but complete read only access to the entire repository. A different script will setup the actual directory permissions.

  3. Read-only Users: Read-only users can be setup using the following command

     <div>

    vivek@chintu>cvspermuseradd.sh -r USERNAME </div>

6.2.2. Removing an existing user

An existing user can be removed from CVS using the following command

<div>

vivek@chintu>cvspermuserdel.sh USERNAME
</div>

This script will revoke all access permissions to an existing user in CVS. Further, this command will also remove all the directory restriction settings for a restricted user.

6.2.3. Enable/Disable user(s)

There are situations when a user has to be temporarily disabled from committing/tagging files to the repository. At a later point in time the same user has to be re-enabled with prior access restrictions intact. In such a situation, the following command can be used.

Disable user(s)

<div>

vivek@chintu>cvspermuserctl.sh -d USERNAME
</div>

Enable user(s)

<div>

vivek@chintu>cvspermuserctl.sh -e USERNAME
</div>

6.3. Setting up access rights for Restricted Users

This section deals with commands that will help establish the access permissions for restricted CVS users. As described before, access control is at the directory level within a repository. Access includes, committing files and tagging files. The command cvspermuserdir.sh can add or remove directories to which the user has commit rights.

Add access rights for a directory

<div>

vivek@chintu>cvspermuserdir.sh USERNAME -a DIRNAME
</div>

Revoke access rights for a directory

<div>

vivek@chintu>cvspermuserdir.sh USERNAME -d DIRNAME
</div>

Note

The directory name must be a full path of the directory name including the repository starting prefix. A partial directory name will result in allowing write access to directories that has this partial name as part of its path.

7. How does CVSPermissions work

7.1. Background

CVSPermissions is a group of shell scripts and configuration files. The shell scripts can be broken into two categories

  1. Configuration Scripts: Scripts that will help the CVS administrator add users, modify directories etc.,. These scripts in turn add or change information in the configuration files that will be used by the Control scripts during CVS operations.

  2. Control Scripts: Control scripts are executed by CVS server automatically when a particular action occurs. For example during file commits, tagging files etc., These scripts read information from the configuration files to determine whether the particular action is permitted. If the action is not permitted, it exits with return code 1 to indicate to the CVS server to abort the operation. The server in turn would communicate back to the client the error message returned by the control script.

7.2. Key Configuration Files

  1. CVSROOT/writers and CVSROOT/readers: These files are part of base CVS configuration. They control all the read/write accesses to the repository. User IDs present in these files are allowed to have read/write access to the repository. CVSPermissions uses these files extensively to control access to the repository. Further, it builds on top of this capability to provide directory level permissions.

  2. CVSROOT/users.restricted: This file is used by CVSPermissions to determine the list of users who have restricted access in the system. The control script uses this list of users to determine whether further permission verification is required

  3. CVSROOT/$USER.permission: Each user listed in CVSROOT/users.restrictedshould have a corresponding file that tracks specific permissions for that user. User level access permission is maintained in the CVSROOT/$USER.permission file.

7.3. Mechanism

In the CVS toolkit collection of scripts, the script cvspermissions.sh and cvspermtagcheck.share control scripts that will be triggered each time a file is committed or tagged to the CVS database respectively. These scripts get information from the various configuration files to determine whether the particular commit operation is valid. If the operation is invalid due to access permissions setup for the particular user in a folder, the script will exit with a return code of 1. This will cause CVS to fail the current process and return an error message to the person changing the file.

The configuration scripts will modify the information stored in the configuration files for the control scripts to work. These configuration files are in turned stored in the “CVSROOT” module of the repository. Further, these files are setup in such a way that any changes to them will cause CVS to rebuild its administrative database.

The shell script cvspermsetup.sh performs the initial setup of the repository including association of the control files with CVS commit operations and adding the configuration files to the CVSROOT module.

8. Conclusion

I hope you have found the toolkit useful. Please send me comments, bugs corrections to vivek at magic hypen cauldron.com. That will help me bring out a better toolkit.