A paste-y journey - finding a pastebin candidate to use

· Savyasachee Jha ·

6 min read Original article ↗

I maintain the privatebin package and module in nixpkgs. I added the package, the module, the tests, and have kept up with changes for quite a while now. I use another service on my own server, though.

Pink, yellow and red sticky notes pinned to a grey board, the nearest ones handwritten, the rest blurred into the distance.
Photo by Patrick Perkins on Unsplash

The reason behind a private pastebin is simple. I'd like to share stuff with my friends (for example a draft blog post), sometimes with strangers (log outputs), and sometimes with my parents, who need nothing more than a link to click. I also self-host many of my own services, so adding a pastebin was trivial. But back during covid-19 lockdowns when I was thinking of hosting one on my own, the only self-hostable service I knew of was privatebin. I wasn't using nixos then, so hosting privatebin was as simple as putting the files inside a document root, revving up php-fpm, and pointing a domain at nginx.

Fast-forward a few years later when I'd discovered nixos and had decided to create a module for it. The experience of creating a php service module in nixos is generally more convoluted than for a few other languages, such as rust or go. Thankfully, I had been maintaining firefly-iii for a while by that point and was able to speed-run the whole thing.

But suddenly, I realised I'd reached a point in my life where I wanted as little PHP as possible in my stack. I'd been using tiny tiny rss, firefly-iii, and a few other PHP services at the time. The fact that I needed to set up both PHP-FPM and nginx for each was bothering me, and I started longing for monolithic, integrated services where I just had one binary to manage and care about.

But when I started shopping around, I realised that the ecosystem was fairly rich and privatebin was built for a case which I wasn't trying to solve.

Perfect secrecy

Privatebin is built for the case where the operator wants to have plausible deniability. Privatebin uses javascript in your browser to encrypt the contents of the paste so the server actually has no idea of the contents of your document. The URL you share has the key, so the decryption is transparent to the recipient, but privatebin ensures the key is never sent to the server, so the operator genuinely has no way of knowing what you've shared.

The downside was no ix.io style plain-curl pastes because the encryption happens client side.

Had I been running a server for dissidents in Iran, it would have been brilliant for my needs. However, my needs were more mundane, and removing PHP was higher in my list than a zero knowledge model.

That's when I landed on microbin. Microbin is written in rust (check), and simply needs a reverse proxy (check), and it can be used to share arbitrary files as well. I felt like I'd landed on the perfect answer to whatever I was searching for. I would get rid of the feature I didn't care about and gain access to an application which would allow me to share random files with people.

Interface design

Within a few weeks of using microbin, however, I started itching for a change. Microbin ticks most features a person could ask for. I didn't have to care about using another service for file sharing, it could burn a paste after a specified time period, and so on. Unfortunately, microbin was solving a problem I didn't have and introducing two major problems, one of them I didn't realise I would ever have.

It didn't look like a proper pastebin.

Microbin works well, but somehow the design of the interface was putting me off of using it. The first thing I expect to see on the screen in a pastebin is the text box where I would paste whatever I wanted. The first action on microbin's interface was asking me about expiration. Why would I care about expiration before I've pasted anything?

Secondly, microbin makes it awkward to use plain curl commands to send pastes.

And finally, while microbin allows me to share arbitrary files with people, I found that I wasn't really using microbin for arbitrary file sharing. I was using WhatsApp and iMessage for that.

Simplicity

I pretty much immediately switched back to privatebin at the time. I still kept a weather eye out for anything which would allow me to replace it, but I was resigned to being unable to do so.

Which is when i came across wastebin.

Simple, sqlite based, written in rust, and did nothing more than I needed. You can switch on (server-side) encryption with a password, or you can keep it off. The interface looks slick and asks you to identify the language you're posting in so whoever is reading gets proper syntax highlighting. Pasting from the command line works perfectly. The service is one simple binary. It won me over with little effort.

Selecting a pastebin

I'm quite comfortable with my current choice, it's a very nice pastebin and does whatever I need it for. There's a few other candidates I skimmed but ended up not checking out. They are (in no particular order):

  • Opengist - Self-hosted GitHub Gist: accounts, git-versioned snippets you can clone and push
  • rustypaste - Terminal-first file and paste uploads with curl, expiring and one-shot links
  • 0x0 - Drop a file or paste with curl and get a short link
  • fiche - The termbin approach: command | nc host 9999 from machines without curl
  • dpaste - Long-running pastebin for code snippets
  • Pastefy - Personal snippet manager with accounts and folders

I bet many of them are pretty great and well-maintained, it's just that a pastebin is somewhat incidental to my life and I didn't spend a lot of time to heavily optimise my choice. Opengist, for example, looks really nice and might persuade me to switch at some point. However, I remain happy with wastebin and will probably only touch this part of my setup when the urge to tinker manifests again.