7.4. Configuration Examples 7.4.1. Setting up CVS This example describes a simple CVS setup and an SELinux configuration which allows remote access. Two hosts are used in this example; a CVS server with a host name of cvs-srv with an IP address of 192.168.1.1 and a client with a host name of cvs-client and an IP address of 192.168.1.100 . Both hosts are on the same subnet (192.168.1.0/24). This is an example only and assumes that the cvs and xinetd packages are installed, that the SELinux targeted policy is used, and that SELinux is running in enforced mode. This example will show that even with full DAC permissions, SELinux can still enforce policy rules based on file labels and only allow access to certain areas that have been specifically labeled for access by CVS. Note Steps 1-9 should be performed on the CVS server, cvs-srv . This example requires the cvs and xinetd packages. Run the rpm -q cvs command to see if the cvs package is installed. If it is not installed, run the following command as the root user to install cvs : Run the rpm -q xinetd command to see if the xinetd package is installed. If it is not installed, run the following command as the root user to install xinetd : Create a group named CVS . This can be done via the groupadd CVS command as the root user, or by using the system-config-users tool. Create a user with a user name of cvsuser and make this user a member of the CVS group. This can be done using the system-config-users tool. Edit the /etc/services file and make sure that the CVS server has uncommented entries looking similar to the following: Create the CVS repository in the root area of the file system. When using SELinux, it is best to have the repository in the root file system so that recursive labels can be given to it without affecting any other subdirectories. For example, as the root user, create a /cvs/ directory to house the repository: Give full permissions to the /cvs/ directory to all users: Warning This is an example only and these permissions should not be used in a production system. Edit the /etc/xinetd.d/cvs file and make sure that the CVS section is uncommented and configured to use the /cvs/ directory. The file should look similar to: Start the xinetd daemon by running the service xinetd start command as the root user. Add a rule which allows inbound connections using TCP on port 2401 by using the system-config-firewall tool. As the cvsuser user, run the following command: At this point, CVS has been configured but SELinux will still deny logins and file access. To demonstrate this, set the USDCVSROOT variable on cvs-client and try to log in remotely. The following step should be performed on cvs-client : SELinux has blocked access. In order to get SELinux to allow this access, the following step should be performed on cvs-srv : Change the context of the /cvs/ directory as the root user in order to recursively label any existing and new data in the /cvs/ directory, giving it the cvs_data_t type: The client, cvs-client should now be able to log in and access all CVS resources in this repository:

Commands:
~]# yum install cvs
~]# yum install xinetd
cvspserver 2401/tcp # CVS client/server operations cvspserver 2401/udp # CVS client/server operations
mkdir /cvs
chmod -R 777 /cvs
service cvspserver { disable = no port = 2401 socket_type = stream protocol = tcp wait = no user = root passenv = PATH server = /usr/bin/cvs env = HOME=/cvs server_args = -f --allow-root=/cvs pserver # bind = 127.0.0.1
[cvsuser@cvs-client]USD cvs -d /cvs init
[cvsuser@cvs-client]USD export CVSROOT=:pserver:cvsuser@192.168.1.1:/cvs [cvsuser@cvs-client]USD [cvsuser@cvs-client]USD cvs login Logging in to :pserver:cvsuser@192.168.1.1:2401/cvs CVS password: ******** cvs [login aborted]: unrecognized auth response from 192.168.100.1: cvs pserver: cannot open /cvs/CVSROOT/config: Permission denied
semanage fcontext -a -t cvs_data_t '/cvs(/.*)?' restorecon -R -v /cvs
[cvsuser@cvs-client]USD export CVSROOT=:pserver:cvsuser@192.168.1.1:/cvs [cvsuser@cvs-client]USD [cvsuser@cvs-client]USD cvs login Logging in to :pserver:cvsuser@192.168.1.1:2401/cvs CVS password: ******** [cvsuser@cvs-client]USD