Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CE-654 - TLS Encryption docs + CE-713 - Gossip Encryption key rotation #21509

Merged
merged 53 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
2c29ac4
New proposed structure
danielehc Jul 3, 2024
8316b47
Fix structure and add some content
danielehc Jul 3, 2024
4337d55
Fix structure and add some content
danielehc Jul 3, 2024
805eafd
Fix structure and add some content
danielehc Jul 3, 2024
d2eb834
Add content
danielehc Jul 3, 2024
b25aec8
Add content
danielehc Jul 3, 2024
a10099a
Merge branch 'main' into CE-654
danielehc Jul 16, 2024
bdb1b9a
mtls steps
danielehc Jul 17, 2024
b380124
Merge branch 'main' into CE-654
danielehc Aug 6, 2024
57b7dab
Merge branch 'main' into CE-654
danielehc Aug 28, 2024
0e2366b
Merge branch 'main' into CE-654
danielehc Sep 3, 2024
0859d97
Encryption docs structure change
danielehc Sep 3, 2024
e0b4e05
Encryption docs structure change
danielehc Sep 3, 2024
ad83a22
Encryption docs structure change
danielehc Sep 3, 2024
9b857af
Encryption docs structure change
danielehc Sep 3, 2024
c0f59fd
Encryption docs structure change
danielehc Sep 3, 2024
baf7582
Encryption docs structure change
danielehc Sep 3, 2024
c81a947
Encryption docs structure change
danielehc Sep 3, 2024
f7842d4
Encryption docs structure change
danielehc Sep 3, 2024
1369c7e
Encryption docs structure change
danielehc Sep 4, 2024
5abe2e8
Encryption docs structure change
danielehc Sep 4, 2024
cc95507
Encryption docs structure change
danielehc Sep 4, 2024
959265f
Encryption docs structure change
danielehc Sep 4, 2024
e831a60
Encryption docs structure change
danielehc Sep 4, 2024
8a28c40
Encryption docs structure change
danielehc Sep 4, 2024
e5a15d1
Encryption docs structure change
danielehc Sep 4, 2024
3d405d4
Encryption docs structure change
danielehc Sep 4, 2024
a7715a7
Encryption docs structure change
danielehc Sep 4, 2024
d2f697b
Encryption docs structure change
danielehc Sep 4, 2024
6bce157
Encryption docs structure change
danielehc Sep 4, 2024
4de0225
spacing fixes
boruszak Sep 4, 2024
51a4993
Replace <CodeTabs>
boruszak Sep 4, 2024
029baaf
<CodeBlockConfig> alignment
boruszak Sep 4, 2024
9955d8a
indent fixes
boruszak Sep 4, 2024
c9f2953
spacing
boruszak Sep 4, 2024
baed998
More Code tabs fixes
boruszak Sep 4, 2024
d8c8a0c
Structure chenges
danielehc Sep 10, 2024
bda2174
Merge branch 'main' into CE-654
danielehc Sep 10, 2024
eb6bdc8
Structure chenges
danielehc Sep 10, 2024
f50b746
Extra content and CE-713 migration
danielehc Sep 10, 2024
1d242c5
Extra content
danielehc Sep 10, 2024
3d11442
Extra content
danielehc Sep 10, 2024
4650c43
Extra content
danielehc Sep 10, 2024
51b5263
Merge branch 'main' into CE-654
danielehc Sep 10, 2024
3f485b0
Merge branch 'main' into CE-654
danielehc Sep 17, 2024
71b093b
Apply suggestions from code review
danielehc Sep 17, 2024
d4a5eac
Apply suggestions from code review
danielehc Sep 17, 2024
ca80d93
Merge branch 'main' into CE-654
danielehc Sep 18, 2024
7ec4859
Apply suggestions from code review
danielehc Sep 18, 2024
7a71843
Test CodeTabs
danielehc Sep 18, 2024
0c3356c
Test CodeTabs
danielehc Sep 18, 2024
f986f2d
Merge branch 'main' into CE-654
danielehc Sep 18, 2024
f6fb9d2
Apply suggestions from code review
danielehc Sep 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 0 additions & 111 deletions website/content/docs/security/encryption.mdx

This file was deleted.

