update-torbrowser tb_onion config setting ignored.

Environment: QubesOS, untested on any other platform but it seems agnostic.

Description:
When setting tb_onion=true in any of the config files in /etc/torbrowser.d/ the update-torbrowser script doesn’t download the Tor Browser using the onion services. However the onion services are used when you call update-torbrowser --onion or tb_onion=true update-torbrowser.

For example using: echo "tb_onion=true" | sudo tee -a "/etc/torbrowser.d/50_user.conf"

Looking at the script [1][2] it appears setting the download URL (in function tb_preparation) [4][5] happens before the config files are loaded (function tb_config_folder_parser) [3], hence as the URL is already set loading the config files from /etc/torbrowser.d/ with tb_onion=true doesn’t make a difference.

The function tb_config_folder_parser [6] depends on the variable $tb_settings_folder being set to work and this appears to be only set in the function tb_preparation [7], hence moving the function tb_config_folder_parser before tb_preparation doesn’t work [3][4]. I’ve got it to work by moving the function call tb_config_folder_parser [3] into the function tb_preparation somewhere between setting $tb_settings_folder (line 629 [7]) and using $tb_onion (line 787 [5]). Another solution would be to refactor function tb_preparation into two smaller functions and call tb_config_folder_parser in between them.

I’m not as familiar with the scripts internals so I don’t want to make a patch, I thought to just posting my findings on here and you can decide how it should be done.

This isn’t relevant to the bug, but this my first direct interaction. I’ve used Whonix most days for ~5 years and really appreciate the work that has been put in. :slight_smile:

Relevant ticket: [8]

[1] GitHub - Kicksecure/tb-updater at 188cc1e12c01b57cf9e363e87ddd57aed464feba
[2] tb-updater/update-torbrowser at 188cc1e12c01b57cf9e363e87ddd57aed464feba · Kicksecure/tb-updater · GitHub
[3] tb-updater/update-torbrowser at 188cc1e12c01b57cf9e363e87ddd57aed464feba · Kicksecure/tb-updater · GitHub
[4] tb-updater/update-torbrowser at 188cc1e12c01b57cf9e363e87ddd57aed464feba · Kicksecure/tb-updater · GitHub
[5] tb-updater/update-torbrowser at 188cc1e12c01b57cf9e363e87ddd57aed464feba · Kicksecure/tb-updater · GitHub
[6] tb-updater/update-torbrowser at 188cc1e12c01b57cf9e363e87ddd57aed464feba · Kicksecure/tb-updater · GitHub
[7] tb-updater/update-torbrowser at 188cc1e12c01b57cf9e363e87ddd57aed464feba · Kicksecure/tb-updater · GitHub
[8] ⚓ T678 tb-updater onion mirros downloads support

3 Likes

Welcome to the forums! Good to hear! Bug should be fixed. Committed to git just now but untested.

2 Likes