YaCy improved-search 日本語

Trust and NAT design

This page summarizes the design document docs/trust-and-nat.md (Japanese), which is the reference.

1. Goals and threat model

ThreatBeforeWith this design
Forged results (ads or malware URLs for any query)Only format checks; remote results stay even when verification failsEvery result needs the signature of its author (the peer that crawled it), and by default the author must be on a coordinator's list
Impersonating peers, altering seedsRandom peer ids, unsigned seedsPeer id = hash of an Ed25519 key. The owner signs the core of its seed, and hello proves key ownership with a challenge
Mass creation of peers (Sybil)After 3 days a new peer is a DHT search targetSearch trust comes from lists (admission). Documents of peers not on a list are not used by default
Storage peers altering DHT dataNot detectableStorage peers need not be trusted. Author signatures reveal changes, so all they can do is withhold data
Trusted peers that mix in ads or relay other engines—Not forbidden, but declared as tags on the list. Users decide by policy

Out of scope: storage peers withholding results, false content signed by a trusted author (handled by tags and audit), query privacy.

2. Identity

2.1 Signed seeds

Receivers rewrite parts of a seed (IP, type, flags, last seen) and relay it. Only the fields that the owner alone decides are signed:

Signed coreNot signed (observed or rewritten by receivers)
Hash, PK, Name, Port, PortSSL, BDate, SigT (signing time), Tags (self-declared), Reach, P2PA, RDSIP, IP6, PeerType, Flags, counters, LastSeen, news, TV

2.2 Hello challenge

The IP address is not signed, so hello checks that the key owner really answers at that address:

3. Delegation and trust lists

coordinator key (configured by the user; several allowed, first has priority)
  └─ delegation: "this operator key may publish the list for this network"   (versioned; revocation is a newer version)
       └─ peer list: "trust these peers, with this priority and these tags"  (signed by the operator; versioned)
{"payload": "<base64url(JSON bytes)>", "signer": "<base64url public key>", "sig": "<base64url signature>"}

{"type": "yacy-delegation-v1", "network": "freeworld", "operator": "<pk>", "version": 3, "revoked": false}
{"type": "yacy-peerlist-v1", "network": "freeworld", "version": 12,
 "peers": [{"pk": "<pk>", "priority": 100, "tags": ["ads"]}]}

3.1 Declared tags

A small common vocabulary. Coordinators may add their own tags with an x-<name>: prefix.

TagMeaning
adsmixes advertising into results
proxy:<engine>relays results of an external search engine
curatedhand-curated index
unfilteredno curation
adultcontains adult content

Tags on the list are authoritative. Tags in the seed are self-declared and only displayed. trust.policy.excludeTags drops documents of authors with those tags, and results carry their author's tags.

4. Distributing lists

5. Document provenance (author signatures)

VerdictConditionDefault
SELFthe author is this peerused
TRUSTEDvalid signature, author in the trust setused, with the author's priority and tags
SIGNEDvalid signature, author not in the trust setdropped (open mode: "unverified")
UNSIGNEDno provenancedropped (open mode: "unverified")
INVALIDsignature does not match, key does not match the author, or URL or title changedalways dropped

6. NAT traversal

 behind the NAT                            public side
┌──────────────────────┐          ┌──────────────────┐          ┌──────────────────────┐
│ YaCy ── sidecar ─────┼─ outbound ▶ relay (sidecar)  ◀ outbound ┼── sidecar ── YaCy    │
│  :8090   :8095 /:4001│ reserve  │  :4001           │ circuit  │  :8095     :8090     │
└──────────────────────┘          └──────────────────┘          └──────────────────────┘
          ◀────────────── DCUtR hole punching upgrades to a direct connection (if it works) ──────────────▶

7. Settings

KeyDefaultMeaning
trust.seed.acceptUnsignedfalseaccept unsigned (old) seeds
trust.coordinatorsemptytrusted coordinator keys, comma separated, first has priority
trust.bundle.urlsemptyURLs to fetch trust bundles from
trust.search.acceptUnverifiedfalseopen mode: show untrusted and unsigned documents as "unverified", after the verified ones
trust.policy.excludeTagsemptydrop documents of authors with these tags
trust.selfTagsemptytags this peer declares in its own seed
trust.signedOnlyfalsewithout coordinators, trust every signed peer (closed networks)
p2p.sidecar.urlemptycontrol API of the sidecar (empty: NAT traversal off)
p2p.sidecar.yacyPort8096loopback connector for requests carried by the sidecar
p2p.modeautoauto / direct / leecher
p2p.relay.dhtStoragefalseoffer DHT storage even behind a relay
remotesearch.maxtime5000milliseconds to wait for other peers (at most 10000). Results are shown as they arrive

Keys, delegations, lists and bundles are made with the TrustTool command line tool. See FORK.md.

8. Known limits