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

Ticket20700 035 02 #301

Closed
wants to merge 46 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
0f28284
hs-v3: Load all client auth keys to the service
haxxpop Aug 18, 2018
629c188
test: HS v3 loading client auth keys service side
haxxpop Aug 18, 2018
0a243a6
hs-v3: Generate all descriptor related keys
haxxpop Apr 9, 2018
2b2a303
test: HS v3 building a descriptor with client auth
haxxpop Apr 12, 2018
d25e381
test: Build an HSv3 descriptor with authorized client
haxxpop Apr 12, 2018
359a49a
hs-v3: Encrypt the descriptor using a cookie
haxxpop Apr 13, 2018
718f39d
test: HS v3 descriptor encoding with client authorization
haxxpop Apr 14, 2018
47d62f8
hs-v3: Load client authorization secret key from file
haxxpop Aug 19, 2018
33071c8
test: HS v3 client authorization loading secret key
haxxpop Aug 19, 2018
a6790e9
hs-v3: Refactor secret data building logic
haxxpop Apr 19, 2018
a7a0545
hs-v3: Refactor the descriptor decryption/decoding
haxxpop Apr 19, 2018
09c3d4b
hs-v3: Decrypt the descriptor with client private key
haxxpop Apr 19, 2018
af0b5b8
test: HS v3 descriptor decoding with client authorization
haxxpop Apr 21, 2018
94674ff
hs-v3: Re-enable the decoding in the encoding function
haxxpop Apr 22, 2018
bbefbd8
hs-v3: Make all descriptor content free functions public
haxxpop May 9, 2018
85115a2
hs-v3: Republish descriptors if client auth changes
haxxpop May 9, 2018
cd01788
test: HS v3 client auth is config equal function
haxxpop May 16, 2018
051d6ab
hs-v3: Rename client_sk to client_auth_sk
haxxpop May 21, 2018
7a18b4d
hs-v3: Rename client_pk to client_auth_pk
haxxpop May 21, 2018
b49df5a
hs-v3: Log client auth load activities service side
haxxpop Aug 19, 2018
4eea079
hs-v3: Log client auth load activities client side
haxxpop Aug 19, 2018
270bfc9
hs-v3: Improve v3 client authorization logging
dgoulet-tor Aug 30, 2018
e7d6c0e
bug: Use PATH_SEPARATOR instead of slash
haxxpop Sep 2, 2018
f1bc43a
fixup! test: HS v3 client authorization loading secret key
haxxpop Sep 2, 2018
9f715d5
fixup! test: HS v3 loading client auth keys service side
haxxpop Sep 2, 2018
67fa226
fixup! hs-v3: Load all client auth keys to the service
dgoulet-tor Sep 5, 2018
de70396
fixup! hs-v3: Load all client auth keys to the service
dgoulet-tor Sep 5, 2018
7396175
fixup! hs-v3: Load all client auth keys to the service
dgoulet-tor Sep 5, 2018
75a261c
fixup! hs-v3: Load all client auth keys to the service
dgoulet-tor Sep 5, 2018
7eaa650
fixup! hs-v3: Log client auth load activities service side
dgoulet-tor Sep 5, 2018
5505486
fixup! hs-v3: Load all client auth keys to the service
dgoulet-tor Sep 5, 2018
c87bf6a
fixup! test: HS v3 loading client auth keys service side
dgoulet-tor Sep 5, 2018
f8e98f8
fixup! test: HS v3 loading client auth keys service side
dgoulet-tor Sep 5, 2018
c6403e6
hs-v3: Make hs_desc_build_fake_authorized_client() return an object
dgoulet-tor Sep 5, 2018
fe50c14
fixup! hs-v3: Encrypt the descriptor using a cookie
dgoulet-tor Sep 5, 2018
9d1fe48
fixup! hs-v3: Load client authorization secret key from file
dgoulet-tor Sep 5, 2018
4ba612a
fixup! hs-v3: Load client authorization secret key from file
dgoulet-tor Sep 5, 2018
97404e3
fixup! hs-v3: Decrypt the descriptor with client private key
dgoulet-tor Sep 5, 2018
54d9da1
fixup! hs-v3: Decrypt the descriptor with client private key
dgoulet-tor Sep 5, 2018
1f98b67
fixup! hs-v3: Decrypt the descriptor with client private key
dgoulet-tor Sep 5, 2018
6e919ff
Revert "fixup! hs-v3: Decrypt the descriptor with client private key"
dgoulet-tor Sep 6, 2018
0510edf
fixup! hs-v3: Decrypt the descriptor with client private key
dgoulet-tor Sep 6, 2018
bcd2b2d
HSv3: Add subcredential in client auth KDF on the service-side.
asn-d6 Sep 6, 2018
0b60cc1
HSv3: Add subcredential in client auth KDF on the client-side.
asn-d6 Sep 6, 2018
3bcfe21
fixup! hs-v3: Republish descriptors if client auth changes
haxxpop Sep 7, 2018
a2b821c
HSv3: Don't assert when reading bad client-side privkeys.
asn-d6 Sep 7, 2018
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+37 −20
Diff settings

Always

Just for now

hs-v3: Log client auth load activities service side

Signed-off-by: David Goulet <dgoulet@torproject.org>
  • Loading branch information...
haxxpop authored and dgoulet-tor committed Aug 19, 2018
commit b49df5a38511eb223f465ff9720f74f46570be1a
@@ -1136,23 +1136,31 @@ parse_authorized_client(const char *client_key_str)
SPLIT_SKIP_SPACE, 0);
/* Wrong number of fields. */
if (smartlist_len(fields) != 3) {
log_warn(LD_REND, "The file is in a wrong format.");

This comment has been minimized.

Copy link
@nmathewson

nmathewson Sep 5, 2018

Contributor

Let's say which file -- it's not going to help the user otherwise.

This comment has been minimized.

Copy link
@dgoulet-tor

dgoulet-tor Sep 5, 2018

Author Contributor

This has been fixed with a future commit in this branch.

goto err;
}

auth_type = smartlist_get(fields, 0);
key_type = smartlist_get(fields, 1);
pubkey_b32 = smartlist_get(fields, 2);

/* Currently, the only supported auth type is "descriptor" and the only
* supported key type is "x25519". */
if (strcmp(auth_type, "descriptor") || strcmp(key_type, "x25519")) {
/* Currently, the only supported auth type is "descriptor". */
if (strcmp(auth_type, "descriptor")) {
log_warn(LD_REND, "The auth type '%s' is not supported.", auth_type);
goto err;
}

/* Currently, the only supported key type is "x25519". */
if (strcmp(key_type, "x25519")) {
log_warn(LD_REND, "The key type '%s' is not supported.", key_type);
goto err;
}

client = tor_malloc_zero(sizeof(hs_service_authorized_client_t));
if (base32_decode((char *) client->client_pk.public_key,

This comment has been minimized.

Copy link
@nmathewson

nmathewson Sep 5, 2018

Contributor

Will this detect truncated public keys?

This comment has been minimized.

Copy link
@dgoulet-tor

dgoulet-tor Sep 5, 2018

Author Contributor

Fixup commit: 7396175

sizeof(client->client_pk.public_key),
pubkey_b32, strlen(pubkey_b32)) < 0) {
log_warn(LD_REND, "The public key cannot be decoded.");

This comment has been minimized.

Copy link
@nmathewson

nmathewson Sep 5, 2018

Contributor

Again, we should really be saying what file is busted, or the user won't know what to do about it.

This comment has been minimized.

Copy link
@dgoulet-tor

dgoulet-tor Sep 5, 2018

Author Contributor

Same as above.

goto err;
}

@@ -1212,28 +1220,37 @@ load_client_keys(hs_service_t *service)
file_list = tor_listdir(client_keys_dir_path);

This comment has been minimized.

Copy link
@nmathewson

nmathewson Sep 5, 2018

Contributor

We need to check for whether this value is NULL, I think.

This comment has been minimized.

Copy link
@dgoulet-tor

dgoulet-tor Sep 5, 2018

Author Contributor

Fixup commit: 5505486


SMARTLIST_FOREACH_BEGIN(file_list, char *, filename) {

This comment has been minimized.

Copy link
@nmathewson

nmathewson Sep 5, 2018

Contributor

Could this be const char *?

This comment has been minimized.

Copy link
@dgoulet-tor

dgoulet-tor Sep 5, 2018

Author Contributor

Fixup commit: 75a261c


hs_service_authorized_client_t *client = NULL;
log_info(LD_REND, "Loading a client authorization key file %s...",
filename);

if (!client_filename_is_valid(filename)) {
log_warn(LD_REND, "The filename is invalid.");
continue;
}

This comment has been minimized.

Copy link
@nmathewson

nmathewson Sep 5, 2018

Contributor

I'm a little concerned that this loop provides no user feedback. If a file is invalid or ignored, how will the user find out?

This comment has been minimized.

Copy link
@dgoulet-tor

dgoulet-tor Sep 5, 2018

Author Contributor

Logging have been added at a later commit :).

if (client_filename_is_valid(filename)) {
/* Create a full path for a file. */
client_key_file_path = hs_path_from_filename(client_keys_dir_path,
filename);
client_key_str = read_file_to_str(client_key_file_path, 0, NULL);
/* Free immediately after using it. */
tor_free(client_key_file_path);
/* Create a full path for a file. */
client_key_file_path = hs_path_from_filename(client_keys_dir_path,
filename);
client_key_str = read_file_to_str(client_key_file_path, 0, NULL);
/* Free immediately after using it. */
tor_free(client_key_file_path);

/* If we cannot read the file, continue with the next file. */
if (!client_key_str) {
continue;
}
/* If we cannot read the file, continue with the next file. */
if (!client_key_str) {
log_warn(LD_REND, "The file cannot be read.");
continue;
}

client = parse_authorized_client(client_key_str);
/* Free immediately after using it. */
tor_free(client_key_str);
client = parse_authorized_client(client_key_str);
/* Free immediately after using it. */
tor_free(client_key_str);

if (client) {
smartlist_add(config->clients, client);
}
if (client) {
smartlist_add(config->clients, client);
log_info(LD_REND, "Loaded a client authorization key file %s.",
filename);
}

} SMARTLIST_FOREACH_END(filename);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.