tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit ae3368c698b2b0a6d1ea8adeca48d6a4ad9ab3cd
parent 05a82b6de99e4041ddacd472432a7e30854ad6a3
Author: Nick Mathewson <nickm@torproject.org>
Date:   Tue, 25 Feb 2025 12:16:57 -0500

Make --keygen-family save a key ID file too.

(Requested by @nusenu)

Diffstat:
Mdoc/man/tor.1.txt | 1+
Msrc/app/main/main.c | 17++++++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/doc/man/tor.1.txt b/doc/man/tor.1.txt @@ -172,6 +172,7 @@ The following options in this section are only recognized on the Generate a new family ID key in __basename__`.secret_family_key`. To use this key, install it on every relay in your family. (Put it in the relay's `KeyDirectory`.) + Also, store the corresponding family ID in __basename__`.public_family_id`. Then enable the corresponding FamilyID option on your relays. See https://community.torproject.org/relay/setup/post-install/family-ids/ for more information. diff --git a/src/app/main/main.c b/src/app/main/main.c @@ -836,23 +836,30 @@ static int do_keygen_family(const char *fname_base) { ed25519_public_key_t pk; - char *fname = NULL; + char *fname_key = NULL, *fname_id = NULL, *id_contents = NULL; int r = -1; if (BUG(!fname_base)) goto done; - tor_asprintf(&fname, "%s.secret_family_key", fname_base); + tor_asprintf(&fname_key, "%s.secret_family_key", fname_base); + tor_asprintf(&fname_id, "%s.public_family_id", fname_base); - if (create_family_id_key(fname, &pk) < 0) + if (create_family_id_key(fname_key, &pk) < 0) + goto done; + tor_asprintf(&id_contents, "%s\n", ed25519_fmt(&pk)); + if (write_str_to_file(fname_id, id_contents, 0) < 0) goto done; - printf("# Generated %s\n", fname); + printf("# Generated %s\n", fname_key); printf("FamilyId %s\n", ed25519_fmt(&pk)); + r = 0; done: - tor_free(fname); + tor_free(fname_key); + tor_free(fname_id); + tor_free(id_contents); return r; }