-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Should have Nomad and Consul deployed and configured with mTLS. ACLs are currently not enabled on Consul, only Nomad. This should provide the minimal working example using mTLS to get the cought dashboard working after a ton of tinkering. 😭 The links I used during my investigation/debugging session: * hashicorp/nomad#6463 * https://learn.hashicorp.com/nomad/consul-integration/nomad-connect-acl#run-a-connect-enabled-job * hashicorp/nomad#6594 * hashicorp/nomad#4276 hashicorp/nomad#7715 * https://www.consul.io/docs/agent/options ⭐ * hashicorp/nomad#7602
- Loading branch information
Showing
35 changed files
with
722 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
resource "tls_private_key" "consul-ca" { | ||
algorithm = "RSA" | ||
rsa_bits = "2048" | ||
} | ||
|
||
resource "tls_self_signed_cert" "consul-ca" { | ||
is_ca_certificate = true | ||
validity_period_hours = 87600 | ||
|
||
key_algorithm = tls_private_key.consul-ca.algorithm | ||
private_key_pem = tls_private_key.consul-ca.private_key_pem | ||
|
||
subject { | ||
common_name = "consul-ca.local" | ||
organization = var.tls_organization | ||
} | ||
|
||
allowed_uses = [ | ||
"cert_signing", | ||
"digital_signature", | ||
"key_encipherment", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
resource "tls_private_key" "consul-cli" { | ||
algorithm = "RSA" | ||
rsa_bits = "2048" | ||
} | ||
|
||
resource "tls_cert_request" "consul-cli" { | ||
key_algorithm = tls_private_key.consul-cli.algorithm | ||
private_key_pem = tls_private_key.consul-cli.private_key_pem | ||
|
||
dns_names = [ | ||
"localhost", | ||
"cli.dc1.consul", | ||
] | ||
|
||
subject { | ||
common_name = "client.global.consul" | ||
organization = var.tls_organization | ||
} | ||
} | ||
|
||
resource "tls_locally_signed_cert" "consul-cli" { | ||
cert_request_pem = tls_cert_request.consul-cli.cert_request_pem | ||
|
||
ca_key_algorithm = tls_private_key.consul-ca.algorithm | ||
ca_private_key_pem = tls_private_key.consul-ca.private_key_pem | ||
ca_cert_pem = tls_self_signed_cert.consul-ca.cert_pem | ||
|
||
validity_period_hours = 87600 | ||
|
||
allowed_uses = [ | ||
"digital_signature", | ||
"key_encipherment", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# TODO(kent): delete once auto_encrypt is setup/verified | ||
|
||
resource "tls_private_key" "consul-client" { | ||
algorithm = "RSA" | ||
rsa_bits = "2048" | ||
} | ||
|
||
resource "tls_cert_request" "consul-client" { | ||
key_algorithm = tls_private_key.consul-client.algorithm | ||
private_key_pem = tls_private_key.consul-client.private_key_pem | ||
|
||
ip_addresses = [ | ||
"127.0.0.1", | ||
] | ||
|
||
dns_names = [ | ||
"localhost", | ||
"client.dc1.consul", | ||
] | ||
|
||
subject { | ||
common_name = "client.dc1.consul" | ||
organization = var.tls_organization | ||
} | ||
} | ||
|
||
resource "tls_locally_signed_cert" "consul-client" { | ||
cert_request_pem = tls_cert_request.consul-client.cert_request_pem | ||
|
||
ca_key_algorithm = tls_private_key.consul-ca.algorithm | ||
ca_private_key_pem = tls_private_key.consul-ca.private_key_pem | ||
ca_cert_pem = tls_self_signed_cert.consul-ca.cert_pem | ||
|
||
validity_period_hours = 87600 | ||
|
||
allowed_uses = [ | ||
"server_auth", | ||
"client_auth", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
resource "tls_private_key" "consul-server" { | ||
algorithm = "RSA" | ||
rsa_bits = "2048" | ||
} | ||
|
||
resource "tls_cert_request" "consul-server" { | ||
key_algorithm = tls_private_key.consul-server.algorithm | ||
private_key_pem = tls_private_key.consul-server.private_key_pem | ||
|
||
ip_addresses = [ | ||
"127.0.0.1", | ||
] | ||
|
||
dns_names = [ | ||
"localhost", | ||
"server.dc1.consul", | ||
] | ||
|
||
subject { | ||
common_name = "server.dc1.consul" | ||
organization = var.tls_organization | ||
} | ||
} | ||
|
||
resource "tls_locally_signed_cert" "consul-server" { | ||
cert_request_pem = tls_cert_request.consul-server.cert_request_pem | ||
|
||
ca_key_algorithm = tls_private_key.consul-ca.algorithm | ||
ca_private_key_pem = tls_private_key.consul-ca.private_key_pem | ||
ca_cert_pem = tls_self_signed_cert.consul-ca.cert_pem | ||
|
||
validity_period_hours = 87600 | ||
|
||
allowed_uses = [ | ||
"server_auth", | ||
"client_auth", | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
resource "random_password" "nomad-gossip-key" { | ||
length = 16 | ||
special = true | ||
} | ||
|
||
resource "random_password" "consul-gossip-key" { | ||
length = 16 | ||
special = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.