|
|
@ -14,22 +14,14 @@ def vault_error(*messages, status=404):
|
|
|
|
|
|
|
|
|
|
|
|
@internal.route("/rspamd/vault/v1/dkim/<domain_name>", methods=['GET'])
|
|
|
|
@internal.route("/rspamd/vault/v1/dkim/<domain_name>", methods=['GET'])
|
|
|
|
def rspamd_dkim_key(domain_name):
|
|
|
|
def rspamd_dkim_key(domain_name):
|
|
|
|
models.Relay.query.get(domain_name) and return flask.jsonify({
|
|
|
|
selectors = []
|
|
|
|
'data': {
|
|
|
|
if domain := models.Domain.query.get(domain_name):
|
|
|
|
'selectors': []
|
|
|
|
if key := domain.dkim_key:
|
|
|
|
}
|
|
|
|
selectors.append(
|
|
|
|
})
|
|
|
|
|
|
|
|
domain = models.Domain.query.get(domain_name) or flask.abort(vault_error('unknown domain'))
|
|
|
|
|
|
|
|
key = domain.dkim_key or flask.abort(vault_error('no dkim key', status=400))
|
|
|
|
|
|
|
|
return flask.jsonify({
|
|
|
|
|
|
|
|
'data': {
|
|
|
|
|
|
|
|
'selectors': [
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
'domain' : domain.name,
|
|
|
|
'domain' : domain.name,
|
|
|
|
'key' : key.decode('utf8'),
|
|
|
|
'key' : key.decode('utf8'),
|
|
|
|
'selector': flask.current_app.config.get('DKIM_SELECTOR', 'dkim'),
|
|
|
|
'selector': flask.current_app.config.get('DKIM_SELECTOR', 'dkim'),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
)
|
|
|
|
}
|
|
|
|
return flask.jsonify({'data': {'selectors': selectors}})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|