2021-10-18
vger/inetd/nginx on openbsd and Linux
Somewhat late to the show, but heck:
Today I pulled together all the ingredients to create a gemini server setup using vger. Using Solenes description I set the thing up on OpenBSD first. And after I understood the details, I managed to deploy the same setup on Debian 11 as well.
It is quite a stack:
- nginx will listen on port 1965 and receive requests. It will handle the tls/cert bits, and route the request in clear text on to port 11965
- inetd will listen on port 11965 and call vger piping the request to vgers stdin file handle.
- vger will then serve the request (/index.gmi for now) and output everything to stdout
- inetd will forward the answer
- nginx will forwart the answer
I can see the index.gmi file with emacs/elpher and gcat on port 1965, but I also can use printf and netcat on port 11965 bypassing all the tls bits and pieces:
me@home:~ 2 > printf "gemini://127.0.0.1/index.gmi\r\n" | netcat 127.0.0.1 11965 20 text/gemini; # vger on HOME system Just to say: yes, I can! ~ew
Yay!
Why? With this setup I can experiment with writing a small special purpose gemini server component while totally ignoring the tls bits and pieces. Thanks to Omar for pointing out the stdin/stdout feature of vger, thanks to Solene to make vger a reality!
Along the way I found out a number of things about my very first instance of OpenBSD:
- my pkg system seems broken somehow. I cannot list available packages any more. It did work initially. But being largely ignorant, I have no clue, where to start looking.
- where is /proc/$PID/fd?
- where is lsof?
- where is ip? Ok, ifconfig works.
- where is strace? oh, ktrace and kdump worked to tell me, what I had wrong (not enough worker threads!)
- bash-completion works, but only up to a point. Whether or not I like it remains undecided.
- rcctl is NOT systemctl :-)
It's small, which I like. On the other hand it's awkward for my finger habits, of course, but that had to be expected.
Life ain't no candy mountain, you know?
From the movie "Candy Mountain" :)
Cheers,
~ew