Crates.io | spaghettinuum |
lib.rs | spaghettinuum |
version | 0.2.2 |
source | src |
created_at | 2023-05-30 16:09:44.557148 |
updated_at | 2023-12-11 13:23:53.482522 |
description | The future of the internet is al dente |
homepage | |
repository | https://github.com/andrewbaxter/spaghettinuum |
max_upload_size | |
id | 878058 |
size | 402,353 |
Spaghettinuum is an alternative to DNS based around a distributed hash table. Replacing the web with a plate of pasta. A little less centralized and a little more noodly.
Featuring:
Current status: Planned features implemented, but not thoroughly tested
Conceptually Spaghettinuum is a distributed two-level key-value store, like DNS
You can use it for hosting your websites (or at least, the name bit, almost, several huge caveats below) and providing public service discovery for various services that don't exist yet.
This repo is
spagh
, including a fully static as well as a database-backed configuration, plus an HTTP resolver, and a DNS bridge for people still using DNSspagh-cli
for interacting with your node, managing identities, publishing data, and generating basic configsTo get the server spagh
and CLI spagh-cli
, install with cargo install spaghettinuum
.
If you're just interacting with a server, curl
is all you need.
There's a public node at spaghetinnuum.isandrew.com
, ip 149.248.205.99
featuring a resolver and DNS bridge.
The resolver runs on port 43891
.
You can query arbitrary keys using the CLI (cargo install spaghettinuum
):
spagh-cli query https://spaghetinnuum.isandrew.com:43891 yryyyyyyyyei1n3eqbew6ysyy6ocdzseit6j5a6kmwb7s8puxmpcwmingf67r dsf9oyfz83fatqpscp9yt8wkuw
or using curl
:
curl https://spaghetinnuum.isandrew.com:43891/yryyyyyyyyei1n3eqbew6ysyy6ocdzseit6j5a6kmwb7s8puxmpcwmingf67r?key1,key2,...
Spaghettinuum supports a DNS bridge, limited to a set of keys mapped to DNS types. The DNS bridge runs on UDP port 53
.
Try it out with dig
:
dig @149.248.205.99 yryyyyyyyyei1n3eqbew6ysyy6ocdzseit6j5a6kmwb7s8puxmpcwmingf67r.s
If you set your DNS resolver to 149.248.205.99
you can read my writings (WIP) in your browser at https://yryyyyyyyyei1n3eqbew6ysyy6ocdzseit6j5a6kmwb7s8puxmpcwmingf67r.s/5987 (WIP - note SSL issues working with traditional infrastructure, discussed below).
To query a resolver, send an HTTP GET
to RESOLVER/v1/IDENTITY?KEY1,KEY2,...
.
The response has this format:
{
"v1": {
"key": {
"expires": "RFC3339 datetime...",
"data": "value"
}
}
}
If the identity can't be resolved you'll get an empty {"v1": {}}
response.
All resolvers must have this API.
spagh-cli
uses environment variable SPAGH_RESOLVER
to find the server if none is specified. This should be a host:port
pair.
cargo install spaghettinuum
spagh-cli generate-config
to generate a configspagh --config YOURCONFIG.json
to start the serverThe spagh
server has a number of child services:
You need an identity to publish.
There are two types of identities:
To create a local identity, do spagh-cli new-local-identity me.ident
. It will save the identity and secret in the file, and print out the identity. Anyone who has this file can publish under the identity, so be careful with it.
To use a card identity, with a Yubikey straight out of the extruder,
pcscd
is running and your Yubikey is plugged incargo install openpgp-card-tools
which installs opgpcard
opgpcard list
, which should show your card with an id like 0006:123456789
opgpcard admin --card 0006:123456789 generate cv25519
with the default 12345678
admin PIN (at the moment, only Ed25519 is supported so to get that you must use cv25519
). Alternatively you can use Sequoia or something to generate a key then do opgpcard admin --card XYZ import
instead, if you want to back up your identity. By the way, Sequoia is super cool and the people who work on it are equally amazing.spagh-cli list-card-identities
to confim it's detected and get the identity for the card ID (required for publishing)The card must be plugged into the server so the server can sign publications.
To publish you need a server with the publisher service enabled.
Create a json file named data.json
containing the data you want to publish under your identity:
{
"missing_ttl": 60,
"data": {
"any key you want": {
"ttl": 60,
"data": "I love you"
}
}
}
TTLs are in minutes.
missing_ttl
is how long keys not in data
can be assummed to be missing.
Then call
spagh-cli publish --server http://localhost local ./identity.json ./data.json
to publish using a local identity or
spagh-cli publish --server http://localhost card 0006:12345678 - ./data.json
to publish using a card.
DNS is normal published data with DNS-bridge specific keys, with a specific value JSON format understood by the DNS bridge service.
You can use spagh-cli generate-dns-data
to generate data for use with spagh-cli publish
or spagh-cli publish-dns
to publish records directly to a dynamic publisher.
If you want to modify the data, the recognized DNS keys are listed in tree/master/src/data/standard.rs.
This is about hacking spaghettinuum into the old technologies, so you can use a plain browser to access your website over the spaghetinnuum.
Note that spaghetinium only handles name resolution - you still need a server to publish the HTTP content, APIs, etc.
The main sticking point here is SSL. There are a couple theoretical options for getting SSL worked out on your website:
.s
domains and do the cert validation themselves - I really wanted to avoid this, since browser extensions are getting less capable (ex: manifest v3), require custom extensions for N types of browser, need to deal with hostile publishing review/policies, need to work with Javascript, so on and so forthTLDR: There's no good options available immediately.
You need:
spaghettinuum
installedSee spagh -h
for instructions on running. See server_config.schema.json for the config schema and field explanations. spagh-cli
will generate a default config for you if you want.
When you do a lookup, what happens is
The information in the DHT includes the public key of the TLS cert for the publisher - this is verified when connecting to the publisher.
The DHT is a modified Kademlia which uses public keys for node ids and requires all stored values to be signed with the identity used for the key. This approach is used by other decentralized protocols such as IPFS and Ethereum for their DHTs.
You have a penchant for anarchy.
Just kidding. The real reasons for disliking DNS are:
More and more things rely on DNS: Getting SSL certificates, email, Matrix, that new Twitter replacement. For all the reasons above, the faster we have an alternative the better.
Yeah, google.com
is a lot more memorable than yryyyyyyyyei1n3eqbew6ysyy6ocdzseit6j5a6kmwb7s8puxmpcwmingf67r.s
for sure.
But I live in Japan, and for all intents and purposes people are already living in a world like this:
google.com
.While I'm not claiming the googling-companies-thing is great, the Line bit works perfectly and shows how a web of trust model can work in the real world.
In my own internet usage, there are only a couple types of websites I use:
As more and more domains get used and the number of meaningless suffixes proliferate, the trust provided by a domain name continues to decrease. Is that new bank at futurebank.io
or futurebank.cash
or futurebank.xyz
or futurebank.it
or (etc). What about typo squatting? What about creative names, like lyft
vs lift
?
So safely browsing the web today requires:
Which would all be the same with gibberish names.
My thoughts were:
A binary API may be available in the future.