Don't return any key for relayed domains

We may want to revisit this (ARC signing)... but in the meantime
it saves from a scary message in rspamd

signing failure: cannot request data from the vault url: /internal/rspamd/vault/v1/dkim/ ...
master
Florent Daigniere 3 years ago
parent 6c6b0b161c
commit bbef4bee27

@ -14,6 +14,11 @@ 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({
'data': {
'selectors': []
}
})
domain = models.Domain.query.get(domain_name) or flask.abort(vault_error('unknown domain')) 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)) key = domain.dkim_key or flask.abort(vault_error('no dkim key', status=400))
return flask.jsonify({ return flask.jsonify({

Loading…
Cancel
Save