[0931098] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
| 7 | ]>
|
---|
| 8 |
|
---|
[6ff0105] | 9 | <sect1 id="cvsserver" xreflabel="Running a CVS Server">
|
---|
[a0f03b0] | 10 | <sect1info>
|
---|
[5cd0959d] | 11 | <othername>$LastChangedBy$</othername>
|
---|
| 12 | <date>$Date$</date>
|
---|
[a0f03b0] | 13 | </sect1info>
|
---|
[00bb024c] | 14 | <?dbhtml filename="cvsserver.html"?>
|
---|
[dcc89bf1] | 15 | <title>Running a CVS server</title>
|
---|
[f45b1953] | 16 |
|
---|
[0931098] | 17 | <sect2>
|
---|
| 18 | <title>Running a <acronym>CVS</acronym> server</title>
|
---|
| 19 |
|
---|
| 20 | <para>This section will describe how to set up, administer and secure
|
---|
| 21 | a <acronym>CVS</acronym> server.</para>
|
---|
| 22 |
|
---|
| 23 | <sect3><title><application>CVS server</application> dependencies</title>
|
---|
| 24 | <sect4><title>Required</title>
|
---|
| 25 | <para><xref linkend="cvs"/> and <xref linkend="openssh"/></para></sect4>
|
---|
| 26 | </sect3>
|
---|
| 27 |
|
---|
| 28 | </sect2>
|
---|
| 29 |
|
---|
| 30 | <sect2>
|
---|
| 31 | <title>Setting up a <acronym>CVS</acronym> server.</title>
|
---|
| 32 |
|
---|
| 33 | <para>A <acronym>CVS</acronym> server will be set up using OpenSSH
|
---|
| 34 | as the remote access method. Other access methods, including :pserver: and
|
---|
| 35 | :server: will not be used for write access to the <acronym>CVS</acronym>
|
---|
| 36 | repository. The :pserver: method sends clear text passwords over the network
|
---|
| 37 | and the :server: method is not supported in all <acronym>CVS</acronym> ports.
|
---|
| 38 | Instructions for anonymous, read only <acronym>CVS</acronym> access using
|
---|
| 39 | :pserver: can be found at the end of this section.</para>
|
---|
| 40 |
|
---|
| 41 | <para>Configuration of the <acronym>CVS</acronym> server consists of four
|
---|
| 42 | steps:</para>
|
---|
| 43 |
|
---|
| 44 | <sect3><title>1. Create a repository.</title>
|
---|
| 45 | <para>Create a new <acronym>CVS</acronym> repository with the following
|
---|
| 46 | commands:</para>
|
---|
[affc260] | 47 | <screen><userinput><command>mkdir /srv/cvsroot &&
|
---|
| 48 | chmod 1777 /srv/cvsroot &&
|
---|
| 49 | export CVSROOT=/srv/cvsroot &&
|
---|
[0931098] | 50 | cvs init</command></userinput></screen></sect3>
|
---|
| 51 |
|
---|
| 52 | <sect3><title>2. Import source code into the repository.</title>
|
---|
| 53 | <para>Import a source module into the repository with the following
|
---|
| 54 | commands, issued from a user account on the same machine as the
|
---|
| 55 | <acronym>CVS</acronym> repository:</para>
|
---|
| 56 |
|
---|
[266724ee] | 57 | <screen><userinput><command>cd <replaceable>[sourcedir]</replaceable> &&
|
---|
| 58 | cvs import -m "<replaceable>[repository test]</replaceable>" <replaceable>[cvstest]</replaceable> <replaceable>[vendortag]</replaceable> <replaceable>[releasetag]</replaceable></command></userinput></screen></sect3>
|
---|
[0931098] | 59 |
|
---|
| 60 | <sect3><title>3. Verify local repository access.</title>
|
---|
| 61 | <para>Test access to the <acronym>CVS</acronym> repository from the same user
|
---|
| 62 | account with the following command:</para>
|
---|
| 63 |
|
---|
| 64 | <screen><userinput><command>cvs co cvstest</command></userinput></screen></sect3>
|
---|
| 65 |
|
---|
| 66 | <sect3><title>4. Verify remote repository access.</title>
|
---|
| 67 | <para>Test access to the <acronym>CVS</acronym> repository from a remote
|
---|
| 68 | machine using a user account that has <command>ssh</command> access to the
|
---|
| 69 | <acronym>CVS</acronym> server with the following commands:</para>
|
---|
| 70 | <note><para>Replace <replaceable>[servername]</replaceable> with the
|
---|
| 71 | <acronym>IP</acronym> address or host name of the <acronym>CVS</acronym>
|
---|
| 72 | repository machine. You will be prompted for the user's shell account password
|
---|
| 73 | before <acronym>CVS</acronym> checkout can continue.</para></note>
|
---|
| 74 |
|
---|
| 75 |
|
---|
| 76 | <screen><userinput><command>export CVS_RSH=/usr/bin/ssh &&
|
---|
[affc260] | 77 | cvs -d:ext:<replaceable>[servername]</replaceable>:/srv/cvsroot co cvstest</command></userinput></screen></sect3>
|
---|
[0931098] | 78 | </sect2>
|
---|
| 79 | <sect2>
|
---|
| 80 | <title>Configuring <acronym>CVS</acronym> for anonymous read only access.</title>
|
---|
| 81 |
|
---|
| 82 | <para><acronym>CVS</acronym> can be set up to allow anonymous read only access
|
---|
| 83 | using the :pserver: method by logging on as root and executing the following
|
---|
| 84 | commands:</para>
|
---|
| 85 |
|
---|
| 86 | <screen><userinput><command>(grep anonymous /etc/passwd || useradd anonymous -s /bin/false) &&
|
---|
[affc260] | 87 | echo anonymous: > /srv/cvsroot/CVSROOT/passwd &&
|
---|
| 88 | echo anonymous > /srv/cvsroot/CVSROOT/readers</command></userinput></screen>
|
---|
[0931098] | 89 |
|
---|
| 90 | <para>If you use <command>inetd</command>, the following command will add the
|
---|
| 91 | pserver entry to <filename>/etc/inetd.conf</filename>:</para>
|
---|
| 92 |
|
---|
| 93 | <screen><userinput><command>echo "2401 stream tcp nowait root /usr/bin/cvs cvs -f \
|
---|
[affc260] | 94 | --allow-root=/srv/cvsroot pserver" >> /etc/inetd.conf</command></userinput></screen>
|
---|
[0931098] | 95 |
|
---|
| 96 | <para>Issue a <command>killall -HUP inetd</command> to reread the changed
|
---|
| 97 | <filename>inetd.conf</filename> file.</para>
|
---|
| 98 |
|
---|
| 99 | <para>If you use <command>xinetd</command>, the following command will add the
|
---|
| 100 | pserver entry to <filename>/etc/xinetd.conf</filename>:</para>
|
---|
| 101 |
|
---|
| 102 | <screen><userinput><command>cat >> /etc/xinetd.conf << "EOF"</command>
|
---|
| 103 | service cvspserver
|
---|
| 104 | {
|
---|
| 105 | port = 2401
|
---|
| 106 | socket_type = stream
|
---|
| 107 | protocol = tcp
|
---|
| 108 | wait = no
|
---|
| 109 | user = root
|
---|
| 110 | passenv = PATH
|
---|
| 111 | server = /usr/bin/cvs
|
---|
[affc260] | 112 | server_args = -f --allow-root=/srv/cvsroot pserver
|
---|
[0931098] | 113 | }
|
---|
| 114 | <command>EOF</command></userinput></screen>
|
---|
| 115 | <para>Issue a <command>/etc/rc.d/init.d/xinetd reload</command> to reread the changed
|
---|
| 116 | <filename>xinetd.conf</filename> file.</para>
|
---|
| 117 |
|
---|
| 118 | <para>Testing anonymous access to the new repository requires an account
|
---|
| 119 | on another machine that can reach the <acronym>CVS</acronym> server via
|
---|
| 120 | network. No account on the <acronym>CVS</acronym> repository is needed. To
|
---|
| 121 | test anonymous access to the <acronym>CVS</acronym> repository, log in to
|
---|
| 122 | another machine as an unprivileged user and execute the following command:
|
---|
| 123 | </para>
|
---|
| 124 |
|
---|
[affc260] | 125 | <screen><userinput><command>cvs -d:pserver:anonymous@<replaceable>[servername]</replaceable>:/srv/cvsroot co cvstest</command></userinput></screen>
|
---|
| 126 | <note><para>Replace <replaceable>[servername]</replaceable> with the
|
---|
| 127 | <acronym>IP</acronym> address or hostname of the
|
---|
| 128 | <acronym>CVS</acronym> server.</para></note>
|
---|
[0931098] | 129 |
|
---|
| 130 | </sect2>
|
---|
| 131 |
|
---|
| 132 | <sect2>
|
---|
| 133 | <title>Command explanations</title>
|
---|
| 134 |
|
---|
[affc260] | 135 | <para><command>mkdir /srv/cvsroot</command>: Create the <acronym>CVS</acronym>
|
---|
[0931098] | 136 | repository directory.</para>
|
---|
| 137 |
|
---|
[affc260] | 138 | <para><command>chmod 1777 /srv/cvsroot</command>: Set sticky bit permissions for
|
---|
[0931098] | 139 | <envar>CVSROOT</envar>.</para>
|
---|
| 140 |
|
---|
[affc260] | 141 | <para><command>export CVSROOT=/srv/cvsroot</command>: Specify new <envar>CVSROOT
|
---|
[0931098] | 142 | </envar> for all <command>cvs</command> commands.</para>
|
---|
| 143 |
|
---|
| 144 | <para><command>cvs init</command>: Initialize the new <acronym>CVS</acronym>
|
---|
| 145 | repository.</para>
|
---|
| 146 |
|
---|
| 147 | <para><command>cvs import -m "repository test" cvstest vendortag
|
---|
| 148 | releasetag</command>: All source code modules must be imported
|
---|
| 149 | into the <acronym>CVS</acronym> repository before use, with the
|
---|
| 150 | <command>cvs import</command> command. The <userinput>-m</userinput>
|
---|
| 151 | flags specifies an initial descriptive entry for the new module.
|
---|
| 152 | The "cvstest" parameter is the name used for the module in all
|
---|
| 153 | subsequent <command>cvs</command> commands. The "vendortag" and "releasetag"
|
---|
| 154 | parameters are used to further identify each <acronym>CVS</acronym> module and
|
---|
| 155 | are mandatory whether used or not.</para>
|
---|
| 156 |
|
---|
| 157 | <para><command>(grep anonymous /etc/passwd || useradd anonymous -s
|
---|
| 158 | /bin/false)</command>: Check for an existing anonymous user and
|
---|
| 159 | create one if not found.</para>
|
---|
| 160 |
|
---|
[affc260] | 161 | <para><command>echo anonymous: > /srv/cvsroot/CVSROOT/passwd
|
---|
[0931098] | 162 | </command>: Add the anonymous user to the <acronym>CVS</acronym> passwd file,
|
---|
| 163 | which is unused for anything else in this configuration.</para>
|
---|
| 164 |
|
---|
[affc260] | 165 | <para><command>echo anonymous > /srv/cvsroot/CVSROOT/readers</command>: Add the
|
---|
[0931098] | 166 | anonymous user to the <acronym>CVS</acronym> readers file, a list of
|
---|
| 167 | users who have read only access to the repository.</para>
|
---|
| 168 |
|
---|
| 169 | </sect2>
|
---|
[f45b1953] | 170 |
|
---|
| 171 | </sect1>
|
---|