-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Auth support in frontends #3559
Conversation
provider/kv/kv_config.go
Outdated
return basicAuth | ||
} | ||
|
||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you remove this line.
provider/kv/kv_config.go
Outdated
|
||
// GetAuth Create auth from labels | ||
func (p *Provider) getAuth(rootPath string) *types.Auth { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you remove this empty line.
provider/kv/kv_config_test.go
Outdated
@@ -24,38 +24,188 @@ func TestProviderBuildConfiguration(t *testing.T) { | |||
kvPairs []*store.KVPair | |||
expected *types.Configuration | |||
}{ | |||
//{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you uncomment or remove this test.
templates/ecs.tmpl
Outdated
|
||
{{ $whitelist := getWhiteList $instance.TraefikLabels }} | ||
{{ $whitelist := getWhiteList $instance.TraefikLabels }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you restore the previous line.
templates/kv.tmpl
Outdated
|
||
{{ $whitelist := getWhiteList $frontend }} | ||
{{ $whitelist := getWhiteList $frontend }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you restore the previous line.
templates/marathon.tmpl
Outdated
|
||
{{ $whitelist := getWhiteList $app.SegmentLabels }} | ||
{{ $whitelist := getWhiteList $app.SegmentLabels }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you restore the previous line.
templates/mesos.tmpl
Outdated
|
||
{{ $whitelist := getWhiteList $app.TraefikLabels }} | ||
{{ $whitelist := getWhiteList $app.TraefikLabels }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you restore the previous line.
templates/rancher.tmpl
Outdated
|
||
{{ $whitelist := getWhiteList $service.SegmentLabels }} | ||
{{ $whitelist := getWhiteList $service.SegmentLabels }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you restore the previous line.
provider/kv/kv_config.go
Outdated
TrustForwardHeader: p.getBool(false, rootPath, pathFrontendAuthForwardTrustForwardHeader), | ||
} | ||
|
||
//TLS configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a whitespace.
// TLS configuration
provider/label/partial.go
Outdated
|
||
return auth | ||
} | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// GetAuth Create auth from labels
func GetAuth(labels map[string]string) *types.Auth {
if !HasPrefix(labels, TraefikFrontendAuth) {
return nil
}
auth := &types.Auth{
HeaderField: GetStringValue(labels, TraefikFrontendAuthHeaderField, ""),
}
if HasPrefix(labels, TraefikFrontendAuthBasic) {
auth.Basic = getAuthBasic(labels)
} else if HasPrefix(labels, TraefikFrontendAuthDigest) {
auth.Digest = getAuthDigest(labels)
} else if HasPrefix(labels, TraefikFrontendAuthForward) {
auth.Forward = getAuthForward(labels)
}
return auth
}
| `<prefix>.frontend.auth.digest.users=EXPR` | Sets digest authentication to this frontend in CSV format: `User:Realm:Hash,User:Realm:Hash`. | | ||
| `<prefix>.frontend.auth.digest.usersfile=/path/.htdigest` | Sets digest authentication with an external file; if users and usersFile are provided, both are merged, with external file contents having precedence. | | ||
| `<prefix>.frontend.auth.forward.address=https://example.com`| The URL of the authentication server. | | ||
| `<prefix>.frontend.auth.forward.tls.ca=/path/ca.pem` | Set the Certificate Authority (CA) for the TLS connection with the authentication server. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sets
instead of Set
| `<prefix>.frontend.auth.forward.address=https://example.com`| The URL of the authentication server. | | ||
| `<prefix>.frontend.auth.forward.tls.ca=/path/ca.pem` | Set the Certificate Authority (CA) for the TLS connection with the authentication server. | | ||
| `<prefix>.frontend.auth.forward.tls.caOptional=true` | Check the certificates if present but do not force to be signed by a specified Certificate Authority (CA). | | ||
| `<prefix>.frontend.auth.forward.tls.cert=/path/server.pem` | Set the Certificate for the TLS connection with the authentication server. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sets
instead of Set
| `<prefix>.frontend.auth.forward.tls.caOptional=true` | Check the certificates if present but do not force to be signed by a specified Certificate Authority (CA). | | ||
| `<prefix>.frontend.auth.forward.tls.cert=/path/server.pem` | Set the Certificate for the TLS connection with the authentication server. | | ||
| `<prefix>.frontend.auth.forward.tls.insecureSkipVerify=true`| If set to true invalid SSL certificates are accepted. | | ||
| `<prefix>.frontend.auth.forward.tls.key=/path/server.key` | Set the Certificate for the TLS connection with the authentication server. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sets
instead of Set
| `<prefix>.frontend.auth.digest.usersfile=/path/.htdigest` | Sets digest authentication with an external file; if users and usersFile are provided, both are merged, with external file contents having precedence. | | ||
| `<prefix>.frontend.auth.forward.address=https://example.com`| The URL of the authentication server. | | ||
| `<prefix>.frontend.auth.forward.tls.ca=/path/ca.pem` | Set the Certificate Authority (CA) for the TLS connection with the authentication server. | | ||
| `<prefix>.frontend.auth.forward.tls.caOptional=true` | Check the certificates if present but do not force to be signed by a specified Certificate Authority (CA). | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks
instead of Check
| `traefik.frontend.auth.digest.users=EXPR` | Sets digest authentication to this frontend in CSV format: `User:Realm:Hash,User:Realm:Hash`. | | ||
| `traefik.frontend.auth.digest.usersfile=/path/.htdigest` | Sets digest authentication with an external file; if users and usersFile are provided, both are merged, with external file contents having precedence. | | ||
| `traefik.frontend.auth.forward.address=https://example.com`| The URL of the authentication server. | | ||
| `traefik.frontend.auth.forward.tls.ca=/path/ca.pem` | Set the Certificate Authority (CA) for the TLS connection with the authentication server. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sets
instead of Set
docs/configuration/backends/mesos.md
Outdated
| `traefik.frontend.auth.forward.tls.caOptional=true` | Check the certificates if present but do not force to be signed by a specified Certificate Authority (CA). | | ||
| `traefik.frontend.auth.forward.tls.cert=/path/server.pem` | Set the Certificate for the TLS connection with the authentication server. | | ||
| `traefik.frontend.auth.forward.tls.insecureSkipVerify=true`| If set to true invalid SSL certificates are accepted. | | ||
| `traefik.frontend.auth.forward.tls.key=/path/server.key` | Set the Certificate for the TLS connection with the authentication server. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sets
instead of Set
| `traefik.frontend.auth.digest.users=EXPR` | Sets digest authentication to this frontend in CSV format: `User:Realm:Hash,User:Realm:Hash`. | | ||
| `traefik.frontend.auth.digest.usersfile=/path/.htdigest` | Sets digest authentication with an external file; if users and usersFile are provided, both are merged, with external file contents having precedence. | | ||
| `traefik.frontend.auth.forward.address=https://example.com`| The URL of the authentication server. | | ||
| `traefik.frontend.auth.forward.tls.ca=/path/ca.pem` | Set the Certificate Authority (CA) for the TLS connection with the authentication server. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sets
instead of Set
| `traefik.frontend.auth.digest.usersfile=/path/.htdigest` | Sets digest authentication with an external file; if users and usersFile are provided, both are merged, with external file contents having precedence. | | ||
| `traefik.frontend.auth.forward.address=https://example.com`| The URL of the authentication server. | | ||
| `traefik.frontend.auth.forward.tls.ca=/path/ca.pem` | Set the Certificate Authority (CA) for the TLS connection with the authentication server. | | ||
| `traefik.frontend.auth.forward.tls.caOptional=true` | Check the certificates if present but do not force to be signed by a specified Certificate Authority (CA). | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checks
instead of Check
| `traefik.frontend.auth.forward.address=https://example.com`| The URL of the authentication server. | | ||
| `traefik.frontend.auth.forward.tls.ca=/path/ca.pem` | Set the Certificate Authority (CA) for the TLS connection with the authentication server. | | ||
| `traefik.frontend.auth.forward.tls.caOptional=true` | Check the certificates if present but do not force to be signed by a specified Certificate Authority (CA). | | ||
| `traefik.frontend.auth.forward.tls.cert=/path/server.pem` | Set the Certificate for the TLS connection with the authentication server. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sets
instead of Set
| `traefik.frontend.auth.forward.tls.caOptional=true` | Check the certificates if present but do not force to be signed by a specified Certificate Authority (CA). | | ||
| `traefik.frontend.auth.forward.tls.cert=/path/server.pem` | Set the Certificate for the TLS connection with the authentication server. | | ||
| `traefik.frontend.auth.forward.tls.insecureSkipVerify=true`| If set to true invalid SSL certificates are accepted. | | ||
| `traefik.frontend.auth.forward.tls.key=/path/server.key` | Set the Certificate for the TLS connection with the authentication server. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sets
instead of Set
provider/marathon/config_test.go
Outdated
"test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", | ||
"test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0", | ||
Auth: &types.Auth{ | ||
//HeaderField: "X-WebAuth-User", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why keep this comment?
provider/marathon/config_test.go
Outdated
Basic: &types.Basic{ | ||
Users: []string{"test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", | ||
"test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"}, | ||
//UsersFile: ".htpasswd", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why keep this comment?
templates/kv.tmpl
Outdated
{{end}} | ||
|
||
{{if $auth.Digest }} | ||
[frontends.{{ $frontendName }}.auth.digest] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there are no "
for {{ $frontendName }}
?
templates/kv.tmpl
Outdated
{{end}} | ||
|
||
{{if $auth.Basic }} | ||
[frontends.{{ $frontendName }}.auth.basic] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there are no "
for {{ $frontendName }}
?
templates/kv.tmpl
Outdated
trustForwardHeader = {{ $auth.Forward.TrustForwardHeader }} | ||
|
||
{{if $auth.Forward.TLS }} | ||
[frontends.{{ $frontendName }}.auth.forward.tls] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there are no "
for {{ $frontendName }}
?
templates/mesos.tmpl
Outdated
|
||
{{if $auth.Digest }} | ||
[frontends.frontend-{{ $frontendName }}.auth.digest] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there are no "
for frontend-{{ $frontendName }}
?
templates/rancher.tmpl
Outdated
headerField = "{{ $auth.HeaderField }}" | ||
|
||
{{if $auth.Forward }} | ||
[frontends.frontend-{{ $frontendName }}.auth.forward] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there are no "
for frontend-{{ $frontendName }}
?
templates/rancher.tmpl
Outdated
trustForwardHeader = {{ $auth.Forward.TrustForwardHeader }} | ||
|
||
{{if $auth.Forward.TLS }} | ||
[frontends.frontend-{{ $frontendName }}.auth.forward.tls] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there are no "
for frontend-{{ $frontendName }}
?
templates/rancher.tmpl
Outdated
{{end}} | ||
|
||
{{if $auth.Basic }} | ||
[frontends.frontend-{{ $frontendName }}.auth.basic] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there are no "
for frontend-{{ $frontendName }}
?
templates/rancher.tmpl
Outdated
{{end}} | ||
|
||
{{if $auth.Digest }} | ||
[frontends.frontend-{{ $frontendName }}.auth.digest] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there are no "
for frontend-{{ $frontendName }}
?
e2b6aef
to
543c282
Compare
@jbdoumenjou on your branch it is remaining this part Is it normal? |
7df06f3
to
f805d21
Compare
What does this PR do?
Authentication support in frontends for the following providers:
Motivation
Fixes #2116, #2162, #2734
Related to #1465, #3460
More