18.4. Configuration Examples
18.4.1. Setting up CVS Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
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 are supposed be performed on the CVS server,
cvs-srv
.
- This example requires the cvs and xinetd packages. Confirm that the packages are installed:
rpm -q cvs xinetd
[cvs-srv]$ rpm -q cvs xinetd package cvs is not installed package xinetd is not installed
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If they are not installed, use theyum
utility as root to install it:yum install cvs xinetd
[cvs-srv]# yum install cvs xinetd
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Enter the following command as root to create a group named
CVS
:groupadd CVS
[cvs-srv]# groupadd CVS
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This can by also done by using thesystem-config-users
utility. - Create a user with a user name of
cvsuser
and make this user a member of the CVS group. This can be done usingsystem-config-users
. - Edit the
/etc/services
file and make sure that the CVS server has uncommented entries looking similar to the following:cvspserver 2401/tcp # CVS client/server operations cvspserver 2401/udp # CVS client/server operations
cvspserver 2401/tcp # CVS client/server operations cvspserver 2401/udp # CVS client/server operations
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 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 root, create a
/cvs/
directory to house the repository:mkdir /cvs
[root@cvs-srv]# mkdir /cvs
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Give full permissions to the
/cvs/
directory to all users:chmod -R 777 /cvs
[root@cvs-srv]# chmod -R 777 /cvs
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Start the
xinetd
daemon:systemctl start xinetd.service
[cvs-srv]# systemctl start xinetd.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Add a rule which allows inbound connections through TCP on port 2401 by using the
system-config-firewall
utility. - On the client side, enter the following command as the
cvsuser
user:cvs -d /cvs init
[cvsuser@cvs-client]$ cvs -d /cvs init
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - At this point, CVS has been configured but SELinux will still deny logins and file access. To demonstrate this, set the
$CVSROOT
variable oncvs-client
and try to log in remotely. The following step is supposed to be performed oncvs-client
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow SELinux has blocked access. In order to get SELinux to allow this access, the following step is supposed to be performed oncvs-srv
: - Change the context of the
/cvs/
directory as root in order to recursively label any existing and new data in the/cvs/
directory, giving it thecvs_data_t
type:semanage fcontext -a -t cvs_data_t '/cvs(/.*)?' restorecon -R -v /cvs
[root@cvs-srv]# semanage fcontext -a -t cvs_data_t '/cvs(/.*)?' [root@cvs-srv]# restorecon -R -v /cvs
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - The client,
cvs-client
should now be able to log in and access all CVS resources in this repository:Copy to Clipboard Copied! Toggle word wrap Toggle overflow