Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Fix tootctl accounts rotate not updating public keys (mastodon#9556)
Browse files Browse the repository at this point in the history
This allowed you to brick your system when running that command, because the accounts would continue to advertise the old public key, but sign things with the new one
  • Loading branch information
Gargron authored Dec 18, 2018
1 parent 12ab15e commit 857e8eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mastodon/accounts_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ def rotate_keys_for_account(account, delay = 0)
end

old_key = account.private_key
new_key = OpenSSL::PKey::RSA.new(2048).to_pem
account.update(private_key: new_key)
new_key = OpenSSL::PKey::RSA.new(2048)
account.update(private_key: new_key.to_pem, public_key: new_key.public_key.to_pem)
ActivityPub::UpdateDistributionWorker.perform_in(delay, account.id, sign_with: old_key)
end
end
Expand Down

0 comments on commit 857e8eb

Please sign in to comment.