Commit Graph

26716 Commits

Author SHA1 Message Date
Nick Mathewson
98e14720b5 Merge remote-tracking branch 'tor-github/pr/1661/head' into maint-0.3.5 2020-10-07 08:14:46 -04:00
Nick Mathewson
9587512578 Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:10:08 -04:00
Nick Mathewson
968b6c30c1 Merge remote-tracking branch 'tor-gitlab/mr/43' into maint-0.3.5 2020-10-07 08:09:59 -04:00
Nick Mathewson
8505dd5e37 Merge branch 'maint-0.4.3' into maint-0.4.4 2020-10-07 08:08:02 -04:00
Nick Mathewson
9029444482 Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:08:01 -04:00
Nick Mathewson
e0e0ef713e Merge remote-tracking branch 'tor-gitlab/mr/137' into maint-0.3.5 2020-10-07 08:07:53 -04:00
Nick Mathewson
8a561fc5bf Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:05:40 -04:00
Nick Mathewson
84a5bd48e2 Merge remote-tracking branch 'tor-gitlab/mr/103' into maint-0.3.5 2020-10-07 08:05:31 -04:00
Nick Mathewson
b5a88e8d47 Merge branch 'maint-0.3.5' into maint-0.4.3 2020-10-07 08:01:37 -04:00
Nick Mathewson
ed6a328297 Merge branch 'mr_124_squashed' into maint-0.3.5 2020-10-07 08:00:59 -04:00
Nick Mathewson
c5ba8b6221 Parallelize src/test/test into chunks.
First, we introduce a flag to teach src/test/test to split its work
into chunks.  Then we replace our invocation of src/test/test in our
"make check" target with a set of 8 scripts that invoke the first
8th of the tests, the second 8th, and so on.

This change makes our "make -kj4 check" target in our hardened
gitlab build more than twice as fast, since src/test/test was taking
the longest to finish.

Closes 40098.
2020-10-07 08:00:49 -04:00
George Kadianakis
438aba6c0b Merge branch 'maint-0.4.4' into master 2020-10-07 13:42:57 +03:00
George Kadianakis
a914ac5d7c Merge remote-tracking branch 'tor-gitlab/mr/154' into maint-0.4.4 2020-10-07 13:32:17 +03:00
George Kadianakis
84e825598a Merge branch 'maint-0.4.4' into master 2020-10-07 13:29:16 +03:00
George Kadianakis
149b7a2418 Merge remote-tracking branch 'tor-gitlab/mr/163' into maint-0.4.4 2020-10-07 13:29:00 +03:00
Alexander Færøy
5f61e19d8a Expose TOR_PT_OUTBOUND_BIND_ADDRESS_{V4,V6} to Pluggable Transports.
This patch adds support for exposing the environment variables
`TOR_PT_OUTBOUND_BIND_ADDRESS_V4` and `TOR_PT_OUTBOUND_BIND_ADDRESS_V6` to
Pluggable Transport proccesses. These two values will contain the IPv4
and IPv6 address that the user have specified in torrc that they wish
the PT to use for all outgoing IP packets.

It is important to note here that it is up to the indvidual Pluggable
Transport if they are willing to honor these values or ignore them
completely.

One can test this feature using the following dummy PT written in POSIX
shell script:

    #!/bin/sh

    echo "LOG SEVERITY=warning MESSAGE=\"Value for IPv4: ${TOR_PT_OUTBOUND_BIND_ADDRESS_V4}\""
    echo "LOG SEVERITY=warning MESSAGE=\"Value for IPv6: ${TOR_PT_OUTBOUND_BIND_ADDRESS_V6}\""

    while true ; do
        sleep 1
    done

with the following entries in your torrc:

    OutboundBindAddressPT 203.0.113.4
    OutboundBindAddress 203.0.113.5
    OutboundBindAddressPT 2001:db8::4
    OutboundBindAddress 2001:db8::5

See: https://bugs.torproject.org/5304
2020-10-06 09:30:11 -04:00
Alexander Færøy
69c1a4ebc3 Move parse logic for outbound addresses to before we handle PT's.
This patch moves the logic for handling outbound addresses in torrc to
before we handle pluggable transports. Since we need access to the
values in OutboundBindAddress and friends for #5304 we have to parse
these values before we spawn any PT's.

This commit is code movement only.

See: https://bugs.torproject.org/5304
2020-10-06 09:30:10 -04:00
Alexander Færøy
ad08743299 Rename OUTBOUND_ADDR_EXIT_AND_OR to OUTBOUND_ADDR_ANY.
This patch renames the enumeration value in `outbound_addr_t` from
`OUTBOUND_ADDR_EXIT_AND_OR` to `OUTBOUND_ADDR_ANY` since with the
arrival of `OUTBOUND_ADDR_PT` it no longer makes sense to call the
fallback value for "Exit and OR". Instead we rename it to "any".

See: https://bugs.torproject.org/5304
2020-10-06 09:30:10 -04:00
Alexander Færøy
db0aaf428e Add OutboundBindAddressPT to torrc.
This patch adds a new option to torrc: `OutboundBindAddressPT`. This
option works in the same way as `OutboundBindAddressOR` and
`OutboundBindAddressExit` in that it allows the user to specify which
outbound IP address the user wants the PT to make its connections from.

There is one difference though in that OutboundBindAddressPT will only
be a suggestion for the PT to use since Tor cannot enforce whether or
not the PT actually uses this option for anything.

See: https://bugs.torproject.org/5304
2020-10-06 09:30:10 -04:00
Alexander Færøy
25bffccd71 Document enumeration values for outbound_addr_t.
This patch adds doxygen documentation strings for each of the values in
`outbound_addr_t`.

See: https://bugs.torproject.org/5304
2020-10-06 09:30:10 -04:00
Daniel Pinto
304ae473ca Fix %include bug with pattern with */ on glibc < 2.19 #40141
Fix bug where %including a pattern ending in */ would include
files and folders (instead of folders only) in versions of
glibc < 2.19.
2020-10-03 04:10:52 +01:00
Roger Dingledine
4f114f59e6 fix typos
no actual changes
2020-10-01 19:32:32 -04:00
Nick Mathewson
f5ddc45647 Merge branch 'bug40133_035' into bug40133_043 2020-09-28 10:37:14 -04:00
Nick Mathewson
79d7773968 Merge branch 'maint-0.3.5' into bug40133_035 2020-09-28 10:35:12 -04:00
Nick Mathewson
e68770719e Add missing documentation for get_net_param_from_list 2020-09-28 08:41:47 -04:00
Nick Mathewson
228ac47c2c Fix memory leak in vote generation 2020-09-23 15:41:27 -04:00
Nick Mathewson
2b39543dfc Move a DIGESTMAP_FOREACH_END (cosmetic) 2020-09-23 15:19:25 -04:00
Nick Mathewson
458897e3c5 Remove parseconf test with AndroidIdentityTag. 2020-09-23 14:40:38 -04:00
Nick Mathewson
5c9b4a0060 Remove support for old android "logcat" API
This is apparently obsolete; syslog is modern instead.  If users
have an android log configured, given them a syslog if we can.

Closes #32181.
2020-09-23 12:33:58 -04:00
Nick Mathewson
d07f17f676 IPv6 sybil: consider addresses in the same /64 to be equal. 2020-09-23 12:06:38 -04:00
Nick Mathewson
1be9e84b9c Refactor address comparison in get_sybil_list_by_ip_version 2020-09-23 12:04:09 -04:00
Nick Mathewson
2dba667928 get_all_possible_sybil: small indentation and comment cleanups 2020-09-23 11:53:28 -04:00
Nick Mathewson
e0f6047ea0 Remove needless sort operation. 2020-09-23 11:50:57 -04:00
Nick Mathewson
3196de33a5 Tidy up compare_routerinfo_by_ipv{4,6} to match better. 2020-09-23 11:48:20 -04:00
Nick Mathewson
81c05e1e98 Style and correctness issues in test_dirvote.
Style:
  - We end our types with _t.
  - Use 'static' to declare functions that only exist in a single
    module.

Correctness:
  - Many tt_...() macros can invoke "goto done;" -- we need to make
    sure that all the variables that could get freed are initialized
    before any "goto done" is hit, or else we might free an
    uninitialized variable.
2020-09-23 11:32:28 -04:00
Nick Mathewson
939d12be58 Fix memory leaks. 2020-09-23 11:32:22 -04:00
vnepveu
43672f9fca Implement IPv6 sybil protection.
[This is a squashed patch for ticket 7193, based on taking a "git
   diff" for the original branch, then applying it with "git apply
   -3".  I earlier attempted to squash the branch with "git rebase",
   but there were too many conflicts. --nickm]
2020-09-23 11:30:15 -04:00
David Goulet
beffad8529 Merge branch 'maint-0.3.5' into maint-0.4.3 2020-09-22 13:47:08 -04:00
David Goulet
b6429430c6 Merge branch 'maint-0.4.3' into maint-0.4.4 2020-09-22 13:47:08 -04:00
David Goulet
3f8201f229 Merge branch 'maint-0.4.4' 2020-09-22 13:47:08 -04:00
David Goulet
4dbbc000b5 Merge branch 'tor-gitlab/mr/145' 2020-09-22 13:39:55 -04:00
David Goulet
faf89ec6c2 srv: Remove spammy debug log
Fixes #40135

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-09-22 11:06:34 -04:00
Nick Mathewson
88d99fc1bd Fix warnings when using two unusual options together.
The option `--enable-all-bugs-are-fatal` when used with
`--disable-module-relay` caused GCC to warn about functions that
it thought should be labeled noreturn.

I've tried a couple of approaches, but disabling the warning on
these functions seems to be the best approach.

Fixed #40129; bugfix on 0.4.4.1-alpha.
2020-09-22 10:07:14 -04:00
Nick Mathewson
6bf964a3e5 Renerate src/test/fuzz/include.am 2020-09-18 16:08:41 -04:00
Nick Mathewson
e9dbb5e395 Build one big .a library full of Tor's implementation.
This is experimental and probably will break some platforms
2020-09-18 16:08:24 -04:00
Alexander Færøy
485990641b Merge remote-tracking branch 'tor-gitlab/mr/137' 2020-09-18 14:51:54 +00:00
Nick Mathewson
781ab9eea4 Add flag for whether an OR conn "counts" for bootstrap tracking
We set this flag if we've launched the connection in order to
satisfy an origin circuit, or when we decide the connection _would_
satisfy an origin circuit.  These are the only or_connections we
want to consider for bootstrapping: other or_connections are opened
because of client EXTEND requests, and they may succeed or fail
because of the clients' confusion or misconfiguration.

Closes #25061.
2020-09-18 10:03:57 -04:00
David Goulet
2ddbfc64af Merge branch 'maint-0.3.5' into maint-0.4.3 2020-09-18 09:45:25 -04:00
David Goulet
2e3603d96d Merge branch 'maint-0.4.3' into maint-0.4.4 2020-09-18 09:45:25 -04:00
David Goulet
e8a4482335 Merge branch 'maint-0.4.4' 2020-09-18 09:45:25 -04:00
Nick Mathewson
7945e075a4 Fix underflow in rend_cache/free_all test.
We already fixed these in #40099 and #40125.

This patch fixes #40126.  Bugfix on 0.2.8.1-alpha.
2020-09-17 14:04:54 -04:00
Nick Mathewson
404c224c71 Merge branch 'maint-0.4.4' 2020-09-17 13:56:40 -04:00
Nick Mathewson
078194ecaf Merge branch 'maint-0.3.5' into maint-0.4.3 2020-09-17 13:56:40 -04:00
Nick Mathewson
54cd2578ef Merge branch 'maint-0.4.3' into maint-0.4.4 2020-09-17 13:56:40 -04:00
David Goulet
47f1d19f8e test: Increment rend cache allocation before freeing
The rend_cache/entry_free was missing the rend cache allocation increment
before freeing the object.

Without it, it had an underflow bug:

  Sep 17 08:40:13.845 [warn] rend_cache_decrement_allocation(): Bug: Underflow
  in rend_cache_decrement_allocation (on Tor 0.4.5.0-alpha-dev
  7eef9ced61)

Fixes #40125

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-09-17 13:00:23 -04:00
David Goulet
a47d12c64d Merge branch 'tor-gitlab/mr/129' 2020-09-17 09:17:53 -04:00
Nick Mathewson
4e8cb410a7 Resolve some coverity complaints in test_util_glob().
Coverity's first complaint was that we didn't check the return
values from chmod.  That's easily fixed.

Coverity's second complaint was that there were code paths where we pass
NULL to chmod.  For example, if this line failed, we'd "goto done",
and then pass NULL to chmod.
  tt_ptr_op(dirname, OP_NE, NULL);

Closes #40103.  Bug not in any released Tor.
2020-09-17 09:17:49 -04:00
Nick Mathewson
5d1d7afcd3 Use the correct SIGNED_KEY_TYPE value for signing->link certs
Our code was using [01] as for the key type of signed->link certs,
which was incorrect.  The value should be [03], to indicate that the
value as the SHA256 of an x.509 cert.

Fortunately, nothing cares about this value, so there shouldn't be
compatibility issues.

Fixes bug 40124; bugfix on 0.2.7.2-alpha.
2020-09-17 08:42:25 -04:00
David Goulet
7eef9ced61 Merge branch 'tor-gitlab/mr/131' 2020-09-17 08:33:10 -04:00
Nick Mathewson
22643272d2 Fix wide lines 2020-09-17 08:19:53 -04:00
Nick Mathewson
c92e19268b Rename tor_cert_create to tor_cert_create_ed25519
This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        tor_cert_create tor_cert_create_ed25519

It was generated with --no-verify, so it probably breaks some commit hooks.
The commiter should be sure to fix them up in a subsequent commit.
2020-09-17 08:17:36 -04:00
Nick Mathewson
bf5bf33661 Bump version to 0.4.4.5-dev. 2020-09-15 08:52:37 -04:00
Nick Mathewson
f6b8894726 Bump version to 0.4.4.5 2020-09-14 13:17:37 -04:00
Nick Mathewson
020e8e41c6 Resolve a compilation warning in test_connection.c
Instead of casting an enum to a void and back, use a string --
that's better C anyway.

Fixes bug 40113; bugfix on 0.2.9.3-alpha.
2020-09-14 11:50:38 -04:00
Nick Mathewson
33380f6b27 Update remaining trac.tpo wiki urls 2020-09-14 11:02:38 -04:00
Alexander Færøy
1c4b140427 Check if glob() is available at build-time.
This patch disables the glob() support in the path library if glob() is
unavailable at build-time. This currently happens with the Android NDK
used for Tor Browser.

See: https://bugs.torproject.org/tpo/core/tor/40114
2020-09-10 10:51:57 -04:00
David Goulet
12c7583126 Merge branch 'maint-0.4.4' 2020-09-08 11:14:12 -04:00
George Kadianakis
85a1e6c601 statistics: Properly count all rendezvous cells (avoid undercounting).
tl;dr We were not counting cells flying from the client to the service, but we
were counting cells flying from the service to the client.

When a rendezvous cell arrives from the client to the RP, the RP forwards it to
the service.

For this to happen, the cell first passes through command_process_relay_cell()
which normally does the statistics counting. However because the `rend_circ`
circuit was not flagged with `circuit_carries_hs_traffic_stats` in
rend_mid_rendezvous(), the cell is not counted there.

Then the cell goes to circuit_receive_relay_cell() which has a special code
block based on `rend_splice` specifically for rendezvous cells, and the cell
gets directly passed to `rend_circ` via a direct call to
circuit_receive_relay_cell(). The cell never passes through
command_process_relay_cell() ever again and hence is never counted by our
rephist module.

The fix here is to flag the `rend_circ` circuit with
`circuit_carries_hs_traffic_stats` so that the cell is counted as soon as it
hits command_process_relay_cell().

Furthermore we avoid double-counting cells since the special code block of
circuit_receive_relay_cell() makes us count rendezvous cells only as they enter
the RP and not as they exit it.

Fixes #40117.
2020-09-07 13:30:21 +03:00
David Goulet
ae6430818e addr: Missing AF family to index conversion
When accessing the last_resolved_address cache we always need to convert the
AF family value to an index value else we are out of bound and thus
overflowing if we write to it.

This fix is on code that has not been released.

GeKo reported the following libasan crash using Tor Browser alpha with tor
0.4.5.0-alpha-dev (3c884bc9e0):

==4240==ERROR: AddressSanitizer: global-buffer-overflow on address
0x55888490e388 at pc 0x5588842cc216 bp 0x7ffc8c421b00 sp 0x7ffc8c421af8
READ of size 2 at 0x55888490e388 thread T0
    #0 0x5588842cc215 in tor_addr_compare_masked
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x5a6215)
    #1 0x558884203210 in is_local_to_resolve_addr
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x4dd210)
    #2 0x558883f7e252 in channel_tls_connect
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x258252)
    #3 0x558883f87ff7 in channel_connect_for_circuit
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x261ff7)
    #4 0x558883f8bc90 in circuit_handle_first_hop
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x265c90)
    #5 0x558883f8c891 in circuit_establish_circuit
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x266891)
    #6 0x558883fc3bbc in circuit_launch_by_extend_info
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x29dbbc)
    #7 0x558883fc5900
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x29f900)
    #8 0x558883fc6988 in connection_ap_handshake_attach_circuit
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x2a0988)
    #9 0x558883fd0d3f in connection_ap_attach_pending
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x2aad3f)
    #10 0x7f4d50110885  (TorBrowser/Tor/libevent-2.1.so.7+0x22885)
    #11 0x7f4d501110de in event_base_loop
