let's encrypt - free ssl certificates for the masses pete...
TRANSCRIPT
Let's Encrypt - Free SSL certificates for the masses
Pete HelgrenBible Study Fellowship International
San Antonio, TX
Agenda
Overview of data security
Encoding and Encryption
SSL and TLS
Certficate options
Self-signed
Commercial
Free
Installation
General
IBM i
Encoding
Encoding
The process of putting a sequence of characters into a special format for transmission or storage purposes.
Most common : BASE64 encoding, encoding binary data into ASCII characters.
Encoding is NOT encryption ! But is often used in conjunction with encryption.
Encryption
Encryption - SymmetricBoth parties share a ‘secret key’
Party A generates a ‘shared secret’ key and sends the key to party B.Party A uses the shared secret key to encrypt the data and send it to Party B. Party B uses their shared secret key to decrypt the data.Party B uses shared secret key to encrypt the data and send it to Party A. Party A uses the shared secret key to decrypt the data.
Encryption
Encryption – Asymmetric
Both parties share ‘public’ keys so that each of them can decrypt the content sent by the other using their public keys.
Party A generates a private key and a public key and sends the public key to party B.Party B generates a private key and a public key and sends the public key to party A.Party A uses Party B’s public key to encrypt the data and send it to Party B. Party B uses their private key to decrypt the data.Party B uses Party A’s public key to encrypt the data and send it to Party A. Party A uses their private key to decrypt the data.
Encryption
Symmetric – doesn’t scale well.
Good for single, party-party data exchanges
Trust in the key and the server is up to you
If the key is compromised, you’re cooked.
Asymmetric – Can scale with 3rd party CA
Many to one and many to many
Key trust relegated to 3rd party CA
If server key compromised, you’re cooked
If CA is compromised, you’re cooked.
Encryption
Asymmetric key most common.
Certificate authority needed as 3rd party
x.509 Certificate is most widely used.
Contains identifying information such as Company name and maybe address
Contains the public key of the public/ private key pair (private key remains on server)
Issued by CA
Encryption
Ciphers (most common and accepted):
RSA (after the inventors Rivest, Shamir, and Adelman)
DSA (Digital Signature Algorithm)
Elliptic Curve Cryptography (ECC)
Diffie-Hellman (DH)and Elliptic Curve Diffie-Hellman (ECDH)
AES - Advanced Encryption Standard
Galois/Counter Mode (GCM)
Cipher “Suites”
A “suite” combines one or more ciphers
Authentication: RSA, DSA, ECDSA
Encryption:RC4, 3DES, AES
Message Authentication (MAC):HMAC-SHA256, HMAC-SHA1, HMAC-MD5
Key Exchange: RSA, Diffie-Hellman, ECDH, SRP, PSK
Cipher “Suites”
From my “SSL” config in Apache (Linux):
SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384
EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256
EECDH EDH+aRSA !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4"
SSL vs TLS
These protocols establish the structure and steps of a secure connection
Basically: Old vs New
SSL (old) – Secure Sockets Layer
All versions have been deprecated
TLS (new) – Transport Security Layer protocol - Version 1.1 and 1.2 (1.3 on the way!)
TLS -Client “Hello”
Client establishes connection with server
ClientHello: Provides a starting point forcommunication, and a set of options (Version,
CipherSuites, etc) for the receiving party (Server)to choose from regarding the connection.
TLS - Server “Hello”
Server responds to the connection request
The server picks the TLS protocol version for further communication, decides on a ciphersuite from the list provided by the client, attaches its certificate, and sends the response back to the
client. Optionally, the server can also send a
request for the client’s certificate and parameters for other TLS extensions.
Server “Hello”
ClientKeyExchange: Confirms the selectedencryption algorithm (RSA, Diffie-Hellman orFortezza/DMS)
Client change cipher
Client's ChangeCipherSpec: Indicates that the client is ready to begin secure communications. Finished: Indicates that further messages from the client will be encrypted
Server change cipher
Server's ChangeCipherSpec: Indicates that theserver is ready to begin secure communications.Finished: Indicates that further messages fromthe server will be encrypted.
Assuming both sides are able to negotiate a common version and cipher, and the client is happy with the certificate provided by the server, the client initiates either the RSA or the Diffie-Hellman key
exchange, which is used to establish the symmetric key for the ensuing session.
The server processes the key exchange parameters sent by the client, checks message integrity by verifying the MAC, and returns
an encrypted Finished message back to the client.
The client decrypts the message with the negotiated symmetric key, verifies the MAC, and if all is well, then the tunnel is established
and application data can now be sent.
MAC - message authentication code - one-way cryptographic hash function
Trusted 3rd party verification
In PKI it’s all about trust!
Trust a 3rd party CATrust the “self-signed” certificate (you are your own CA)
WHO do you trust?
Let’s Encrypt basics
Free!
Available in 90 day lifespans
Wildcards not supported
Multiple subdomains and domains on a single certificate is supported.
Automated renewal and revocation through ACME clients (most platforms..except IBM i for now)
Let’s Encrypt methods
Two ways to handle the request and installation:
Manually – there are step by step instructionsCertbot – about 95% automatedACME clients (Automated Certificate Management Environment)
Although some registrars and web services providers support Let’s Encrypt, many do not so you’ll end up “rolling your own”.
ACME clients
Certbot
Pre-built, wizard-like scripts.
Most steps completely automated.
Get just a cert or help with install on server.
Other “automated” scripts and websites in:
PerlPythonJavaJavascriptRubyPHP MANY others!
Certificate generation
Certificate signing request
Sent to your CA
Contains the public key
Java – Keytool
keytool -genkey -alias mydomain -keyalg RSA -keystore keystore.jks -keysize 2048keytool -certreq -alias mydomain -keystore keystore.jks -file mydomain.csr
Certificate generation
Certificate signing request
OpenSSL
openssl genrsa -out /path/to/www_server_com.key 2048openssl req -new -key /path/to/www_server_com.key -out /path/to/www_server_com.csr
Requirements
The Country Name is mandatory and takes a two-letter country code.
The State or Province Name field requires a full name – do not use an abbreviation.
The Locality Name field is for your city or town.
In the Organization Name field, add your company or organization.
Organizational Unit Name is an optional field for your department or section.
The Common Name field is used for the Fully Qualified Domain Name (FQDN) of the website this certificate will protect.
Email address is an optional field for this request.
The challenge password and optional company name fields are optional and can be skipped as well
CSR Output
-----BEGIN CERTIFICATE REQUEST-----MIIByjCCATMCAQAwgYkxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRMwEQYDVQQKEwpHb29nbGUgSW5jMR8wHQYDVQQLExZJbmZvcm1hdGlvbiBUZWNobm9sb2d5MRcwFQYDVQQDEw53d3cuZ29vZ2xlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEApZtYJCHJ4VpVXHfVIlstQTlO4qC03hjX+ZkPyvdYd1Q4+qbAeTwXmCUKYHThVRd5aXSqlPzyIBwieMZrWFlRQddZ1IzXAlVRDWwAo60KecqeAXnnUK+5fXoTI/UgWshre8tJ+x/TMHaQKR/JcIWPhqaQhsJuzZbvAdGA80BLxdMCAwEAAaAAMA0GCSqGSIb3DQEBBQUAA4GBAIhl4PvFq+e7ipARgI5ZM+GZx6mpCz44DTo0JkwfRDf+BtrsaC0q68eTf2XhYOsq4fkHQ0uA0aVog3f5iJxCa3Hp5gxbJQ6zV6kJ0TEsuaaOhEko9sdpCoPOnRBm2i/XRD2D6iNh8f8z0ShGsFqjDgFHyF3o+lUyj+UC6H1QW7bn-----END CERTIFICATE REQUEST-----
Certificate request
If all is well, you are sent either a file or a link.
You may have an intermediate file or you may be requested to “bundle” them (copy them together).
Installation may be manual, semi-automatic or automated (a la Certbot)
Self signed Certificates
One extra step (no CA to send you a cert)
Generate the x.509 certificate:
openssl req -x509 -sha256 -days 365 -key private.key -in csr.csr -out certificate.crt
How many days duration should you set?
3-5 years is most common (5 years -1825 days)
On IBM i we use DCM
Digital Certificate Manager
CAN be a challenge to use and understandGenerate a CSR Import the x.509 certificate from third party (Let’s Encrypt in our case)
Send the request to Let’s Encrypt
The ACME client can help here
LE will need to confirm you are who you say you are. Creating a private key that you register with them. Also by validating your site through file access or DNS entry (file is easier – called a challenge)
I have been using the Bash shell version of an ACME client called….acme.sh and a java version.
You can find more info on acme.sh here:
https://github.com/Neilpang/acme.sh
Install acme.sh
Choose a location ( ~ for home folder, ‘git’ for git...whatever)
Use the bash shell in your ssh session: bash <enter>
git clone https://github.com/Neilpang/acme.sh.git
cd ./acme.sh
./acme.sh --install –force
Exit and then sign back in
Run it!
We already have a CSR generated by the DCM...so...
acme.sh --signcsr --csr /path/to/mycsr.csr -w /path/to/webroot/
Import the LE Certificate
Running the ACME client probably put your certificate into a folder in the IFS. Point your path there:
Apache Adjustments
The SSL configuration tweaks provided by the wizard:
Added ibm_ssl_module
You add/modify the port assignment
Modifications made to your virtual host
Virtual host changes
I have a reverse proxy so I:
Removed the virtual host modifications from “PETES”
Added the mods to my Virtual Host entries in the reverse proxy:
90 day renewal
Not automated for DCM/IBM i Apache (yet!)
Issue the renew option for your ACME client to run
Import the renewed certificate
Use Calendar reminder every 75 days
Basic steps when using DCM:
Use DCM to generate CSR
Use ACME client to use csr to generate LE certificate
Use DCM to import generated certificate
Every 60-75 days, renew the certificate with LE and import into DCM