mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-01-27 20:24:39 +00:00
remove dnssec keys
This commit is contained in:
parent
197f555dfc
commit
5ea70023ff
@ -846,6 +846,27 @@ class Domain(db.Model):
|
|||||||
else:
|
else:
|
||||||
return {'status': 'error', 'msg': 'This domain doesnot exist'}
|
return {'status': 'error', 'msg': 'This domain doesnot exist'}
|
||||||
|
|
||||||
|
def delete_dnssec_key(self, domain_name, key_id):
|
||||||
|
"""
|
||||||
|
Remove keys DNSSEC
|
||||||
|
"""
|
||||||
|
domain = Domain.query.filter(Domain.name == domain_name).first()
|
||||||
|
if domain:
|
||||||
|
headers = {}
|
||||||
|
headers['X-API-Key'] = PDNS_API_KEY
|
||||||
|
url = '/servers/localhost/zones/%s/cryptokeys/%s' % (domain.name, key_id)
|
||||||
|
|
||||||
|
try:
|
||||||
|
jdata = utils.fetch_json(urlparse.urljoin(PDNS_STATS_URL, API_EXTENDED_URL + url), headers=headers, method='DELETE')
|
||||||
|
if 'error' in jdata:
|
||||||
|
return {'status': 'error', 'msg': 'DNSSEC is not disabled for this domain', 'jdata' : jdata}
|
||||||
|
else:
|
||||||
|
return {'status': 'ok'}
|
||||||
|
except:
|
||||||
|
return {'status': 'error', 'msg': 'There was something wrong, please contact administrator','id': key_id, 'url': url}
|
||||||
|
else:
|
||||||
|
return {'status': 'error', 'msg': 'This domain doesnot exist'}
|
||||||
|
|
||||||
class DomainUser(db.Model):
|
class DomainUser(db.Model):
|
||||||
__tablename__ = 'domain_user'
|
__tablename__ = 'domain_user'
|
||||||
id = db.Column(db.Integer, primary_key = True)
|
id = db.Column(db.Integer, primary_key = True)
|
||||||
|
@ -662,7 +662,13 @@ def domain_dnssec_disable(domain_name):
|
|||||||
|
|
||||||
domain = Domain()
|
domain = Domain()
|
||||||
dnssec = domain.get_domain_dnssec(domain_name)
|
dnssec = domain.get_domain_dnssec(domain_name)
|
||||||
return make_response(jsonify({'status': 'error', 'msg': 'Function not implemented'}), 400)
|
|
||||||
|
for key in dnssec['dnssec']:
|
||||||
|
response = domain.delete_dnssec_key(domain_name,key['id']);
|
||||||
|
|
||||||
|
return make_response(jsonify( { 'status': 'ok', 'msg': 'Setting updated.', 'response': response } ))
|
||||||
|
|
||||||
|
#return make_response(jsonify({'status': 'error', 'msg': 'Function not implemented'}), 400)
|
||||||
#return make_response(jsonify(dnssec), 200)
|
#return make_response(jsonify(dnssec), 200)
|
||||||
|
|
||||||
@app.route('/domain/<string:domain_name>/managesetting', methods=['GET', 'POST'])
|
@app.route('/domain/<string:domain_name>/managesetting', methods=['GET', 'POST'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user