(TorBrowser/Tor/libevent-2.1.so.7+0x230de)
    #12 0x558883f69b3c in do_main_loop
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x243b3c)
    #13 0x558883f3f70c in tor_run_main
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x21970c)
    #14 0x558883f3c2f7 in tor_main
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x2162f7)
    #15 0x558883f3531b in main
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x20f31b)
    #16 0x7f4d4f76acc9 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x26cc9)
    #17 0x558883f3ba00
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x215a00)

0x55888490e388 is located 24 bytes to the left of global variable
'state_mgr' defined in 'src/app/config/statefile.c:184:22'
(0x55888490e3a0) of size 8
0x55888490e388 is located 32 bytes to the right of global variable
'global_state' defined in 'src/app/config/statefile.c:204:20'
(0x55888490e360) of size 8
SUMMARY: AddressSanitizer: global-buffer-overflow
(/home/thomas/Arbeit/Tor/tor-browser-build/tor-browser_en-US/Browser/TorBrowser/Tor/tor+0x5a6215)
in tor_addr_compare_masked
Shadow bytes around the buggy address:
  0x0ab190919c20: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9
  0x0ab190919c30: 04 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 03 f9 f9 f9
  0x0ab190919c40: f9 f9 f9 f9 03 f9 f9 f9 f9 f9 f9 f9 00 00 00 00
  0x0ab190919c50: 00 00 00 04 f9 f9 f9 f9 00 00 00 00 00 00 00 04
  0x0ab190919c60: f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9
=>0x0ab190919c70: f9[f9]f9 f9 00 f9 f9 f9 f9 f9 f9 f9 00 00 00 00
  0x0ab190919c80: 04 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9
  0x0ab190919c90: 04 f9 f9 f9 f9 f9 f9 f9 04 f9 f9 f9 f9 f9 f9 f9
  0x0ab190919ca0: 00 00 00 00 00 f9 f9 f9 f9 f9 f9 f9 00 00 00 00
  0x0ab190919cb0: 01 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9
  0x0ab190919cc0: 00 f9 f9 f9 f9 f9 f9 f9 00 f9 f9 f9 f9 f9 f9 f9
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==4240==ABORTING

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-09-03 16:07:19 +00:00
David Goulet
ea339227c2 conn: Remove assert on new listener connection when retrying
Opening a new listener connection can fail in many ways like a bind()
permission denied on a low port for instance.

And thus, we should expect to handle an error when creating a new one instead
of assert() on it.

To hit the removed assert:

  ORPort 80
  KeepBindCapabilities 0

Start tor. Then edit torrc:

  ORPort <some-IP>:80

HUP tor and the assert is hit.

Fixes #40073

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-09-01 10:01:21 -04:00
Alexander Færøy
511730db2d Merge remote-tracking branch 'tor-gitlab/mr/133' 2020-08-26 21:55:39 +00:00
David Goulet
a6a97236fc Merge branch 'tor-gitlab/mr/135' 2020-08-26 11:04:53 -04:00
George Kadianakis
d4f3cfe99a Merge branch 'mr/113' 2020-08-25 20:37:04 +03:00
Neel Chauhan
90707c9264 Even argument spacing for some functions in feature/client/bridges.c 2020-08-25 09:16:58 -04:00
Nick Mathewson
75772ea096 Validate address more carefully when checking self-reachability
Previously, we would treat *any* incoming circuit on a non-local
channel as meaning that our ORPort was reachable.  With this patch,
we make sure that the address that the peer _says_ we have is the
same as the one we're trying to advertise right now.

Closes 20165. Bugfix on 4f5192b280 in 0.1.0.1-rc, when
reachability self-tests were first introduced.
2020-08-25 16:02:59 +03:00
George Kadianakis
cc4e42ee32 Merge remote-tracking branch 'tor-gitlab/mr/115' 2020-08-25 15:43:00 +03:00
David Goulet
6dc0b04319 Merge branch 'maint-0.4.4' 2020-08-25 08:23:06 -04:00
George Kadianakis
53cd1c9710 Avoid guard-related warning when upgrading from 043 to 044.
Fixes #40105.
2020-08-25 15:09:57 +03:00
George Kadianakis
4b9ed14d9b Merge remote-tracking branch 'tor-gitlab/mr/108' 2020-08-25 15:02:04 +03:00
George Kadianakis
935160ce86 Merge branch 'maint-0.4.4' 2020-08-25 14:51:23 +03:00
George Kadianakis
1397a86bbd Merge remote-tracking branch 'tor-gitlab/mr/130' into maint-0.4.4 2020-08-25 14:51:05 +03:00
Neel Chauhan
b16d82043c Include crypto_rand.h in ed25519_tor.c 2020-08-23 06:05:08 -07:00
George Kadianakis
36203e8894 Merge branch 'maint-0.4.4' 2020-08-20 14:34:56 +03:00
Neel Chauhan
6e37086f85 v3 control: Persist ONION_CLIENT_AUTH_ADD client name 2020-08-20 14:34:21 +03:00
David Goulet
83052372a0 relay: Query our cache when deciding for dummy descriptor fetch
Instead of looking at the "Address" option alone, instead check if we have an
address in our cache (that is discovered by tor). If not, then it tells us
that tor does not have an address to work with so we can then ask a directory
authority for a suggestion.

Related #2178

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-08-19 10:25:47 -04:00
David Goulet
f5c9f6d432 hs: Don't overwrite DoS parameters on circuit with consensus params
Turns out that the HS DoS defenses parameters were overwritten by the
consensus parameters everytime a new consensus would arrive.

This means that a service operator can still enable the defenses but as soon
as the intro point relay would get a new consensus, they would be overwritten.
And at this commit, the network is entirely disabling DoS defenses.

Fix this by introducing an "explicit" flag that indicate if the
ESTABLISH_INTRO cell DoS extension set those parameters or not. If set, avoid
using the consenus at once.

We are not bumping the protover HSIntro value for this because 0.4.2.x series
is EOL in 1 month and thus 0.4.3.x would be the only series with this bug. We
are confident that a backport and then upgrade path to the latest 0.4.4.x
stable coming up soon is enough to mitigate this problem in the coming months.

It avoids the upgrade path on the service side by keeping the requirement for
protover HSIntro=5.

Fixes #40109

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-08-19 09:47:34 -04:00
George Kadianakis
4e3f55fba1 Merge branch 'maint-0.4.4' 2020-08-19 13:56:34 +03:00
George Kadianakis
b1b0079675 Merge branch 'mr/124' into maint-0.4.4 2020-08-19 13:55:07 +03:00
Nick Mathewson
974abdf632 Parallelize src/test/test into chunks.
First, we introduce a flag to teach src/test/test to split its work
into chunks.  Then we replace our invocation of src/test/test in our
"make check" target with a set of 8 scripts that invoke the first
8th of the tests, the second 8th, and so on.

This change makes our "make -kj4 check" target in our hardened
gitlab build more than twice as fast, since src/test/test was taking
the longest to finish.

Closes 40098.
2020-08-19 13:46:50 +03:00
David Goulet
1089ac6f22 Merge branch 'tor-gitlab/mr/126' 2020-08-18 08:56:27 -04:00
David Goulet
80d2376f33 Merge branch 'maint-0.4.4' 2020-08-18 08:49:07 -04:00
David Goulet
deea196370 Merge branch 'tor-gitlab/mr/121' into maint-0.4.4 2020-08-18 08:49:01 -04:00
Daniel Pinto
ebaa1a1d23 Make options_init_from_torrc smaller #40102
Split implementation of several command line options from
options_init_from_torrc into smaller isolated functions.
2020-08-14 16:01:02 +01:00
Nick Mathewson
563f8610fd Revise trac.torproject.org urls to refer to gitlab replacements.
Closes #40101.
2020-08-14 09:21:28 -04:00
Nick Mathewson
7915b651d9 Merge branch 'maint-0.4.2' into maint-0.4.3 2020-08-13 14:20:39 -04:00
Nick Mathewson
ef18fb56c9 Merge branch 'maint-0.4.3' into maint-0.4.4 2020-08-13 14:20:39 -04:00
Nick Mathewson
8669ace2fb Merge branch 'maint-0.4.4' 2020-08-13 14:20:39 -04:00
Nick Mathewson
45d9830493 Merge branch 'maint-0.3.5' into maint-0.4.2 2020-08-13 14:20:39 -04:00
Nick Mathewson
26b257757b Bump to 0.4.4.4-rc-dev 2020-08-13 09:43:54 -04:00
Nick Mathewson
7b4716a762 Make test_glob() pass even when run as root.
Previously the test relied on not being able to look inside 000
directories, which is a thing root _can_ do.

Bug not in any released Tor version.
2020-08-12 20:36:23 -04:00
Nick Mathewson
9ef991dbe3 Use correct type for gl_closedir to avoid a compiler warning 2020-08-12 14:42:30 -04:00
Nick Mathewson
e151442037 Merge remote-tracking branch 'tor-gitlab/mr/62' 2020-08-12 14:37:21 -04:00
Nick Mathewson
f9bb49d870 Fix allocation counting in clean_v2_descs_as_dir test.
Without this fix, running this test on its own would fail.

Fixes bug 40099. Bugfix on ade5005853 in 0.2.8.1-alpha.
2020-08-12 14:25:46 -04:00
Daniel Pinto
60c436d14d Attempt to fix test_include.py on TravisCI #25140 2020-08-12 14:35:51 +01:00
George Kadianakis
347f87ae9d Merge branch 'maint-0.4.4' 2020-08-12 13:47:59 +03:00
George Kadianakis
5a1918d7e7 Merge remote-tracking branch 'tor-gitlab/mr/107' into maint-0.4.4 2020-08-12 13:47:34 +03:00
George Kadianakis
c591a0d246 Merge branch 'maint-0.4.4' 2020-08-12 13:23:33 +03:00
George Kadianakis
8e9edb93be Merge remote-tracking branch 'tor-gitlab/mr/104' into maint-0.4.4 2020-08-12 13:23:08 +03:00
Nick Mathewson
4fdec27a12 Remove extraneous EVENT_CONTROLLER_WAIT
This turned into a new StreamStatus value.

Closes #40092. Bug not in any released Tor.
2020-08-11 18:41:15 -04:00
Nick Mathewson
1770d1c216 bump version to 0.4.4.4-rc 2020-08-11 17:46:44 -04:00
Nick Mathewson
a02002dc99 Lower the minimum value for MaxMemInQueues to 64 MB for relays.
For clients, there is no minimum value; in both cases, we warn if
the value seems too low.

