Copia y creación de repositorios de paquetes en Oracle® Solaris 11.2

Salir de la Vista de impresión

Actualización: Septiembre de 2014
 
 

Ejemplo completo de repositorios seguros

En este ejemplo, se configuran tres repositorios seguros denominados repo1, repo2 y repo3. Los repositorios repo1 y repo2 están configurados con certificados dedicados. Por lo tanto, los certificados para repo1 no funcionarán en repo2 y los certificados para repo2 no funcionarán en repo1. El repositorio repo3 está configurado para aceptar cualquier certificado.

El ejemplo supone que usted dispone de un certificado de servidor adecuado para la instancia Apache ya disponible. Si no tiene un certificado de servidor para la instancia Apache, consulte las instrucciones para crear un certificado de prueba en Creación de una autoridad de certificación de servidor autofirmado.

Los tres repositorios se configuran en https://pkg-sec.example.com/repo1, https://pkg-sec.example.com/repo2 y https://pkg-sec.example.com/repo3. Estos repositorios apuntan a servidores de depósitos configurados en http://internal.example.com en puertos 10001, 10002 y 10003 respectivamente. Asegúrese de que la variable del entorno SOFTTOKEN_DIR esté definida correctamente como se describe en Creación de un almacén de claves.

Cómo configurar repositorios seguros

  1. Cree un certificado de CA para repo1.
    $ pktool gencert label=repo1_ca subject="CN=repo1" serial=0x01
    $ pktool export objtype=cert label=repo1_ca outformat=pem \
    outfile=repo1_ca.pem
  2. Cree un certificado de CA para repo2.
    $ pktool gencert label=repo2_ca subject="CN=repo2" serial=0x01
    $ pktool export objtype=cert label=repo2_ca outformat=pem \
    outfile=repo2_ca.pem
  3. Cree un archivo de certificado CA combinado.
    $ cat repo1_ca.pem > repo_cas.pem
    $ cat repo2_ca.pem >> repo_cas.pem
    $ cp repo_cas.pem /path-to-certs
  4. Cree un par de certificado de cliente/clave para permitir que el usuario myuser acceda al repositorio repo1.
    $ pktool gencsr subject="C=US,CN=myuser" label=repo1_0001 format=pem \
    outcsr=repo1_myuser.csr
    $ pktool signcsr signkey=repo1_ca csr=repo1_myuser.csr  \
    serial=0x02 outcert=repo1_myuser.crt.pem issuer="CN=repo1"
    $ pktool export objtype=key label=repo1_0001 outformat=pem \
    outfile=repo1_myuser.key.pem
    $ cp repo1_myuser.key.pem /path-to-certs
    $ cp repo1_myuser.crt.pem /path-to-certs
  5. Cree un par de certificado de cliente/clave para permitir que el usuario myuser acceda al repositorio repo2.
    $ pktool gencsr subject="C=US,CN=myuser" label=repo2_0001 format=pem \
    outcsr=repo2_myuser.csr
    $ pktool signcsr signkey=repo2_ca csr=repo2_myuser.csr  \
    serial=0x02 outcert=repo2_myuser.crt.pem issuer="CN=repo2"
    $ pktool export objtype=key label=repo2_0001 outformat=pem \
    outfile=repo2_myuser.key.pem
    $ cp repo2_myuser.key.pem /path-to-certs
    $ cp repo2_myuser.crt.pem /path-to-certs
  6. Configure Apache.

    Agregue la siguiente configuración de SSL al final de su archivo httpd.conf:

    # Let Apache listen on the standard HTTPS port
    Listen 443
    
    <VirtualHost 0.0.0.0:443>
            # DNS domain name of the server
            ServerName pkg-sec.example.com
            
            # enable SSL
            SSLEngine On
    
            # Location of the server certificate and key.
            # You either have to get one from a certificate signing authority like
            # VeriSign or create your own CA for testing purposes (see "Creating a 
            # Self-Signed CA for Testing Purposes") 
            SSLCertificateFile /path/to/server.crt
            SSLCertificateKeyFile /path/to/server.key
    
            # Intermediate CA certificate file. Required if your server certificate
            # is not signed by a top-level CA directly but an intermediate authority.
            # Comment out this section if you don't need one or if you are using a
            # test certificate 
            SSLCertificateChainFile /path/to/ca_intermediate.pem
    
            # CA certs for client verification.
            # This is where the CA certificate created in step 3 needs to go.
            # If you have multiple CAs for multiple repos, just concatenate the
            # CA certificate files
            SSLCACertificateFile /path/to/certs/repo_cas.pem
    
            # If the client presents a certificate, verify it here. If it doesn't, 
            # ignore.
            # This is required to be able to use client-certificate based and
            # anonymous SSL traffic on the same VirtualHost. 
            SSLVerifyClient optional
    
            <Location /repo1>
                    SSLVerifyDepth 1
                    SSLRequire ( %{SSL_CLIENT_I_DN_CN} =~ m/repo1/ )
                    # proxy request to depot running at internal.example.com:10001
                    ProxyPass http://internal.example.com:10001 nocanon max=500
            </Location>
    
            <Location /repo2>
                    SSLVerifyDepth 1
                    SSLRequire ( %{SSL_CLIENT_I_DN_CN} =~ m/repo2/ )
                    # proxy request to depot running at internal.example.com:10002
                    ProxyPass http://internal.example.com:10002 nocanon max=500
            </Location>
    
            <Location /repo3>
                    SSLVerifyDepth 1
                    SSLRequire ( %{SSL_CLIENT_VERIFY} eq "SUCCESS" )
                    # proxy request to depot running at internal.example.com:10003
                    ProxyPass http://internal.example.com:10003 nocanon max=500
            </Location>
    
    </VirtualHost>
  7. Pruebe el acceso a repo1.
    $ pkg set-publisher -k /path-to-certs/repo1_myuser.key.pem \
    -c /path-to-certs/repo1_myuser.crt.pem \
    -p https://pkg-sec.example.com/repo1/
  8. Pruebe el acceso a repo2.
    $ pkg set-publisher -k /path-to-certs/repo2_myuser.key.pem \
    -c /path-to-certs/repo2_myuser.crt.pem \
    -p https://pkg-sec.example.com/repo2/
  9. Pruebe el acceso a repo3.

    Utilice el certificado repo1 para probar el acceso a repo3.

    $ pkg set-publisher -k /path-to-certs/repo1_myuser.key.pem \
    -c /path-to-certs/repo1_myuser.crt.pem \
    -p https://pkg-sec.example.com/repo3/

    Utilice el certificado repo2 para probar el acceso a repo3.

    $ pkg set-publisher -k /path-to-certs/repo2_myuser.key.pem \
    -c /path-to-certs/repo2_myuser.crt.pem \
    -p https://pkg-sec.example.com/repo3/