mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 22:50:26 +00:00
Merge branch 'master' of https://github.com/ngoduykhanh/PowerDNS-Admin
This commit is contained in:
commit
56381e766f
@ -19,6 +19,9 @@ if app.config['SAML_ENABLED']:
|
||||
from onelogin.saml2.idp_metadata_parser import OneLogin_Saml2_IdPMetadataParser
|
||||
idp_timestamp = datetime(1970, 1, 1)
|
||||
idp_data = None
|
||||
if 'SAML_IDP_ENTITY_ID' in app.config:
|
||||
idp_data = OneLogin_Saml2_IdPMetadataParser.parse_remote(app.config['SAML_METADATA_URL'], entity_id=app.config.get('SAML_IDP_ENTITY_ID', None), required_sso_binding=app.config['SAML_IDP_SSO_BINDING'])
|
||||
else:
|
||||
idp_data = OneLogin_Saml2_IdPMetadataParser.parse_remote(app.config['SAML_METADATA_URL'], entity_id=app.config.get('SAML_IDP_ENTITY_ID', None))
|
||||
if idp_data is None:
|
||||
print('SAML: IDP Metadata initial load failed')
|
||||
@ -37,6 +40,9 @@ def get_idp_data():
|
||||
|
||||
def retreive_idp_data():
|
||||
global idp_data, idp_timestamp
|
||||
if 'SAML_IDP_SSO_BINDING' in app.config:
|
||||
new_idp_data = OneLogin_Saml2_IdPMetadataParser.parse_remote(app.config['SAML_METADATA_URL'], entity_id=app.config.get('SAML_IDP_ENTITY_ID', None), required_sso_binding=app.config['SAML_IDP_SSO_BINDING'])
|
||||
else:
|
||||
new_idp_data = OneLogin_Saml2_IdPMetadataParser.parse_remote(app.config['SAML_METADATA_URL'], entity_id=app.config.get('SAML_IDP_ENTITY_ID', None))
|
||||
if new_idp_data is not None:
|
||||
idp_data = new_idp_data
|
||||
|
@ -94,6 +94,10 @@ SAML_METADATA_URL = 'https://<hostname>/FederationMetadata/2007-06/FederationMet
|
||||
#Cache Lifetime in Seconds
|
||||
SAML_METADATA_CACHE_LIFETIME = 1
|
||||
|
||||
# SAML SSO binding format to use
|
||||
## Default: library default (urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect)
|
||||
#SAML_IDP_SSO_BINDING = 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'
|
||||
|
||||
## EntityID of the IdP to use. Only needed if more than one IdP is
|
||||
## in the SAML_METADATA_URL
|
||||
### Default: First (only) IdP in the SAML_METADATA_URL
|
||||
|
32
update_zones.py
Normal file
32
update_zones.py
Normal file
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
####################################################################################################################################
|
||||
# A CLI Script to update list of domains instead from the UI. Can be usefull for people who want to execute updates from a cronjob
|
||||
#
|
||||
# Tip:
|
||||
# When running from a cron, use flock (you might need to install it) to be sure only one process is running a time. eg:
|
||||
# */5 * * * * flock -xn "/tmp/pdns-update-zones.lock" python /var/www/html/apps/poweradmin/update_zones.py >/dev/null 2>&1
|
||||
#
|
||||
##############################################################
|
||||
|
||||
### Imports
|
||||
from app import app
|
||||
from app.lib import log
|
||||
from app.models import Domain
|
||||
from config import BG_DOMAIN_UPDATES
|
||||
|
||||
import sys
|
||||
import logging as logger
|
||||
|
||||
### Define logging
|
||||
logging = logger.getLogger(__name__)
|
||||
|
||||
### Check if BG_DOMAIN_UPDATES is set to true
|
||||
if not BG_DOMAIN_UPDATES:
|
||||
logging.error('Set BG_DOMAIN_UPDATES to True in config.py')
|
||||
sys.exit(1)
|
||||
|
||||
### Start the update process
|
||||
logging.info('Update zones from nameserver API')
|
||||
|
||||
d = Domain().update()
|
Loading…
Reference in New Issue
Block a user