Closes ticket 24308.
2020-08-11 17:01:49 -04:00
Daniel Pinto
0b633b1f6d Improved documentation and comments #25140 2020-08-11 18:26:41 +01:00
Nick Mathewson
431dcc42e0 Rename argument to compute_real_max_mem_in_queues() 2020-08-11 12:59:07 -04:00
Nick Mathewson
d76f8457f3 Merge remote-tracking branch 'tor-gitlab/mr/119' into maint-0.4.4 2020-08-11 12:40:02 -04:00
Nick Mathewson
11961f0bc5 Merge remote-tracking branch 'tor-gitlab/mr/119' 2020-08-11 12:39:30 -04:00
George Kadianakis
b705cfa024 Merge remote-tracking branch 'tor-gitlab/mr/111' 2020-08-11 15:12:43 +03:00
George Kadianakis
f971a8fbad Merge branch 'mr/105' 2020-08-11 15:04:15 +03:00
Nick Mathewson
7df52b71bf Only log port self-testing message when we are _starting_ to test.
(Unlike approaches in earlier versions of Tor, this one logs if and
only if we are launching a test, and we haven't said that we're
testing this port.)

Fixes bug 40068; bug not in any released version.

Closes #40068.
2020-08-11 15:02:44 +03:00
George Kadianakis
b8003fbe99 Merge branch 'maint-0.4.4' 2020-08-11 14:54:26 +03:00
George Kadianakis
ab9c35f043 Merge remote-tracking branch 'tor-gitlab/mr/102' into maint-0.4.4 2020-08-11 14:53:03 +03:00
George Kadianakis
9316ca9f06 Remove a BUG() that could normally trigger in edge-cases. 2020-08-11 14:42:18 +03:00
Nick Mathewson
069946852a Merge branch 'maint-0.4.4' 2020-08-10 19:33:07 -04:00
Nick Mathewson
7d80bf80fe Merge branch 'maint-0.4.3' into maint-0.4.4 2020-08-10 19:33:07 -04:00
Nick Mathewson
f3fcc89d05 Merge branch 'maint-0.4.2' into maint-0.4.3 2020-08-10 19:33:06 -04:00
Nick Mathewson
68f8250cbb Merge branch 'maint-0.3.5' into maint-0.4.2 2020-08-10 19:32:49 -04:00
Nick Mathewson
e873c7e893 small code tweaks to try to work around debian stable complaints 2020-08-10 19:20:05 -04:00
Nick Mathewson
3eb9331133 Merge remote-tracking branch 'tor-gitlab/mr/110' 2020-08-10 14:51:12 -04:00
Nick Mathewson
24c721de37 Log number of inbound/outbound ipv4/6 conns as part of heartbeat
Closes #29113
2020-08-07 10:45:29 -04:00
Nick Mathewson
6fde1548f2 Revise test_status to use log testing helpers.
This change lets us make these tests much shorter and easier to
maintain.
2020-08-07 10:42:12 -04:00
Nick Mathewson
afb6ff1739 Validate ed25519 keys and canonicity from circuit_n_conn_done()
Fixes bug 40080. Bugfix on 0.2.7.2-alpha.
2020-08-06 15:59:28 -04:00
Nick Mathewson
b417594dbc Replace several C identifiers for ticket 18106.
We used to have a single boolean, "FascistFirewall".  Ages ago, in
tickets #17840 and #9067, we added an improved "ReachableAddresses"
mechanism.  It's time to rename related identifiers in the code for
consistency.  This closes #18106.

This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        fascist_firewall_allows_address reachable_addr_allows \
        fascist_firewall_use_ipv6 reachable_addr_use_ipv6 \
        fascist_firewall_prefer_ipv6_impl reachable_addr_prefer_ipv6_impl \
        fascist_firewall_prefer_ipv6_orport reachable_addr_prefer_ipv6_orport \
        fascist_firewall_prefer_ipv6_dirport reachable_addr_prefer_ipv6_dirport \
        fascist_firewall_allows_address_addr reachable_addr_allows_addr \
        fascist_firewall_allows_address_ap reachable_addr_allows_ap \
        fascist_firewall_allows_base reachable_addr_allows_base \
        fascist_firewall_allows_ri_impl reachable_addr_allows_ri_impl \
        fascist_firewall_allows_rs_impl reachable_addr_allows_rs_impl \
        fascist_firewall_allows_rs reachable_addr_allows_rs \
        fascist_firewall_allows_md_impl reachable_addr_allows_md_impl \
        fascist_firewall_allows_node reachable_addr_allows_node \
        fascist_firewall_allows_dir_server reachable_addr_allows_dir_server \
        fascist_firewall_choose_address_impl reachable_addr_choose_impl \
        fascist_firewall_choose_address reachable_addr_choose \
        fascist_firewall_choose_address_base reachable_addr_choose_base \
        fascist_firewall_choose_address_rs reachable_addr_choose_from_rs \
        fascist_firewall_choose_address_ls reachable_addr_choose_from_ls \
        fascist_firewall_choose_address_node reachable_addr_choose_from_node \
        fascist_firewall_choose_address_dir_server reachable_addr_choose_from_dir_server
2020-08-05 16:34:45 -04:00
George Kadianakis
afd88ee87f Merge remote-tracking branch 'tor-gitlab/mr/88' 2020-08-05 14:57:20 +03:00
Neel Chauhan
d1413e04f8 ipv6: Specialize GETINFO address interface for v4 and v6 2020-08-04 13:59:49 -07:00
Nick Mathewson
1d0695fe7e Improve ratelimit message to list true interval.
Previous message would say "N messages in the last T seconds", but
would give an inaccurate number for N.

We now give an accurate number, rounded up to the nearest 60 seconds.

Closes #19431.
2020-08-04 13:56:28 -04:00
Nick Mathewson
04926126ee Merge remote-tracking branch 'tor-gitlab/mr/100' 2020-08-04 13:28:51 -04:00
Nick Mathewson
08de260682 Merge branch 'bug40083_035' into bug40083_042
Fixes conflicts due to code movement.
2020-08-04 13:10:16 -04:00
Nick Mathewson
62361cc698 Launch early reachability tests once a minute, not once a second.
This fixes bug 40083, which was introduced in 9f31908a in
0.2.8.1-alpha.
2020-08-04 13:05:07 -04:00
Daniel Pinto
ccdd0d801a Minor style improvements. #30045 2020-08-03 20:08:17 +01:00
Nick Mathewson
aef9c0f580 Merge branch 'ticket40081_035' into ticket40081_044
Resolves conflicts:
	src/core/or/channel.c
        src/test/test_channel.c
