diff options
author | David Goulet <dgoulet@torproject.org> | 2019-06-19 12:02:41 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2019-07-03 08:21:16 -0400 |
commit | ef2123c7c7bbf0cb6ec2a5528bae082d51ea8962 (patch) | |
tree | 4c32e0dd186f873323786f60a46d0a97799228e7 /src/feature/dircache | |
parent | fdbd139495639576c233df47ae2db3becd7f43fd (diff) | |
download | tor-ef2123c7c7bbf0cb6ec2a5528bae082d51ea8962.tar.gz tor-ef2123c7c7bbf0cb6ec2a5528bae082d51ea8962.zip |
hs-v3: Disallow single hop client to post/get a descriptor
Closes #24964
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/dircache')
-rw-r--r-- | src/feature/dircache/dircache.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/feature/dircache/dircache.c b/src/feature/dircache/dircache.c index 1b36f716f4..7c6af3582b 100644 --- a/src/feature/dircache/dircache.c +++ b/src/feature/dircache/dircache.c @@ -1390,8 +1390,9 @@ handle_get_hs_descriptor_v3(dir_connection_t *conn, const char *pubkey_str = NULL; const char *url = args->url; - /* Reject unencrypted dir connections */ - if (!connection_dir_is_encrypted(conn)) { + /* Reject non anonymous dir connections (which also tests if encrypted). We + * do not allow single hop clients to query an HSDir. */ + if (!connection_dir_is_anonymous(conn)) { write_short_http_response(conn, 404, "Not found"); goto done; } @@ -1632,10 +1633,10 @@ directory_handle_command_post,(dir_connection_t *conn, const char *headers, goto done; } - /* Handle HS descriptor publish request. */ - /* XXX: This should be disabled with a consensus param until we want to - * the prop224 be deployed and thus use. */ - if (connection_dir_is_encrypted(conn) && !strcmpstart(url, "/tor/hs/")) { + /* Handle HS descriptor publish request. We force an anonymous connection + * (which also tests for encrypted). We do not allow single-hop client to + * post a descriptor onto an HSDir. */ + if (connection_dir_is_anonymous(conn) && !strcmpstart(url, "/tor/hs/")) { const char *msg = "HS descriptor stored successfully."; /* We most probably have a publish request for an HS descriptor. */ |