284 changes: 284 additions & 0 deletions website/content/docs/security/encryption/gossip.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
---
layout: docs
page_title: Gossip Encryption
description: >-
Consul supports encrypting all of its network traffic. Gossip communication between all agents can be encrypted unsing a symmetric key.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
page_title: Gossip Encryption
description: >-
Consul supports encrypting all of its network traffic. Gossip communication between all agents can be encrypted unsing a symmetric key.
page_title: Manage gossip encryption
description: >-
Consul supports encrypting all of its network traffic. Learn how to secure gossip communication between all agents by creating and rotating a symmetric key.

---

# Gossip Encryption
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Gossip Encryption
# Manage gossip encryption


This topics describes how to enable gossip encryption on a Consul datacenter.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
This topics describes how to enable gossip encryption on a Consul datacenter.
This topic describes the steps to enable gossip encryption on a Consul datacenter and rotate the gossip encryption key to maintain secure communication between agents.


## Enable gossip encryption
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
## Enable gossip encryption
## Workflows


We recommend enabling gossip encryption to all new deployed Consul datacenters.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
We recommend enabling gossip encryption to all new deployed Consul datacenters.
We recommend enabling gossip encryption to all new deployed Consul datacenters. You can also update the agents in an existing datacenter to use gossip encryption.


danielehc marked this conversation as resolved.
Show resolved Hide resolved
If you have an existing datacenter running Consul `0.8.4` and above, it is possible to modify its configuration to support gossip encryption.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
If you have an existing datacenter running Consul `0.8.4` and above, it is possible to modify its configuration to support gossip encryption.

v0.8.x is too old for us to maintain in documentation. That's about 4 years ago. I'm keeping the instruction to "enable on an existing datacenter," just moving some words around.


Below are listed the steps required for both scenarios:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Below are listed the steps required for both scenarios:
The workflow to enable gossip encryption changes depending on whether your datacenter has client agents running.


- [Enable gossip encryption on a new datacenter](#enable-gossip-encryption-on-a-new-datacenter)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- [Enable gossip encryption on a new datacenter](#enable-gossip-encryption-on-a-new-datacenter)
To [enable gossip encryption on a new datacenter](#enable-gossip-encryption-on-a-new-datacenter):

1. Use `consul keygen` to generate a new gossip encryption key.
1. Create a configuration file that includes the `encrypt` parameter set to the newly generated key.
1. Distribute the configuration file to all the agent nodes that need to be pert of the datacenter and start the Consul agent on all the nodes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
1. Create a configuration file that includes the `encrypt` parameter set to the newly generated key.
1. Distribute the configuration file to all the agent nodes that need to be pert of the datacenter and start the Consul agent on all the nodes.
1. Create a configuration file that sets the `encrypt` parameter to the newly generated key.
1. Distribute the configuration file to all agent nodes that are part of the datacenter. Then start the Consul agent on all the nodes.

- [Enable gossip encryption on an existing datacenter](#enable-gossip-encryption-on-an-existing-datacenter)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- [Enable gossip encryption on an existing datacenter](#enable-gossip-encryption-on-an-existing-datacenter)
To [enable gossip encryption on an existing datacenter](#enable-gossip-encryption-on-an-existing-datacenter):

1. Use `consul keygen` to generate a new gossip encryption key.
1. Create a configuration file that includes the `encrypt` parameter set to the newly generated key and `encrypt_verify_incoming` and `encrypt_verify_outgoing` set to `false`.
1. Distribute the configuration file to all the agent nodes that need to be pert of the datacenter and perform a rolling restart of all the agents.
1. Update the `encrypt_verify_outgoing` setting to `true` and perform a rolling restart of all the agents.
1. Update the `encrypt_verify_incoming` setting to `true` and perform a rolling restart of all the agents.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
1. Create a configuration file that includes the `encrypt` parameter set to the newly generated key and `encrypt_verify_incoming` and `encrypt_verify_outgoing` set to `false`.
1. Distribute the configuration file to all the agent nodes that need to be pert of the datacenter and perform a rolling restart of all the agents.
1. Update the `encrypt_verify_outgoing` setting to `true` and perform a rolling restart of all the agents.
1. Update the `encrypt_verify_incoming` setting to `true` and perform a rolling restart of all the agents.
1. Create a configuration file that sets the `encrypt` parameter to the newly generated key and sets `encrypt_verify_incoming` and `encrypt_verify_outgoing` to `false`.
1. Distribute the configuration file to all agent nodes that are part of the datacenter. Then perform a rolling restart of all Consul agents.
1. Update the `encrypt_verify_outgoing` setting to `true` and perform a rolling restart of all Consul agents.
1. Update the `encrypt_verify_incoming` setting to `true` and perform a rolling restart of all Consul agents.


If you have multiple datacenters joined in WAN federation, be sure to use _the same encryption key_ in all datacenters.

## Enable gossip encryption on a new datacenter

Enable gossip encryption on a new datacenter is a straightforward process and should be the default approach for all new datacenters you are deploying. To enable gossip encryption you set an encryption key when starting the Consul agent. The key can be set via the `encrypt` parameter.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Enable gossip encryption on a new datacenter is a straightforward process and should be the default approach for all new datacenters you are deploying. To enable gossip encryption you set an encryption key when starting the Consul agent. The key can be set via the `encrypt` parameter.
We recommend enabling gossip encryption on all new Consul datacenters.

Repetitive statements can be removed


**Step 1**: Generate an encryption key using `consul keygen`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
**Step 1**: Generate an encryption key using `consul keygen`.
### Generate a gossip encryption key
First, generate an encryption key on a Consul server. The Consul CLI includes a `consul keygen` command to generate a key.


```shell-session
$ consul keygen
YwgWlBvicJN17UOYcutXLpJSZsw5aWpLEEWqgK635zA=
```

You can generate a new gossip key using any method that can creates 32 random bytes encoded in base64.

For example on Linux you can use `openssl` or `dd` to create one.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
You can generate a new gossip key using any method that can creates 32 random bytes encoded in base64.
For example on Linux you can use `openssl` or `dd` to create one.
You can generate a new gossip key using any method that can create 32 random bytes encoded in base64. For example, you can use `openssl` or `dd` to create a key on Linux with one of the following commands:


- `openssl rand -base64 32`
- `dd if=/dev/urandom bs=32 count=1 status=none | base64`

**Step 2**: Create a configuration file that includes the `encrypt` parameter set to the newly generated key.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
**Step 2**: Create a configuration file that includes the `encrypt` parameter set to the newly generated key.
### Add the key to the agent configuration
Create a configuration that sets `encrypt` parameter to the newly generated key. You can edit the existing agent configuration, or you can add a file to the configuration directory. For more information, refer to [configuring Consul agents](/consul/docs/agent#configuring-consul-agents).


<CodeTabs>

```hcl
encrypt = "YwgWlBvicJN17UOYcutXLpJSZsw5aWpLEEWqgK635zA="
```

```json
{
"encrypt": "YwgWlBvicJN17UOYcutXLpJSZsw5aWpLEEWqgK635zA="
}
```

</CodeTabs>

**Step 3**: Distribute the configuration file to all the agent nodes that need to be pert of the datacenter and start the Consul agent on all the nodes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
**Step 3**: Distribute the configuration file to all the agent nodes that need to be pert of the datacenter and start the Consul agent on all the nodes.
### Add the key to all agent configurations
Distribute the gossip key to all the agent nodes that need to be pert of the datacenter. Then start the Consul agent on all the nodes.


If gossip encryption is properly configured `Gossip Encryption: true` will be shown in the logs at startup.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
If gossip encryption is properly configured `Gossip Encryption: true` will be shown in the logs at startup.
When gossip encryption is properly configured, `Gossip Encryption: true` appears in the Consul logs at startup.


<CodeBlockConfig filename="consul.log" hideClipboard highlight="10">

```log
==> Starting Consul agent...
Version: '1.19.0'
Build Date: '2024-06-12 13:59:10 +0000 UTC'
Node ID: 'e74b1ade-e932-1707-cdf1-6579b8b2536c'
Node name: 'consul-server-0'
Datacenter: 'dc1' (Segment: '<all>')
Server: true (Bootstrap: false)
Client Addr: [127.0.0.1] (HTTP: 8500, HTTPS: 8443, gRPC: -1, gRPC-TLS: 8503, DNS: 53)
Cluster Addr: 172.19.0.7 (LAN: 8301, WAN: 8302)
Gossip Encryption: true
Auto-Encrypt-TLS: true
ACL Enabled: true
Reporting Enabled: false
ACL Default Policy: deny
HTTPS TLS: Verify Incoming: false, Verify Outgoing: true, Min Version: TLSv1_2
gRPC TLS: Verify Incoming: false, Min Version: TLSv1_2
Internal RPC TLS: Verify Incoming: true, Verify Outgoing: true (Verify Hostname: true), Min Version: TLSv1_2
## ...
```

</CodeBlockConfig>

## Enable gossip encryption on an existing datacenter

Gossip encryption can also be enabled on existing datacenters, but requires several extra steps.

**Step 1**: Generate an encryption key using `consul keygen`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Gossip encryption can also be enabled on existing datacenters, but requires several extra steps.
**Step 1**: Generate an encryption key using `consul keygen`.
You can also enable gossip encryption on existing Consul datacenters.
### Generate a gossip encryption key
First, generate an encryption key on a Consul server. The Consul CLI includes a `consul keygen` command to generate a key.


```shell-session
$ consul keygen
YwgWlBvicJN17UOYcutXLpJSZsw5aWpLEEWqgK635zA=
```

**Step 2**: Create a configuration file that includes the `encrypt` parameter set to the newly generated key. Set `encrypt_verify_incoming` and `encrypt_verify_outgoing` to `false`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
**Step 2**: Create a configuration file that includes the `encrypt` parameter set to the newly generated key. Set `encrypt_verify_incoming` and `encrypt_verify_outgoing` to `false`.
### Add the key to the agent configuration
Create a configuration that sets the `encrypt` parameter to the newly generated key and sets the `encrypt_verify_incoming` and `encrypt_verify_outgoing` parameters to `false`. You can edit the existing agent configuration, or you can add a file to the configuration directory. For more information, refer to [configuring Consul agents](/consul/docs/agent#configuring-consul-agents).


<CodeTabs>

<CodeBlockConfig filename="/etc/consul.d/encryption.hcl">

```hcl
encrypt = "YwgWlBvicJN17UOYcutXLpJSZsw5aWpLEEWqgK635zA="
encrypt_verify_incoming = false
encrypt_verify_outgoing = false
```

</CodeBlockConfig>

<CodeBlockConfig filename="/etc/consul.d/encryption.json">

```json
{
"encrypt": "YwgWlBvicJN17UOYcutXLpJSZsw5aWpLEEWqgK635zA=",
"encrypt_verify_incoming" : false,
"encrypt_verify_outgoing" : false
}
```

</CodeBlockConfig>

</CodeTabs>

**Step 3**: Distribute the configuration file to all the agent nodes that need to be pert of the datacenter and initiate a rolling update of all the
agents with these new values. After this step, the agents will be able to decrypt gossip but will not yet be able to send encrypted traffic. A rolling update can be made by restarting the Consul agents (clients and servers) in turn. `consul reload` or `kill -HUP <process_id>` is _not_ sufficient to change the gossip configuration.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
**Step 3**: Distribute the configuration file to all the agent nodes that need to be pert of the datacenter and initiate a rolling update of all the
agents with these new values. After this step, the agents will be able to decrypt gossip but will not yet be able to send encrypted traffic. A rolling update can be made by restarting the Consul agents (clients and servers) in turn. `consul reload` or `kill -HUP <process_id>` is _not_ sufficient to change the gossip configuration.
### Add the configuration to all agents
Distribute the configuration to all the agent nodes that need to be part of the datacenter, and then initiate a rolling update that restarts each agent. You must restart each agent. The `consul reload` and `kill -HUP <process_id>` commands are not sufficient when changing the gossip configuration.


**Step 4**: Update the `encrypt_verify_outgoing` setting to `true` and perform another rolling update of all the agents by restarting Consul on each agent. The agents will now be sending encrypted gossip but will still allow incoming unencrypted traffic. Complete the process on all the nodes before moving to the next step.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
**Step 4**: Update the `encrypt_verify_outgoing` setting to `true` and perform another rolling update of all the agents by restarting Consul on each agent. The agents will now be sending encrypted gossip but will still allow incoming unencrypted traffic. Complete the process on all the nodes before moving to the next step.
### Update outgoing encryption
The agents can decrypt gossip communication with the `encrypt` parameter set, but they are not able to send encrypted traffic.
Update the `encrypt_verify_outgoing` setting to `true` and then perform another rolling update of all Consul agents. Complete the process on all the nodes before moving to the next step.


<CodeTabs>

<CodeBlockConfig filename="/etc/consul.d/encryption.hcl">

```hcl
encrypt = "YwgWlBvicJN17UOYcutXLpJSZsw5aWpLEEWqgK635zA="
encrypt_verify_incoming = false
encrypt_verify_outgoing = true
```

</CodeBlockConfig>

<CodeBlockConfig filename="/etc/consul.d/encryption.json">

```json
{
"encrypt": "YwgWlBvicJN17UOYcutXLpJSZsw5aWpLEEWqgK635zA=",
"encrypt_verify_incoming": false,
danielehc marked this conversation as resolved.
Show resolved Hide resolved
"encrypt_verify_outgoing": true
}
```

</CodeBlockConfig>

</CodeTabs>

**Step 5**: Update the `encrypt_verify_incoming` setting to `true` and perform a final rolling update on all the agents.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
**Step 5**: Update the `encrypt_verify_incoming` setting to `true` and perform a final rolling update on all the agents.
### Update incoming encryption
The agents can send encrypted gossip but still allow unencrypted incoming traffic. Update the `encrypt_verify_incoming` setting to `true` and then perform a final rolling update on all the agents.


<CodeTabs>

<CodeBlockConfig filename="/etc/consul.d/encryption.hcl">

```hcl
encrypt = "YwgWlBvicJN17UOYcutXLpJSZsw5aWpLEEWqgK635zA="
encrypt_verify_incoming = true
encrypt_verify_outgoing = true
```

</CodeBlockConfig>

<CodeBlockConfig filename="/etc/consul.d/encryption.json">

```json
{
"encrypt": "YwgWlBvicJN17UOYcutXLpJSZsw5aWpLEEWqgK635zA=",
"encrypt_verify_incoming": true,
"encrypt_verify_outgoing": true
}
```

</CodeBlockConfig>

</CodeTabs>

## Rotate the gossip encryption key

It is important to periodically rotate the gossip encryption key used by your Consul datacenter.

The process of rotating the gossip encryption key is centralized and can be performed on a single datacenter node.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
It is important to periodically rotate the gossip encryption key used by your Consul datacenter.
The process of rotating the gossip encryption key is centralized and can be performed on a single datacenter node.
It is important to periodically rotate the gossip encryption key your Consul datacenter uses.
The process of rotating the gossip encryption key is centralized so that you can perform it on a single datacenter node.


The steps to rotate a gossip encryption key are listed below:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
The steps to rotate a gossip encryption key are listed below:
The process to rotate a gossip encryption key consists of the following steps:


1. Generate a new encryption key using the `consul keygen` command.
1. Install the new encryption key using the `consul keyring -install` command.
1. Instruct Consul to use the new key with the `consul keyring -install` command.
1. Verify the new key is installed in your Consul datacenter with the `consul keyring -list` command.
1. Remove the old key using the `consul keyring -remove` command.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
1. Generate a new encryption key using the `consul keygen` command.
1. Install the new encryption key using the `consul keyring -install` command.
1. Instruct Consul to use the new key with the `consul keyring -install` command.
1. Verify the new key is installed in your Consul datacenter with the `consul keyring -list` command.
1. Remove the old key using the `consul keyring -remove` command.
1. Generate a new encryption key using the `consul keygen` command.
1. Install the new encryption key using the `consul keyring -install` command.
1. Verify the new key is installed in your Consul datacenter with the `consul keyring -list` command.
1. Instruct Consul to use the new key with the `consul keyring -use` command.
1. Remove the old key using the `consul keyring -remove` command.

Typo + matching the order of the following instructions


### Generate a new encryption key

Generate a new key using `consul keygen`:

```shell-session
$ consul keygen
FfRV9j6NXU9LlCI4zLZjjpZdj4Nrqsdm7R8YgzSHzHw=
```

### Add new key to the keyring

Add your newly generated key to the keyring.

```shell-session
$ consul keyring -install FfRV9j6NXU9LlCI4zLZjjpZdj4Nrqsdm7R8YgzSHzHw=
==> Installing new gossip encryption key...
```

### Verify that the new key is installed

Once you have added the key to one of the Consul agents, it will be propagated across the whole datacenter. You do not need to repeat the command on other agents.

You can ensure that the key has been propagated to all agents by verifying the number of agents that recognize the key over the number of total agents in the datacenter.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Once you have added the key to one of the Consul agents, it will be propagated across the whole datacenter. You do not need to repeat the command on other agents.
You can ensure that the key has been propagated to all agents by verifying the number of agents that recognize the key over the number of total agents in the datacenter.
After you add the key to one of the Consul agents, Consul propagates it across the entire datacenter. You do not need to repeat the command on other agents.
To ensure that the key has been propagated to all agents, list the installed encryption keys and verify that the number of agents that recognize the key is equal to the total number of agents in the datacenter.


```shell-session
$ consul keyring -list
==> Gathering installed encryption keys...

WAN:
FfRV9j6NXU9LlCI4zLZjjpZdj4Nrqsdm7R8YgzSHzHw= [1/1]
YwgWlBvicJN17UOYcutXLpJSZsw5aWpLEEWqgK635zA= [1/1]

dc1 (LAN):
YwgWlBvicJN17UOYcutXLpJSZsw5aWpLEEWqgK635zA= [7/7]
FfRV9j6NXU9LlCI4zLZjjpZdj4Nrqsdm7R8YgzSHzHw= [7/7]
```

You must check that the two keys are installed in the datacenter, and are recognized by all agents, as well as by all the server agents. The server agents are listed in the `WAN` section. Do not proceed to the next step unless all agents have the new key.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
You must check that the two keys are installed in the datacenter, and are recognized by all agents, as well as by all the server agents. The server agents are listed in the `WAN` section. Do not proceed to the next step unless all agents have the new key.
Confirm that the two keys are installed in the datacenter and recognized by all agents, including server agents. The server agents are listed in the `WAN` section. Do not proceed to the next step unless all agents have the new key.


### Promote the new key to primary

Once all agents have received the key and are able to use it as the primary encryption key, it is possible to promote the new key to primary.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Once all agents have received the key and are able to use it as the primary encryption key, it is possible to promote the new key to primary.
After all agents recognize the key, it is possible to promote it to be the new primary encryption key.


```shell-session
$ consul keyring -use FfRV9j6NXU9LlCI4zLZjjpZdj4Nrqsdm7R8YgzSHzHw=
==> Changing primary gossip encryption key...
```

### Remove the old key from the keyring

To avoid unused keys remaining in the keyring, we recommended you remove the old primary from the keyring once a new key is installed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
To avoid unused keys remaining in the keyring, we recommended you remove the old primary from the keyring once a new key is installed.
Unused keys in the keyring are a potential security risk to your Consul cluster. We recommended that you remove the former primary key from the keyring after a new key is installed.


```shell-session
$ consul keyring -remove YwgWlBvicJN17UOYcutXLpJSZsw5aWpLEEWqgK635zA=
==> Removing gossip encryption key...
```

Verify that the keyring contains only one key.

```shell-session
$ consul keyring -list
==> Gathering installed encryption keys...

WAN:
FfRV9j6NXU9LlCI4zLZjjpZdj4Nrqsdm7R8YgzSHzHw= [1/1]

dc1 (LAN):
FfRV9j6NXU9LlCI4zLZjjpZdj4Nrqsdm7R8YgzSHzHw= [7/7]
```

## Next steps

Documentation for the commands used in this topic is available at [Consul agent configuration - Encryption Parameters](/consul/docs/agent/config/config-files#encryption-parameters). You can find more information over the gossip protocol used by Consul at [Gossip Protocol](/consul/docs/architecture/gossip).

Comment on lines +298 to +299
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Documentation for the commands used in this topic is available at [Consul agent configuration - Encryption Parameters](/consul/docs/agent/config/config-files#encryption-parameters). You can find more information over the gossip protocol used by Consul at [Gossip Protocol](/consul/docs/architecture/gossip).

Not really "next steps" - I suggest removing this sentence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see your point but I think is always useful to have a place where some links to the documentation/reference for the commands shown is located.

After enabling gossip encryption, to continue securing your Consul datacenter, enable mutual TLS encryption. Read more on [Mutual TLS (mTLS) Encryption](/consul/docs/security/encryption/mtls).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
After enabling gossip encryption, to continue securing your Consul datacenter, enable mutual TLS encryption. Read more on [Mutual TLS (mTLS) Encryption](/consul/docs/security/encryption/mtls).
After you enable gossip encryption, you can continue to process to secure your Consul datacenter by enabling mutual TLS encryption. For more information, refer to [Mutual TLS (mTLS) Encryption](/consul/docs/security/encryption/mtls).


To learn how to automate gossip key rotation using HashiCorp Vault and consul-template, refer to the [Automatically Rotate Gossip Encryption Keys Secured in Vault](/consul/tutorials/operate-consul/vault-kv-consul-secure-gossip) tutorial.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
To learn how to automate gossip key rotation using HashiCorp Vault and consul-template, refer to the [Automatically Rotate Gossip Encryption Keys Secured in Vault](/consul/tutorials/operate-consul/vault-kv-consul-secure-gossip) tutorial.
To learn how to automate gossip key rotation using HashiCorp Vault and consul-template, refer to the [Automatically Rotate Gossip Encryption Keys Secured in Vault tutorial](/consul/tutorials/operate-consul/vault-kv-consul-secure-gossip).

Loading