2020-08-03 11:49:09 -04:00
Nick Mathewson
435f31aed3 Remove channel_is_canonical_is_reliable()
This function once served to let circuits continue to be built over
version-1 link connections.  But such connections are long-obsolete,
and it's time to remove this check.

Closes #40081.
2020-08-03 11:25:37 -04:00
Nick Mathewson
ea876ab00e Wipe address strings from connections before freeing them them.
This is a defense-in-depth fix; closes 6198.
2020-08-03 10:15:08 -04:00
Nick Mathewson
5b9508c9a5 Add a tor_str_wipe_and_free() function.
Frequently we want to do

    if (s) {
      memwipe(s, 0, sizeof(s));
      tor_free(s);
    }

and it's good to have a way to do this concisely.
2020-08-03 10:11:03 -04:00
George Kadianakis
e069b0af4b Merge branch 'maint-0.4.4' 2020-08-03 16:49:05 +03:00
George Kadianakis
18d2c7c5d7 Merge remote-tracking branch 'tor-gitlab/mr/79' into maint-0.4.4 2020-08-03 16:48:52 +03:00
Nick Mathewson
ce57404a42 Fix comment on protover_list_is_invalid 2020-08-03 08:57:21 -04:00
Nick Mathewson
efc969e862 Rename protover_contains_long_protocol_names to protover_list_is_invalid
This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        protover_contains_long_protocol_names protover_list_is_invalid
2020-08-03 08:55:17 -04:00
Nick Mathewson
d1fda62d11 Merge remote-tracking branch 'tor-gitlab/mr/94' 2020-08-03 08:54:03 -04:00
Nick Mathewson
3e3b0b0443 Merge remote-tracking branch 'tor-github/pr/1986/head' 2020-08-03 08:33:22 -04:00
Nick Mathewson
efe8a98817 Fix a leak-on-failure on test_get_bandwidth_lines()
Spotted by coverity. This is CID 1465571.
2020-08-01 09:29:08 -04:00
Daniel Pinto
1474ab3395 Add --format argument to --key-expiration option. #30045 2020-08-01 01:08:37 +01:00
Neel Chauhan
837e0c4dc9 Code simplifications for AP_CONN_STATE_CONTROLLER_WAIT 2020-07-31 09:21:43 -07:00
MrSquanchee
bb585c5e37
test_stats : Removed CONFIG_PRIVATE
Signed-off-by: Suraj Upadhyay <usuraj35@gmail.com>
2020-07-31 21:12:29 +05:30
MrSquanchee
a93c3d7a8d
Added tests for bandwidth functions
Added tests for
1. commit_max
2. advance_obs
3. add_obs
4. rep_hist_fill_bandwidth_history
5. rep_hist_get_bandwidth_lines

 (Lightly edited by nickm to use new names from bwhist refactoring.)

Signed-off-by: Suraj Upadhyay <usuraj35@gmail.com>
2020-07-31 21:12:16 +05:30
MrSquanchee
708f51637f
Added tests for bandwidth functions
Added tests for
1. commit_max
2. advance_obs
3. add_obs
4. rep_hist_fill_bandwidth_history
5. rep_hist_get_bandwidth_lines

Signed-off-by: Suraj Upadhyay <usuraj35@gmail.com>
2020-07-31 21:10:54 +05:30
Nick Mathewson
b5068e4826 Extract bw_array_t and related constants into a header.
This will be used for testing.

Partially reproduces work by MrSquanchee in #33812.
2020-07-31 10:46:52 -04:00
Alexander Færøy
e78a7450a2 Merge branch 'maint-0.4.2' into maint-0.4.3 2020-07-31 02:03:34 +00:00
Alexander Færøy
4e684c8695 Merge branch 'maint-0.3.5' into maint-0.4.2 2020-07-31 02:03:34 +00:00
Nick Mathewson
4c810a6abe Merge branch 'bug40076_044' 2020-07-30 14:35:06 -04:00
Nick Mathewson
b4400e2093 Merge branch 'bug40076_043' into bug40076_044 2020-07-30 14:28:11 -04:00
Nick Mathewson
69d7752937 Merge branch 'bug40076_042' into bug40076_043 2020-07-30 14:27:29 -04:00
Nick Mathewson
c2d5ec5e43 Merge branch 'maint-0.4.2' into bug40076_042 2020-07-30 14:27:29 -04:00
Nick Mathewson
c4742b89b2 Fix a bug in buf_move_all() when the input buffer is empty.
We found this in #40076, after we started using buf_move_all() in
more places.  Fixes bug #40076; bugfix on 0.3.3.1-alpha.  As far as
I know, the crash only affects master, but I think this warrants a
backport, "just in case".
2020-07-30 14:24:25 -04:00
Nick Mathewson
0a588821cb Add unit test for buf_move_all(), including a failing case
The failing case is #if'd out for now, but will be fixed in the next
commit.

Testing for a fix for #40076.
2020-07-30 14:19:32 -04:00
George Kadianakis
155e0dee49 Merge branch 'tor-gitlab/mr/84' 2020-07-30 19:49:25 +03:00
Nick Mathewson
219edc9ab1 Handle ORPort auto when logging about removed orports.
Closes #40075
2020-07-30 19:46:44 +03:00
George Kadianakis
2bb9acca73 Write unittest for #40065.
Make the unit test pass by including an explicit IPv6 port and an
implicit IPv4 port.  See comments for more details.
2020-07-30 19:46:39 +03:00
Nick Mathewson
fc5fe094b1 Fix segfault and logic error in remove_duplicate_orports()
This function tried to modify an array in place, but did it in a
pretty confusing and complicated way.  I've revised it to follow a
much more straightforward approach.

