Sun Java System Web Server 7.0 Developer's Guide

ProcedureTo Install suid and Cgistub Directories

  1. Login as a superuser.

  2. Create the private directory for Cgistub:

    cd install_dir/https-instance

    mkdir private

    Note –

    Installing Cgistub in the install_dir/https-instance/private directory is recommended. If you install it anywhere else, you must specify the path to Cgistub in the init-cgi function in magnus.conf. For details, see the Sun Java System Web Server 7.0 Administrator’s Configuration File Reference.

    Note –

    It is not possible to install the suid Cgistub program on an NFS mount. If you wish to use an suid Cgistub, you must install your server instance to a local file system.

  3. Copy Cgistub to the private directory:

    cd private

    cp ../../lib/Cgistub.

  4. Set the owner of private to the server user:

    chown user .

  5. Set the permissions on private:

    chmod 500.

  6. Set the owner of Cgistub to root:

    chown root Cgistub

  7. Set the permissions on Cgistub:

    chmod 4711 Cgistub

  8. You can give each reference to the send-cgi SAF in obj.conf a user parameter.

    For example: Service fn="send-cgi" user="user"

    You can use variable substitution. For example, in server.xml, give a virtual-server element the following variable subelement:

    <variable user="user"\>

    This modification to the server.xml allows you to write the send-cgi SAF line in the obj.conf as follows:

    Service fn="send-cgi" user="$user"

    For more information about server.xml and send-cgi in the obj.conf file and , see the Sun Java System Web Server 7.0 Administrator’s Configuration File Reference.

  9. Restart the server to apply the changes.

    Cgistub enforces the following security restrictions:

    • The user the CGI program executes as must have a uid of 100 or greater. This prevents anyone from using Cgistub to obtain root access.

    • The CGI program must be owned by the user it is executed as and must not be writable by anyone other than its owner. This makes it difficult for anyone to covertly inject and then remotely execute programs.

    • Cgistub creates its UNIX listen socket with 0700 permissions.

      Note –

      Socket permissions are not respected on a number of UNIX variants, including current versions of Sun operating systems/Solaris. To prevent a malicious user from exploiting Cgistub, ensure that the server's temporary directory is set (using the server.xml temp-path element) to a directory accessible only to the server user.