Opened 5 years ago

Closed 5 years ago

#13037 closed defect (implemented)

compile time option to not read config from sysconfdir

Reported by: weasel Owned by: rl1987
Priority: Medium Milestone: Tor: 0.2.6.x-final
Component: Core Tor/Tor Version: Tor: unspecified
Severity: Keywords: easy, 026-triaged-1, nickm-patch
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

AIUI, right now tor will read /etc/tor/torrc and /etc/tor/torrc-defaults (or /usr/local/etc/tor/...) when started as any user, if they exist and aren't overridden on the command line. (Other conditionals may apply.)

I'd like a compile time option that would stop tor reading any global configuration/defaults files. If no ~/.torrc exists and no configuration file is passed on the command line it should instead just use its built-in defaults.

That way, users running tor under their own user won't get interfered with /etc/tor/torrc settings. The init script can continue to pass /etc/tor/torrc to the tor binary on the command line.

Cheers,

Child Tickets

Change History (9)

comment:1 Changed 5 years ago by nickm

Keywords: eas added

comment:2 Changed 5 years ago by nickm

Keywords: easy added; eas removed

comment:3 Changed 5 years ago by nickm

Keywords: 026-triaged-1 added

comment:4 Changed 5 years ago by rl1987

Owner: set to rl1987
Status: newaccepted

comment:5 Changed 5 years ago by nickm

Status: acceptedneeds_review

Implemented in "ticket13037", please review?

comment:6 Changed 5 years ago by nickm

Keywords: nickm-patch added

Add the nickm-patch keyword to a bunch of needs_review tickets.

comment:7 Changed 5 years ago by weasel

Looking at your ticket13037 branch,

  • it seems good in general. I tested it and I think it did what I wanted and expected.
  • it has unrelated 9396005428c40cf7ef9f1e6ae1d725f3155391f5 (Remove a check for an ancient bad dirserver fingerprint) without a changelog entry.
  • src/or/config.c:6446 write_configuration_file(): that tor_assert(fname) is now useless.
  • src/or/contro.c:1440: getinfo_helper_misc(): Don't like double calling of far away function. proposal:
    --- a/src/or/control.c
    +++ b/src/or/control.c
    @@ -1439,11 +1439,13 @@ getinfo_helper_misc(control_connection_t *conn, const char *question,
       if (!strcmp(question, "version")) {
         *answer = tor_strdup(get_version());
       } else if (!strcmp(question, "config-file")) {
    -    if (get_torrc_fname(0))
    -      *answer = tor_strdup(get_torrc_fname(0));
    +    const char* a;
    +    if ((a = get_torrc_fname(0)))
    +      *answer = tor_strdup(a);
       } else if (!strcmp(question, "config-defaults-file")) {
    -    if (get_torrc_fname(1))
    -      *answer = tor_strdup(get_torrc_fname(1));
    +    const char* a;
    +    if ((a = get_torrc_fname(1)))
    +      *answer = tor_strdup(a);
       } else if (!strcmp(question, "config-text")) {
         *answer = options_dump(get_options(), OPTIONS_DUMP_MINIMAL);
       } else if (!strcmp(question, "info/names")) {
    

comment:8 Changed 5 years ago by nickm

Tweaked per your requests. Better now?

comment:9 Changed 5 years ago by nickm

Resolution: implemented
Status: needs_reviewclosed

Assuming so, and merging. There were some tricky conflicts, so you might want to test this again when you have a chance. :)

Note: See TracTickets for help on using tickets.