mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-09 15:10:27 +00:00
Merge pull request #15 from vdchuyen/master
Add Active directory authentication and Timeout for large zone
This commit is contained in:
commit
7c46c149f8
@ -3,6 +3,9 @@ import sys
|
||||
import json
|
||||
import requests
|
||||
import urlparse
|
||||
from app import app
|
||||
|
||||
TIMEOUT = app.config['TIMEOUT']
|
||||
|
||||
def auth_from_url(url):
|
||||
auth = None
|
||||
@ -18,7 +21,7 @@ def fetch_remote(remote_url, method='GET', data=None, accept=None, params=None,
|
||||
data = json.dumps(data)
|
||||
|
||||
if timeout is None:
|
||||
timeout = 1.5
|
||||
timeout = TIMEOUT
|
||||
|
||||
verify = False
|
||||
|
||||
|
@ -18,6 +18,7 @@ LDAP_URI = app.config['LDAP_URI']
|
||||
LDAP_USERNAME = app.config['LDAP_USERNAME']
|
||||
LDAP_PASSWORD = app.config['LDAP_PASSWORD']
|
||||
LDAP_SEARCH_BASE = app.config['LDAP_SEARCH_BASE']
|
||||
LDAP_TYPE = app.config['LDAP_TYPE']
|
||||
|
||||
PDNS_STATS_URL = app.config['PDNS_STATS_URL']
|
||||
PDNS_API_KEY = app.config['PDNS_API_KEY']
|
||||
@ -146,7 +147,10 @@ class User(db.Model):
|
||||
return False
|
||||
|
||||
elif method == 'LDAP':
|
||||
if LDAP_TYPE == 'ldap':
|
||||
searchFilter = "cn=%s" % self.username
|
||||
else:
|
||||
searchFilter = "(&(objectcategory=person)(samaccountname=%s))" % self.username
|
||||
try:
|
||||
result = self.ldap_search(searchFilter, LDAP_SEARCH_BASE)
|
||||
except Exception, e:
|
||||
|
@ -6,6 +6,9 @@ WTF_CSRF_ENABLED = True
|
||||
SECRET_KEY = 'We are the world'
|
||||
PORT = 9393
|
||||
|
||||
# TIMEOUT - for large zones
|
||||
TIMEOUT = 10
|
||||
|
||||
# LOG CONFIG
|
||||
LOG_LEVEL = 'DEBUG'
|
||||
LOG_FILE = 'logfile.log'
|
||||
@ -23,6 +26,7 @@ LDAP_URI = 'ldaps://your-ldap-server:636'
|
||||
LDAP_USERNAME = 'cn=dnsuser,ou=users,ou=services,dc=duykhanh,dc=me'
|
||||
LDAP_PASSWORD = 'dnsuser'
|
||||
LDAP_SEARCH_BASE = 'ou=System Admins,ou=People,dc=duykhanh,dc=me'
|
||||
LDAP_TYPE = 'ldap' // or 'ad'
|
||||
|
||||
# POWERDNS CONFIG
|
||||
PDNS_STATS_URL = 'http://172.16.214.131:8081/'
|
||||
|
Loading…
Reference in New Issue
Block a user