Have a "defaults" torrc file and a regular one
(Since I'm hoping to implement this, let's make a ticket. Hoping it's not a duplicate.)
Tor could support up to two torrc files: one installer-provided "defaults" file, and one user "torrc" file. Additionally, the user could provide arguments from the command line as they can today. These three places to put options would constitute three "zones" or "configuration sources" or something: "defaults", "torrc", and "cmdline".
The behavior for reading them would be as follows:
- Any option set in cmdline would override torrc and defaults; any option set in torrc would override defaults.
- This goes for linelist options too. For example, if the defaults exit policy was "ExitPolicy reject :" and the torrc had "ExitPolicy accept *:80\nExitPolicy reject :", then the torrc's ExitPolicy would replace the defaults exit policy. Or if the torrc had "SocksPort auto" and the command line had "SocksPort 9050", then there would be exactly one socksport, as specified by the command line. This would be new behavior.
- The behavior on saveconf would be to compute every option that differed from what its value had been after reading "defaults", and store that option's new value to "torrc".
- HUP and equivalents would reload all options.
A) should SAVECONF store stuff that was on the command-line? B) Where do we look for the defaults file?
What would be most useful at this point would be to confirm whether this approach would work for vidalia, TBB, arm, others.