mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-14 01:20:27 +00:00
enable_dns_sec function added
This commit is contained in:
parent
1b93803d6e
commit
38be504d17
@ -823,6 +823,28 @@ class Domain(db.Model):
|
|||||||
else:
|
else:
|
||||||
return {'status': 'error', 'msg': 'This domain doesnot exist'}
|
return {'status': 'error', 'msg': 'This domain doesnot exist'}
|
||||||
|
|
||||||
|
def enable_domain_dnssec(self, domain_name):
|
||||||
|
"""
|
||||||
|
Enable domain DNSSEC
|
||||||
|
"""
|
||||||
|
domain = Domain.query.filter(Domain.name == domain_name).first()
|
||||||
|
if domain:
|
||||||
|
headers = {}
|
||||||
|
headers['X-API-Key'] = PDNS_API_KEY
|
||||||
|
post_data = {
|
||||||
|
"keytype": "ksk",
|
||||||
|
"active": True
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
jdata = utils.fetch_json(urlparse.urljoin(PDNS_STATS_URL, API_EXTENDED_URL + '/servers/localhost/zones/%s/cryptokeys' % domain.name), headers=headers, method='POST',data=post_data)
|
||||||
|
if 'error' in jdata:
|
||||||
|
return {'status': 'error', 'msg': 'DNSSEC is not enabled for this domain', 'jdata' : jdata}
|
||||||
|
else:
|
||||||
|
return {'status': 'ok'}
|
||||||
|
except:
|
||||||
|
return {'status': 'error', 'msg': 'There was something wrong, please contact administrator'}
|
||||||
|
else:
|
||||||
|
return {'status': 'error', 'msg': 'This domain doesnot exist'}
|
||||||
|
|
||||||
class DomainUser(db.Model):
|
class DomainUser(db.Model):
|
||||||
__tablename__ = 'domain_user'
|
__tablename__ = 'domain_user'
|
||||||
|
Loading…
Reference in New Issue
Block a user