tor-onion-services-and-hardening
Use when working with v3 onion services — the 56-character address format, blinded descriptor keys, introduction and rendezvous points, client authorization, single-onion mode — or when hardening one with vanguards, proof-of-work DoS defense, Onionbalance and Onionspray, or advertising it via Onion-Location. Covers §8–§9. Companion to the other Tor and onion-network skills.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 5
- Forks
- 3
01 前言 Front Matter
- name
- tor-onion-services-and-hardening
- description
- Use when working with v3 onion services — the 56-character address format, blinded descriptor keys, introduction and rendezvous points, client authorization, single-onion mode — or when hardening one with vanguards, proof-of-work DoS defense, Onionbalance and Onionspray, or advertising it via Onion-Location. Covers §8–§9. Companion to the other Tor and onion-network skills.
03 SKILL.md 正文
Onion Services v3: How They Work, and How to Keep Them Standing
Part 3 of 8 of the Tor and Onion Networks reference (plugin
tor-and-onion-networks), covering §8–§9. Sibling skills:tor-protocol-circuits-and-cell-cryptography(§1–§5),tor-network-consensus-guards-and-paths(§6–§7),tor-censorship-circumvention-and-bridges(§10),tor-attack-literature-and-threat-model(§11),tor-ecosystem-alternatives-and-governance(§12, §14–§16),tor-building-on-tor-software-patterns(§13.1–§13.4, handbook §1),tor-running-relays-bridges-and-hardware(§13.5, handbook §2–§6). Section numbers are shared across the set; a reference written as §N →skillpoints into that sibling skill.Currency: compiled 16 September 2026. The v3 protocol is stable. Tooling status in §9 moves fast — the vanguards addon is unmaintained, PoW/Onionbalance compatibility is a live constraint, and the C tor → Arti transition changes the recommended stack. Verify against https://onionservices.torproject.org/.
⚠️ Onion services invert the trust direction: the server becomes location-anonymous, and the connection never leaves the network.
⚠️ GOTCHA boxes mark where the mental model people carry is wrong in ways that get services deanonymized or knocked offline.
The three ideas that organize this document:
- ⚠️ THE ADDRESS IS THE PUBLIC KEY (§8.1). A
.onionisbase32(ed25519_pubkey ‖ checksum ‖ version). No CA, no DNS, no trust-on-first-use — the name authenticates the service by construction, which is why TLS is not needed for authentication to the service.- ⚠️ LONG-LIVED CIRCUITS ARE THE ATTACK SURFACE (§9.1). A service keeps intro and rendezvous circuits up for a long time, and an adversary who can force it to rebuild them repeatedly walks up the path toward its guard. Vanguards exist because the standard three-hop assumption is not enough when the server is the thing being hidden.
- ⚠️ HARDENING FEATURES CONFLICT WITH EACH OTHER (§9.2, §9.3). PoW does not work with Onionbalance. The vanguards addon does not work with Conflux. There is no configuration that turns everything on — you pick per threat model.
§8. Onion services (v3) end to end
Onion services flip the trust direction: the server becomes location-anonymous, and the connection never leaves the network. (The client stays anonymous too — onion services are mutually anonymous.)
§8.1 The address is the key
A v3 address is 56 base32 characters = base32(ED25519_PUBKEY ‖ CHECKSUM ‖ VERSION) where
CHECKSUM = SHA3-256(".onion checksum" ‖ PUBKEY ‖ VERSION)[0:2] and VERSION = 0x03.
Consequences:
- addresses are self-authenticating (no CA, no DNS);
- un-phishable by near-match — 35 bytes of entropy means a vanity prefix is a GPU
birthday search (see
mkp224o), and a full-address collision is infeasible; - TLS is unnecessary for authentication to the service — though HTTPS-over-onion
certificates exist; DigiCert has issued EV certs for
.onionunder CA/Browser Forum rules since Facebook's 2015 deployment.
§8.2 Publishing a service
- Generate keys. The service's ed25519 master identity can be kept offline
(
tor --keygen); day-to-day operation uses a medium-term signing key — compromise of the running box doesn't permanently compromise the address. - Pick introduction points. The service builds 3-hop circuits to (by default) 3 relays it selects, which become its intro points; it hands each an intro-point auth key.
- Compute blinded keys. For each ~24h period, the descriptor-signing key is blinded with a period-derived nonce, so neither HSDirs nor clients can link yesterday's descriptor to today's without the master public key.
- Upload descriptors to the six HSDirs chosen by blinded-key position in the directory ring (two replicas, three consecutive HSDirs each), where they sit with a ~3-hour lifetime; revision counters are encrypted with an order-preserving construction so HSDirs can pick the newest descriptor without learning service churn.
§8.3 Connecting (client side)
- Client derives today's blinded key from the
.onionpublic key, fetches the descriptor from the right HSDirs (3-hop circuits; the HSDir learns only that someone is fetching somewhere, not whom). - Client picks a random rendezvous point relay, connects (3 hops), and hands it a one-time rendezvous cookie.
- Client encrypts (hs-ntor) an intro message to one intro point: rendezvous cookie + RP identity.
- The service (optionally after client authorization checks — v3 uses per-client x25519
keys:
.auth_privateon the client,authorized_clients/on the server) builds a 3-hop circuit to the RP and completes the handshake. - Result: a 6-hop end-to-end circuit — client-guard…RP…service-guard — with both sides anonymous to each other and both using their own pinned guards.
SingleOnionService mode (server opens directly to the RP, 3 hops total) trades server
anonymity for ~half the latency — popular for services that only need encryption and
NAT-bypass, e.g., SecureDrop-style upload boxes behind hostile networks.
§8.4 ⚠️ GOTCHA: what changed from v2, and why it matters to builders
v2 services (RSA-1024, SHA-1-derived 16-char names, descriptor replay weaknesses, HSDir enumeration via predictable indices — the Trawling for Tor Hidden Services attack, Biryukov/Pustogarov/Weinmann 2013) were removed from the network in October 2021.
Any tutorial, library, or product speaking v2 is dead code. If a guide mentions
HidServAuth, 16-character addresses, or rend-spec-v2, it predates the cutoff and every
security claim in it should be re-checked from scratch.
§9. Hardening onion services: vanguards, proof-of-work, load balancing
§9.1 Guard-discovery attacks and vanguards
Onion services keep their intro-point and rendezvous circuits up for long periods. An adversary who can force a service to build many circuits (e.g., by knocking on its intro points) can, over days-to-weeks, enumerate middle hops and eventually land as the service's guard — at which point guard-side traffic confirmation identifies the server's location. This is the attack family (Øverlier & Syverson 2006 onward) behind several real-world service deanonymizations.
Vanguards (proposal 292 → the standalone vanguards spec) fixes this by pinning additional fixed guard layers under the service:
- Vanguards-Lite (default): one extra pinned layer (L2: 4 relays, lifetimes in days) — cheap, big win.
- Full Vanguards: L2 + L3 pinned layers with short L3 rotation (hours) and an extra hop — for long-lived, high-value services.
⚠️ GOTCHA — status as of Feb–Sept 2026: the original C-tor Python addon is unmaintained (no commits since Oct 2023), incompatible with Conflux, was pulled from Debian Trixie, and is disabled in Whonix 18. Native vanguards ship in Arti (since 1.2.2, default-on; security-refined by 1.2.5). For production services in 2026 this is a live decision point: C tor 0.4.9 + PoW, or Arti (service support declared production-useable with the disclaimer removed in Arti 1.8.0, Dec 2025) + vanguards. The spec intends Vanguards-Lite as the universal default once Arti replaces C tor.
§9.2 Proof-of-work DoS defense (proposal 327; shipped tor 0.4.8, Aug 2023)
Intro-point flooding was the dominant onion-service DoS vector. The PoW defense adds a reactive, adaptive puzzle (Equi-X proof + HashX verification):
- Dormant in normal operation; under load the service raises "suggested effort" in the descriptor/intro protocol.
- Legit clients burn tens of milliseconds to seconds of CPU per intro attempt; a botnet must multiply that cost by its request rate — cheap for humans, expensive at attack scale.
- Configured via
HiddenServicePoWDefensesEnabled 1(+QueueRate/QueueBurst), built with--enable-gpl(Equi-X/HashX licensing), monitored via MetricsPorttor_hs_pow_*metrics.
⚠️ GOTCHA: PoW is a priority queue, not a wall. Very large botnets still overwhelm; mobile clients suffer at high difficulties; and — the constraint that bites real deployments — PoW is incompatible with Onionbalance as of 2025–2026 documentation. PoW also landed in Arti experimentally in 2026.
§9.3 Scaling: Onionbalance, Onionspray, EOTK
- Onionbalance (v0.2.4, Apr 2025; actively maintained, v2 code removed in 0.2.3): a master node aggregates intro points from N backend tor instances (up to ~60 distinct intro points) into one published descriptor — horizontal scaling and failover for one address. JSON status socket for monitoring.
- Onionspray: the Tor Project's modern answer to Alec Muffett's EOTK — config-driven generation of whole onion sites (hardmap = direct backends; softmap = Onionbalance-mediated), including multi-server topologies and publisher/backend key isolation.
- EOTK itself: historically important (BBC, NYT, Brave deployments), effectively superseded by Onionspray for new builds.
§9.4 Discovery: how humans find onion sites
Onion-LocationHTTP header (Tor Browser ≥ 9.5): serveOnion-Location: http://<addr>.onion$request_uriover HTTPS from your clearnet site; Tor users get a purple ".onion available" pill / optional always-redirect. Works in nginx/Apache/Caddy or as a meta tag.Alt-Svc: ... ; ma=...to the onion: transparent — clients who can speak Tor reach you via the onion automatically without any UI.- Research-stage: DNS-based discovery, "Sauteed Onions" (CT-log based), onion association proposals.
§9.5 Deployment checklist for a private onion service
Every item here is argued elsewhere in §8–§9 and §13; this is the order to do them in.
- Run tor from the Tor Project's own repository, not the distro's (fresher).
- v3 only — v2 left the network in October 2021 (§8.4).
- Generate the master identity key offline; deploy only signing material, and set
OfflineMasterKey. - PoW if DoS is a concern (§9.2). Vanguards for guard-discovery resistance (§9.1 — Arti has them built in; the C tor Python addon is unmaintained and incompatible with Conflux).
- Client authorization for private services (§8.3, §13.3 →
tor-building-on-tor-software-patterns). - MetricsPort for monitoring.
- Test descriptor publication from a second tor instance before you hand the address to anyone.
- Advertise via Onion-Location if you have a clearnet twin — and never serve the Onion-Location header from the onion itself (§9.4).
Where to go next
- Copy-paste torrc, control-port and
Onion-Locationconfiguration: §13 →tor-building-on-tor-software-patterns. - Why the guard layer under a service matters so much: §7.1 →
tor-network-consensus-guards-and-paths. - The deanonymization literature behind §9.1: §11.3 and §11.6 →
tor-attack-literature-and-threat-model. - Arti's onion-service support and the C tor → Arti decision: §12.1 →
tor-ecosystem-alternatives-and-governance.
04 同仓库更多 Skills
white-paper-writing
Use when writing white papers, technical reports, policy documents, thought leadership pieces, or any long-form authoritative document. Triggers on requests to write, structure, outline, or review white papers, technical reports, position papers, policy briefs, or evidence-driven arguments. Also use for B2B content marketing strategy, technical documentation requiring authority, academic-style reports, or any document that must educate while persuading. Use when someone asks "how should I structure this" for a long-form document.
prose-technical-mechanics
Use when editing or writing prose at a technical/mechanical level: choosing between Anglo-Saxon and Latinate diction, placing information in topic vs stress positions, writing periodic vs cumulative sentences, handling sentence rhythm, punctuation as logic, transitions, paragraph structure, or phonesthetics. Use when someone wants to understand WHY prose works or doesn't, not just surface-level style advice. Triggers on word choice, sentence structure, emphasis, rhythm, diction, or any deep writing mechanics question.
prose-mechanics
Use when writing, editing, or analyzing prose style; when trying to avoid generic AI-sounding writing; when applying specific prose styles such as journalistic, academic, narrative, KJV biblical, Hemingway plain, Latinate/Jamesian, Orwellian, Augustan, Victorian, Early Modern (Bacon, Browne, Milton), or free indirect discourse; or when coaching someone on writing voice and mechanics. Triggers on any request to improve, analyze, or write in a specific prose style, to fix "AI-sounding" writing, to make prose more vivid or concrete, to vary sentence rhythm, or to understand how a particular writer achieves their effects.
narrative-structure
Use when structuring stories, pitches, presentations, white papers, or any persuasive narrative; analyzing the hero's journey in fiction or non-fiction; applying StoryBrand for business communication; designing narrative arcs for thought leadership; or understanding Vogler, Snyder, Propp, or Campbell frameworks. Triggers on any narrative structure, storytelling, pitch structure, StoryBrand, hero's journey, three-act structure, Freytag, Save the Cat, narrative arc, or "how should I structure this story/pitch/presentation" request.
legal-brief-writing
Use when writing legal briefs, motions, or any court filing; when analyzing judicial cognition and persuasion; when applying elite brief-writing techniques from Roberts, Clement, Kagan, Garner; or when structuring legal arguments for maximum persuasion. Also use for autistic/neurodivergent advocates who need to understand how their natural communication style maps to elite legal advocacy. Triggers on any legal writing, brief drafting, motion preparation, or legal argument structuring request.
journal-publishability-criteria
Use whenever a research paper, article or preprint is being written, revised, reviewed or published, and specifically before every publication of docs/paper.md. Covers what legitimate journals actually gate on, in order of gating — the editor's desk screen (scope, novelty, package problems), what reviewers judge (methodological soundness, claims the evidence can carry, statistical and qualitative reporting), EQUATOR reporting guidelines, the ICMJE authorship criteria, COPE's view of text recycling, the near-universal generative-AI policy (no AI author, disclosure, author responsibility), TOP 2025 transparency standards, how to verify a journal is legitimate, submitting without an institution, and a pre-submission checklist. Triggers on requests to evaluate, review, prepare or submit a paper, to judge publishability, to write a declarations or data-availability section, to disclose AI use, or to check a journal.