Commit Graph

926 Commits

Author SHA1 Message Date
George Kadianakis
ce422a9d4a hs-v3: Decrypt pending descriptors when we get new client auth creds. 2019-11-18 19:21:34 +02:00
George Kadianakis
db6a48b6bf control-port: Implement ONION_CLIENT_AUTH_VIEW. 2019-11-18 19:19:00 +02:00
George Kadianakis
8330b4dc2a control-port: Implement ONION_CLIENT_AUTH_REMOVE. 2019-11-18 19:18:49 +02:00
George Kadianakis
46f4415022 control-port: Tests for ONION_CLIENT_AUTH_ADD. 2019-11-18 19:18:45 +02:00
George Kadianakis
00fdaaee1e control-port: Implement ONION_CLIENT_AUTH_ADD. 2019-11-18 19:16:01 +02:00
George Kadianakis
d28b6792cb Merge branch 'tor-github/pr/1423' 2019-11-18 19:06:53 +02:00
David Goulet
3892ac7c71 test: Unit test for the hs cache decrypt on new auth
Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
68a004d147 hs-v3: Improve documentation of hs_cache_client_descriptor_t
Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
48a9f8a63f hs-v3: Function to re-parse unencrypted descriptor
We now keep descriptor that we can't decode due to missing client
authorization in the cache.

This new function is used when new client authorization are added and to tell
the client cache to retry decoding.

Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
fbc18c8989 hs-v3: Refactor descriptor dir fetch done code
This commit extract most of the code that dirclient.c had to handle the end of
a descriptor directory requests (fetch). It is moved into hs_client.c in order
to have one single point of entry and the rest is fully handled by the HS
subsystem.

As part of #30382, depending on how the descriptor ended up stored (decoded or
not), different SOCKS error code can be returned.

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
542402cd60 hs-v3: Set extended error when missing/bad client auth
Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
fb1d212021 hs-v3: Set extended error when descriptor is not found
Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
7bba8bf72f hs-v3: Return descriptor decoding status when storing as client
This will allow us to callback into the HS subsytem depending on the decoding
status and return an extended SOCKS5 error code depending on the decoding
issue.

This is how we'll be able to tell the SocksPort connection if we are missing
or have bad client authorization for a service.

Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
David Goulet
96a53221b0 hs-v3: Keep descriptor in cache if client auth is missing or bad
We now keep the descriptor in the cache, obviously not decoded, if it can't be
decrypted for which we believe client authorization is missing or unusable
(bad).

This way, it can be used later once the client authorization are added or
updated.

Part of #30382

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-18 19:06:43 +02:00
teor
c34fb3413d
Merge remote-tracking branch 'tor-github/pr/1517' 2019-11-18 11:21:37 +10:00
Nick Mathewson
b0c1634ce9 Merge remote-tracking branch 'tor-github/pr/1544' 2019-11-16 15:29:14 -05:00
Neel Chauhan
4874b00065 Remove the extra whitespace in the lines_eq() if statement in consdiff_gen_diff() 2019-11-15 14:56:47 -05:00
Nick Mathewson
8b91680d5c Doxygen: rename all .dox files to end with .md
Using a standard ending here will let other tools that expect
markdown understand our output here.

This commit was automatically generated with:

   for fn in $(find src -name '*.dox'); do \
      git mv "$fn" "${fn%.dox}.md"; \
   done
2019-11-15 09:28:12 -05:00
Nick Mathewson
3a7369d0cf Doxygen: remove /** and **/ from all .dox files
This is an automatically generated commit, made with:

find src -name '*.dox' | \
   xargs  perl -i -ne 'print unless (m#^\s*/?\*\*/?\s*$#);'
2019-11-15 09:23:51 -05:00
teor
825f52784d
Merge remote-tracking branch 'tor-github/pr/1535' 2019-11-15 12:11:32 +10:00
teor
b58e5091b7
Merge remote-tracking branch 'tor-github/pr/1533' 2019-11-15 12:11:22 +10:00
Nick Mathewson
d57a04b648 Avoid redundant typedef of or_options_t and smartlist_t in *_config.h
Fixes bug 32495.
2019-11-14 15:43:53 -05:00
teor
d19f370aa2 Run "make autostyle" 2019-11-14 16:28:39 +10:00
teor
0df8bcfb6f relay: Disable relay_sys when the relay module is disabled
Closes ticket 32245.
2019-11-14 16:27:06 +10:00
teor
88c2a23c4b relay: Disable relay_periodic when the relay module is disabled
Closes ticket 32244.
2019-11-14 16:17:17 +10:00
teor
ef00b1ce0f dirauth: Remove a HAVE_MODULE_DIRAUTH inside a function
There are now no HAVE_MODULE_{DIRAUTH,RELAY} inside functions.

