Document all the configuration parameters for OnionShare itself and mode-specific settings when using persistence

This commit is contained in:
Miguel Jacq 2025-02-14 18:28:05 +11:00
parent cd9acaa5af
commit 260427aead
No known key found for this signature in database
GPG Key ID: 59B3F0C24135C6A9

View File

@ -309,3 +309,165 @@ OnionShare stores all such data in a specific folder. Copy the relevant folder f
* Linux: ``~/.config/onionshare``
* macOS: ``~/Library/Application Support/OnionShare``
* Windows: ``%APPDATA%\OnionShare``
Configuration file parameters
-----------------------------
OnionShare stores its settings in a JSON file. Both the CLI and the Desktop versions use this configuration file. The CLI also lets you specify a path to a custom configuration file with ``--config``.
Below are the configuration file parameters and what they mean. If your configuration file has other parameters not listed here, they may be obsolete from older OnionShare versions.
==================== =========== ===========
Parameter Type Explanation
==================== =========== ===========
version ``string`` The version of OnionShare. You should not ever need to change this value.
connection_type ``string`` The way in which OnionShare connects to Tor. Valid options are 'bundled', 'automatic' (use Tor Browser's Tor connection), 'control_port' or 'socket_file'. Default: 'bundled'
control_port_address ``string`` The IP address of Tor's Control port, if ``connection_type`` is set to 'control_port'. Default: '127.0.0.1'
control_port_port ``integer`` The port number of Tor's Control port, if ``connection_type`` is set to 'control_port'. Default: '9051'
socks_address ``string`` The IP address of Tor's SOCKS proxy, if ``connection_type`` is set to 'control_port' or 'socket_file'. Default: '127.0.0.1'
socks_port ``integer`` The port number of Tor's SOCKS proxy, if ``connection_type`` is set to 'control_port' or 'socket_file'. Default: '127.0.0.1'
socket_file_path ``string`` The path to Tor's socket file, if ``connection_type`` is set to 'socket_file'. Default: '/var/run/tor/control'
auth_type ``string`` If access to Tor's control port requires a password, this can be set to 'password', otherwise 'no_auth'. Default: 'no_auth'
auth_password ``string`` If access to Tor's control port requires a password, and ``auth_type`` is set to 'password', specify the password here. Default: ''
auto_connect ``boolean`` Whether OnionShare should automatically connect to Tor when it starts. Default: False
use_autoupdate ``boolean`` Whether OnionShare should automatically check for updates (over Tor). This setting is only valid for MacOS or Windows installations. Default: True.
autoupdate_timestamp ``integer`` The last time OnionShare checked for updates. Default: None
bridges_enabled ``boolean`` Whether to connect to Tor using bridges. Default: False
bridges_type ``string`` When ``bridges_enabled`` is True, where to load bridges from. Options are "built-in" (bridges shipped with OnionShare and which may get updated from Tor), "moat" (request bridges from Tor's Moat API), or "custom" (user-supplied bridges). Default: "built-in"
bridges_builtin_pt ``string`` When ``bridges_type`` is set to "built-in", this specifies which type of bridge protocol to use. Options are "obfs4", "meek-azure" or "snowflake". Default: "obfs4"
bridges_moat ``string`` When ``bridges_type`` is set to "moat", the bridges returned from Tor's Moat API are stored here. Default: ""
bridges_custom ``string`` When ``bridges_type`` is set to "custom", the bridges specified by the user are stored here. Separate each bridge line in the string with '\n'. Default: ""
bridges_builtin ``dict`` When ``bridges_type`` is set to "built-in", OnionShare obtains the latest built-in bridges recommended by Tor and stores them here. Default: {}
persistent_tabs ``list`` If the user has defined any tabs as 'saved' (meaning that they are persistent each time OnionShare starts, and their onion address doesn't change), these are given a random identifier which gets listed here. The persistent onion is stored as a JSON file with the same name as this identifier, in a subfolder of the OnionShare configuration folder called 'persistent'. Default: []
locale ``string`` The locale used in OnionShare. Default: None (which is the same as 'en'). For valid locale codes, see 'available_locales' in https://github.com/onionshare/onionshare/blob/main/cli/onionshare_cli/settings.py
theme ``boolean`` The theme for the OnionShare desktop app. Valid options are 0 (automatically detect the user's computer's light or dark theme), 1 (light) or 2 (dark).
==================== =========== ===========
Configuration file parameters for persistent onions
---------------------------------------------------
As described above, each 'persistent' onion has parameters of its own which are stored in its own JSON file. The path to this file can be specified for the CLI tool with ``--persistent``.
Here is an example persistent JSON configuration::
{
"onion": {
"private_key": "0HGxILDDwYhxAB2Zq8mM3Wu3MirBgK7Fw2/tVrTw1XraElH7MWbVn3lzKbcJEapVWz2TFjaoCAVN48hGqraiRg==",
"client_auth_priv_key": "UT55HDBA5VSRWOUERMGOHEIBKZCMOOGZAFFNI54GDQFZ6CMCUGIQ",
"client_auth_pub_key": "TPQCMCV26UEDMCWGZCWAWM4FOJSQKZZTVPC5TC3CAGMDWKV255OA"
},
"persistent": {
"mode": "share",
"enabled": true,
"autostart_on_launch": false
},
"general": {
"title": null,
"public": false,
"autostart_timer": false,
"autostop_timer": false,
"service_id": "hvsufvk2anyadehahfqiacy4wbrjt2atpnagk4itlkh4mdfsg6vhd5ad"
},
"share": {
"autostop_sharing": true,
"filenames": [
"/home/user/git/onionshare/desktop/org.onionshare.OnionShare.svg"
],
"log_filenames": false
},
"receive": {
"data_dir": "/home/user/OnionShare",
"webhook_url": null,
"disable_text": false,
"disable_files": false
},
"website": {
"disable_csp": false,
"custom_csp": null,
"log_filenames": false,
"filenames": []
},
"chat": {}
}
Below are the configuration file parameters for a persistent onion and what they mean, for each section in the JSON
onion
^^^^^
==================== ========== ===========
Parameter Type Explanation
==================== ========== ===========
private_key ``string`` Base64-encoded private key of the onion service
client_auth_priv_key ``string`` The private key when using Client Authentication. Send this to the user.
client_auth_pub_key ``string`` The public key when using Client Authentication. Used on OnionShare's side.
==================== ========== ===========
persistent
^^^^^^^^^^
=================== =========== ===========
Parameter Type Explanation
=================== =========== ===========
mode ``string`` What mode this persistent onion uses. Options are "share", "receive", "website" or "chat".
enabled ``boolean`` Whether persistence is enabled for this onion. When the persistent option is unchecked in the desktop, this entire JSON file is deleted. Default: true
autostart_on_launch ``boolean`` Whether to automatically start this persistent onion when OnionShare starts and once Tor is connected. Default: false
=================== =========== ===========
general
^^^^^^^
=============== =========== ===========
Parameter Type Explanation
=============== =========== ===========
title ``string`` An optional custom title for displaying on the onion service. Default: null ("OnionShare" will be shown instead)
public ``boolean`` Whether the onion service can be accessed with or without a Private Key (Client Authentication). If true, no Private Key is required.
autostart_timer ``boolean`` Whether the onion service is configured to start at a specific time. The time can be set in the desktop app or specified in seconds with ``--auto-start-timer`` with the CLI tool.
autostop_timer ``boolean`` Whether the onion service is configured to stop at a specific time. The time can be set in the desktop app or specified in seconds with ``--auto-stop-timer`` with the CLI tool.
service_id ``string`` The 32-character onion service URL, without the scheme and without the '.onion' suffix.
=============== =========== ===========
The below are settings specific to the 'mode' specified in the ``persistent`` section above.
share
^^^^^
================ =========== ===========
Parameter Type Explanation
================ =========== ===========
autostop_sharing ``boolean`` Whether to automatically stop the share once files are downloaded the first time. Default: true
filenames ``list`` A list of files to share. Default: []
log_filenames ``boolean`` Whether to log URL requests to stdout when using the CLI tool. Default: false
================ =========== ===========
receive
^^^^^^^
============= =========== ===========
Parameter Type Explanation
============= =========== ===========
data_dir ``string`` The path where received files or text messages will be stored. Default: the 'OnionShare' folder of the user's home directory.
webhook_url ``string`` A webhook URL that OnionShare will POST to when it receives files or text messages. Default: null
disable_text ``boolean`` Whether to disable receiving text messages. Default: false
disable_files ``boolean`` Whether to disable receiving files. Default: false
============= =========== ===========
website
^^^^^^^
============= =========== ===========
Parameter Type Explanation
============= =========== ===========
disable_csp ``boolean`` If set to ``true``, OnionShare won't set its default Content Security Policy header for the website. Default: ``false``
custom_csp ``string`` A custom Content Security Policy header to send instead of the default.
log_filenames ``boolean`` Whether to log URL requests to stdout when using the CLI tool. Default: false
filenames ``list`` A list of files to share. Default: []
============= =========== ===========
chat
^^^^
There are currently no configurable settings for the Chat mode.