diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-09-24 17:25:41 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-09-24 17:25:41 +0100 |
commit | 52ca8676700368098ca0689c424f972ac54ac780 (patch) | |
tree | 43bc0d4caeb33bc342f5b5a604dcfd0eac89cb4f /synapse/federation | |
parent | Fix a few pyflakes errors in the server_key_resource (diff) | |
download | synapse-52ca8676700368098ca0689c424f972ac54ac780.tar.xz |
Sign federation transactions
Diffstat (limited to 'synapse/federation')
-rw-r--r-- | synapse/federation/replication.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/synapse/federation/replication.py b/synapse/federation/replication.py index 96b82f00cb..84977e7e57 100644 --- a/synapse/federation/replication.py +++ b/synapse/federation/replication.py @@ -25,6 +25,8 @@ from .persistence import PduActions, TransactionActions from synapse.util.logutils import log_function +from syutil.crypto.jsonsign import sign_json + import logging @@ -489,7 +491,7 @@ class _TransactionQueue(object): """ def __init__(self, hs, transaction_actions, transport_layer): - + self.signing_key = hs.config.signing_key[0] self.server_name = hs.hostname self.transaction_actions = transaction_actions self.transport_layer = transport_layer @@ -604,6 +606,9 @@ class _TransactionQueue(object): # Actually send the transaction + server_name = self.server_name + signing_key = self.signing_key + # FIXME (erikj): This is a bit of a hack to make the Pdu age # keys work def cb(transaction): @@ -613,6 +618,8 @@ class _TransactionQueue(object): if "age_ts" in p: p["age"] = now - int(p["age_ts"]) + transaction = sign_json(transaction, server_name, signing_key) + return transaction code, response = yield self.transport_layer.send_transaction( |