2015-04-17 19:01:20 +00:00
---
layout: "docs"
page_title: "Server Configuration"
sidebar_current: "docs-config"
description: |-
Vault server configuration reference.
---
# Server Configuration
Outside of development mode, Vault servers are configured using a file.
The format of this file is [HCL ](https://github.com/hashicorp/hcl ) or JSON.
An example configuration is shown below:
2015-04-22 23:47:11 +00:00
```javascript
2015-04-17 19:01:20 +00:00
backend "consul" {
2015-05-28 12:11:34 +00:00
address = "127.0.0.1:8500"
2015-04-22 23:47:11 +00:00
path = "vault"
2015-04-17 19:01:20 +00:00
}
listener "tcp" {
2015-04-22 23:47:11 +00:00
address = "127.0.0.1:8200"
tls_disable = 1
2015-04-17 19:01:20 +00:00
}
2015-07-14 22:44:48 +00:00
telemetry {
statsite_address = "127.0.0.1:8125"
disable_hostname = true
}
2015-04-17 19:01:20 +00:00
```
After the configuration is written, use the `-config` flag with `vault server`
to specify where the configuration is.
## Reference
2015-05-27 20:44:17 +00:00
* `backend` (required) - Configures the storage backend where Vault data
is stored. There are multiple options available for storage backends,
2015-04-17 19:01:20 +00:00
and they're documented below.
2015-12-15 02:04:58 +00:00
* `ha_backend` (optional) - Configures the storage backend where Vault HA
coordination will take place. Must be an HA-supporting backend using the
configuration options as documented below. If not set, HA will be attempted
on the backend given in the `backend` parameter.
2015-04-17 19:01:20 +00:00
* `listener` (required) - Configures how Vault is listening for API requests.
"tcp" is currently the only option available. A full reference for the
inner syntax is below.
2015-10-12 16:55:02 +00:00
* `disable_cache` (optional) - A boolean. If true, this will disable the
read cache used by the physical storage subsystem. This will very
significantly impact performance.
2015-04-28 22:13:07 +00:00
* `disable_mlock` (optional) - A boolean. If true, this will disable the
server from executing the `mlock` syscall to prevent memory from being
2015-05-28 10:40:56 +00:00
swapped to disk. This is not recommended in production (see below).
2015-04-28 22:13:07 +00:00
2015-07-14 22:44:48 +00:00
* `telemetry` (optional) - Configures the telemetry reporting system
(see below).
2015-04-17 19:01:20 +00:00
2015-09-24 16:17:26 +00:00
* `default_lease_ttl` (optional) - Configures the default lease duration
2016-02-01 14:44:42 +00:00
for tokens and secrets. This is a string value using a suffix, e.g. "720h".
Default value is 30 days. This value cannot be larger than `max_lease_ttl` .
2015-07-30 13:42:49 +00:00
2015-09-24 16:17:26 +00:00
* `max_lease_ttl` (optional) - Configures the maximum possible
2016-02-01 14:44:42 +00:00
lease duration for tokens and secrets. This is a string value using a suffix,
e.g. "720h". Default value is 30 days.
2015-07-30 13:42:49 +00:00
2015-05-28 10:40:56 +00:00
In production, you should only consider setting the `disable_mlock` option
on Linux systems that only use encrypted swap or do not use swap at all.
Vault does not currently support memory locking on Mac OS X and Windows
and so the feature is automatically disabled on those platforms. To give
the Vault executable access to the `mlock` syscall on Linux systems:
```shell
sudo setcap cap_ipc_lock=+ep $(readlink -f $(which vault))
```
2015-12-22 15:50:31 +00:00
## Listener Reference
For the `listener` section, the only supported listener currently
is "tcp". Regardless of future plans, this is the recommended listener,
since it allows for HA mode.
The supported options are:
* `address` (optional) - The address to bind to for listening. This
defaults to "127.0.0.1:8200".
2015-12-29 17:56:19 +00:00
* `tls_disable` (optional) - If true, then TLS will be disabled.
This will parse as boolean value, and can be set to "0", "no",
"false", "1", "yes", or "true". This is an opt-in; Vault assumes
by default that TLS will be used.
2015-12-22 15:50:31 +00:00
* `tls_cert_file` (required unless disabled) - The path to the certificate
for TLS.
* `tls_key_file` (required unless disabled) - The path to the private key
for the certificate.
* `tls_min_version` (optional) - ** (Vault > 0.2)** If provided, specifies
the minimum supported version of TLS. Accepted values are "tls10", "tls11"
or "tls12". This defaults to "tls12". WARNING: TLS 1.1 and lower
are generally considered less secure; avoid using these if
possible.
## Telemetry Reference
For the `telemetry` section, there is no resource name. All configuration
is within the object itself.
* `statsite_address` (optional) - An address to a [Statsite ](https://github.com/armon/statsite )
instances for metrics. This is highly recommended for production usage.
* `statsd_address` (optional) - This is the same as `statsite_address` but
for StatsD.
* `disable_hostname` (optional) - Whether or not to prepend runtime telemetry
with the machines hostname. This is a global option. Defaults to false.
2015-04-17 19:01:20 +00:00
## Backend Reference
2015-12-22 15:50:31 +00:00
For the `backend` section, the supported physical backends are shown below.
2015-04-17 19:01:20 +00:00
Vault requires that the backend itself will be responsible for backups,
durability, etc.
2015-12-22 15:50:31 +00:00
__*Please note*__: The only physical backends actively maintained by HashiCorp
are `consul` , `inmem` , and `file` . The other backends are community-derived and
community-supported. We include them in the hope that they will be useful to
those users that wish to utilize them, but they receive minimal validation and
testing from HashiCorp, and HashiCorp staff may not be knowledgeable about the
data store being utilized. If you encounter problems with them, we will attempt
2016-01-14 18:42:47 +00:00
to help you, but may refer you to the backend author.
2015-12-22 15:50:31 +00:00
2016-01-14 18:42:47 +00:00
* `consul` - Store data within [Consul ](https://www.consul.io ). This
2015-12-22 15:50:31 +00:00
backend supports HA. It is the most recommended backend for Vault and has
been shown to work at high scale under heavy load.
2015-04-17 19:01:20 +00:00
2015-05-24 16:38:49 +00:00
* `etcd` - Store data within [etcd ](https://coreos.com/etcd/ ).
2015-12-22 15:50:31 +00:00
This backend supports HA. This is a community-supported backend.
2015-07-13 09:01:32 +00:00
* `zookeeper` - Store data within [Zookeeper ](https://zookeeper.apache.org/ ).
2015-12-22 15:50:31 +00:00
This backend supports HA. This is a community-supported backend.
2015-05-24 16:38:49 +00:00
2016-01-08 16:30:39 +00:00
* `dynamodb` - Store data in a [DynamoDB ](https://aws.amazon.com/dynamodb/ ) table.
This backend supports HA. This is a community-supported backend.
2016-01-14 18:55:53 +00:00
* `s3` - Store data within an S3 bucket [S3 ](https://aws.amazon.com/s3/ ).
This backend does not support HA. This is a community-supported backend.
2015-12-22 15:50:31 +00:00
* `mysql` - Store data within MySQL. This backend does not support HA. This
is a community-supported backend.
2015-06-18 21:31:00 +00:00
2016-02-03 19:04:55 +00:00
* `postgresql` - Store data within PostgreSQL. This backend does not support HA. This
is a community-supported backend.
2015-04-17 19:01:20 +00:00
* `inmem` - Store data in-memory. This is only really useful for
2015-12-22 15:50:31 +00:00
development and experimentation. Data is lost whenever Vault is
restarted.
2015-04-17 19:01:20 +00:00
* `file` - Store data on the filesystem using a directory structure.
2015-12-22 15:50:31 +00:00
This backend does not support HA.
2015-04-17 19:01:20 +00:00
#### Common Backend Options
All backends support the following options:
* `advertise_addr` (optional) - For backends that support HA, this
is the address to advertise to other Vault servers in the cluster
2015-05-11 17:43:00 +00:00
for request forwarding. Most HA backends will attempt to determine
2015-12-15 02:22:55 +00:00
the advertise address if not provided. This can also be set via
the `VAULT_ADVERTISE_ADDR` environment variable.
2015-04-17 19:01:20 +00:00
#### Backend Reference: Consul
For Consul, the following options are supported:
* `path` (optional) - The path within Consul where data will be stored.
Defaults to "vault/".
* `address` (optional) - The address of the Consul agent to talk to.
Defaults to the local agent address, if available.
* `scheme` (optional) - "http" or "https" for talking to Consul.
* `token` (optional) - An access token to use to write data to Consul.
2015-11-03 20:26:07 +00:00
* `max_parallel` (optional) - The maximum number of connections to Consul;
defaults to "128".
2015-07-28 12:50:43 +00:00
* `tls_skip_verify` (optional) - If non-empty, then TLS host verification
will be disabled for Consul communication.
Defaults to false.
The following settings should be set according to your [Consul encryption settings ](https://www.consul.io/docs/agent/encryption.html ):
* `tls_ca_file` (optional) - The path to the CA certificate used for Consul communication.
2015-07-28 09:00:42 +00:00
Defaults to system bundle if not specified.
Set accordingly to the [ca_file ](https://www.consul.io/docs/agent/options.html#ca_file ) setting in Consul.
2015-07-28 12:50:43 +00:00
* `tls_cert_file` (optional) - The path to the certificate for Consul communication.
2015-07-28 09:00:42 +00:00
Set accordingly to the [cert_file ](https://www.consul.io/docs/agent/options.html#cert_file ) setting in Consul.
2015-07-28 12:50:43 +00:00
* `tls_key_file` (optional) - The path to the private key for Consul communication.
2015-07-28 09:00:42 +00:00
Set accordingly to the [key_file ](https://www.consul.io/docs/agent/options.html#key_file ) setting in Consul.
2015-12-22 15:50:31 +00:00
#### Backend Reference: etcd (Community-Supported)
2015-05-24 16:38:49 +00:00
For etcd, the following options are supported:
* `path` (optional) - The path within etcd where data will be stored.
Defaults to "vault/".
* `address` (optional) - The address(es) of the etcd instance(s) to talk to.
Can be comma separated list (protocol://host:port) of many etcd instances.
2015-11-05 14:47:50 +00:00
Defaults to "http://localhost:2379" if not specified.
2015-05-24 16:38:49 +00:00
2016-01-11 18:56:58 +00:00
* `sync` (optional) - Should we synchronize the list of available etcd
2016-01-27 22:15:52 +00:00
servers on startup? This is a **string** value to allow for auto-sync to
be implemented later. It can be set to "0", "no", "n", "false", "1",
"yes", "y", or "true". Defaults to on. Set to false if your etcd
cluster is behind a proxy server and syncing causes Vault to fail.
2016-01-11 18:56:58 +00:00
2016-01-11 16:30:51 +00:00
* `username` (optional) - Username to use when authenticating with the etcd
server. May also be specified via the ETCD_USERNAME environment variable.
* `password` (optional) - Password to use when authenticating with the etcd
server. May also be specified via the ETCD_PASSWORD environment variable.
2015-12-17 15:34:41 +00:00
* `tls_ca_file` (optional) - The path to the CA certificate used for etcd communication.
Defaults to system bundle if not specified.
* `tls_cert_file` (optional) - The path to the certificate for etcd communication.
* `tls_key_file` (optional) - The path to the private key for etcd communication.
2016-01-14 18:55:53 +00:00
#### Backend Reference: Zookeeper (Community-Supported)
2015-07-23 12:53:20 +00:00
2016-01-14 18:55:53 +00:00
For Zookeeper, the following options are supported:
2015-11-04 14:36:24 +00:00
2016-01-14 18:55:53 +00:00
* `path` (optional) - The path within Zookeeper where data will be stored.
Defaults to "vault/".
2015-05-05 20:08:42 +00:00
2016-01-14 18:55:53 +00:00
* `address` (optional) - The address(es) of the Zookeeper instance(s) to talk to.
Can be comma separated list (host:port) of many Zookeeper instances.
Defaults to "localhost:2181" if not specified.
2015-08-25 13:47:07 +00:00
2016-02-15 16:20:32 +00:00
The following optional settings can be used to configure zNode ACLs
* `auth_info` (optional) - Authentication string to match Zookeeper AddAuth format
'schema:auth'. A simple example would be 'digest:UserName:Password' - to
authenticate as UserName using Password
* `znode_owner` (optional) - Schema and User parts of Zookeeper ACL format. Expected format
is 'schema:user-ACL-match. Vault will always set all permissions (CRWDA) to that ACL, some examples:
* 'digest:UserName:HIDfRvTv623G==' - The user 'UserName' with the 'HIDfRvTv623G==' (second colon is part
of the user information)
* 'ip:127.0.01' - Access from localhost only
* 'ip:70.95.0.0/16' - Any host on the 70.95.0.0 network (CIDR is supported starting from Zookeeper 3.5.0)
In neither of those is set the backend will not authenticate with Zookeeper and will set the OPEN_ACL_UNSAFE ACL
on all nodes. The affect would be that anyone connected to Zookeeper could change Vault’ s znodes and, potentially,
take Vault out of service. Sample configurations:
````
backend "zookeeper" {
znode_owner = "digest:vaultUser:raxgVAfnDRljZDAcJFxznkZsExs="
auth_info = "digest:vaultUser:abc"
}
````
2016-01-08 16:30:39 +00:00
#### Backend Reference: DynamoDB (Community-Supported)
The DynamoDB backend has the following options:
* `table` (optional) - The name of the DynamoDB table to store data in. The default table name is `vault-dynamodb-backend` . This option can also be provided via the environment variable `AWS_DYNAMODB_TABLE` . If the specified table does not yet exist, it will be created during initialization.
* `read_capacity` (optional) - The read capacity to provision when creating the DynamoDB table. This is the maximum number of reads consumed per second on the table. The default value is 5. This option can also be provided via the environment variable `AWS_DYNAMODB_READ_CAPACITY` .
* `write_capacity` (optional) - The write capacity to provision when creating the DynamoDB table. This is the maximum number of writes performed per second on the table. The default value is 5. This option can also be provided via the environment variable `AWS_DYNAMODB_WRITE_CAPACITY` .
* `access_key` - (required) The AWS access key. It must be provided, but it can also be sourced from the `AWS_ACCESS_KEY_ID` environment variable.
* `secret_key` - (required) The AWS secret key. It must be provided, but it can also be sourced from the `AWS_SECRET_ACCESS_KEY` environment variable.
* `session_token` - (optional) The AWS session token. It can also be sourced from the `AWS_SESSION_TOKEN` environment variable.
* `endpoint` - (optional) An alternative (AWS compatible) DynamoDB endpoint to use. It can also be sourced from the `AWS_DYNAMODB_ENDPOINT` environment variable.
* `region` (optional) - The AWS region. It can be sourced from the `AWS_DEFAULT_REGION` environment variable and will default to "us-east-1" if not specified.
* `recovery_mode` (optional) - When the Vault leader crashes or is killed without being able to shut down properly, no other node can become the new leader because the DynamoDB table still holds the old leader's lock record. To recover from this situation, one can start a single Vault node with this option set to `1` and the node will remove the old lock from DynamoDB. It is important that only one node is running in recovery mode! After this node has become the leader, other nodes can be started with regular configuration.
This option can also be provided via the environment variable `RECOVERY_MODE` .
2016-01-14 18:42:47 +00:00
For more information about the read/write capacity of DynamoDB tables, see the [official AWS DynamoDB docs ](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithTables.html#ProvisionedThroughput ).
2016-01-08 16:30:39 +00:00
If you are running your Vault server on an EC2 instance, you can also make use
of the EC2 instance profile service to provide the credentials Vault will use to
make DynamoDB API calls. Leaving the `access_key` and `secret_key` fields empty
will cause Vault to attempt to retrieve credentials from the metadata service.
2016-01-14 18:55:53 +00:00
#### Backend Reference: S3 (Community-Supported)
For S3, the following options are supported:
* `bucket` (required) - The name of the S3 bucket to use. It must be provided, but it can also be sourced from the `AWS_S3_BUCKET` environment variable.
* `access_key` - (required) The AWS access key. It must be provided, but it can also be sourced from the `AWS_ACCESS_KEY_ID` environment variable.
* `secret_key` - (required) The AWS secret key. It must be provided, but it can also be sourced from the `AWS_SECRET_ACCESS_KEY` environment variable.
* `session_token` - (optional) The AWS session token. It can also be sourced from the `AWS_SESSION_TOKEN` environment variable.
* `endpoint` - (optional) An alternative (AWS compatible) S3 endpoint to use. It can also be sourced from the `AWS_S3_ENDPOINT` environment variable.
* `region` (optional) - The AWS region. It can be sourced from the `AWS_DEFAULT_REGION` environment variable and will default to "us-east-1" if not specified.
If you are running your Vault server on an EC2 instance, you can also make use
of the EC2 instance profile service to provide the credentials Vault will use to
make S3 API calls. Leaving the `access_key` and `secret_key` fields empty
will cause Vault to attempt to retrieve credentials from the metadata service.
You are responsible for ensuring your instance is launched with the appropriate
profile enabled. Vault will handle renewing profile credentials as they rotate.
2015-12-22 15:50:31 +00:00
#### Backend Reference: MySQL (Community-Supported)
2015-06-18 21:31:00 +00:00
The MySQL backend has the following options:
* `username` (required) - The MySQL username to connect with.
* `password` (required) - The MySQL password to connect with.
* `address` (optional) - The address of the MySQL host. Defaults to
"127.0.0.1:3306.
* `database` (optional) - The name of the database to use. Defaults to "vault".
* `table` (optional) - The name of the table to use. Defaults to "vault".
2015-08-04 05:05:27 +00:00
* `tls_ca_file` (optional) - The path to the CA certificate to connect using TLS
2016-01-20 00:00:09 +00:00
#### Backend Reference: PostgreSQL (Community-Supported)
The PostgreSQL backend has the following options:
* `connection_url` (required) - The connection string used to connect to PostgreSQL.
Examples:
2016-01-21 01:52:49 +00:00
* postgres://username:password@localhost:5432/database?sslmode=disabled
2016-01-20 00:00:09 +00:00
* postgres://username:password@localhost:5432/database?sslmode=verify-full
A list of all supported parameters can be found in [the pq library documentation ](https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters ).
2016-01-21 01:52:49 +00:00
* `table` (optional) - The name of the table to write vault data to. Defaults
2016-01-28 00:15:48 +00:00
to "vault_kv_store".
2016-01-21 01:52:49 +00:00
2016-01-29 20:47:10 +00:00
Add the following table and index to a new or existing PostgreSQL database:
2016-01-21 01:52:49 +00:00
```sql
2016-01-28 00:15:48 +00:00
CREATE TABLE vault_kv_store (
2016-01-29 20:47:10 +00:00
parent_path TEXT COLLATE "C" NOT NULL,
path TEXT COLLATE "C",
key TEXT COLLATE "C",
value BYTEA,
CONSTRAINT pkey PRIMARY KEY (path, key)
2016-01-21 01:52:49 +00:00
);
2016-01-29 20:47:10 +00:00
CREATE INDEX parent_path_idx ON vault_kv_store (parent_path);
2016-01-21 01:52:49 +00:00
```
2016-01-29 20:47:10 +00:00
If you're using a version of PostgreSQL prior to 9.5, create the following
function:
2016-01-23 00:15:10 +00:00
```sql
2016-01-29 20:47:10 +00:00
CREATE FUNCTION vault_kv_put(_parent_path TEXT, _path TEXT, _key TEXT, _value BYTEA) RETURNS VOID AS
2016-01-23 00:15:10 +00:00
$$
BEGIN
LOOP
-- first try to update the key
2016-01-29 20:47:10 +00:00
UPDATE vault_kv_store
SET (parent_path, path, key, value) = (_parent_path, _path, _key, _value)
WHERE _path = path AND key = _key;
2016-01-23 00:15:10 +00:00
IF found THEN
RETURN;
END IF;
-- not there, so try to insert the key
-- if someone else inserts the same key concurrently,
-- we could get a unique-key failure
BEGIN
2016-01-29 20:47:10 +00:00
INSERT INTO vault_kv_store (parent_path, path, key, value)
VALUES (_parent_path, _path, _key, _value);
2016-01-23 00:15:10 +00:00
RETURN;
EXCEPTION WHEN unique_violation THEN
-- Do nothing, and loop to try the UPDATE again.
END;
END LOOP;
END;
$$
LANGUAGE plpgsql;
```
More info can be found in the [PostgreSQL documentation ](http://www.postgresql.org/docs/9.4/static/plpgsql-control-structures.html#PLPGSQL-UPSERT-EXAMPLE ):
2015-04-17 19:01:20 +00:00
#### Backend Reference: Inmem
The in-memory backend has no configuration options.
#### Backend Reference: File
The file backend has the following options:
* `path` (required) - The path on disk to a directory where the
data will be stored.