mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
support connect ldap server with starttls (#5969)
* support connect ldap server with starttls * add more doc for start_tls option
This commit is contained in:
parent
4edb31723c
commit
7b1c374f64
@ -8,6 +8,8 @@ host = "127.0.0.1"
|
|||||||
port = 389
|
port = 389
|
||||||
# Set to true if ldap server supports TLS
|
# Set to true if ldap server supports TLS
|
||||||
use_ssl = false
|
use_ssl = false
|
||||||
|
# Set to true if connect ldap server with STARTTLS pattern (create connection in insecure, then upgrade to secure connection with TLS)
|
||||||
|
start_tls = false
|
||||||
# set to true if you want to skip ssl cert validation
|
# set to true if you want to skip ssl cert validation
|
||||||
ssl_skip_verify = false
|
ssl_skip_verify = false
|
||||||
# set to the path to your root CA certificate or leave unset to use system defaults
|
# set to the path to your root CA certificate or leave unset to use system defaults
|
||||||
|
@ -27,6 +27,8 @@ host = "127.0.0.1"
|
|||||||
port = 389
|
port = 389
|
||||||
# Set to true if ldap server supports TLS
|
# Set to true if ldap server supports TLS
|
||||||
use_ssl = false
|
use_ssl = false
|
||||||
|
# Set to true if connect ldap server with STARTTLS pattern (create connection in insecure, then upgrade to secure connection with TLS)
|
||||||
|
start_tls = false
|
||||||
# set to true if you want to skip ssl cert validation
|
# set to true if you want to skip ssl cert validation
|
||||||
ssl_skip_verify = false
|
ssl_skip_verify = false
|
||||||
# set to the path to your root CA certificate or leave unset to use system defaults
|
# set to the path to your root CA certificate or leave unset to use system defaults
|
||||||
|
@ -48,7 +48,16 @@ func (a *ldapAuther) Dial() error {
|
|||||||
ServerName: host,
|
ServerName: host,
|
||||||
RootCAs: certPool,
|
RootCAs: certPool,
|
||||||
}
|
}
|
||||||
|
if a.server.StartTLS {
|
||||||
|
a.conn, err = ldap.Dial("tcp", address)
|
||||||
|
if err == nil {
|
||||||
|
if err = a.conn.StartTLS(tlsCfg); err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
a.conn, err = ldap.DialTLS("tcp", address, tlsCfg)
|
a.conn, err = ldap.DialTLS("tcp", address, tlsCfg)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
a.conn, err = ldap.Dial("tcp", address)
|
a.conn, err = ldap.Dial("tcp", address)
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ type LdapServerConf struct {
|
|||||||
Host string `toml:"host"`
|
Host string `toml:"host"`
|
||||||
Port int `toml:"port"`
|
Port int `toml:"port"`
|
||||||
UseSSL bool `toml:"use_ssl"`
|
UseSSL bool `toml:"use_ssl"`
|
||||||
|
StartTLS bool `toml:"start_tls"`
|
||||||
SkipVerifySSL bool `toml:"ssl_skip_verify"`
|
SkipVerifySSL bool `toml:"ssl_skip_verify"`
|
||||||
RootCACert string `toml:"root_ca_cert"`
|
RootCACert string `toml:"root_ca_cert"`
|
||||||
BindDN string `toml:"bind_dn"`
|
BindDN string `toml:"bind_dn"`
|
||||||
|
Loading…
Reference in New Issue
Block a user