Fixes bug #40065.
2020-07-30 19:46:02 +03:00
Nick Mathewson
fcf4954cc8 Add a unit test for write_str_to_file_if_not_equal() 2020-07-30 10:46:15 -04:00
Nick Mathewson
f3e5b283ad test_util.c: Extract utime() function.
We need this to manipulate mtimes, but only in this file.
2020-07-30 10:46:15 -04:00
Neel Chauhan
67a62ccf51 Use write_str_if_not_equal() for onion services 2020-07-30 10:46:15 -04:00
Neel Chauhan
c212578bf0 Introduce write_str_if_not_equal() 2020-07-30 10:46:15 -04:00
Nick Mathewson
9164d7c75e Merge branch 'maint-0.4.4' 2020-07-29 12:37:08 -04:00
Nick Mathewson
3b8bf743ae Merge branch 'maint-0.4.2' into maint-0.4.3 2020-07-29 12:37:07 -04:00
Nick Mathewson
cdb0e6c252 Merge branch 'maint-0.3.5' into maint-0.4.2 2020-07-29 12:37:07 -04:00
Nick Mathewson
8c92d44622 Merge remote-tracking branch 'tor-gitlab/mr/68' into maint-0.4.4 2020-07-29 12:35:57 -04:00
Nick Mathewson
75f94ea1ec Merge remote-tracking branch 'tor-github/pr/1987/head' 2020-07-29 10:58:47 -04:00
Alexander Færøy
eba2870d18 Merge branch 'maint-0.4.4' 2020-07-29 13:58:14 +00:00
Alexander Færøy
8e690ce736 Merge remote-tracking branch 'tor-gitlab/mr/85' into maint-0.4.4 2020-07-29 13:57:47 +00:00
Alexander Færøy
109063185b Merge branch 'tor-gitlab/mr/73_squashed' 2020-07-29 13:34:24 +00:00
Nick Mathewson
3cb9a9b8ce Remove the connection_t.outbuf_flushlen field
This was once used for rate-limiting, but now it's only for
accounting.  It hasn't served a useful purpose in a long time.

Closes ticket 33097.
2020-07-29 13:33:35 +00:00
Daniel Pinto
eab8e7af52 Fix startup crash with seccomp sandbox enabled #40072
Fix crash introduced in #40020. On startup, tor calls
check_private_dir on the data and key directories. This function
uses open instead of opendir on the received directory. Data and
key directoryes are only opened here, so the seccomp rule added
should be for open instead of opendir, despite the fact that they
are directories.
2020-07-29 00:34:08 +01:00
Nick Mathewson
dcc60294ad Use _lseeki64() on windows.
Fixes bug 31036; bugfix on 0.2.1.8-alpha when we moved the logging
system to use posix fds.
2020-07-28 11:30:47 -04:00
Nick Mathewson
0a38e02fb3 bump to 0.4.4.3-alpha-dev 2020-07-27 19:15:15 -04:00
Nick Mathewson
98d84587a8 Fix documentation of cache_failure_intro_lookup
Closes ticket 17793
2020-07-27 14:22:10 -04:00
Nick Mathewson
31eba7f009 Merge branch 'maint-0.4.3' into maint-0.4.4 2020-07-27 12:56:19 -04:00
Nick Mathewson
64d7b28298 Merge branch 'maint-0.4.4' 2020-07-27 12:56:19 -04:00
Nick Mathewson
97d0cb83ed Merge branch 'maint-0.4.2' into maint-0.4.3 2020-07-27 12:56:18 -04:00
Nick Mathewson
c0bc30b6f0 Merge branch 'maint-0.3.5' into maint-0.4.2 2020-07-27 12:56:18 -04:00
Nick Mathewson
95914ceb57 Bump to 0.4.4.3-alpha 2020-07-27 08:32:56 -04:00
Nick Mathewson
010387e4bd Merge branch '40068_maybe' 2020-07-24 15:15:46 -04:00
David Goulet
564a9a54a1 fallbackdir: Remove all three Digitalcourage3 relays
They are about to be shutdown in September.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-24 14:56:07 -04:00
Nick Mathewson
2299b31f40 Don't let a bad IPv6 orport stop our IPv4 bandwidth test.
Specifically: do not close IPv4 bandwidth-testing circuits just
because our IPv6 orport is unreachable.

Attempted fix for #40068.
2020-07-24 14:50:42 -04:00
David Goulet
ad9806b539 relay: Publish IPv4 descriptor on guessed IPv6 reachability failure
On an IPv6 reachability failure test, if the address was configured, don't
publish the descriptor and log warn. If the address was auto discovered, still
publish the descriptor.

Closes #33247.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-24 12:18:07 -04:00
David Goulet
fda0fa02bf relay: Add a cache that tracks which address was configured
Related to #33247

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-24 11:32:49 -04:00
David Goulet
bf2b1e7a6f relay: Turn find address "method_used" into enum
Enum allows us to easily compare what is being returned but also better
semantic to the code.

Related #33247

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-24 11:32:49 -04:00
Nick Mathewson
9d922b8eaa Merge branch 'maint-0.4.4' 2020-07-23 10:10:32 -04:00
Nick Mathewson
6354b70e49 Merge branch 'maint-0.4.2' into maint-0.4.3 2020-07-23 10:09:14 -04:00
Nick Mathewson
3bcbd69a77 Merge branch 'maint-0.3.5' into maint-0.4.2 2020-07-23 10:09:14 -04:00
Nick Mathewson
07934664c5 Merge branch 'maint-0.4.3' into maint-0.4.4 2020-07-23 10:09:14 -04:00
David Goulet
6f19e67c98 fallbackdir: Update list for 2020
Closes #40061

Signed-off-by: David Goulet <dgoulet@torproject.org>
2020-07-23 10:05:11 -04:00