Close

Gemini protocol powers the small internet​

dearuserhrondearuserhron wrote 12/18/2022 at 23:44 • 7 min read • Like

P.S. I do not have a leading picture for a hackaday tip. Please ask your artist to draw some nifty illustrations.

P.S. tags: gopher, tilde, small internet, gemini, bloated internet, grassroot movement, fediverse, new retro, minimalism, privacy, web, protocols

[title] Gemini protocol powers the small internet

Modern world wide web is kinda overloaded, over-featured, sometimes very slow and unusable, and people complain about it. (https://medium.com/swlh/the-web-is-becoming-unusable-e7aec886402f )

For developers it means that web will become harder to maintain and less reliable. The famous sermon explains (https://www.stilldrinking.org/programming-sucks ).

Humanity is always trying to improve things, hack around, add more features to the things and so on. This is considered to be a good thing, unless it goes too far and becomes a nightmare.

If only there was a way to implement a new simple and minimalist standard for a web that restricts extensibility - on purpose - to keep technical complexity under control...

[header] Back in time...

Well, at the beginning, it all was manageable. Once, there was a Network - a bunch of computers that were connected together using a wire, and were able to send arbitrary data to each other. So there was a need to set up some rules for computer programs to communicate via the Network. Hypertext Transfer Protocol (HTTP) was invented to serve this purpose. Now every program that speaks HTTP can connect to another program and retrieve a web page. HTTP headers take care of text encoding, data compression etc. And the web page itself was composed using Hypertext Markup Language or HTML for short.

Among other things, HTML allows to turn certain elements on the page into hyperlinks. User can select such part of page, activate it using mouse, and this will lead him to another web page. Hence, it is named Hypertext, because it allows linking web pages with each other. This was the key feature for people to start building electronic knowledge bases and rely on it.

HTTP was not the only protocol back then to serve the content. There was a Finger protocol (it is another story https://en.wikipedia.org/wiki/Finger_(protocol)  ), and a Gopher protocol.

Gopher is a minimalistic tool to retrieve text and other files from other computers over Network. Like HTTP, it allows user to navigate between different pages using so called selectors. But it has its own taste about content handling. Each element of the page must reside on its own line by design. This results in a nice uniformly structured text which can be navigated in a menu driven fashion.

HTML on its side allows to place HTML formatting tags right into text at arbitrary place with arbitrary nesting and combination. Also it allows to implement new tags with new fancy features without breaking everything else. HTML was open for add-ons and improvements. And that is why HTML wins the battle against Gopher.

Shortly HTML was accompanied with ECMAScript (or Javascript) that runs on client side and modify page content on the fly, and then CSS (Cascaded Style Sheet) that is used to fine-tune the fonts and colors of the page. Now it is an ultimate tool that can handle almost everything starting from a computer game or video-chat, and it continue to evolve, and no one knows where it stops.

Gopher did not evolve. It still transfer pure text to the user that run antique client program to view it. The good thing is that Gopher has little ads, no popups, no interactive content except selectors, and it is very optimized for old hardware. At the same time it is an obsolete protocol that lacks some essential things e.g. encryption.

[header] So, how do we fix it?

In 2019 anonymous hacker known as [Solderpunk] proposed a new protocol called Gemini. https://en.wikipedia.org/wiki/Gemini_(protocol)

The protocol is initially inspired by Gopher, but it is a bit different:

The thing works like so: user wants to read a page. He/She starts the client program. The program makes TCP connection to the server, that talks Gemini protocol, and make a request. Server accepts a selector line and then returns a page generated on the fly, and then close the TCP socket. Thus, one request - one page.

Well, that's it. As it was said, Gemini protocol adds constraints to the content, because it is a minimalistic tool. Hackers are advised not to hack around much and keep it as simple as it is now.

[header] No Certificate Authorities needed, it is just TOFU

Connection is encrypted with TLS. Each server has to provide a cryptographic certificate, that is used in X.509 key exchange.

If client is connecting for the first time, it remembers the certificate and automatically trust it. That's called Trust On First Usage (TOFU). This means that server owner can avoid dealing with Certificate Authorities, certificate chains and all this mess. Just generate a key on the server ... and you are done.

The same fingerprint of a server key ensures that the user is connected to the same server as before.

If the server fingerprint changes during time, user will get a warning. User can ignore the warning and continue to read the page. If in doubt, user can try to connect from different places (using proxy) to see if the server fingerprint changes (and thus revealing a man-in-the-middle attack). If user really cares, he/she can contact server owner and compare the fingerprint.

In a modern web there is a different scheme. Certificate Authorities make fingerprint checking for you. And you have to rely on CA's for secure web. If the site use self-signed certificate it will trigger a warning in the client. However in Gemini it is a normal thing.

[header] What's the point?

You may wonder, why there is another protocol. If modern web browsers will accommodate it, does it make them even heavier and slower?

Well, you do not have to run modern web browser to access gemini. That's the point. Gemini client starts much faster then the browser.

Given the simplicity of protocol, one can design a new client that will be fully functional, just for fun.

[header] Why the name Gemini?

When reffering to Gemini one have to explicitly say that it is about network protocol, because there are already many things called the same name. ( https://en.wikipedia.org/wiki/Gemini )

Gemini is themed around space travel. You will often see ascii-art depicting spacecrafts, aliens, other stuff.

[header] So, what have we got inside?

In order to view a page in Geminispace, you have to run a client that talk Gemini (This one https://github.com/skyjake/lagrange ), or use a gateway from the web. See this page to start with: https://portal.mozz.us/gemini/skyjake.fi/lagrange/getting_started.gmi

Many people write small blogs (Gemlogs) and homepages and make them accessible via Gemini. Small pages from tildespace are good to be mirrored to the gemini. (tilde.team for example)

Search engines (Kennedy, geminispace.info, TLGS)

Good idea is to capture data from the web and put it to the gemini. [jpfox] has set up a mirror of some sites including hackaday blog: gemini://jpfox.fr/ham/hackaday.com/

The sad thing about Gemini is that sites disappear at the same rate as they disappear in normal web. If you see something interesting in Geminispace, you can secure it using Wayback Machine. Wayback Machine does not see gemini url directly, but you can point it to gateway. Also, the search engines sometimes allow one to watch cached copy of a page.

Client will not load images by default. You have to select image link manually to open it.

ASCII-art is a thing, it is widely spread on Gemini. Being a part of the page, it will be always visible. Mostly used as a site logo. Did I say that Gemini is command line friendly?

[header] Take my identity

The weird part of TLS is that it allows not only the server, but the client to have a digital certificate too. This way user can prove to the server that he/she is the same user as before. Client program can generate such certificates, and it is called a Gemini user identity. User can use many different certificates for each site.

If designed right, it can be used to implement a chat room or a forum engine where each user can borrow a nickname, and certificate would be a key that gives access to that nickname.

Also, gemini cares about user privacy a lot. There is no cookies, no Javascript and no way server can maintain state for individual users except for the identity that must be turned on manually.

[header] I want to write a message for site owner in Gemini. What should I do?

Authors usually leave contacts on special page on their sites. This probably means e-mail address. Many authors also use distributed messangers (which are different each time).

Gemini does not solve the messaging automatically, one have to use some other means to contact the authors.

A convinient way would be a forum hosted on Gemini, which allows personal messages. As long as I know, there is no such thing yet (2022). Some gemini sites do have a guest book.

[header] Small internet

We are used to use internet services that are run by big corporations. Sometimes this means censorship and surveillance. I am not sure if it is a good or a bad thing.

Distributed crowd operated services create an environment where each user can communicate freely and securely. Also, distributed style makes the network stronger and less prone to failures. One can call such services a small internet.

Other projects that are decentralized are BitTorrent file sharing protocol, BitMessage messaging, Mastodon social network, Matrix messenger, you name it.

It would be really cool if deecentralized software meets dezentralized hardware stuff. There is Disaster Radio, Meshtastic, APRS and other mesh networks.

I do not think everybody should use small internet right away, but it always was here, for those who need it.

[header] Video

This guy explains very well what it is all about:

Like

Discussions