Re: [tor-dev] Default parsing order of config files in Debain tor package

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Hi Daniel! Thank you so much for your immediate, detailed and informative answer. I really like the example you offered as it clearly illustrates the parsing order. Your answer is very helpful for me to decide where I should place the %include line and Tor config files. I really appreciate your help. Best, iry Daniel:
The precedence for tor options is the following (1 overrides 2, etc...):
1. Command line options. 2. Configuration file options (your /etc/torrc). 3. Defaults file options (your /usr/share/tor/tor-service-defaults-torrc).
In the same file, options that appear later override earlier options.
Currently, there is no torrc.d directory created when you install the tor package. However, you can use a %include in the configuration file or in the defaults file. When you insert a %include in a file, it works as if all the options for the included file or folder were written on the line of the %include. If you're including a folder, the files will be processed in lexicographic order and files starting with a dot will be ignored.
Here is an example:
tor-service-defaults-torrc: SomeOption 0 %include /etc/tor/torrc.d/ # SomeOption is now 2 SomeOption 3 # SomeOption is now 3
/etc/tor/torrc.d/01_one: SomeOption 1
/etc/tor/torrc.d/02_two: SomeOption 2
With this configuration, the value for some option is 3. But we can have a torrc with %include too:
/etc/torrc: SomeOption 4 # SomeOption is now 4 %include /etc/tor/foo.torrc # SomeOption is now 5 SomeOption 6 # SomeOption is now 6
/etc/tor/foo.torrc: SomeOption 5
With both these files, the value for SomeOption is 6.
There are also different types of options and some can take multiple values. For more information see the section "Mid-level semantics" on this file: https://gitweb.torproject.org/tor.git/tree/doc/torrc_format.txt
Best regards, Daniel -----BEGIN PGP SIGNATURE-----
iQIcBAEBCgAGBQJZWZ1gAAoJEKFLTbxtzdU84gAQAKVu8UcbYHXIaZ+sUkiENUeW lSBnvOHeRcIBAOe1LfClgkAFiVWhHwfG2ll7cGDTiMxn7IuDlv+sUFtwpqRVFgYH kOxJiVS1kORQJ8t8DuXh3rQZTUTKOkhCCepb8maHeCSED0yUGSXs+wzpFMAyKJk+ 2B73YR/hQd2XgpZx9LcpfkdznTXF/jpOPZthZWFAkwm1yNAlvwAmfXgADV4lQy5K RRCwYmAgdSS9OLrDMj0G1lVnvsr7qUgfePzLpp1FBkMf/E8nhL6NBCK+jJc+BA+R 3YKn5pKtJ5/KaAwutQ5nlI3+mdVoDnJI0wWGHxL6ZJPwfCMANqkrbRa8/Wq0i7ZB u1sG9aWJzTXPaI/OZQ8VE5bvh9mLSfwo0RpzYv8CVsFgu2VnMPk5EW13d33+Dzjz 5GVcA0s0V1AA7uZ/NGUrcUZ/jO+z5Argre7RxkCnAgjItKb2vJK5hGnj7gVQO0il bcx+e47MyLVNoi7tOaoJmOusEEMQB1wMG6S1Pc+o/apqW6p2VEUKrTh+DSp72+LX zDPOxAleJjbntXZkGrDO0nay21y1LWYL2bOHpWomjd03f9v6br/n9oofNX6pN7Xn B9FIOa0PxzCT2BwcROnEDEB9mCHDbIRSEvuwpbbdz3StRW3pLzU1Q2e6WO+eF7dH OpDeWlO5/Z6IJKV4eesz =9riT -----END PGP SIGNATURE-----
participants (1)
-
iry