From 9de1d14c1c14d79d8d3cfa79ac60ff813e90c8e8 Mon Sep 17 00:00:00 2001 From: trinity-1686a Date: Sat, 29 Jul 2023 22:37:18 +0200 Subject: add config ReevaluateExitPolicy --- doc/man/tor.1.txt | 10 ++++++++++ src/app/config/config.c | 1 + src/app/config/or_options_st.h | 2 ++ src/config/torrc.sample.in | 4 ++++ src/core/or/connection_edge.c | 4 ++-- 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/doc/man/tor.1.txt b/doc/man/tor.1.txt index 1589809b1a..248c0b7896 100644 --- a/doc/man/tor.1.txt +++ b/doc/man/tor.1.txt @@ -2385,6 +2385,16 @@ is non-zero): policy options are set, Tor behaves as if ExitRelay were set to 0. (Default: auto) +[[ReevaluateExitPolicy]] **ReevaluateExitPolicy** **0**|**1**:: + If set, reevaluate the exit policy on existing connections when reloading + configuration. + + + + When the exit policy of an exit node change while reloading configuration, + connections made prior to this change could violate the new policy. By + setting this to 1, Tor will check if such connections exist, and mark them + for termination. + (Default: 0) + [[ExtendAllowPrivateAddresses]] **ExtendAllowPrivateAddresses** **0**|**1**:: When this option is enabled, Tor will connect to relays on localhost, RFC1918 addresses, and so on. In particular, Tor will make direct OR diff --git a/src/app/config/config.c b/src/app/config/config.c index 60565d15c4..ae7f6203ce 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -637,6 +637,7 @@ static const config_var_t option_vars_[] = { V(RephistTrackTime, INTERVAL, "24 hours"), V_IMMUTABLE(RunAsDaemon, BOOL, "0"), V(ReducedExitPolicy, BOOL, "0"), + V(ReevaluateExitPolicy, BOOL, "0"), OBSOLETE("RunTesting"), // currently unused V_IMMUTABLE(Sandbox, BOOL, "0"), V(SafeLogging, STRING, "1"), diff --git a/src/app/config/or_options_st.h b/src/app/config/or_options_st.h index 36b00662b5..624dc61bc5 100644 --- a/src/app/config/or_options_st.h +++ b/src/app/config/or_options_st.h @@ -141,6 +141,8 @@ struct or_options_t { * Includes OutboundBindAddresses and * configured ports. */ int ReducedExitPolicy; /**ReevaluateExitPolicy == 1) {*/ - if (false) { + if (get_options()->ReevaluateExitPolicy == 0) { return; } @@ -4262,6 +4261,7 @@ connection_reapply_exit_policy(config_line_t *changes) "ExitRelay", "ExitPolicy", "ReducedExitPolicy", + "ReevaluateExitPolicy", "IPv6Exit", NULL }; -- cgit v1.2.3-54-g00ecf