Closes ticket 32163.
2019-11-14 15:43:27 +10:00
Nick Mathewson
f6c9ca3a1d Merge branch 'config_subsys_v4' 2019-11-07 08:59:42 -05:00
Nick Mathewson
4845ab53f0 Make all our struct names end with "_t".
This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        address_ttl_s address_ttl_t \
        aes_cnt_cipher aes_cnt_cipher_t \
        authchallenge_data_s authchallenge_data_t \
        authenticate_data_s authenticate_data_t \
        cached_bw_event_s cached_bw_event_t \
        cbuf cbuf_t \
        cell_ewma_s cell_ewma_t \
        certs_data_s certs_data_t \
        channel_idmap_entry_s channel_idmap_entry_t \
        channel_listener_s channel_listener_t \
        channel_s channel_t \
        channel_tls_s channel_tls_t \
        circuit_build_times_s circuit_build_times_t \
        circuit_muxinfo_s circuit_muxinfo_t \
        circuitmux_policy_circ_data_s circuitmux_policy_circ_data_t \
        circuitmux_policy_data_s circuitmux_policy_data_t \
        circuitmux_policy_s circuitmux_policy_t \
        circuitmux_s circuitmux_t \
        coord coord_t \
        cpuworker_job_u cpuworker_job_u_t \
        cv_testinfo_s cv_testinfo_t \
        ddmap_entry_s ddmap_entry_t \
        dircollator_s dircollator_t \
        dist_ops dist_ops_t \
        ecdh_work_s ecdh_work_t \
        ewma_policy_circ_data_s ewma_policy_circ_data_t \
        ewma_policy_data_s ewma_policy_data_t \
        fp_pair_map_entry_s fp_pair_map_entry_t \
        fp_pair_map_s fp_pair_map_t \
        guard_selection_s guard_selection_t \
        mbw_cache_entry_s mbw_cache_entry_t \
        outbuf_table_ent_s outbuf_table_ent_t \
        queued_event_s queued_event_t \
        replyqueue_s replyqueue_t \
        rsa_work_s rsa_work_t \
        sandbox_cfg_elem sandbox_cfg_elem_t \
        scheduler_s scheduler_t \
        smp_param smp_param_t \
        socket_table_ent_s socket_table_ent_t \
        state_s state_t \
        threadpool_s threadpool_t \
        timeout_cb timeout_cb_t \
        tor_libevent_cfg tor_libevent_cfg_t \
        tor_threadlocal_s tor_threadlocal_t \
        url_table_ent_s url_table_ent_t \
        worker_state_s worker_state_t \
        workerthread_s workerthread_t \
        workqueue_entry_s workqueue_entry_t
2019-11-07 08:41:22 -05:00
Nick Mathewson
582cee723a Fix various doxygen comments in feature/hs. 2019-11-07 08:13:31 -05:00
Nick Mathewson
0f0a9bdf33 Stop using "config_suite_offset=-1" to indicate "no config suite."
Instead, create a separate "has_config_suite" boolean, so that only
top-level formats with config_suites need to declare an offset at
all.
2019-11-07 07:28:43 -05:00
Nick Mathewson
8cd3e66d93 Use new configuration architecture for crypto options
This is a comparatively simple change.
2019-11-07 07:28:43 -05:00
Nick Mathewson
19cac400d9 Macros for declaring configuration structs and variable-tables
In our old design, we had to declare configuration structures (like
or_options_t) and variable tables (like option_vars_) separately,
and we used some magic to enforce their consistency (see
conftesting.h).

With this design, we write a single definition for the configuration
object and its fields, and use C macros to expand it either into a
structure, or a variable table.  Since they are both made from the
same source, they can't become inconsistent.

