Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Add support for enabling auto_encrypt on both server and client instances #151

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jinnko
Copy link
Contributor

@jinnko jinnko commented Sep 9, 2019

We get support for enabling auto_encryption at set up time, allowing client instances to get their TLS key/cert pairs from the consul servers.

In order to allow browsers to access the UI we also need to TLS on the HTTPS endponit, while keeping mTLS enabled for RPC connections.

There are a couple of special cases to be considered (see individual commits for details):

  1. Workaround for v1.6.0 (Error starting agent: AutoEncrypt failed: unknown private key type requested: on autoencrypt enabled client consul#6391)
  2. Workaround lack of support for HTTPS (Use certificates generated by auto_encrypt for HTTPS API and not only RPC consul#6403)

We get support for enabling auto_encryption at set up time, allowing
client instances to get their TLS key/cert pairs from the consul
servers.

In order to allow browsers to access the UI we also need to enable the
HTTPS endpoint and disable mTLS on the HTTPS endponit, while keeping
mTLS enabled for RPC connections.
When we're running consul in client mode and want it to connect to the
servers we must provide the CA and enable HTTPS.  It's also good
practice to disable plain HTTP.
There's a known issue[1] in v1.6.0 that prevents consul clients from
contacting the servers when they're configured to auto-join.  This
workaround[2] gets things working.

1: hashicorp/consul#6391
2: hashicorp/consul#6391 (comment)
When auto_encrypt is used on the client agents there's still no support
for TLS over the HTTPS API[1].

In order for the client agents to interact with services such as nomad
we need to enable the HTTP API, but to maintain some level of controls
we also restrict write operations to localhost.

1: hashicorp/consul#6403
@brikis98
Copy link
Collaborator

@Etiene Could you review this one?

"ca_path": "$ca_path",
"cert_file": "$cert_file_path",
"key_file": "$key_file_path",
"ports": {
"https": 8501,
"grpc": 8502
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these be configurable?

"https": 8501
},
"http_config": {
"allow_write_http_from": ["127.0.0.0/8"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be configurable too?

@Etiene
Copy link
Contributor

Etiene commented Sep 20, 2019

Thanks for the PR! How did you test this? I wonder if we should have an automated test to check this behavior

@bigeasy
Copy link

bigeasy commented Sep 25, 2019

I created a Pull Request for this Pull request.

ixydo#1

Enable auto encryption without requiring server key and certificate. My understand of auto-encryption is that the server will provide a PKI certificate to clients, you don't have to distribute them yourself. Adjusted to create a configuration similar to on in the Learning Consul documentation.

@hashicorp-cla
Copy link

hashicorp-cla commented Mar 12, 2022

CLA assistant check
All committers have signed the CLA.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants