Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug32562 #1563

Closed
wants to merge 8 commits into from
Closed

Bug32562 #1563

wants to merge 8 commits into from

Conversation

Labels
None yet
Projects
None yet
4 participants
@asn-d6
Copy link
Member

@asn-d6 asn-d6 commented Nov 25, 2019

No description provided.

asn-d6 added 6 commits Nov 25, 2019
- See hs_client_register_auth_credentials() for the entry point.
- Also set the permanent flag for credentials we read from the filesystem.
- Also add some missing documentation.
Remove Permanent flag from old tests, and make a new test that does all the
permanent things.
Because the function that parses client auth credentials saved on
disk (parse_auth_file_content()) is not future compatible, there is no way to
add support for storing the nickname on the disk. Hence, nicknames cannot
persist after Tor restart making them pretty much useless.

In the future we can introduce nicknames by adding a new file format for client
auth credentials, but this was not deemed worth doing at this stage.
- Remove key_dir which is useless.
- Kill an indentation layer.

We want to make it cleaner and slimmer so that we can reuse parts of it in the
REMOVE command for removing the right client auth file.
Now we have a function that reads a file and returns a credential. We need that
for the REMOVE control port command.
@coveralls
Copy link

@coveralls coveralls commented Nov 25, 2019

Pull Request Test Coverage Report for Build 7372

  • 91 of 103 (88.35%) changed or added relevant lines in 2 files are covered.
  • 1340 unchanged lines in 9 files lost coverage.
  • Overall coverage increased (+0.3%) to 62.995%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/feature/hs/hs_client.c 87 99 87.88%
Files with Coverage Reduction New Missed Lines %
src/feature/control/control_hs.c 2 82.47%
src/feature/rend/rendclient.c 12 23.82%
src/core/or/circuitlist.c 61 58.93%
src/feature/hs/hs_client.c 84 55.54%
src/feature/hs/hs_service.c 142 73.36%
src/feature/hs/hs_circuit.c 169 42.52%
src/core/or/circuituse.c 209 31.56%
src/feature/control/control_events.c 248 39.14%
src/app/config/config.c 413 79.67%
Totals Coverage Status
Change from base Build 7321: 0.3%
Covered Lines: 49496
Relevant Lines: 78571

💛 - Coveralls


tor_asprintf(&fname, "%s.auth_private", onion_address);
full_fname = hs_path_from_filename(dir, fname);
tor_free(fname);
Copy link
Contributor

@dgoulet-tor dgoulet-tor Nov 26, 2019

Maybe you meant to use full_name ?

Copy link
Member Author

@asn-d6 asn-d6 Dec 2, 2019

I actually did mean full_fname, in the sense that it's the full path instead of just the actual filename. Let me know if you want me to change it to something else.

@@ -1445,6 +1445,79 @@ client_dir_fetch_unexpected(dir_connection_t *dir_conn, const char *reason,
NULL);
}

/** Get the full filename for storing the client auth credentials for the
* service in <b>onion_address</b>. The base directory is <b>dir</b>. */
Copy link
Contributor

@dgoulet-tor dgoulet-tor Nov 26, 2019

Seems this can never fail that is never return NULL. I would add a comment about that.

Copy link
Member Author

@asn-d6 asn-d6 Dec 2, 2019

Fixed in e7f8319.

log_warn(LD_REND, "Failed to remove client auth file (%s).",
creds_file_path);
goto end;
}
Copy link
Contributor

@dgoulet-tor dgoulet-tor Nov 26, 2019

Hmmm, don't we have a TOCTOU issue race? Seems possibly harmless but you never know. I would probably just let tor_unlink() fail here instead of looking if the file is legit before?

Copy link
Member Author

@asn-d6 asn-d6 Dec 2, 2019

Fixed in 2852f8d.

FWIW I was following the logic from expire_old_onion_keys() but this new logic is also fine.

@torproject-pusher torproject-pusher deleted the branch torproject:master May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment