1
0
mirror of https://github.com/containous/traefik.git synced 2024-12-24 21:34:39 +03:00

Support token authentication for Consul KV

This commit is contained in:
Kevin Pollet 2022-01-19 17:46:11 +01:00 committed by GitHub
parent a914ce2bd2
commit f29e311b73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 58 additions and 1 deletions

View File

@ -125,7 +125,30 @@ providers:
``` ```
```bash tab="CLI" ```bash tab="CLI"
--providers.consul.password=foo --providers.consul.password=bar
```
### `token`
_Optional, Default=""_
Defines a token with which to connect to Consul.
```yaml tab="File (YAML)"
providers:
consul:
# ...
token: "bar"
```
```toml tab="File (TOML)"
[providers.consul]
# ...
token = "bar"
```
```bash tab="CLI"
--providers.consul.token=bar
``` ```
### `tls` ### `tls`

View File

@ -375,6 +375,9 @@ TLS insecure skip verify (Default: ```false```)
`--providers.consul.tls.key`: `--providers.consul.tls.key`:
TLS key TLS key
`--providers.consul.token`:
KV Token
`--providers.consul.username`: `--providers.consul.username`:
KV Username KV Username
@ -561,6 +564,9 @@ TLS insecure skip verify (Default: ```false```)
`--providers.etcd.tls.key`: `--providers.etcd.tls.key`:
TLS key TLS key
`--providers.etcd.token`:
KV Token
`--providers.etcd.username`: `--providers.etcd.username`:
KV Username KV Username
@ -819,6 +825,9 @@ TLS insecure skip verify (Default: ```false```)
`--providers.redis.tls.key`: `--providers.redis.tls.key`:
TLS key TLS key
`--providers.redis.token`:
KV Token
`--providers.redis.username`: `--providers.redis.username`:
KV Username KV Username
@ -858,6 +867,9 @@ TLS insecure skip verify (Default: ```false```)
`--providers.zookeeper.tls.key`: `--providers.zookeeper.tls.key`:
TLS key TLS key
`--providers.zookeeper.token`:
KV Token
`--providers.zookeeper.username`: `--providers.zookeeper.username`:
KV Username KV Username

View File

@ -450,6 +450,9 @@ TLS insecure skip verify (Default: ```false```)
`TRAEFIK_PROVIDERS_CONSUL_TLS_KEY`: `TRAEFIK_PROVIDERS_CONSUL_TLS_KEY`:
TLS key TLS key
`TRAEFIK_PROVIDERS_CONSUL_TOKEN`:
KV Token
`TRAEFIK_PROVIDERS_CONSUL_USERNAME`: `TRAEFIK_PROVIDERS_CONSUL_USERNAME`:
KV Username KV Username
@ -561,6 +564,9 @@ TLS insecure skip verify (Default: ```false```)
`TRAEFIK_PROVIDERS_ETCD_TLS_KEY`: `TRAEFIK_PROVIDERS_ETCD_TLS_KEY`:
TLS key TLS key
`TRAEFIK_PROVIDERS_ETCD_TOKEN`:
KV Token
`TRAEFIK_PROVIDERS_ETCD_USERNAME`: `TRAEFIK_PROVIDERS_ETCD_USERNAME`:
KV Username KV Username
@ -819,6 +825,9 @@ TLS insecure skip verify (Default: ```false```)
`TRAEFIK_PROVIDERS_REDIS_TLS_KEY`: `TRAEFIK_PROVIDERS_REDIS_TLS_KEY`:
TLS key TLS key
`TRAEFIK_PROVIDERS_REDIS_TOKEN`:
KV Token
`TRAEFIK_PROVIDERS_REDIS_USERNAME`: `TRAEFIK_PROVIDERS_REDIS_USERNAME`:
KV Username KV Username
@ -858,6 +867,9 @@ TLS insecure skip verify (Default: ```false```)
`TRAEFIK_PROVIDERS_ZOOKEEPER_TLS_KEY`: `TRAEFIK_PROVIDERS_ZOOKEEPER_TLS_KEY`:
TLS key TLS key
`TRAEFIK_PROVIDERS_ZOOKEEPER_TOKEN`:
KV Token
`TRAEFIK_PROVIDERS_ZOOKEEPER_USERNAME`: `TRAEFIK_PROVIDERS_ZOOKEEPER_USERNAME`:
KV Username KV Username

View File

@ -180,6 +180,7 @@
username = "foobar" username = "foobar"
password = "foobar" password = "foobar"
namespace = "foobar" namespace = "foobar"
token = "foobar"
[providers.consul.tls] [providers.consul.tls]
ca = "foobar" ca = "foobar"
caOptional = true caOptional = true
@ -192,6 +193,7 @@
username = "foobar" username = "foobar"
password = "foobar" password = "foobar"
namespace = "foobar" namespace = "foobar"
token = "foobar"
[providers.etcd.tls] [providers.etcd.tls]
ca = "foobar" ca = "foobar"
caOptional = true caOptional = true
@ -204,6 +206,7 @@
username = "foobar" username = "foobar"
password = "foobar" password = "foobar"
namespace = "foobar" namespace = "foobar"
token = "foobar"
[providers.zooKeeper.tls] [providers.zooKeeper.tls]
ca = "foobar" ca = "foobar"
caOptional = true caOptional = true
@ -216,6 +219,7 @@
username = "foobar" username = "foobar"
password = "foobar" password = "foobar"
namespace = "foobar" namespace = "foobar"
token = "foobar"
[providers.redis.tls] [providers.redis.tls]
ca = "foobar" ca = "foobar"
caOptional = true caOptional = true

View File

@ -196,6 +196,7 @@ providers:
username: foobar username: foobar
password: foobar password: foobar
namespace: foobar namespace: foobar
token: foobar
tls: tls:
ca: foobar ca: foobar
caOptional: true caOptional: true
@ -210,6 +211,7 @@ providers:
username: foobar username: foobar
password: foobar password: foobar
namespace: foobar namespace: foobar
token: foobar
tls: tls:
ca: foobar ca: foobar
caOptional: true caOptional: true
@ -224,6 +226,7 @@ providers:
username: foobar username: foobar
password: foobar password: foobar
namespace: foobar namespace: foobar
token: foobar
tls: tls:
ca: foobar ca: foobar
caOptional: true caOptional: true
@ -238,6 +241,7 @@ providers:
username: foobar username: foobar
password: foobar password: foobar
namespace: foobar namespace: foobar
token: foobar
tls: tls:
ca: foobar ca: foobar
caOptional: true caOptional: true

View File

@ -29,6 +29,7 @@ type Provider struct {
Endpoints []string `description:"KV store endpoints" json:"endpoints,omitempty" toml:"endpoints,omitempty" yaml:"endpoints,omitempty"` Endpoints []string `description:"KV store endpoints" json:"endpoints,omitempty" toml:"endpoints,omitempty" yaml:"endpoints,omitempty"`
Username string `description:"KV Username" json:"username,omitempty" toml:"username,omitempty" yaml:"username,omitempty"` Username string `description:"KV Username" json:"username,omitempty" toml:"username,omitempty" yaml:"username,omitempty"`
Password string `description:"KV Password" json:"password,omitempty" toml:"password,omitempty" yaml:"password,omitempty"` Password string `description:"KV Password" json:"password,omitempty" toml:"password,omitempty" yaml:"password,omitempty"`
Token string `description:"KV Token" json:"token,omitempty" toml:"token,omitempty" yaml:"token,omitempty"`
Namespace string `description:"KV Namespace" json:"namespace,omitempty" toml:"namespace,omitempty" yaml:"namespace,omitempty"` Namespace string `description:"KV Namespace" json:"namespace,omitempty" toml:"namespace,omitempty" yaml:"namespace,omitempty"`
TLS *types.ClientTLS `description:"Enable TLS support" export:"true" json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty"` TLS *types.ClientTLS `description:"Enable TLS support" export:"true" json:"tls,omitempty" toml:"tls,omitempty" yaml:"tls,omitempty"`
@ -165,6 +166,7 @@ func (p *Provider) createKVClient(ctx context.Context) (store.Store, error) {
Bucket: "traefik", Bucket: "traefik",
Username: p.Username, Username: p.Username,
Password: p.Password, Password: p.Password,
Token: p.Token,
Namespace: p.Namespace, Namespace: p.Namespace,
} }