Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
proto3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
protokollsystem
proto3
Commits
173da7c9
Commit
173da7c9
authored
8 years ago
by
Robin Sonnabend
Browse files
Options
Downloads
Patches
Plain Diff
Allow configuration of the LDAP server certificate
parent
8c04d06d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
auth.py
+9
-2
9 additions, 2 deletions
auth.py
config.py.example
+2
-1
2 additions, 1 deletion
config.py.example
with
11 additions
and
3 deletions
auth.py
+
9
−
2
View file @
173da7c9
import
ldap
import
hmac
,
hashlib
import
ssl
import
ldap3
from
ldap3.utils.dn
import
parse_dn
from
datetime
import
datetime
...
...
@@ -99,8 +100,14 @@ class LdapManager:
yield
group
.
cn
.
value
class
ADManager
:
def
__init__
(
self
,
host
,
domain
,
user_dn
,
group_dn
,
port
=
636
,
use_ssl
=
True
):
self
.
server
=
ldap3
.
Server
(
host
,
port
=
port
,
use_ssl
=
use_ssl
)
def
__init__
(
self
,
host
,
domain
,
user_dn
,
group_dn
,
port
=
636
,
use_ssl
=
True
,
ca_cert
=
None
):
tls_config
=
ldap3
.
Tls
(
validate
=
ssl
.
CERT_REQUIRED
)
if
ca_cert
is
not
None
:
tls_config
=
ldap3
.
Tls
(
validate
=
ssl
.
CERT_REQUIRED
,
ca_certs_file
=
ca_cert
)
self
.
server
=
ldap3
.
Server
(
host
,
port
=
port
,
use_ssl
=
use_ssl
,
tls
=
tls_config
)
self
.
domain
=
domain
self
.
user_dn
=
user_dn
self
.
group_dn
=
group_dn
...
...
This diff is collapsed.
Click to expand it.
config.py.example
+
2
−
1
View file @
173da7c9
...
...
@@ -78,7 +78,8 @@ AUTH_BACKENDS = [
host="ad.example.com",
domain="EXAMPLE",
user_dn="cn=users,dc=example,dc=com",
group_dn="dc=example,dc=com")
group_dn="dc=example,dc=com",
ca_cert="/etc/ssl/certs/example-ca.pem")
]
# lines of error description
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment