2020-11-04 22:05:44 +00:00
|
|
|
|
---
|
|
|
|
|
layout: docs
|
|
|
|
|
page_title: Consul NIA Security Model
|
|
|
|
|
sidebar_title: Network Infrastructure Automation <sup>Tech Preview</sup>
|
|
|
|
|
description: >-
|
2020-12-08 23:24:36 +00:00
|
|
|
|
Security model including requirements, recommendations, and threats for Consul Network Infrastructure Automation (NIA).
|
2020-11-04 22:05:44 +00:00
|
|
|
|
---
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
## Overview
|
2020-11-04 22:05:44 +00:00
|
|
|
|
|
|
|
|
|
Consul Network Infrastructure Automation (NIA) enables declarative workflows to handle Day-2 network security
|
2020-11-05 20:59:53 +00:00
|
|
|
|
infrastructure tasks for network, security, and operations teams. NIA uses [Terraform](https://www.terraform.io/)
|
2020-11-04 22:05:44 +00:00
|
|
|
|
to propagate Consul catalog changes, and relevant configuration to network appliances, or network APIs.
|
|
|
|
|
|
|
|
|
|
### Personas
|
|
|
|
|
|
|
|
|
|
When thinking about Consul NIA, it helps to consider the following types of base personas when managing the security
|
|
|
|
|
requirements for the cluster deployment.
|
|
|
|
|
|
|
|
|
|
- **System Administrator** - This is someone who has access to the underlying infrastructure to the
|
|
|
|
|
Consul NIA daemon, and possibly the core Consul service. Often she has access to SSH directly
|
2020-12-08 23:24:36 +00:00
|
|
|
|
into a server within a cluster through a bastion host. Ultimately they have read, write and
|
|
|
|
|
execute permissions for the actual NIA daemon binary. These users potentially have sudo,
|
2020-11-04 22:05:44 +00:00
|
|
|
|
administrative, or some other super-user access to the underlying compute resource. Users like
|
2020-12-08 23:24:36 +00:00
|
|
|
|
these are essentially totally trusted by Consul NIA as they have administrative rights to the
|
2020-11-04 22:05:44 +00:00
|
|
|
|
system and can start or stop the daemon.
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Consul NIA Operator** - This is someone (probably the same System Administrator) who has access
|
2020-11-04 22:05:44 +00:00
|
|
|
|
to define the Consul NIA daemon configuration, and possibly a Consul ACL token, and other secrets to
|
2020-12-08 23:24:36 +00:00
|
|
|
|
run the daemon against various network infrastructure APIs. They also have total rights to all of
|
2020-11-04 22:05:44 +00:00
|
|
|
|
the parts in the Consul NIA system including the ability to configure, start, and stop the daemon.
|
|
|
|
|
|
|
|
|
|
- **Developer** - This is someone who is responsible for creating, and possibly deploying applications
|
2020-12-08 23:24:36 +00:00
|
|
|
|
connected, or configured with Consul. In some cases they may have no access, or limited capabilities
|
2020-11-04 22:05:44 +00:00
|
|
|
|
to view Consul information, such as through metrics, or logs.
|
|
|
|
|
- **User** - The end-user using the applications and other services managed by the NIA daemon, and should
|
2020-12-08 23:24:36 +00:00
|
|
|
|
have no knowledge or access to the daemon’s API endpoints, ACL tokens, certificates, or any other
|
2020-11-04 22:05:44 +00:00
|
|
|
|
piece of the system.
|
|
|
|
|
|
|
|
|
|
### Secure Configuration
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
Consul NIA’s security model is applicable only if all parts of the system are running with a secure
|
|
|
|
|
configuration; the daemon is not secure-by-default. Without the following mechanisms enabled in the
|
|
|
|
|
daemon’s configuration, it may be possible to abuse access to the daemon. Like all security
|
2020-11-04 22:05:44 +00:00
|
|
|
|
considerations, one must determine what concerns are appropriate for their environment, and adapt these
|
|
|
|
|
security concerns accordingly.
|
|
|
|
|
|
|
|
|
|
#### Requirements
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Protect Configuration Files & Directories** - A dedicated NIA daemon user and group with limited
|
|
|
|
|
permissions should be created for production, along with directory and file permissions appropriately
|
2020-11-04 22:05:44 +00:00
|
|
|
|
scoped for your operating environment.
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
Example commands to illustrate creating a dedicated `consul-nia` system user, along with the supporting
|
|
|
|
|
directories, configuration file, and securing those permissions using
|
2020-11-04 22:05:44 +00:00
|
|
|
|
[`chown`](https://en.wikipedia.org/wiki/Chown) and [`chmod`](https://en.wikipedia.org/wiki/Chmod):
|
|
|
|
|
|
|
|
|
|
```shell-session
|
|
|
|
|
$ useradd --system --shell /bin/false consul-nia
|
|
|
|
|
$ mkdir -p /consul-nia/data
|
2020-12-08 23:24:36 +00:00
|
|
|
|
$ mkdir -p /consul-nia/config
|
2020-11-04 22:05:44 +00:00
|
|
|
|
$ echo "{ ... }" > /consul-nia/config/file.hcl
|
|
|
|
|
$ chown --recursive consul-nia:consul-nia /consul-nia
|
|
|
|
|
$ chmod -R 0750 consul-nia/
|
|
|
|
|
```
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Protect Consul KV Path or Namespaces** - Note the NIA daemon can monitor Consul services in other Namespaces.
|
|
|
|
|
This can be limited based on the ACL token used for the NIA daemon.
|
2020-11-04 22:05:44 +00:00
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Use Consul ACLs** - The Access Control List (ACL) system within Consul can be used to restrict access to
|
2020-11-04 22:05:44 +00:00
|
|
|
|
only the required parts of Consul for the NIA daemon to operate.
|
|
|
|
|
- **Read + Write** permission for Consul KV to the specified path, and namespace.
|
|
|
|
|
- **Read** permission for Consul Catalog for all of the selected services to be monitored, and their namespaces.
|
|
|
|
|
- **Read + Write** permission to update health checks, when using NIA health monitoring.
|
|
|
|
|
|
|
|
|
|
#### Recommendations
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Use Dedicated Host** - The NIA daemon will potentially have access to critical secrets for your environment’s
|
|
|
|
|
network infrastructure. Using a hardened, dedicated host, for supporting these sensitive operations is highly.
|
|
|
|
|
Workload orchestrators, such as [HashiCorp Nomad](https://www.nomadproject.io/), also provide benefits of ensuring
|
2020-11-04 22:05:44 +00:00
|
|
|
|
uptime and isolation.
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Run without Root** - The NIA daemon does not require root or other administrative privileges to operate.
|
2020-11-04 22:05:44 +00:00
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Protect NIA Daemon API Endpoint** - Any network endpoints provided by, or exposed to the NIA Daemon should be
|
2020-11-04 22:05:44 +00:00
|
|
|
|
protected using Consul Connect and appropriate firewall rules.
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Use a centralized logging solution** - Export log entries within [syslog](https://en.wikipedia.org/wiki/Syslog)
|
2020-11-04 22:05:44 +00:00
|
|
|
|
generated from the NIA daemon to a centralized logging solution.
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Audit used Terraform providers** - [Terraform providers](https://www.terraform.io/docs/providers/index.html) that
|
|
|
|
|
are configured with the NIA daemon should be audited to ensure you’re only using providers from sources that
|
2020-11-04 22:05:44 +00:00
|
|
|
|
you trust.
|
|
|
|
|
|
|
|
|
|
### Threat Model
|
|
|
|
|
|
|
|
|
|
The following are the parts of the NIA threat model:
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Consul agent communication** - In order to monitor the Consul Catalog for changes, the NIA daemon interacts with
|
2020-11-04 22:05:44 +00:00
|
|
|
|
Consul’s HTTP API on a local or remote server agent. This communication requires TLS transport encryption, preferably
|
|
|
|
|
using mTLS for mutual authentication.
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **NIA Terraform communication** - Network connectivity to downstream infrastructure APIs managed by the NIA daemon’s
|
2020-11-04 22:05:44 +00:00
|
|
|
|
Terraform runs will need to be properly configured for secure access.
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Tampering of data in transit** - Any tampering should be detectable and cause the daemon to avoid processing the
|
2020-11-04 22:05:44 +00:00
|
|
|
|
request.
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Access to data without authentication or authorization** - Requests to the Consul agent should be authenticated and
|
|
|
|
|
authorized using (m)TLS and ACLs respectively. ACLs should be configured with the minimal permissions required for
|
2020-11-04 22:05:44 +00:00
|
|
|
|
your environment.
|
|
|
|
|
|
|
|
|
|
- **Denial-of-Service** - DoS attacks against the NIA Daemon should not compromise the security of Consul, or Terraform,
|
2020-12-08 23:24:36 +00:00
|
|
|
|
but may impact any networking components relying on updates from the daemon to properly handle traffic within the
|
2020-11-04 22:05:44 +00:00
|
|
|
|
network. Access to the daemon should be prevented using firewall rules.
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
The following are not a part of the threat model, as the NIA Daemon expects a secure configuration, while always
|
|
|
|
|
providing the default options for testing in local environments which cannot be automatically configured to be both
|
2020-11-04 22:05:44 +00:00
|
|
|
|
secure, and easily usable. However, these are valid concerns for Administrators and Operators to evaluate when hardening
|
|
|
|
|
a production deployment:
|
|
|
|
|
|
|
|
|
|
- **Access (read or write) to the Consul NIA Configuration Files or Directory** - Necessary configuration for the daemon
|
2020-12-08 23:24:36 +00:00
|
|
|
|
process can be loaded from a single file or a directory of files. These configurations may contain secrets and can
|
2020-11-04 22:05:44 +00:00
|
|
|
|
enable/disable insecure features, or Terraform providers.
|
|
|
|
|
|
|
|
|
|
- **Access (read or write) to the Consul NIA Consul KV Path** - Access to the daemon’s Consul KV path may leak sensitive
|
|
|
|
|
information such as usernames, passwords, certificates, and tokens used by Terraform to provision infrastructure.
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Memory Access to a Running Consul NIA Daemon Process** - Direct access to the memory of running the daemon process
|
2020-11-04 22:05:44 +00:00
|
|
|
|
allows an attacker to extract sensitive information.
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Memory Access to a Running Terraform Process** - Direct access to the memory of running the Terraform process
|
2020-11-04 22:05:44 +00:00
|
|
|
|
managed by the daemon process allows an attacker to extract sensitive information.
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Access to the Terraform Binary** - Direct access to the Terraform binary used by the NIA daemon can allow an
|
2020-11-04 22:05:44 +00:00
|
|
|
|
attacker to extract sensitive information.
|
|
|
|
|
|
|
|
|
|
- **Access to the Consul NIA Daemon Binary** - Direct access to the system binary used to start the NIA daemon can allow
|
|
|
|
|
an attacker to extract sensitive information.
|
|
|
|
|
|
|
|
|
|
#### Internal Threats
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **NIA Operator** - Someone with access to the NIA Host, and it’s related binaries or configuration files may be a
|
|
|
|
|
threat to your deployment, especially considering multi-team deployments. They may accidentally or intentionally use a
|
|
|
|
|
malicious Terraform provider, or extract various secrets to cause harm to the network. Access to the NIA host should
|
2020-11-04 22:05:44 +00:00
|
|
|
|
be guarded.
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Consul Operator** - Someone with access to the backend Consul cluster, similar to the NIA Operator, which can
|
2020-11-04 22:05:44 +00:00
|
|
|
|
perform actions that may trigger Terraform runs. They may also have access to the namespace and KV path of the NIA
|
2020-12-08 23:24:36 +00:00
|
|
|
|
daemon, which could give unintended access to Terraform’s state file, which contains sensitive information. ACL
|
2020-11-04 22:05:44 +00:00
|
|
|
|
permissions for Consul should be carefully audited to ensure that no policies may be leaking the state file containing
|
|
|
|
|
sensitive information to other Consul operators unintentionally within the cluster.
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **System-bound Attackers** - Multi-tenant environments, especially container orchestrators, can introduce a number of
|
|
|
|
|
security concerns. These may include shared secrets, host volume access, and other sources of potential pivoting, or
|
2020-11-04 22:05:44 +00:00
|
|
|
|
privilege escalation from attackers with operating system-level access, or side-car container access, through various
|
2020-12-08 23:24:36 +00:00
|
|
|
|
means. Extra steps to configuring OS, cluster, service, user, directory, and file permissions are essential steps for
|
2020-11-04 22:05:44 +00:00
|
|
|
|
implementing defense-in-depth within a production environment.
|
|
|
|
|
|
|
|
|
|
#### External Threats
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Terraform Providers and Modules** - Potentially malicious providers or modules, or any malicious dependencies part
|
2020-11-04 22:05:44 +00:00
|
|
|
|
of the Terraform ecosystem could cause harm to the network, and may have access to secrets in order to make necessary
|
2020-12-08 23:24:36 +00:00
|
|
|
|
network changes. Terraform provider configuration should be audited, pinned to a version, and audited for potential
|
2020-11-04 22:05:44 +00:00
|
|
|
|
typo-squatting issues from the Terraform Registry.
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Network-bound Attackers** - Whenever a service is exposed to the open internet, which may be the case, you really
|
|
|
|
|
need to consider external network attackers which may seek-out hidden, unauthenticated, or otherwise vulnerable
|
2020-11-04 22:05:44 +00:00
|
|
|
|
endpoints. This can lead to larger security concerns when able to pivot to internal resources from an external one.
|
|
|
|
|
|
2020-12-08 23:24:36 +00:00
|
|
|
|
- **Leaking Secrets** - TLS certificates and tokens used by the Consul NIA daemon can enable external attackers to
|
|
|
|
|
access Consul, or Terraform resources. These secrets shouldn’t be hardcoded into configs uploaded to public
|
|
|
|
|
places like GitHub.
|