mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-12 16:40:26 +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 json
|
||||||
import requests
|
import requests
|
||||||
import urlparse
|
import urlparse
|
||||||
|
from app import app
|
||||||
|
|
||||||
|
TIMEOUT = app.config['TIMEOUT']
|
||||||
|
|
||||||
def auth_from_url(url):
|
def auth_from_url(url):
|
||||||
auth = None
|
auth = None
|
||||||
@ -18,7 +21,7 @@ def fetch_remote(remote_url, method='GET', data=None, accept=None, params=None,
|
|||||||
data = json.dumps(data)
|
data = json.dumps(data)
|
||||||
|
|
||||||
if timeout is None:
|
if timeout is None:
|
||||||
timeout = 1.5
|
timeout = TIMEOUT
|
||||||
|
|
||||||
verify = False
|
verify = False
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ LDAP_URI = app.config['LDAP_URI']
|
|||||||
LDAP_USERNAME = app.config['LDAP_USERNAME']
|
LDAP_USERNAME = app.config['LDAP_USERNAME']
|
||||||
LDAP_PASSWORD = app.config['LDAP_PASSWORD']
|
LDAP_PASSWORD = app.config['LDAP_PASSWORD']
|
||||||
LDAP_SEARCH_BASE = app.config['LDAP_SEARCH_BASE']
|
LDAP_SEARCH_BASE = app.config['LDAP_SEARCH_BASE']
|
||||||
|
LDAP_TYPE = app.config['LDAP_TYPE']
|
||||||
|
|
||||||
PDNS_STATS_URL = app.config['PDNS_STATS_URL']
|
PDNS_STATS_URL = app.config['PDNS_STATS_URL']
|
||||||
PDNS_API_KEY = app.config['PDNS_API_KEY']
|
PDNS_API_KEY = app.config['PDNS_API_KEY']
|
||||||
@ -146,7 +147,10 @@ class User(db.Model):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
elif method == 'LDAP':
|
elif method == 'LDAP':
|
||||||
|
if LDAP_TYPE == 'ldap':
|
||||||
searchFilter = "cn=%s" % self.username
|
searchFilter = "cn=%s" % self.username
|
||||||
|
else:
|
||||||
|
searchFilter = "(&(objectcategory=person)(samaccountname=%s))" % self.username
|
||||||
try:
|
try:
|
||||||
result = self.ldap_search(searchFilter, LDAP_SEARCH_BASE)
|
result = self.ldap_search(searchFilter, LDAP_SEARCH_BASE)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
@ -6,6 +6,9 @@ WTF_CSRF_ENABLED = True
|
|||||||
SECRET_KEY = 'We are the world'
|
SECRET_KEY = 'We are the world'
|
||||||
PORT = 9393
|
PORT = 9393
|
||||||
|
|
||||||
|
# TIMEOUT - for large zones
|
||||||
|
TIMEOUT = 10
|
||||||
|
|
||||||
# LOG CONFIG
|
# LOG CONFIG
|
||||||
LOG_LEVEL = 'DEBUG'
|
LOG_LEVEL = 'DEBUG'
|
||||||
LOG_FILE = 'logfile.log'
|
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_USERNAME = 'cn=dnsuser,ou=users,ou=services,dc=duykhanh,dc=me'
|
||||||
LDAP_PASSWORD = 'dnsuser'
|
LDAP_PASSWORD = 'dnsuser'
|
||||||
LDAP_SEARCH_BASE = 'ou=System Admins,ou=People,dc=duykhanh,dc=me'
|
LDAP_SEARCH_BASE = 'ou=System Admins,ou=People,dc=duykhanh,dc=me'
|
||||||
|
LDAP_TYPE = 'ldap' // or 'ad'
|
||||||
|
|
||||||
# POWERDNS CONFIG
|
# POWERDNS CONFIG
|
||||||
PDNS_STATS_URL = 'http://172.16.214.131:8081/'
|
PDNS_STATS_URL = 'http://172.16.214.131:8081/'
|
||||||
|
Loading…
Reference in New Issue
Block a user