github.com/smintz/nomad@v0.8.3/website/source/docs/agent/encryption.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Gossip and RPC Encryption"
     4  sidebar_current: "docs-agent-encryption"
     5  description: |-
     6    Learn how to configure Nomad to encrypt HTTP, RPC, and Serf traffic.
     7  ---
     8  
     9  # Encryption
    10  
    11  The Nomad agent supports encrypting all of its network traffic. There are
    12  two separate encryption systems, one for gossip traffic, and one for HTTP and
    13  RPC.
    14  
    15  ## Gossip
    16  
    17  Enabling gossip encryption only requires that you set an encryption key when
    18  starting the Nomad server. The key can be set via the
    19  [`encrypt`](/docs/agent/configuration/server.html#encrypt) parameter: the value
    20  of this setting is a server configuration file containing the encryption key.
    21  
    22  The key must be 16 bytes, base64 encoded. As a convenience, Nomad provides the
    23  [`nomad operator keygen`](/docs/commands/operator/keygen.html) command to
    24  generate a cryptographically suitable key:
    25  
    26  ```sh
    27  $ nomad operator keygen
    28  cg8StVXbQJ0gPvMd9o7yrg==
    29  ```
    30  
    31  With that key, you can enable gossip encryption on the agent.
    32  
    33  
    34  ## HTTP, RPC, and Raft Encryption with TLS
    35  
    36  Nomad supports using TLS to verify the authenticity of servers and clients. To
    37  enable this, Nomad requires that all clients and servers have key pairs that are
    38  generated and signed by a private Certificate Authority (CA).
    39  
    40  TLS can be used to verify the authenticity of the servers and clients. The
    41  configuration option [`verify_server_hostname`][tls] causes Nomad to verify that
    42  a certificate is provided that is signed by the Certificate Authority from the
    43  [`ca_file`][tls] for TLS connections.
    44  
    45  If `verify_server_hostname` is set, then outgoing connections perform
    46  hostname verification. Unlike traditional HTTPS browser validation, all servers
    47  must have a certificate valid for `server.<region>.nomad` or the client will
    48  reject the handshake. It is also recommended for the certificate to sign
    49  `localhost` such that the CLI can validate the server name.
    50  
    51  TLS is used to secure the RPC calls between agents, but gossip between nodes is
    52  done over UDP and is secured using a symmetric key. See above for enabling
    53  gossip encryption.
    54  
    55  ### Configuring the command line tool
    56  
    57  If you have HTTPS enabled for your Nomad agent, you must export environment
    58  variables for the command line tool to also use HTTPS:
    59  
    60  ```sh
    61  # NOMAD_ADDR defaults to http://, so set it to https
    62  # Alternatively you can use the -address flag
    63  export NOMAD_ADDR=https://127.0.0.1:4646
    64  
    65  # Set the location of your CA certificate
    66  # Alternatively you can use the -ca-cert flag
    67  export NOMAD_CACERT=/path/to/ca.pem
    68  ```
    69  
    70  Run any command except `agent` with `-h` to see all environment variables and
    71  flags. For example: `nomad status -h`
    72  
    73  By default HTTPS does not validate client certificates, so you do not need to
    74  give the command line tool access to any private keys.
    75  
    76  ### Network Isolation with TLS
    77  
    78  If you want to isolate Nomad agents on a network with TLS you need to enable
    79  both [`verify_https_client`][tls] and [`verify_server_hostname`][tls]. This
    80  will cause agents to require client certificates for all incoming HTTPS
    81  connections as well as verify proper names on all other certificates.
    82  
    83  Consul will not attempt to health check agents with `verify_https_client` set
    84  as it is unable to use client certificates.
    85  
    86  # Configuring Nomad with TLS
    87  
    88  Read the [Securing Nomad with TLS Guide][guide] for details on how to configure
    89  encryption for Nomad.
    90  
    91  [guide]: /guides/securing-nomad.html "Securing Nomad with TLS"
    92  [tls]: /docs/agent/configuration/tls.html "Nomad TLS Configuration"