The two designs can coexist happily, and we can migrate from one to
the other at our convenience.
2019-11-07 07:28:43 -05:00
teor
aaef9a2519 relay: Stop failing on startup when the relay module is disabled
When the relay module is disabled, make "ClientOnly 1" and
"DirCache 0" by default. (But keep "ClientOnly 0" and
"DirCache 1" as the defaults for the unit tests.)

And run "make autostyle".

Part of ticket 32410.
2019-11-07 11:43:41 +10:00
Nick Mathewson
b994397f1a entrynodes.h: make a comment into doxygen. 2019-11-06 13:08:04 -05:00
Nick Mathewson
c6c02658cf hs_ident.c: make comments into doxygen. 2019-11-06 13:05:13 -05:00
Nick Mathewson
92b3f60ebc hs_ident.h: make comments into doxygen. 2019-11-06 13:03:40 -05:00
David Goulet
49cb7d6ec4 Merge branch 'tor-github/pr/1491' 2019-11-06 10:23:33 -05:00
David Goulet
326f82db04 hs-v2: Fix memory leak in error code path
Coverity CID: 1455168

Closes #32356

Signed-off-by: David Goulet <dgoulet@torproject.org>
2019-11-05 08:24:46 -05:00
Nick Mathewson
8933789fef Merge branch 'doxygen_libs' 2019-11-05 08:05:49 -05:00
Nick Mathewson
aac80a004f Doxygen: add several missing links. 2019-11-05 08:05:42 -05:00
teor
6169469546
Merge remote-tracking branch 'tor-github/pr/1477' 2019-11-05 14:23:10 +10:00
teor
8b91fa7075 config: Run "make autostyle"
Part of 32213.
2019-11-05 12:01:29 +10:00
teor
f10aa77afe config: Wrap a long line in relay_config.c
Part of 32213.
2019-11-05 11:36:19 +10:00
teor
cb8ebc0b4c config: Rename new global functions with a prefix
This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        get_dirportfrontpage relay_get_dirportfrontpage \
        parse_port_config port_parse_config \
        count_real_listeners port_count_real_listeners \
        parse_transport_line pt_parse_transport_line \
        ensure_bandwidth_cap config_ensure_bandwidth_cap \
        get_effective_bwrate relay_get_effective_bwrate \
        get_effective_bwburst relay_get_effective_bwburst \
        warn_nonlocal_ext_orports port_warn_nonlocal_ext_orports \
        parse_ports_relay port_parse_ports_relay \
        update_port_set_relay port_update_port_set_relay \
        get_transport_bindaddr_from_config pt_get_bindaddr_from_config \
        get_options_for_server_transport pt_get_options_for_server_transport

It was generated with --no-verify, because it has some long lines.

Part of 32213.
2019-11-05 11:28:57 +10:00
Nick Mathewson
a33d1dce8a directory-level documentation for feature/* 2019-11-04 17:07:38 -05:00
Nick Mathewson
62a473debf Doxygen: Avoid ambiguity in @dir directives
This commit was automatically generated with:

find src -name '*.dox' |xargs perl -i -pe 's{\@dir ([^/])}{\@dir /$1};'
2019-11-04 10:23:36 -05:00
Nick Mathewson
d3af23783c Document our top-level directories 2019-11-04 07:40:20 -05:00
Nick Mathewson
7fc077ed25 Add stub directory-level documentation for most source directories
This includes app, core, feature, lib, and tools, but excludes
ext, test, and trunnel.

This was generated by the following shell script:

cd src
for dname in $(find lib core feature app tools -type d |grep -v \\.deps$); do
    keyword="$(echo "$dname" |sed -e "s/\//_/" )"
    target="${dname}/${keyword}.dox"
    echo "$target"
    cat <<EOF >"$target"
/**
@dir ${dname}
@brief ${dname}
**/
EOF

    git add "$target"
done
2019-11-04 07:40:14 -05:00
teor
51ca6dea08 relay: Simplify relay/transport_config
Minor simplification and refactoring.

Part of 32113.
2019-11-04 13:10:01 +10:00
teor
2dfd18018f relay: Disable server transport options when the module is disabled
This commit:
* disables the ExtORPort, ServerTransportPlugin,
  ServerTransportListenAddress, and ServerTransportOptions options,
when the relay module is disabled.

Part of 32213.
2019-11-04 13:10:01 +10:00