SlideShare una empresa de Scribd logo
1 de 73
Descargar para leer sin conexión
HashiTLS
Demystifying Security Certs
HashiTalks 2020
Alan Scherger
Cloud Janitor
Microsoft Teams - 3hr Outage
Feb 3, 2020
Nomad - CVE-2020-7956
Jan 28th, 2020
Kubernetes - CVE-2016-7075
Oct 10, 2016
So what?
1. Managing certificates in 2020 is still hard.
2. We keep repeating the same errors in our software.
3. It all starts with education, and a foundation in the basics.
bit.ly/learn-mtls-the-hard-way
A future workshop that will be much more in-depth than these slides.
Agenda
Hands-on Practice
Use practical tools like mkcert
and HashiCorp Consul to get
familiar with how certificates
can be managed and used.
First Principles
Learn what makes up a
certificate and how those
pieces come together to for a
complete system.
Learn the Code
Examine a few code bases
which utilize mTLS to get work
done.
SSL Certificate
TLS Certificate
HTTPS Certificate
X.509 v3 Certificate
SSL Certificate
TLS Certificate
HTTPS Certificate
X.509 v3 Certificate
X.509 v3 Certificate
RFC 5280
Certificate Basic Fields - 1/3
▪ Version Number
– The version of the encoded certificate.
▪ Serial Number
– A positive integer unique to the Certificate Authority.
▪ Signature Algorithm
– Contains the identifier for the cryptographic algorithm used by the CA to
sign the certificate.
Certificate Basic Fields - 2/3
▪ Issuer
– Identifies the entity that has signed and issued the certificate.
▪ Validity
– The time interval during which the CA warrants that it will maintain
information about the status of the certificate.
▪ Subject
– Identifies the entity associate with the public key stored in the subject
public key field.
Certificate Basic Fields - 3/3
▪ Subject Public Key Info
– Used to carry the public key and identify the algorithm with which the key
is used.
▪ Extensions
– Provide methods for associating additional attributes to certificates.
Let’s Look at a Certificate
TERMINAL
> openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
ba:26:56:af:26:bd:3c:1a:e5:05:9d:fa:0b:83:40:26
Signature Algorithm: sha256WithRSAEncryption
Issuer: O = mkcert development CA,
OU = ascherger@incontrol (Alan Scherger),
CN = mkcert ascherger@incontrol (Alan Scherger)
Validity
Not Before: Feb 18 22:34:27 2020 GMT
Not After : Feb 18 22:34:27 2030 GMT
...
TERMINAL
> openssl version
LibreSSL 2.8.3
>macOS
Catalina
10.15.3
LibreSSL since 10.13 -
September 2017
TERMINAL
> docker run --rm ubuntu:18.04 /bin/bash -c "apt-get
update && apt-get install openssl -y && openssl
version"
…
Get:1 http://archive.ubuntu.com/ubuntu
bionic-updates/main amd64 libssl1.1 amd64
1.1.1-1ubuntu2.1~18.04.5 [1300 kB]
Get:2 http://archive.ubuntu.com/ubuntu
bionic-updates/main amd64 openssl amd64
1.1.1-1ubuntu2.1~18.04.5 [613 kB]
…
Setting up openssl (1.1.1-1ubuntu2.1~18.04.5) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
OpenSSL 1.1.1 11 Sep 2018
Ubuntu
Bionic
Beaver
18.04
OpenSSL 1.1.1
OpenSSL Command
TERMINAL
> openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout
This is the command which is used for displaying and signing X509 formatted
certificates.
OpenSSL Command
TERMINAL
> openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout
This specifies the input filename to read a certificate from.
OpenSSL Command
TERMINAL
> openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout
-text : Prints out the certificate in text form.
-noout : Prevents output of the encoded version of the certificate.
Version
The version of the encoded certificate.
TERMINAL
> openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
ba:26:56:af:26:bd:3c:1a:e5:05:9d:fa:0b:83:40:26
Signature Algorithm: sha256WithRSAEncryption
Issuer: O = mkcert development CA,
OU = ascherger@incontrol (Alan Scherger),
CN = mkcert ascherger@incontrol (Alan Scherger)
Validity
Not Before: Feb 18 22:34:27 2020 GMT
Not After : Feb 18 22:34:27 2030 GMT
...
Serial Number
A positive integer unique to the Certificate Authority.
TERMINAL
> openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
ba:26:56:af:26:bd:3c:1a:e5:05:9d:fa:0b:83:40:26
Signature Algorithm: sha256WithRSAEncryption
Issuer: O = mkcert development CA,
OU = ascherger@incontrol (Alan Scherger),
CN = mkcert ascherger@incontrol (Alan Scherger)
Validity
Not Before: Feb 18 22:34:27 2020 GMT
Not After : Feb 18 22:34:27 2030 GMT
...
Signature Algorithm
Contains the identifier for the cryptographic algorithm used by the CA to sign this certificate.
TERMINAL
> openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
ba:26:56:af:26:bd:3c:1a:e5:05:9d:fa:0b:83:40:26
Signature Algorithm: sha256WithRSAEncryption
Issuer: O = mkcert development CA,
OU = ascherger@incontrol (Alan Scherger),
CN = mkcert ascherger@incontrol (Alan Scherger)
Validity
Not Before: Feb 18 22:34:27 2020 GMT
Not After : Feb 18 22:34:27 2030 GMT
...
Issuer
Identifies the entity that has signed and issued the certificate.
TERMINAL
> openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
ba:26:56:af:26:bd:3c:1a:e5:05:9d:fa:0b:83:40:26
Signature Algorithm: sha256WithRSAEncryption
Issuer: O = mkcert development CA,
OU = ascherger@incontrol (Alan Scherger),
CN = mkcert ascherger@incontrol (Alan Scherger)
Validity
Not Before: Feb 18 22:34:27 2020 GMT
Not After : Feb 18 22:34:27 2030 GMT
...
Validity
The time interval during which the CA warrants that it will maintain information about the status of the certificate.
TERMINAL
> openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
ba:26:56:af:26:bd:3c:1a:e5:05:9d:fa:0b:83:40:26
Signature Algorithm: sha256WithRSAEncryption
Issuer: O = mkcert development CA,
OU = ascherger@incontrol (Alan Scherger),
CN = mkcert ascherger@incontrol (Alan Scherger)
Validity
Not Before: Feb 18 22:34:27 2020 GMT
Not After : Feb 18 22:34:27 2030 GMT
...
Subject
Identifies the entity associate with the public key stored in the subject public key field.
TERMINAL
Subject: O = mkcert development CA,
OU = ascherger@incontrol (Alan Scherger),
CN = mkcert ascherger@incontrol (Alan Scherger)
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public-Key: (3072 bit)
Modulus: [large integer represented in colon-hexadecimal notation]
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Key Usage: critical
Certificate Sign
X509v3 Basic Constraints: critical
CA:TRUE, pathlen:0
X509v3 Subject Key Identifier:
B9:D5:B3:06:55:B4:E6:CE:CB:CB:56:B3:4A:35:96:A3:AA:5F:2D:C4
Subject Public Key Info
Used to carry the public key and identify the algorithm with which the key is used.
TERMINAL
Subject: O = mkcert development CA,
OU = ascherger@incontrol (Alan Scherger),
CN = mkcert ascherger@incontrol (Alan Scherger)
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public-Key: (3072 bit)
Modulus: [large integer represented in colon-hexadecimal notation]
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Key Usage: critical
Certificate Sign
X509v3 Basic Constraints: critical
CA:TRUE, pathlen:0
X509v3 Subject Key Identifier:
B9:D5:B3:06:55:B4:E6:CE:CB:CB:56:B3:4A:35:96:A3:AA:5F:2D:C4
Extensions: Key Usage
Defines the purpose of the key contained in the certificate.
TERMINAL
Subject: O = mkcert development CA,
OU = ascherger@incontrol (Alan Scherger),
CN = mkcert ascherger@incontrol (Alan Scherger)
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public-Key: (3072 bit)
Modulus: [large integer represented in colon-hexadecimal notation]
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Key Usage: critical
Certificate Sign
X509v3 Basic Constraints: critical
CA:TRUE, pathlen:0
X509v3 Subject Key Identifier:
B9:D5:B3:06:55:B4:E6:CE:CB:CB:56:B3:4A:35:96:A3:AA:5F:2D:C4
Extensions: Basic Constraints
Identifies whether the subject of the certificate is a CA and
the maximum depth of valid certification paths that include this certificate.
TERMINAL
Subject: O = mkcert development CA,
OU = ascherger@incontrol (Alan Scherger),
CN = mkcert ascherger@incontrol (Alan Scherger)
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public-Key: (3072 bit)
Modulus: [large integer represented in colon-hexadecimal notation]
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Key Usage: critical
Certificate Sign
X509v3 Basic Constraints: critical
CA:TRUE, pathlen:0
X509v3 Subject Key Identifier:
B9:D5:B3:06:55:B4:E6:CE:CB:CB:56:B3:4A:35:96:A3:AA:5F:2D:C4
Extensions: Subject Key Identifier
Provides a means of identifying certificates that contain a particular public key.
TERMINAL
Subject: O = mkcert development CA,
OU = ascherger@incontrol (Alan Scherger),
CN = mkcert ascherger@incontrol (Alan Scherger)
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public-Key: (3072 bit)
Modulus: [large integer represented in colon-hexadecimal notation]
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Key Usage: critical
Certificate Sign
X509v3 Basic Constraints: critical
CA:TRUE, pathlen:0
X509v3 Subject Key Identifier:
B9:D5:B3:06:55:B4:E6:CE:CB:CB:56:B3:4A:35:96:A3:AA:5F:2D:C4
Blue Book
Volume VIII - Fascicle VIII.8
Data Communication Networks Directory
Recommendations X.500-X.521
🔥 236 glorious pages of explanation 🔥
Certificate Authority
Is an entity that issues digital certificates.
Certificate Chain of Trust
A list of certificates (usually starting with an end-entity
certificate) followed by one or more CA certificates (usually the
last one being a self-signed certificate), with the following
properties:
1. The Issuer of each certificate (except the last one)
matches the Subject of the next certificate in the list.
2. Each certificate (except the last one) is supposed to be
signed by the secret key corresponding to the next
certificate in the chain (i.e. the signature of one
certificate can be verified using the public key contained
in the following certificate).
3. The last certificate in the list is a trust anchor: a
certificate that you trust because it was delivered to you
by some trustworthy procedure.
Cryptographic Protocols
The final chapter in me rambling!
Cryptographic Protocols
Protocol Document Deprecated
SSL Version 2.0 Draft
March 2011
RFC 6176
SSL Version 3.0 RFC 6101
June 2015
RFC 7568
TLS 1.0 RFC 2246
May 2015
RFC 7525
---
June 2018
PCI DSS
TLS 1.1 RFC 4346
First ½ 2020
Apple, Microsoft, Google
TLS 1.2 RFC 5246
TLS 1.3 RFC 8446
Hands-on Practice
FiloSottile/mkcert
A simple tool for making locally-trusted development certificates.
iOS 13 and macOS 10.15 - Gotchya
https://support.apple.com/en-us/HT210176
iOS 13 and macOS 10.15 - Gotchya
https://support.apple.com/en-us/HT210176
Install
Download the latest
Release
Use the -install flag to
generate an install
certificates.
TERMINAL
> chmod +x ~/Downloads/mkcert-v1.4.1-darwin-amd64
> ~/Downloads/mkcert-v1.4.1-darwin-amd64 -install
Created a new local CA at
"/Users/ascherger/Library/Application Support/mkcert" 💥
Sudo password:
The local CA is now installed in the system trust store!
⚡
Warning: "certutil" is not available, so the CA can't be
automatically installed in Firefox! ⚠
Install "certutil" with "brew install nss" and re-run
"mkcert -install" 👈
>
TERMINAL
> ls -al /Users/ascherger/Library/Application Support/mkcert
total 16
drwxr-xr-x 4 ascherger staff 128 Feb 16 22:09 .
drwx------+ 121 ascherger staff 3872 Feb 16 22:09 ..
-r-------- 1 ascherger staff 2488 Feb 16 22:09 rootCA-key.pem
-rw-r--r-- 1 ascherger staff 1728 Feb 16 22:09 rootCA.pem
>
Look at our
certificates.
rootCA-key.pem is the private key.
rootCA.pem is the public certificate.
Inspect the
Root CA
Private Key
RFC 3447
Section 3.2
TERMINAL
> openssl rsa -in rootCA-key.pem -text -noout
Private-Key: (3072 bit)
modulus:
00:e0:70:56:33:aa:83:d5:ed:0f:46:f1:99:d5:81:
...
publicExponent: 65537 (0x10001)
privateExponent:
00:aa:f4:e6:b4:74:2d:f7:c5:9a:dd:6f:2a:be:77:
...
prime1:
00:f2:6d:61:68:e0:6d:18:72:ef:7e:86:17:7a:b7:
...
prime2:
00:ed:01:22:6b:5b:88:ae:c1:21:e5:be:91:58:c4:
...
exponent1:
00:a4:82:77:5c:cd:17:1b:45:3b:a2:57:6a:6d:7b:
...
exponent2:
00:9f:f6:39:0d:ee:bc:c4:fe:33:6b:c6:00:81:c2:
...
coefficient:
10:0e:1d:ad:75:e5:b9:fc:fe:47:72:c6:86:88:dc:
...
TERMINAL
> openssl x509 -in rootCA.pem -text -noout
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
84:4a:83:84:72:ad:27:89:09:7e:48:44:b9:f6:30:6e
Signature Algorithm: sha256WithRSAEncryption
Issuer: O=mkcert development CA,
OU=ascherger@Alans-MacBook-Pro.local,
CN=mkcert ascherger@Alans-MacBook-Pro.local
Validity
Not Before: Feb 17 04:09:41 2020 GMT
Not After : Feb 17 04:09:41 2030 GMT
Subject: O=mkcert development CA,
OU=ascherger@Alans-MacBook-Pro.local,
CN=mkcert ascherger@Alans-MacBook-Pro.local
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (3072 bit)
Modulus:
00:e0:70:56:33:aa:83:d5:ed:0f:46:f1:99:d5:81:
...
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Key Usage: critical
Certificate Sign
X509v3 Basic Constraints: critical
CA:TRUE, pathlen:0
X509v3 Subject Key Identifier:
93:EF:36:51:3D:94:46:01:8F:01:F7:B9:22:09:75:F9:E7:63:93:F9
Signature Algorithm: sha256WithRSAEncryption
bb:0e:80:b4:35:b8:2a:58:9e:36:f3:4a:ce:87:5c:0b:86:54:
...
Inspect the
Root CA
Public
Certificate
Make a new
localhost
certificate.
TERMINAL
> mkcert localhost 127.0.0.1 ::1
Using the local CA at
"/Users/ascherger/Library/Application Support/mkcert" ✨
Created a new certificate valid for the following names
📜
- "localhost"
- "127.0.0.1"
- "::1"
The certificate is at "./localhost+2.pem" and the key at
"./localhost+2-key.pem" ✅
>
Serial Number
Remember “18:f1” we’ll see that again soon.
TERMINAL
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
18:f1:88:4e:19:56:0f:7a:ae:11:75:eb:e9:67:8d:57
Signature Algorithm: sha256WithRSAEncryption
Issuer: O=mkcert development CA,
OU=ascherger@Alans-MacBook-Pro.local,
CN=mkcert ascherger@Alans-MacBook-Pro.local
Validity
Not Before: Jun 1 00:00:00 2019 GMT
Not After : Feb 19 07:05:58 2030 GMT
Subject: O=mkcert development certificate,
OU=ascherger@Alans-MacBook-Pro.local
Issuer
Matches our Root CA public key information.
TERMINAL
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
18:f1:88:4e:19:56:0f:7a:ae:11:75:eb:e9:67:8d:57
Signature Algorithm: sha256WithRSAEncryption
Issuer: O=mkcert development CA,
OU=ascherger@Alans-MacBook-Pro.local,
CN=mkcert ascherger@Alans-MacBook-Pro.local
Validity
Not Before: Jun 1 00:00:00 2019 GMT
Not After : Feb 19 07:05:58 2030 GMT
Subject: O=mkcert development certificate,
OU=ascherger@Alans-MacBook-Pro.local
Validity
Patched to get around the macOS hiccup.
TERMINAL
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
18:f1:88:4e:19:56:0f:7a:ae:11:75:eb:e9:67:8d:57
Signature Algorithm: sha256WithRSAEncryption
Issuer: O=mkcert development CA,
OU=ascherger@Alans-MacBook-Pro.local,
CN=mkcert ascherger@Alans-MacBook-Pro.local
Validity
Not Before: Jun 1 00:00:00 2019 GMT
Not After : Feb 19 07:05:58 2030 GMT
Subject: O=mkcert development certificate,
OU=ascherger@Alans-MacBook-Pro.local
Subject
No Common Name (CN), and different than CA information.
TERMINAL
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
18:f1:88:4e:19:56:0f:7a:ae:11:75:eb:e9:67:8d:57
Signature Algorithm: sha256WithRSAEncryption
Issuer: O=mkcert development CA,
OU=ascherger@Alans-MacBook-Pro.local,
CN=mkcert ascherger@Alans-MacBook-Pro.local
Validity
Not Before: Jun 1 00:00:00 2019 GMT
Not After : Feb 19 07:05:58 2030 GMT
Subject: O=mkcert development certificate,
OU=ascherger@Alans-MacBook-Pro.local
Key Usage
Explicitly allows for Web Server usage, but not Client usage.
TERMINAL
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:c0:ed:e2:11:01:66:60:d1:c6:50:cd:e0:7a:a3:
...
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Key Usage: critical
Digital Signature, Key Encipherment
X509v3 Extended Key Usage:
TLS Web Server Authentication
X509v3 Basic Constraints: critical
CA:FALSE
Basic Constraints
This certificate cannot act as a CA, so it cannot make child certificates.
TERMINAL
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:c0:ed:e2:11:01:66:60:d1:c6:50:cd:e0:7a:a3:
...
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Key Usage: critical
Digital Signature, Key Encipherment
X509v3 Extended Key Usage:
TLS Web Server Authentication
X509v3 Basic Constraints: critical
CA:FALSE
Authority Key Identifier
Matches the Subject Key Identifier of the Root certificate.
TERMINAL
X509v3 Authority Key Identifier:
keyid:93:EF:36:51:3D:94:46:01:8F:01:F7:B9:22:09:75:F9:E7:63:93:F9
X509v3 Subject Alternative Name:
DNS:localhost, IP Address:127.0.0.1, IP Address:0:0:0:0:0:0:0:1
Signature Algorithm: sha256WithRSAEncryption
4b:f5:d0:fa:27:43:c2:d8:ef:4c:be:5e:66:81:21:c1:c1:5f:
...
Subject Alternative Name
A list of DNS and IP addresses this certificate is allowed to represent.
TERMINAL
X509v3 Authority Key Identifier:
keyid:93:EF:36:51:3D:94:46:01:8F:01:F7:B9:22:09:75:F9:E7:63:93:F9
X509v3 Subject Alternative Name:
DNS:localhost, IP Address:127.0.0.1, IP Address:0:0:0:0:0:0:0:1
Signature Algorithm: sha256WithRSAEncryption
4b:f5:d0:fa:27:43:c2:d8:ef:4c:be:5e:66:81:21:c1:c1:5f:
...
Nginx
default.conf
CODE EDITOR
server {
listen [::]:443 ssl http2 ipv6only=on;
listen 443 ssl http2;
server_name localhost;
ssl_certificate /etc/nginx/conf.d/localhost+2.pem;
ssl_certificate_key /etc/nginx/conf.d/localhost+2-key.pem;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Run Nginx
TERMINAL
> docker run -p 4448:443 -v "`pwd`:/etc/nginx/conf.d" nginx
Unable to find image 'nginx:latest' locally
latest: Pulling from library/nginx
bc51dd8edc1b: Pull complete
66ba67045f57: Pull complete
bf317aa10aa5: Pull complete
Digest:
sha256:ad5552c786f128e389a0263104ae39f3d3c7895579d45ae716f528185b36
bc6f
Status: Downloaded newer image for nginx:latest
Visit https://localhost:4448/
The certificate is trusted, and the Serial Number matches the certificate we just created.
cloudflare/cfssl
Cloudflare’s PKI and TLS toolkit
bit.ly/consul-mtls
Learn mTLS with Consul!
Consul + TLS
1. Consul CLI has a tls command for setting up a CA and certificates.
2. Consul has an auto_encrypt feature for auto-managing certificates
3. Consul’s Connect API contains the CA endpoints, and supports automated
CA rotation through cross-signing.
bit.ly/vault-learn
Learn how to setup Vault!
Be sure to look up tls_require_and_verify_client_cert
bit.ly/nomad-mtls
Learn mTLS with Nomad!
Learn the Code
Consul - Encryption
If verify_server_hostname is set, then outgoing
connections perform hostname verification.
All servers must have a certificate valid for
server.<datacenter>.<domain> or the client will reject the
handshake.
package tlsutil - config.go L706-L726
CODE EDITOR
// Wrap a net.Conn into a client tls connection, performing any
// additional verification as needed.
//
// As of go 1.3, crypto/tls only supports either doing no certificate
// verification, or doing full verification including of the peer's
// DNS name. For consul, we want to validate that the certificate is
// signed by a known CA, but because consul doesn't use DNS names for
// node names, we don't verify the certificate DNS names. Since go 1.3
// no longer supports this mode of operation, we have to do it
// manually.
func (c *Configurator ) wrapTLSClient (dc string, conn net.Conn) (net.Conn, error) {
config := c.OutgoingRPCConfig ()
verifyServerHostname := c.VerifyServerHostname ()
verifyOutgoing := c.verifyOutgoing ()
domain := c.domain()
if verifyServerHostname {
// Strip the trailing '.' from the domain if any
domain = strings.TrimSuffix(domain, ".")
config.ServerName = "server." + dc + "." + domain
}
tlsConn := tls.Client(conn, config)
Nomad - Securing With TLS
To fulfill the desired security properties Nomad
certificates are signed with their region and role such as:
- client.global.nomad for a client node in the global
region
- server.us-west.nomad for a server node in the
us-west region
package tls - common.go L510-L521
CODE EDITOR
// VerifyPeerCertificate, if not nil, is called after normal
// certificate verification by either a TLS clientor server. It
// receives the raw ASN.1 certificates provided by the peer and also
// any verified chains that normal processing found. If it returns a
// non-nil error, the handshake is aborted and that error results.
//
// If normal verification fails then the handshake will abort before
// considering this callback. If normal verification is disabled by
// setting InsecureSkipVerify, or (for a server) when ClientAuth is
// RequestClientCert or RequireAnyClientCert, then this callback will
// be considered but the verifiedChains argument will always be nil.
VerifyPeerCertificate func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error
package nomad - server.go L451-L477
CODE EDITOR
// getTLSConf gets the server's TLS configuration based on the config supplied
// by the operator
func getTLSConf(enableRPC bool, tlsConf *tlsutil.Config, region string)
(*tls.Config, tlsutil.RegionWrapper , error) {
// omitted for slide
if tlsConf.VerifyServerHostname {
incomingTLS = itls.Clone()
incomingTLS .VerifyPeerCertificate =
rpcNameAndRegionValidator (region)
} else {
incomingTLS = itls
}
return incomingTLS , tlsWrap, nil
}
package nomad - server.go L479-L497
CODE EDITOR
// implements signature of tls.Config.VerifyPeerCertificate which is called
// after the certs have been verified. We'll ignore the raw certs and only
// check the verified certs.
func rpcNameAndRegionValidator(region string) func([][]byte, [][]*x509.Certificate)
error {
return func(_ [][]byte, certificates [][]*x509.Certificate) error {
if len(certificates) > 0 && len(certificates[0]) > 0 {
cert := certificates[0][0]
for _, dnsName := range cert.DNSNames {
if validateRPCRegionPeer(dnsName, region) {return nil}
}
if validateRPCRegionPeer(cert.Subject.CommonName, region) {
return nil
}
}
return errors.New("invalid role or region for certificate")
}
package nomad - server.go L499-L515
CODE EDITOR
func validateRPCRegionPeer (name, region string) bool {
parts := strings.Split(name, ".")
if len(parts) < 3 {
// Invalid SAN
return false
}
if parts[len(parts)-1] != "nomad" {
// Incorrect service
return false
}
if parts[0] == "client" {
// Clients may only connect to servers in their region
return name == "client."+region+".nomad"
}
// Servers may connect to any Nomad RPC service for federation.
return parts[0] == "server"
}
Thank You!
Alan Scherger
@flyinprogrammer
bit.ly/learn-mtls-the-hard-way
73

Más contenido relacionado

La actualidad más candente

Injecting Vault Secrets Into Kubernetes Pods via a Sidecar
Injecting Vault Secrets Into Kubernetes Pods via a SidecarInjecting Vault Secrets Into Kubernetes Pods via a Sidecar
Injecting Vault Secrets Into Kubernetes Pods via a SidecarMitchell Pronschinske
 
Vault 1.0: How to Auto-Unseal and Other New Features
Vault 1.0: How to Auto-Unseal and Other New FeaturesVault 1.0: How to Auto-Unseal and Other New Features
Vault 1.0: How to Auto-Unseal and Other New FeaturesMitchell Pronschinske
 
Chickens & Eggs: Managing secrets in AWS with Hashicorp Vault
Chickens & Eggs: Managing secrets in AWS with Hashicorp VaultChickens & Eggs: Managing secrets in AWS with Hashicorp Vault
Chickens & Eggs: Managing secrets in AWS with Hashicorp VaultJeff Horwitz
 
Post quantum cryptography in vault (hashi talks 2020)
Post quantum cryptography in vault (hashi talks 2020)Post quantum cryptography in vault (hashi talks 2020)
Post quantum cryptography in vault (hashi talks 2020)Mitchell Pronschinske
 
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault Outlyer
 
Criteo meetup - S.R.E Tech Talk
Criteo meetup - S.R.E Tech TalkCriteo meetup - S.R.E Tech Talk
Criteo meetup - S.R.E Tech TalkPierre Mavro
 
HashiCorp Vault Workshop:幫 Credentials 找個窩
HashiCorp Vault Workshop:幫 Credentials 找個窩HashiCorp Vault Workshop:幫 Credentials 找個窩
HashiCorp Vault Workshop:幫 Credentials 找個窩smalltown
 
Kubernetes Security
Kubernetes SecurityKubernetes Security
Kubernetes Securityinovex GmbH
 
Issuing temporary credentials for my sql using hashicorp vault
Issuing temporary credentials for my sql using hashicorp vaultIssuing temporary credentials for my sql using hashicorp vault
Issuing temporary credentials for my sql using hashicorp vaultOlinData
 
Using Vault to decouple MySQL Secrets
Using Vault to decouple MySQL SecretsUsing Vault to decouple MySQL Secrets
Using Vault to decouple MySQL SecretsDerek Downey
 
Kubernetes - Security Journey
Kubernetes - Security JourneyKubernetes - Security Journey
Kubernetes - Security JourneyJerry Jalava
 
Overview of secret management solutions and architecture
Overview of secret management solutions and architectureOverview of secret management solutions and architecture
Overview of secret management solutions and architectureYuechuan (Mike) Chen
 
Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...
Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...
Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...Stenio Ferreira
 
Vault - Secret and Key Management
Vault - Secret and Key ManagementVault - Secret and Key Management
Vault - Secret and Key ManagementAnthony Ikeda
 
How to Use HashiCorp Vault with Hiera 5 for Secret Management With Puppet
How to Use HashiCorp Vault with Hiera 5 for Secret Management With PuppetHow to Use HashiCorp Vault with Hiera 5 for Secret Management With Puppet
How to Use HashiCorp Vault with Hiera 5 for Secret Management With PuppetAmanda MacLeod
 
2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...
2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...
2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...Andrey Devyatkin
 
DevOpsDays - DevOps: Security 干我何事?
DevOpsDays - DevOps: Security 干我何事?DevOpsDays - DevOps: Security 干我何事?
DevOpsDays - DevOps: Security 干我何事?smalltown
 

La actualidad más candente (20)

Injecting Vault Secrets Into Kubernetes Pods via a Sidecar
Injecting Vault Secrets Into Kubernetes Pods via a SidecarInjecting Vault Secrets Into Kubernetes Pods via a Sidecar
Injecting Vault Secrets Into Kubernetes Pods via a Sidecar
 
Hashicorp Vault ppt
Hashicorp Vault pptHashicorp Vault ppt
Hashicorp Vault ppt
 
Vault 1.0: How to Auto-Unseal and Other New Features
Vault 1.0: How to Auto-Unseal and Other New FeaturesVault 1.0: How to Auto-Unseal and Other New Features
Vault 1.0: How to Auto-Unseal and Other New Features
 
Chickens & Eggs: Managing secrets in AWS with Hashicorp Vault
Chickens & Eggs: Managing secrets in AWS with Hashicorp VaultChickens & Eggs: Managing secrets in AWS with Hashicorp Vault
Chickens & Eggs: Managing secrets in AWS with Hashicorp Vault
 
Post quantum cryptography in vault (hashi talks 2020)
Post quantum cryptography in vault (hashi talks 2020)Post quantum cryptography in vault (hashi talks 2020)
Post quantum cryptography in vault (hashi talks 2020)
 
Vault 101
Vault 101Vault 101
Vault 101
 
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
Neil Saunders (Beamly) - Securing your AWS Infrastructure with Hashicorp Vault
 
Criteo meetup - S.R.E Tech Talk
Criteo meetup - S.R.E Tech TalkCriteo meetup - S.R.E Tech Talk
Criteo meetup - S.R.E Tech Talk
 
HashiCorp Vault Workshop:幫 Credentials 找個窩
HashiCorp Vault Workshop:幫 Credentials 找個窩HashiCorp Vault Workshop:幫 Credentials 找個窩
HashiCorp Vault Workshop:幫 Credentials 找個窩
 
Kubernetes Security
Kubernetes SecurityKubernetes Security
Kubernetes Security
 
Issuing temporary credentials for my sql using hashicorp vault
Issuing temporary credentials for my sql using hashicorp vaultIssuing temporary credentials for my sql using hashicorp vault
Issuing temporary credentials for my sql using hashicorp vault
 
Using Vault to decouple MySQL Secrets
Using Vault to decouple MySQL SecretsUsing Vault to decouple MySQL Secrets
Using Vault to decouple MySQL Secrets
 
Kubernetes - Security Journey
Kubernetes - Security JourneyKubernetes - Security Journey
Kubernetes - Security Journey
 
Overview of secret management solutions and architecture
Overview of secret management solutions and architectureOverview of secret management solutions and architecture
Overview of secret management solutions and architecture
 
Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...
Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...
Secure and Convenient Workflows: Integrating HashiCorp Vault with Pivotal Clo...
 
Vault - Secret and Key Management
Vault - Secret and Key ManagementVault - Secret and Key Management
Vault - Secret and Key Management
 
HashiCorp's Vault - The Examples
HashiCorp's Vault - The ExamplesHashiCorp's Vault - The Examples
HashiCorp's Vault - The Examples
 
How to Use HashiCorp Vault with Hiera 5 for Secret Management With Puppet
How to Use HashiCorp Vault with Hiera 5 for Secret Management With PuppetHow to Use HashiCorp Vault with Hiera 5 for Secret Management With Puppet
How to Use HashiCorp Vault with Hiera 5 for Secret Management With Puppet
 
2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...
2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...
2020-02-20 - HashiTalks 2020 - HashiCorp Vault configuration as code via Hash...
 
DevOpsDays - DevOps: Security 干我何事?
DevOpsDays - DevOps: Security 干我何事?DevOpsDays - DevOps: Security 干我何事?
DevOpsDays - DevOps: Security 干我何事?
 

Similar a HashiTLS Demystifying Security Certs

EthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptxEthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptxWijdenBenothmen1
 
SSL/TLS for Mortals (JavaZone)
SSL/TLS for Mortals (JavaZone)SSL/TLS for Mortals (JavaZone)
SSL/TLS for Mortals (JavaZone)Maarten Mulders
 
Humantalk Angers 14 Mars
Humantalk Angers 14 MarsHumantalk Angers 14 Mars
Humantalk Angers 14 MarsRémi Dubois
 
Client server computing in mobile environments part 2
Client server computing in mobile environments part 2Client server computing in mobile environments part 2
Client server computing in mobile environments part 2Praveen Joshi
 
Enabling Web Apps For DoD Security via PKI/CAC Enablement (Forge.Mil case study)
Enabling Web Apps For DoD Security via PKI/CAC Enablement (Forge.Mil case study)Enabling Web Apps For DoD Security via PKI/CAC Enablement (Forge.Mil case study)
Enabling Web Apps For DoD Security via PKI/CAC Enablement (Forge.Mil case study)Richard Bullington-McGuire
 
コマンドラインで始める SoftLayer (May 23, 2014)
コマンドラインで始める SoftLayer (May 23, 2014)コマンドラインで始める SoftLayer (May 23, 2014)
コマンドラインで始める SoftLayer (May 23, 2014)隆明 中島
 
Oralce SSL walelt -TCPS_Troubleshooting_PB.pptx
Oralce SSL walelt -TCPS_Troubleshooting_PB.pptxOralce SSL walelt -TCPS_Troubleshooting_PB.pptx
Oralce SSL walelt -TCPS_Troubleshooting_PB.pptxssuser865ecd
 
Building an HPC Cluster in 10 Minutes
Building an HPC Cluster in 10 MinutesBuilding an HPC Cluster in 10 Minutes
Building an HPC Cluster in 10 MinutesMonica Rut Avellino
 
A New Framework for Detection
A New Framework for DetectionA New Framework for Detection
A New Framework for DetectionSourcefire VRT
 
給 RD 的 Kubernetes 初體驗 (EKS version)
給 RD 的 Kubernetes 初體驗 (EKS version)給 RD 的 Kubernetes 初體驗 (EKS version)
給 RD 的 Kubernetes 初體驗 (EKS version)William Yeh
 
OSSNA 2017 Performance Analysis Superpowers with Linux BPF
OSSNA 2017 Performance Analysis Superpowers with Linux BPFOSSNA 2017 Performance Analysis Superpowers with Linux BPF
OSSNA 2017 Performance Analysis Superpowers with Linux BPFBrendan Gregg
 
Developing Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache KafkaDeveloping Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache KafkaJoe Stein
 
Tutorial s crypto api session keys
Tutorial   s crypto api session keysTutorial   s crypto api session keys
Tutorial s crypto api session keysDr. Edwin Hernandez
 
Appsecco Kubernetes Hacking Masterclass Presentation Slides
Appsecco Kubernetes Hacking Masterclass Presentation SlidesAppsecco Kubernetes Hacking Masterclass Presentation Slides
Appsecco Kubernetes Hacking Masterclass Presentation SlidesAppsecco
 
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)Jakub Botwicz
 
Defending Against Attacks With Rails
Defending Against Attacks With RailsDefending Against Attacks With Rails
Defending Against Attacks With RailsTony Amoyal
 

Similar a HashiTLS Demystifying Security Certs (20)

EthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptxEthereumBlockchainMarch3 (1).pptx
EthereumBlockchainMarch3 (1).pptx
 
SSL/TLS for Mortals (JavaZone)
SSL/TLS for Mortals (JavaZone)SSL/TLS for Mortals (JavaZone)
SSL/TLS for Mortals (JavaZone)
 
IoT Secure Bootsrapping : ideas
IoT Secure Bootsrapping : ideasIoT Secure Bootsrapping : ideas
IoT Secure Bootsrapping : ideas
 
Humantalk Angers 14 Mars
Humantalk Angers 14 MarsHumantalk Angers 14 Mars
Humantalk Angers 14 Mars
 
Client server computing in mobile environments part 2
Client server computing in mobile environments part 2Client server computing in mobile environments part 2
Client server computing in mobile environments part 2
 
Enabling Web Apps For DoD Security via PKI/CAC Enablement (Forge.Mil case study)
Enabling Web Apps For DoD Security via PKI/CAC Enablement (Forge.Mil case study)Enabling Web Apps For DoD Security via PKI/CAC Enablement (Forge.Mil case study)
Enabling Web Apps For DoD Security via PKI/CAC Enablement (Forge.Mil case study)
 
コマンドラインで始める SoftLayer (May 23, 2014)
コマンドラインで始める SoftLayer (May 23, 2014)コマンドラインで始める SoftLayer (May 23, 2014)
コマンドラインで始める SoftLayer (May 23, 2014)
 
Oralce SSL walelt -TCPS_Troubleshooting_PB.pptx
Oralce SSL walelt -TCPS_Troubleshooting_PB.pptxOralce SSL walelt -TCPS_Troubleshooting_PB.pptx
Oralce SSL walelt -TCPS_Troubleshooting_PB.pptx
 
One-Man Ops
One-Man OpsOne-Man Ops
One-Man Ops
 
Building an HPC Cluster in 10 Minutes
Building an HPC Cluster in 10 MinutesBuilding an HPC Cluster in 10 Minutes
Building an HPC Cluster in 10 Minutes
 
A New Framework for Detection
A New Framework for DetectionA New Framework for Detection
A New Framework for Detection
 
給 RD 的 Kubernetes 初體驗 (EKS version)
給 RD 的 Kubernetes 初體驗 (EKS version)給 RD 的 Kubernetes 初體驗 (EKS version)
給 RD 的 Kubernetes 初體驗 (EKS version)
 
Protecting host with calico
Protecting host with calicoProtecting host with calico
Protecting host with calico
 
OSSNA 2017 Performance Analysis Superpowers with Linux BPF
OSSNA 2017 Performance Analysis Superpowers with Linux BPFOSSNA 2017 Performance Analysis Superpowers with Linux BPF
OSSNA 2017 Performance Analysis Superpowers with Linux BPF
 
Developing Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache KafkaDeveloping Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache Kafka
 
Tutorial s crypto api session keys
Tutorial   s crypto api session keysTutorial   s crypto api session keys
Tutorial s crypto api session keys
 
Computer Security
Computer SecurityComputer Security
Computer Security
 
Appsecco Kubernetes Hacking Masterclass Presentation Slides
Appsecco Kubernetes Hacking Masterclass Presentation SlidesAppsecco Kubernetes Hacking Masterclass Presentation Slides
Appsecco Kubernetes Hacking Masterclass Presentation Slides
 
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
Cotopaxi - IoT testing toolkit (Black Hat Asia 2019 Arsenal)
 
Defending Against Attacks With Rails
Defending Against Attacks With RailsDefending Against Attacks With Rails
Defending Against Attacks With Rails
 

Más de Mitchell Pronschinske

Getting Started with Kubernetes and Consul
Getting Started with Kubernetes and ConsulGetting Started with Kubernetes and Consul
Getting Started with Kubernetes and ConsulMitchell Pronschinske
 
Multi-Cloud with Nomad and Consul Connect
Multi-Cloud with Nomad and Consul ConnectMulti-Cloud with Nomad and Consul Connect
Multi-Cloud with Nomad and Consul ConnectMitchell Pronschinske
 
Dynamic Azure Credentials for Applications and CI/CD Pipelines
Dynamic Azure Credentials for Applications and CI/CD PipelinesDynamic Azure Credentials for Applications and CI/CD Pipelines
Dynamic Azure Credentials for Applications and CI/CD PipelinesMitchell Pronschinske
 
Migrating from VMs to Kubernetes using HashiCorp Consul Service on Azure
Migrating from VMs to Kubernetes using HashiCorp Consul Service on AzureMigrating from VMs to Kubernetes using HashiCorp Consul Service on Azure
Migrating from VMs to Kubernetes using HashiCorp Consul Service on AzureMitchell Pronschinske
 
Empowering developers and operators through Gitlab and HashiCorp
Empowering developers and operators through Gitlab and HashiCorpEmpowering developers and operators through Gitlab and HashiCorp
Empowering developers and operators through Gitlab and HashiCorpMitchell Pronschinske
 
Automate and simplify multi cloud complexity with f5 and hashi corp
Automate and simplify multi cloud complexity with f5 and hashi corpAutomate and simplify multi cloud complexity with f5 and hashi corp
Automate and simplify multi cloud complexity with f5 and hashi corpMitchell Pronschinske
 
Using new sentinel features in terraform cloud
Using new sentinel features in terraform cloudUsing new sentinel features in terraform cloud
Using new sentinel features in terraform cloudMitchell Pronschinske
 
Military Edge Computing with Vault and Consul
Military Edge Computing with Vault and ConsulMilitary Edge Computing with Vault and Consul
Military Edge Computing with Vault and ConsulMitchell Pronschinske
 
Unlocking the Cloud operating model with GitHub Actions
Unlocking the Cloud operating model with GitHub ActionsUnlocking the Cloud operating model with GitHub Actions
Unlocking the Cloud operating model with GitHub ActionsMitchell Pronschinske
 
Vault 1.4 integrated storage overview
Vault 1.4 integrated storage overviewVault 1.4 integrated storage overview
Vault 1.4 integrated storage overviewMitchell Pronschinske
 
Cisco ACI with HashiCorp Terraform (APAC)
Cisco ACI with HashiCorp Terraform (APAC)Cisco ACI with HashiCorp Terraform (APAC)
Cisco ACI with HashiCorp Terraform (APAC)Mitchell Pronschinske
 
Governance for Multiple Teams Sharing a Nomad Cluster
Governance for Multiple Teams Sharing a Nomad ClusterGovernance for Multiple Teams Sharing a Nomad Cluster
Governance for Multiple Teams Sharing a Nomad ClusterMitchell Pronschinske
 
Unlocking the Cloud Operating Model: Deployment
Unlocking the Cloud Operating Model: DeploymentUnlocking the Cloud Operating Model: Deployment
Unlocking the Cloud Operating Model: DeploymentMitchell Pronschinske
 
Modern Scheduling for Modern Applications with Nomad
Modern Scheduling for Modern Applications with NomadModern Scheduling for Modern Applications with Nomad
Modern Scheduling for Modern Applications with NomadMitchell Pronschinske
 
Moving to a Microservice World: Leveraging Consul on Azure
Moving to a Microservice World: Leveraging Consul on AzureMoving to a Microservice World: Leveraging Consul on Azure
Moving to a Microservice World: Leveraging Consul on AzureMitchell Pronschinske
 

Más de Mitchell Pronschinske (20)

Getting Started with Kubernetes and Consul
Getting Started with Kubernetes and ConsulGetting Started with Kubernetes and Consul
Getting Started with Kubernetes and Consul
 
Multi-Cloud with Nomad and Consul Connect
Multi-Cloud with Nomad and Consul ConnectMulti-Cloud with Nomad and Consul Connect
Multi-Cloud with Nomad and Consul Connect
 
Code quality for Terraform
Code quality for TerraformCode quality for Terraform
Code quality for Terraform
 
Dynamic Azure Credentials for Applications and CI/CD Pipelines
Dynamic Azure Credentials for Applications and CI/CD PipelinesDynamic Azure Credentials for Applications and CI/CD Pipelines
Dynamic Azure Credentials for Applications and CI/CD Pipelines
 
Migrating from VMs to Kubernetes using HashiCorp Consul Service on Azure
Migrating from VMs to Kubernetes using HashiCorp Consul Service on AzureMigrating from VMs to Kubernetes using HashiCorp Consul Service on Azure
Migrating from VMs to Kubernetes using HashiCorp Consul Service on Azure
 
Empowering developers and operators through Gitlab and HashiCorp
Empowering developers and operators through Gitlab and HashiCorpEmpowering developers and operators through Gitlab and HashiCorp
Empowering developers and operators through Gitlab and HashiCorp
 
Automate and simplify multi cloud complexity with f5 and hashi corp
Automate and simplify multi cloud complexity with f5 and hashi corpAutomate and simplify multi cloud complexity with f5 and hashi corp
Automate and simplify multi cloud complexity with f5 and hashi corp
 
Vault 1.5 Overview
Vault 1.5 OverviewVault 1.5 Overview
Vault 1.5 Overview
 
Using new sentinel features in terraform cloud
Using new sentinel features in terraform cloudUsing new sentinel features in terraform cloud
Using new sentinel features in terraform cloud
 
Military Edge Computing with Vault and Consul
Military Edge Computing with Vault and ConsulMilitary Edge Computing with Vault and Consul
Military Edge Computing with Vault and Consul
 
Unlocking the Cloud operating model with GitHub Actions
Unlocking the Cloud operating model with GitHub ActionsUnlocking the Cloud operating model with GitHub Actions
Unlocking the Cloud operating model with GitHub Actions
 
Vault 1.4 integrated storage overview
Vault 1.4 integrated storage overviewVault 1.4 integrated storage overview
Vault 1.4 integrated storage overview
 
Unlocking the Cloud Operating Model
Unlocking the Cloud Operating ModelUnlocking the Cloud Operating Model
Unlocking the Cloud Operating Model
 
Cisco ACI with HashiCorp Terraform (APAC)
Cisco ACI with HashiCorp Terraform (APAC)Cisco ACI with HashiCorp Terraform (APAC)
Cisco ACI with HashiCorp Terraform (APAC)
 
Governance for Multiple Teams Sharing a Nomad Cluster
Governance for Multiple Teams Sharing a Nomad ClusterGovernance for Multiple Teams Sharing a Nomad Cluster
Governance for Multiple Teams Sharing a Nomad Cluster
 
Integrating Terraform and Consul
Integrating Terraform and ConsulIntegrating Terraform and Consul
Integrating Terraform and Consul
 
Unlocking the Cloud Operating Model: Deployment
Unlocking the Cloud Operating Model: DeploymentUnlocking the Cloud Operating Model: Deployment
Unlocking the Cloud Operating Model: Deployment
 
Modern Scheduling for Modern Applications with Nomad
Modern Scheduling for Modern Applications with NomadModern Scheduling for Modern Applications with Nomad
Modern Scheduling for Modern Applications with Nomad
 
Moving to a Microservice World: Leveraging Consul on Azure
Moving to a Microservice World: Leveraging Consul on AzureMoving to a Microservice World: Leveraging Consul on Azure
Moving to a Microservice World: Leveraging Consul on Azure
 
Remote Culture at HashiCorp
Remote Culture at HashiCorpRemote Culture at HashiCorp
Remote Culture at HashiCorp
 

Último

Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROmotivationalword821
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 

Último (20)

Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
How To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTROHow To Manage Restaurant Staff -BTRESTRO
How To Manage Restaurant Staff -BTRESTRO
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 

HashiTLS Demystifying Security Certs

  • 1. HashiTLS Demystifying Security Certs HashiTalks 2020 Alan Scherger Cloud Janitor
  • 2. Microsoft Teams - 3hr Outage Feb 3, 2020
  • 5. So what? 1. Managing certificates in 2020 is still hard. 2. We keep repeating the same errors in our software. 3. It all starts with education, and a foundation in the basics.
  • 6. bit.ly/learn-mtls-the-hard-way A future workshop that will be much more in-depth than these slides.
  • 7. Agenda Hands-on Practice Use practical tools like mkcert and HashiCorp Consul to get familiar with how certificates can be managed and used. First Principles Learn what makes up a certificate and how those pieces come together to for a complete system. Learn the Code Examine a few code bases which utilize mTLS to get work done.
  • 8. SSL Certificate TLS Certificate HTTPS Certificate X.509 v3 Certificate
  • 9. SSL Certificate TLS Certificate HTTPS Certificate X.509 v3 Certificate
  • 11. Certificate Basic Fields - 1/3 ▪ Version Number – The version of the encoded certificate. ▪ Serial Number – A positive integer unique to the Certificate Authority. ▪ Signature Algorithm – Contains the identifier for the cryptographic algorithm used by the CA to sign the certificate.
  • 12. Certificate Basic Fields - 2/3 ▪ Issuer – Identifies the entity that has signed and issued the certificate. ▪ Validity – The time interval during which the CA warrants that it will maintain information about the status of the certificate. ▪ Subject – Identifies the entity associate with the public key stored in the subject public key field.
  • 13. Certificate Basic Fields - 3/3 ▪ Subject Public Key Info – Used to carry the public key and identify the algorithm with which the key is used. ▪ Extensions – Provide methods for associating additional attributes to certificates.
  • 14.
  • 15. Let’s Look at a Certificate TERMINAL > openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout Certificate: Data: Version: 3 (0x2) Serial Number: ba:26:56:af:26:bd:3c:1a:e5:05:9d:fa:0b:83:40:26 Signature Algorithm: sha256WithRSAEncryption Issuer: O = mkcert development CA, OU = ascherger@incontrol (Alan Scherger), CN = mkcert ascherger@incontrol (Alan Scherger) Validity Not Before: Feb 18 22:34:27 2020 GMT Not After : Feb 18 22:34:27 2030 GMT ...
  • 16. TERMINAL > openssl version LibreSSL 2.8.3 >macOS Catalina 10.15.3 LibreSSL since 10.13 - September 2017
  • 17. TERMINAL > docker run --rm ubuntu:18.04 /bin/bash -c "apt-get update && apt-get install openssl -y && openssl version" … Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libssl1.1 amd64 1.1.1-1ubuntu2.1~18.04.5 [1300 kB] Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 openssl amd64 1.1.1-1ubuntu2.1~18.04.5 [613 kB] … Setting up openssl (1.1.1-1ubuntu2.1~18.04.5) ... Processing triggers for libc-bin (2.27-3ubuntu1) ... OpenSSL 1.1.1 11 Sep 2018 Ubuntu Bionic Beaver 18.04 OpenSSL 1.1.1
  • 18. OpenSSL Command TERMINAL > openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout This is the command which is used for displaying and signing X509 formatted certificates.
  • 19. OpenSSL Command TERMINAL > openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout This specifies the input filename to read a certificate from.
  • 20. OpenSSL Command TERMINAL > openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout -text : Prints out the certificate in text form. -noout : Prevents output of the encoded version of the certificate.
  • 21. Version The version of the encoded certificate. TERMINAL > openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout Certificate: Data: Version: 3 (0x2) Serial Number: ba:26:56:af:26:bd:3c:1a:e5:05:9d:fa:0b:83:40:26 Signature Algorithm: sha256WithRSAEncryption Issuer: O = mkcert development CA, OU = ascherger@incontrol (Alan Scherger), CN = mkcert ascherger@incontrol (Alan Scherger) Validity Not Before: Feb 18 22:34:27 2020 GMT Not After : Feb 18 22:34:27 2030 GMT ...
  • 22. Serial Number A positive integer unique to the Certificate Authority. TERMINAL > openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout Certificate: Data: Version: 3 (0x2) Serial Number: ba:26:56:af:26:bd:3c:1a:e5:05:9d:fa:0b:83:40:26 Signature Algorithm: sha256WithRSAEncryption Issuer: O = mkcert development CA, OU = ascherger@incontrol (Alan Scherger), CN = mkcert ascherger@incontrol (Alan Scherger) Validity Not Before: Feb 18 22:34:27 2020 GMT Not After : Feb 18 22:34:27 2030 GMT ...
  • 23. Signature Algorithm Contains the identifier for the cryptographic algorithm used by the CA to sign this certificate. TERMINAL > openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout Certificate: Data: Version: 3 (0x2) Serial Number: ba:26:56:af:26:bd:3c:1a:e5:05:9d:fa:0b:83:40:26 Signature Algorithm: sha256WithRSAEncryption Issuer: O = mkcert development CA, OU = ascherger@incontrol (Alan Scherger), CN = mkcert ascherger@incontrol (Alan Scherger) Validity Not Before: Feb 18 22:34:27 2020 GMT Not After : Feb 18 22:34:27 2030 GMT ...
  • 24. Issuer Identifies the entity that has signed and issued the certificate. TERMINAL > openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout Certificate: Data: Version: 3 (0x2) Serial Number: ba:26:56:af:26:bd:3c:1a:e5:05:9d:fa:0b:83:40:26 Signature Algorithm: sha256WithRSAEncryption Issuer: O = mkcert development CA, OU = ascherger@incontrol (Alan Scherger), CN = mkcert ascherger@incontrol (Alan Scherger) Validity Not Before: Feb 18 22:34:27 2020 GMT Not After : Feb 18 22:34:27 2030 GMT ...
  • 25. Validity The time interval during which the CA warrants that it will maintain information about the status of the certificate. TERMINAL > openssl x509 -in ~/.local/share/mkcert/rootCA.pem -text -noout Certificate: Data: Version: 3 (0x2) Serial Number: ba:26:56:af:26:bd:3c:1a:e5:05:9d:fa:0b:83:40:26 Signature Algorithm: sha256WithRSAEncryption Issuer: O = mkcert development CA, OU = ascherger@incontrol (Alan Scherger), CN = mkcert ascherger@incontrol (Alan Scherger) Validity Not Before: Feb 18 22:34:27 2020 GMT Not After : Feb 18 22:34:27 2030 GMT ...
  • 26. Subject Identifies the entity associate with the public key stored in the subject public key field. TERMINAL Subject: O = mkcert development CA, OU = ascherger@incontrol (Alan Scherger), CN = mkcert ascherger@incontrol (Alan Scherger) Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public-Key: (3072 bit) Modulus: [large integer represented in colon-hexadecimal notation] Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Key Usage: critical Certificate Sign X509v3 Basic Constraints: critical CA:TRUE, pathlen:0 X509v3 Subject Key Identifier: B9:D5:B3:06:55:B4:E6:CE:CB:CB:56:B3:4A:35:96:A3:AA:5F:2D:C4
  • 27. Subject Public Key Info Used to carry the public key and identify the algorithm with which the key is used. TERMINAL Subject: O = mkcert development CA, OU = ascherger@incontrol (Alan Scherger), CN = mkcert ascherger@incontrol (Alan Scherger) Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public-Key: (3072 bit) Modulus: [large integer represented in colon-hexadecimal notation] Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Key Usage: critical Certificate Sign X509v3 Basic Constraints: critical CA:TRUE, pathlen:0 X509v3 Subject Key Identifier: B9:D5:B3:06:55:B4:E6:CE:CB:CB:56:B3:4A:35:96:A3:AA:5F:2D:C4
  • 28. Extensions: Key Usage Defines the purpose of the key contained in the certificate. TERMINAL Subject: O = mkcert development CA, OU = ascherger@incontrol (Alan Scherger), CN = mkcert ascherger@incontrol (Alan Scherger) Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public-Key: (3072 bit) Modulus: [large integer represented in colon-hexadecimal notation] Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Key Usage: critical Certificate Sign X509v3 Basic Constraints: critical CA:TRUE, pathlen:0 X509v3 Subject Key Identifier: B9:D5:B3:06:55:B4:E6:CE:CB:CB:56:B3:4A:35:96:A3:AA:5F:2D:C4
  • 29. Extensions: Basic Constraints Identifies whether the subject of the certificate is a CA and the maximum depth of valid certification paths that include this certificate. TERMINAL Subject: O = mkcert development CA, OU = ascherger@incontrol (Alan Scherger), CN = mkcert ascherger@incontrol (Alan Scherger) Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public-Key: (3072 bit) Modulus: [large integer represented in colon-hexadecimal notation] Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Key Usage: critical Certificate Sign X509v3 Basic Constraints: critical CA:TRUE, pathlen:0 X509v3 Subject Key Identifier: B9:D5:B3:06:55:B4:E6:CE:CB:CB:56:B3:4A:35:96:A3:AA:5F:2D:C4
  • 30. Extensions: Subject Key Identifier Provides a means of identifying certificates that contain a particular public key. TERMINAL Subject: O = mkcert development CA, OU = ascherger@incontrol (Alan Scherger), CN = mkcert ascherger@incontrol (Alan Scherger) Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public-Key: (3072 bit) Modulus: [large integer represented in colon-hexadecimal notation] Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Key Usage: critical Certificate Sign X509v3 Basic Constraints: critical CA:TRUE, pathlen:0 X509v3 Subject Key Identifier: B9:D5:B3:06:55:B4:E6:CE:CB:CB:56:B3:4A:35:96:A3:AA:5F:2D:C4
  • 31.
  • 32. Blue Book Volume VIII - Fascicle VIII.8 Data Communication Networks Directory Recommendations X.500-X.521 🔥 236 glorious pages of explanation 🔥
  • 33. Certificate Authority Is an entity that issues digital certificates.
  • 34. Certificate Chain of Trust A list of certificates (usually starting with an end-entity certificate) followed by one or more CA certificates (usually the last one being a self-signed certificate), with the following properties: 1. The Issuer of each certificate (except the last one) matches the Subject of the next certificate in the list. 2. Each certificate (except the last one) is supposed to be signed by the secret key corresponding to the next certificate in the chain (i.e. the signature of one certificate can be verified using the public key contained in the following certificate). 3. The last certificate in the list is a trust anchor: a certificate that you trust because it was delivered to you by some trustworthy procedure.
  • 35. Cryptographic Protocols The final chapter in me rambling!
  • 36. Cryptographic Protocols Protocol Document Deprecated SSL Version 2.0 Draft March 2011 RFC 6176 SSL Version 3.0 RFC 6101 June 2015 RFC 7568 TLS 1.0 RFC 2246 May 2015 RFC 7525 --- June 2018 PCI DSS TLS 1.1 RFC 4346 First ½ 2020 Apple, Microsoft, Google TLS 1.2 RFC 5246 TLS 1.3 RFC 8446
  • 38. FiloSottile/mkcert A simple tool for making locally-trusted development certificates.
  • 39. iOS 13 and macOS 10.15 - Gotchya https://support.apple.com/en-us/HT210176
  • 40. iOS 13 and macOS 10.15 - Gotchya https://support.apple.com/en-us/HT210176
  • 41. Install Download the latest Release Use the -install flag to generate an install certificates. TERMINAL > chmod +x ~/Downloads/mkcert-v1.4.1-darwin-amd64 > ~/Downloads/mkcert-v1.4.1-darwin-amd64 -install Created a new local CA at "/Users/ascherger/Library/Application Support/mkcert" 💥 Sudo password: The local CA is now installed in the system trust store! ⚡ Warning: "certutil" is not available, so the CA can't be automatically installed in Firefox! ⚠ Install "certutil" with "brew install nss" and re-run "mkcert -install" 👈 >
  • 42. TERMINAL > ls -al /Users/ascherger/Library/Application Support/mkcert total 16 drwxr-xr-x 4 ascherger staff 128 Feb 16 22:09 . drwx------+ 121 ascherger staff 3872 Feb 16 22:09 .. -r-------- 1 ascherger staff 2488 Feb 16 22:09 rootCA-key.pem -rw-r--r-- 1 ascherger staff 1728 Feb 16 22:09 rootCA.pem > Look at our certificates. rootCA-key.pem is the private key. rootCA.pem is the public certificate.
  • 43. Inspect the Root CA Private Key RFC 3447 Section 3.2 TERMINAL > openssl rsa -in rootCA-key.pem -text -noout Private-Key: (3072 bit) modulus: 00:e0:70:56:33:aa:83:d5:ed:0f:46:f1:99:d5:81: ... publicExponent: 65537 (0x10001) privateExponent: 00:aa:f4:e6:b4:74:2d:f7:c5:9a:dd:6f:2a:be:77: ... prime1: 00:f2:6d:61:68:e0:6d:18:72:ef:7e:86:17:7a:b7: ... prime2: 00:ed:01:22:6b:5b:88:ae:c1:21:e5:be:91:58:c4: ... exponent1: 00:a4:82:77:5c:cd:17:1b:45:3b:a2:57:6a:6d:7b: ... exponent2: 00:9f:f6:39:0d:ee:bc:c4:fe:33:6b:c6:00:81:c2: ... coefficient: 10:0e:1d:ad:75:e5:b9:fc:fe:47:72:c6:86:88:dc: ...
  • 44. TERMINAL > openssl x509 -in rootCA.pem -text -noout Certificate: Data: Version: 3 (0x2) Serial Number: 84:4a:83:84:72:ad:27:89:09:7e:48:44:b9:f6:30:6e Signature Algorithm: sha256WithRSAEncryption Issuer: O=mkcert development CA, OU=ascherger@Alans-MacBook-Pro.local, CN=mkcert ascherger@Alans-MacBook-Pro.local Validity Not Before: Feb 17 04:09:41 2020 GMT Not After : Feb 17 04:09:41 2030 GMT Subject: O=mkcert development CA, OU=ascherger@Alans-MacBook-Pro.local, CN=mkcert ascherger@Alans-MacBook-Pro.local Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (3072 bit) Modulus: 00:e0:70:56:33:aa:83:d5:ed:0f:46:f1:99:d5:81: ... Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Key Usage: critical Certificate Sign X509v3 Basic Constraints: critical CA:TRUE, pathlen:0 X509v3 Subject Key Identifier: 93:EF:36:51:3D:94:46:01:8F:01:F7:B9:22:09:75:F9:E7:63:93:F9 Signature Algorithm: sha256WithRSAEncryption bb:0e:80:b4:35:b8:2a:58:9e:36:f3:4a:ce:87:5c:0b:86:54: ... Inspect the Root CA Public Certificate
  • 45. Make a new localhost certificate. TERMINAL > mkcert localhost 127.0.0.1 ::1 Using the local CA at "/Users/ascherger/Library/Application Support/mkcert" ✨ Created a new certificate valid for the following names 📜 - "localhost" - "127.0.0.1" - "::1" The certificate is at "./localhost+2.pem" and the key at "./localhost+2-key.pem" ✅ >
  • 46. Serial Number Remember “18:f1” we’ll see that again soon. TERMINAL Certificate: Data: Version: 3 (0x2) Serial Number: 18:f1:88:4e:19:56:0f:7a:ae:11:75:eb:e9:67:8d:57 Signature Algorithm: sha256WithRSAEncryption Issuer: O=mkcert development CA, OU=ascherger@Alans-MacBook-Pro.local, CN=mkcert ascherger@Alans-MacBook-Pro.local Validity Not Before: Jun 1 00:00:00 2019 GMT Not After : Feb 19 07:05:58 2030 GMT Subject: O=mkcert development certificate, OU=ascherger@Alans-MacBook-Pro.local
  • 47. Issuer Matches our Root CA public key information. TERMINAL Certificate: Data: Version: 3 (0x2) Serial Number: 18:f1:88:4e:19:56:0f:7a:ae:11:75:eb:e9:67:8d:57 Signature Algorithm: sha256WithRSAEncryption Issuer: O=mkcert development CA, OU=ascherger@Alans-MacBook-Pro.local, CN=mkcert ascherger@Alans-MacBook-Pro.local Validity Not Before: Jun 1 00:00:00 2019 GMT Not After : Feb 19 07:05:58 2030 GMT Subject: O=mkcert development certificate, OU=ascherger@Alans-MacBook-Pro.local
  • 48. Validity Patched to get around the macOS hiccup. TERMINAL Certificate: Data: Version: 3 (0x2) Serial Number: 18:f1:88:4e:19:56:0f:7a:ae:11:75:eb:e9:67:8d:57 Signature Algorithm: sha256WithRSAEncryption Issuer: O=mkcert development CA, OU=ascherger@Alans-MacBook-Pro.local, CN=mkcert ascherger@Alans-MacBook-Pro.local Validity Not Before: Jun 1 00:00:00 2019 GMT Not After : Feb 19 07:05:58 2030 GMT Subject: O=mkcert development certificate, OU=ascherger@Alans-MacBook-Pro.local
  • 49. Subject No Common Name (CN), and different than CA information. TERMINAL Certificate: Data: Version: 3 (0x2) Serial Number: 18:f1:88:4e:19:56:0f:7a:ae:11:75:eb:e9:67:8d:57 Signature Algorithm: sha256WithRSAEncryption Issuer: O=mkcert development CA, OU=ascherger@Alans-MacBook-Pro.local, CN=mkcert ascherger@Alans-MacBook-Pro.local Validity Not Before: Jun 1 00:00:00 2019 GMT Not After : Feb 19 07:05:58 2030 GMT Subject: O=mkcert development certificate, OU=ascherger@Alans-MacBook-Pro.local
  • 50. Key Usage Explicitly allows for Web Server usage, but not Client usage. TERMINAL Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (2048 bit) Modulus: 00:c0:ed:e2:11:01:66:60:d1:c6:50:cd:e0:7a:a3: ... Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Key Usage: critical Digital Signature, Key Encipherment X509v3 Extended Key Usage: TLS Web Server Authentication X509v3 Basic Constraints: critical CA:FALSE
  • 51. Basic Constraints This certificate cannot act as a CA, so it cannot make child certificates. TERMINAL Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (2048 bit) Modulus: 00:c0:ed:e2:11:01:66:60:d1:c6:50:cd:e0:7a:a3: ... Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Key Usage: critical Digital Signature, Key Encipherment X509v3 Extended Key Usage: TLS Web Server Authentication X509v3 Basic Constraints: critical CA:FALSE
  • 52. Authority Key Identifier Matches the Subject Key Identifier of the Root certificate. TERMINAL X509v3 Authority Key Identifier: keyid:93:EF:36:51:3D:94:46:01:8F:01:F7:B9:22:09:75:F9:E7:63:93:F9 X509v3 Subject Alternative Name: DNS:localhost, IP Address:127.0.0.1, IP Address:0:0:0:0:0:0:0:1 Signature Algorithm: sha256WithRSAEncryption 4b:f5:d0:fa:27:43:c2:d8:ef:4c:be:5e:66:81:21:c1:c1:5f: ...
  • 53. Subject Alternative Name A list of DNS and IP addresses this certificate is allowed to represent. TERMINAL X509v3 Authority Key Identifier: keyid:93:EF:36:51:3D:94:46:01:8F:01:F7:B9:22:09:75:F9:E7:63:93:F9 X509v3 Subject Alternative Name: DNS:localhost, IP Address:127.0.0.1, IP Address:0:0:0:0:0:0:0:1 Signature Algorithm: sha256WithRSAEncryption 4b:f5:d0:fa:27:43:c2:d8:ef:4c:be:5e:66:81:21:c1:c1:5f: ...
  • 54. Nginx default.conf CODE EDITOR server { listen [::]:443 ssl http2 ipv6only=on; listen 443 ssl http2; server_name localhost; ssl_certificate /etc/nginx/conf.d/localhost+2.pem; ssl_certificate_key /etc/nginx/conf.d/localhost+2-key.pem; location / { root /usr/share/nginx/html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }
  • 55. Run Nginx TERMINAL > docker run -p 4448:443 -v "`pwd`:/etc/nginx/conf.d" nginx Unable to find image 'nginx:latest' locally latest: Pulling from library/nginx bc51dd8edc1b: Pull complete 66ba67045f57: Pull complete bf317aa10aa5: Pull complete Digest: sha256:ad5552c786f128e389a0263104ae39f3d3c7895579d45ae716f528185b36 bc6f Status: Downloaded newer image for nginx:latest
  • 56. Visit https://localhost:4448/ The certificate is trusted, and the Serial Number matches the certificate we just created.
  • 58.
  • 60. Consul + TLS 1. Consul CLI has a tls command for setting up a CA and certificates. 2. Consul has an auto_encrypt feature for auto-managing certificates 3. Consul’s Connect API contains the CA endpoints, and supports automated CA rotation through cross-signing.
  • 61.
  • 62. bit.ly/vault-learn Learn how to setup Vault! Be sure to look up tls_require_and_verify_client_cert
  • 63.
  • 66. Consul - Encryption If verify_server_hostname is set, then outgoing connections perform hostname verification. All servers must have a certificate valid for server.<datacenter>.<domain> or the client will reject the handshake.
  • 67. package tlsutil - config.go L706-L726 CODE EDITOR // Wrap a net.Conn into a client tls connection, performing any // additional verification as needed. // // As of go 1.3, crypto/tls only supports either doing no certificate // verification, or doing full verification including of the peer's // DNS name. For consul, we want to validate that the certificate is // signed by a known CA, but because consul doesn't use DNS names for // node names, we don't verify the certificate DNS names. Since go 1.3 // no longer supports this mode of operation, we have to do it // manually. func (c *Configurator ) wrapTLSClient (dc string, conn net.Conn) (net.Conn, error) { config := c.OutgoingRPCConfig () verifyServerHostname := c.VerifyServerHostname () verifyOutgoing := c.verifyOutgoing () domain := c.domain() if verifyServerHostname { // Strip the trailing '.' from the domain if any domain = strings.TrimSuffix(domain, ".") config.ServerName = "server." + dc + "." + domain } tlsConn := tls.Client(conn, config)
  • 68. Nomad - Securing With TLS To fulfill the desired security properties Nomad certificates are signed with their region and role such as: - client.global.nomad for a client node in the global region - server.us-west.nomad for a server node in the us-west region
  • 69. package tls - common.go L510-L521 CODE EDITOR // VerifyPeerCertificate, if not nil, is called after normal // certificate verification by either a TLS clientor server. It // receives the raw ASN.1 certificates provided by the peer and also // any verified chains that normal processing found. If it returns a // non-nil error, the handshake is aborted and that error results. // // If normal verification fails then the handshake will abort before // considering this callback. If normal verification is disabled by // setting InsecureSkipVerify, or (for a server) when ClientAuth is // RequestClientCert or RequireAnyClientCert, then this callback will // be considered but the verifiedChains argument will always be nil. VerifyPeerCertificate func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error
  • 70. package nomad - server.go L451-L477 CODE EDITOR // getTLSConf gets the server's TLS configuration based on the config supplied // by the operator func getTLSConf(enableRPC bool, tlsConf *tlsutil.Config, region string) (*tls.Config, tlsutil.RegionWrapper , error) { // omitted for slide if tlsConf.VerifyServerHostname { incomingTLS = itls.Clone() incomingTLS .VerifyPeerCertificate = rpcNameAndRegionValidator (region) } else { incomingTLS = itls } return incomingTLS , tlsWrap, nil }
  • 71. package nomad - server.go L479-L497 CODE EDITOR // implements signature of tls.Config.VerifyPeerCertificate which is called // after the certs have been verified. We'll ignore the raw certs and only // check the verified certs. func rpcNameAndRegionValidator(region string) func([][]byte, [][]*x509.Certificate) error { return func(_ [][]byte, certificates [][]*x509.Certificate) error { if len(certificates) > 0 && len(certificates[0]) > 0 { cert := certificates[0][0] for _, dnsName := range cert.DNSNames { if validateRPCRegionPeer(dnsName, region) {return nil} } if validateRPCRegionPeer(cert.Subject.CommonName, region) { return nil } } return errors.New("invalid role or region for certificate") }
  • 72. package nomad - server.go L499-L515 CODE EDITOR func validateRPCRegionPeer (name, region string) bool { parts := strings.Split(name, ".") if len(parts) < 3 { // Invalid SAN return false } if parts[len(parts)-1] != "nomad" { // Incorrect service return false } if parts[0] == "client" { // Clients may only connect to servers in their region return name == "client."+region+".nomad" } // Servers may connect to any Nomad RPC service for federation. return parts[0] == "server" }