convert_document_to_journalist_interface migration breaks Tor when restoring from a pre-0.4 backup #2484
Labels
bug
goals: packaging
good first issue
Hacktoberfest
Issues suitable for the annual Hacktoberfest organized by Digital Ocean
Milestone
This is a good first issue for new contributors to take on, if you have any questions, please ask on the task or in our Gitter room! See "Proposed fix" at the bottom of the description for what to do.
Bug
Description
During the backup procedure (see
install_files/ansible-base/roles/backup/files/backup.py
) - we grab a couple of key files/folders from an old instance and then a restore script will lay these down upon the new server. In particular for this bug, we are grabbing/etc/tor/torrc/
and/var/lib/tor/services
.When an admin uses our backup against a pre
0.4
instance, restores to a post0.4
instance, and then waits approximately 6 weeks for the next securedrop dpkg to be released, their instance will come back with a misconfigured tor setup for the journalist interface.Steps to Reproduce
0.4
SecureDrop instance and take a backup. Specifically, all you need is/etc/tor/torrc
and a tar of everything under/var/lib/tor/services
.0.4.x
version of securedrop to another serverExpected Behavior
An apt upgrade doesn't break tor and updates the server-side code without incident.
Actual Behavior
A SecureDrop
torrc
that has been migrated from a pre-0.4
box looks something like this:and the listing of directories under
/var/lib/tor/services
looks like this:You might be asking above --
well why the hell is there a journalist AND a document folder?
. Becausejournalist
was created on a new ansible run, and then a restore process merely brought over thedocument
folder but we didnt have any logic to handle any existing journalist folder here.So, AFTER a package update from securedrop services the
torrc
looks like this:and the listing of directories under
/var/lib/tor/services
looks like this:Basically the journalist interface ends up reverting to what was originally installed from securedrop playbook before the restore process.
Comments
The problem here is that the migration logic that runs as part of the debian pkg
preinst
scripts (seeinstall_files/securedrop-app-code/DEBIAN/preinst
) do not take into account an existing journalist directory on a system and therefore end up breaking the configuration. The best thing to do would be to update that logic to perform anrsync -av --delete
instead of a move. Note the problematic logic below:Proposed fix
Remove the
convert_document_to_journalist_interface
function from https://github.com/freedomofpress/securedrop/blob/7e38090789a94c1398ac858585fd85ead238f396/install_files/securedrop-app-code/debian/preinst.The text was updated successfully, but these errors were encountered: