#pragma section-numbers off This is the page of the MemberManual that describes how to generate a valid SSL cert. <> {{{#!wiki caution '''Security Precautions''' At some point, your certificate and private key will need to be stored in afs. Since afs is publicly accessible, you need to take a few precautions to ensure that your data remains private. For all key operations, keep the files in a directory that only you and the admins can read. We provide a script to create such a directory: `/afs/hcoop.net/common/bin/make-secure-directory certificates` }}} == Introduction == There are a few options for acquiring an SSL certificate to use with us. The first option is to get a signed certificate from a trusted Certificate Authority ("CA" for short). If you want to make it so that visitors to your website never see an annoying nag dialog box, then this is your best option. The easiest way to do this is [[/LetsEncrypt|using letsencrypt]] Alternatively, you can generate a self-signed certificate. There are several good introductions to SSL and x509 certificates in general if you are unfamiliar with the subject: * [[https://www.ssllabs.com/projects/best-practices/index.html|Qualsys SSL Deployment Best Practices]] * [[https://httpd.apache.org/docs/2.4/ssl/ssl_faq.html#aboutcerts|Apache SSL FAQ]] * [[http://www.tldp.org/HOWTO/SSL-Certificates-HOWTO/index.html|The SSL Certificate HOWTO]] == Generating a Key and Certificate Signing Request == If you are creating an SSL certificate to use for a web virtual host via DomTool, then you need to create both a key file and a csr file. The csr file is called a "certificate signing request" (sometimes abbreviated "certificate request"), and you will want to specify that on the SSL form in the HCoop Portal. We'll also need access to your key. Your key ''must be kept private''. You supply the csr to any certification authorities you would like to sign your key, and later combine the certificate given by them with your private key to server a TLS site from our servers. It is highly recommended that you generate a private key specifically for use with HCoop. To create a cerificate request in `file.csr` and a private key in `file.key`, do the following. These files should be readable only by you and the HCoop admins, so be sure to set permissions properly on the directory where you store the certificate request and key. The certificate should be placed somewhere in your home directory, like `~/certificates`. {{{ /afs/hcoop.net/common/bin/make-secure-directory ~/certificates cd ~/certificates openssl req -sha256 -newkey rsa:2048 -keyout file.key -out file.csr -nodes }}} Here is an explanation of the parameters that you will be asked to provide. Replace '''yourdomain.org''' with your domain name. * '''Country'''/'''State'''/'''Locality''': These are self-explanatory. * '''Organization Name''': This can be anything you want. It is often the full name or description of your organization or website. * '''Organizational Unit Name''': This can be anything you want. It can be left blank. * '''Common Name''': This is the domain that goes with the certificate. It can be either a single name (i.e. "yourdomain.org"), or a wildcard domain (like "*.yourdomain.org"). The wildcard domain is used for sharing the same certificate in multiple subdomains of your domain. Most CAs will not sign wildcard certificates. * '''Email Address''': A valid email address. People often use {{{ca@yourdomain.org}}}. * '''Challenge Password''': Leave blank. * '''Company Name''': This can be anything you want. It can be left blank. == Signing the Key == === Using a Trusted CA === There are several options available. By far the largest providers are [[https://www.verisign.com/|VeriSign]] and [[https://www.thawte.com/|Thawte]]. Several members seem to like [[https://gandi.net|Gandi]]. We make no specific recommendations concerning which CA to choose: just make certain that their root CA certificates are included with the majority of web browsers. [[https://letsencrypt.org/|Letencrypt]] offers free SSL certificates (but must be renewed every 60 days). === Self-Signing === '''FILE''' is the filename of the certificate that will be generated: it should end in ".pem". '''DAYS''' indicates the number of days that you want the certificate to be valid. It is recommended not to sign keys for longer than a year or two. {{{ /afs/hcoop.net/common/bin/make-secure-directory ~/certificates cd ~/certificates openssl req -x509 -newkey rsa:2048 -keyout FILE -out FILE -days DAYS -nodes }}} == Installing the Certificate == Now that you have a certificate, we need to install it. Use the [[https://members.hcoop.net/portal/cert|SSL permissions]] page on the portal to request installation of your new certificate. You need to provide us with either: * A `pem` containing your public certificate, private key, and any intermediate certificates (in that order) concatenated together * Your public certificate and private key, both in `pem` format For the latter option, provide both paths in the same form, separated by a space. We will then verify the certificate and install it, providing you with a path that you can use to [[DomTool/Examples#UsingSSL.28HTTPS.29|enable SSL using domtool]]. ---- CategoryMemberManual