Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
5bea54ea
Commit
5bea54ea
authored
Aug 03, 2018
by
Emil Flink
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support client certificates for LDAP servers
parent
bda49fca
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
0 deletions
+18
-0
conf/ldap.toml
+3
-0
docs/sources/installation/ldap.md
+3
-0
pkg/login/ldap.go
+10
-0
pkg/login/ldap_settings.go
+2
-0
No files found.
conf/ldap.toml
View file @
5bea54ea
...
@@ -15,6 +15,9 @@ start_tls = false
...
@@ -15,6 +15,9 @@ start_tls = false
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
# root_ca_cert = "/path/to/certificate.crt"
# root_ca_cert = "/path/to/certificate.crt"
# Authentication against LDAP servers requiring client certificates
# client_cert = "/path/to/client.crt"
# client_key = "/path/to/client.key"
# Search user bind dn
# Search user bind dn
bind_dn
=
"cn=admin,dc=grafana,dc=org"
bind_dn
=
"cn=admin,dc=grafana,dc=org"
...
...
docs/sources/installation/ldap.md
View file @
5bea54ea
...
@@ -40,6 +40,9 @@ start_tls = false
...
@@ -40,6 +40,9 @@ start_tls = false
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
# root_ca_cert = "/path/to/certificate.crt"
# root_ca_cert = "/path/to/certificate.crt"
# Authentication against LDAP servers requiring client certificates
# client_cert = "/path/to/client.crt"
# client_key = "/path/to/client.key"
# Search user bind dn
# Search user bind dn
bind_dn
=
"cn=admin,dc=grafana,dc=org"
bind_dn
=
"cn=admin,dc=grafana,dc=org"
...
...
pkg/login/ldap.go
View file @
5bea54ea
...
@@ -59,6 +59,13 @@ func (a *ldapAuther) Dial() error {
...
@@ -59,6 +59,13 @@ func (a *ldapAuther) Dial() error {
}
}
}
}
}
}
var
clientCert
tls
.
Certificate
if
a
.
server
.
ClientCert
!=
""
&&
a
.
server
.
ClientKey
!=
""
{
clientCert
,
err
=
tls
.
LoadX509KeyPair
(
a
.
server
.
ClientCert
,
a
.
server
.
ClientKey
)
if
err
!=
nil
{
return
err
}
}
for
_
,
host
:=
range
strings
.
Split
(
a
.
server
.
Host
,
" "
)
{
for
_
,
host
:=
range
strings
.
Split
(
a
.
server
.
Host
,
" "
)
{
address
:=
fmt
.
Sprintf
(
"%s:%d"
,
host
,
a
.
server
.
Port
)
address
:=
fmt
.
Sprintf
(
"%s:%d"
,
host
,
a
.
server
.
Port
)
if
a
.
server
.
UseSSL
{
if
a
.
server
.
UseSSL
{
...
@@ -67,6 +74,9 @@ func (a *ldapAuther) Dial() error {
...
@@ -67,6 +74,9 @@ func (a *ldapAuther) Dial() error {
ServerName
:
host
,
ServerName
:
host
,
RootCAs
:
certPool
,
RootCAs
:
certPool
,
}
}
if
len
(
clientCert
.
Certificate
)
>
0
{
tlsCfg
.
Certificates
=
append
(
tlsCfg
.
Certificates
,
clientCert
)
}
if
a
.
server
.
StartTLS
{
if
a
.
server
.
StartTLS
{
a
.
conn
,
err
=
ldap
.
Dial
(
"tcp"
,
address
)
a
.
conn
,
err
=
ldap
.
Dial
(
"tcp"
,
address
)
if
err
==
nil
{
if
err
==
nil
{
...
...
pkg/login/ldap_settings.go
View file @
5bea54ea
...
@@ -21,6 +21,8 @@ type LdapServerConf struct {
...
@@ -21,6 +21,8 @@ type LdapServerConf struct {
StartTLS
bool
`toml:"start_tls"`
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"`
ClientCert
string
`toml:"client_cert"`
ClientKey
string
`toml:"client_key"`
BindDN
string
`toml:"bind_dn"`
BindDN
string
`toml:"bind_dn"`
BindPassword
string
`toml:"bind_password"`
BindPassword
string
`toml:"bind_password"`
Attr
LdapAttributeMap
`toml:"attributes"`
Attr
LdapAttributeMap
`toml:"attributes"`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment