## State of Geomyidae. State of Geomyidae. Big Changes! by Christoph Lohmann <20h@r-36.net> ## Geomyidae Last version: 0.69 released in 19.09.2022. There is much that has changed! ## Common Changelog * Memory leaks fixed. * Error codes fixed. * Fix example scripts. * Snowman science evidence added. * See the repository. * Fix typos in the manpage. * Make geomyidae easier compile on BSD systems. * TLS connections now correctly work everywhere. * No lingering connections. * IPv6 now correctly works everywhere. * Code style fixes. ## Telemetry Support * Bitreich telemetry support in the Makefile added. $ make telemetry printf "/telemetry/geomyidae/installed\r\n" | nc bitreich.org 70 Thank you for using the bitreich telemetry service. Nothing is logged. You can trust us, we are not Google. ## BOB Support #!/bin/sh # # Don't drink and code. # Eval BOB! # # https://www.bob.be/ # # We want to create awareness of people writing code while being drunken. # See PHP or Ruby on Rails for how to not do it. You will end up in a # life of misery, where you cannot escape and need to keep going until # your pension with some ugly language, reinventing what has been done # before. Noone will remember you, since you write shit code and the next # hype kid replaced your idea with their own hype, rewriting what you # already did. ## BOB Support { awk -v "bob=1" \ 'BEGIN { print "cat </ { sub(/?>/,"\ncat < extra $a ## Rework of all path handling This took me 24 hours and a long 6 hour hacking session at Singapore Changi airport. Now the CGI enviroment variables contain what they are supposed to contain. The pathes work in chroot and normal mode. Requests can be now with no beginning slash. Thanks Bob for helping debugging this! ## There is now a unit tests framework Thanks Bob again! $ git clone git://bitreich.org/geomyidae-tests $ cd geomyidae-tests $ ./run.sh Pretty simple, thought out and easy to reuse for other daemons! ## Rework of CGI call arguments geomyidae(8): executable.[d]cgi $search $arguments $host $port $traversal \ $selector search = query string (type 7) or "" (type 0) arguments = string behind "?" in selector or "" host = server's hostname ("localhost" by default) port = server's port ("70" by default) traversal = remaining path from path traversal in REST case selector = raw selector or full req (See HTTP compatibility mode.) ## New more redable examples of REST logic geomyidae(8): The REST path handling If a client requests a path in a selector, which has no corre‐ sponding file or path found, geomyidae will try to traverse from the -b base path until a path component / directory is not found. Then geomyidae tries to find some index.dcgi or index.cgi file in the last existing directory. If this is found and the index files are executable, geomyidae will execute them using the traversal and TRAVERSAL parameter and environment variable being set to the rest path. Selector: /some/v1/service/add/something?args=value -> /some/v1/service exists -> /some/v1/service/index.dcgi exists -> /some/v1/service/index.dcgi "" "args=value" $host $port "/add/something" "/some/v1/service/add/something?args=value" is called ## New CGI environment variables and fixes geomyidae(8): GATEWAY_INTERFACE = `CGI/1.1' PATH_INFO = script which is executed PATH_TRANSLATED = absolute path with script which is executed QUERY_STRING = arguments (See above.) SELECTOR = raw selector REQUEST = raw selector TRAVERSAL = traversal (See above.) REMOTE_ADDR = IP of the client REMOTE_HOST = REMOTE_ADDR REQUEST_METHOD = `GET' SCRIPT_NAME = script which is executed SERVER_NAME = server's hostname SERVER_PORT = server's port SERVER_LISTEN_NAME = ip the server received the connection on SERVER_PROTOCOL = `gopher/1.0' SERVER_SOFTWARE = `geomyidae' X_GOPHER_SEARCH = search (See above.) SEARCHREQUEST = search (For backwards compatibility.) HTTPS and GOPHERS = set, if TLS is used ## SERVER_LISTEN_NAME * Used by the billion gopher project EXCLUSIVE PEEK into the billion gopher source code incoming. ## Billion Gopher Project #!/bin/sh serverlistenname="${SERVER_LISTEN_NAME}" newsubgopher="$(printf "%x\n" $RANDOM)" newgopher="$(printf "%x\n" $RANDOM)" ## Billion Gopher Project * Can you spot the address pun? case "${serverlistenname}" in 2a01:4f8:1c17:4885:686f:6c65:*) ;; *) cat << END A BILLION GOPHERS PROJECT People say, the web is big. People say, gopher is dying. THIS IS NOT TRUE! There are four billion gopherholes more out there now! And there is a hidden secret. Can you find it? [1|Begin here. (IPv6 required)||2a01:4f8:1c17:4885:686f:6c65:${newsubgopher}:${newgopher}|70] [1|<< back to bitreich.org||server|port] END exit 0 ;; esac ## Billion Gopher Project * Gopherspace is now bigger than the web! billiongopherprefix="2a01:4f8:1c17:4885:686f:6c65:" billiongopherpath="/br/gopher/billion-gophers" cd $billiongopherpath billiongopher="$(printf "%s\n" "${serverlistenname}" \ | cut -d':' -f 8)" billionsubgopher="$(printf "%s\n" "${serverlistenname}" \ | cut -d':' -f 7)" billionpath="${billionsubgopher}/${billiongopher}" mkdir -p "$billionpath" ## Billion Gopher Project # Here is the magic. if [ ! -e "$billionpath/index.gph" ]; then { printf "Welcome to gopher %s:%s of the billion gophers project!\n" \ "$billionsubgopher" "$billiongopher" printf "\n" printf "Maybe you find the hidden secret?\n" printf "[1|Maybe it is here?| |2a01:4f8:1c17:4885:686f:6c65:%s:%s|port]\n" \ "${newsubgopher}" "${newgopher}" printf "\n" printf "[1|See the project a bitreich.org| /billion-gophers|bitreich.org|70]\n" } > "$billionpath/index.gph" fi cat "$billionpath/index.gph" ## New HTTP compatibility geomyidae(8): HTTP compatibility For maximum flexibility in case someone sends a HTTP request to gopher, geomyidae supports a special case of CGI. See this exam‐ ple: Client request: GET /some/path HTTP/1.1 -> /GET exists and is executable -> /GET "" "" $host $port "" "GET /some/path HTTP/1.1" is called This allows for example simple scripts for icecast upload compat‐ ibility or handling transparent HTTP right next to gopher, get‐ ting TLS for free. See the brcon2023-hackathons repository for how we will work on this. ## All CGI scripts now support full bidirectional I/O When some CGI or DCGI script is executed, in TLS or non-TLS mode, the script will get full and raw write and read access with stdin and stdout attached to the client socket. mpg gophers://bitreich.org/9/radio/listen Or see gophers://bitreich.org/0/GET gophers://bitreich.org/0/PUT gophers://bitreich.org/0/SOURCE You can now theoretically implement every protocol over gopher. This gives us unlimited new possibilities! A bright future is there for us! ## New Release The new release will be v0.96. Yes, we are getting close to v1.0. But there is one bug report missing: * Evil_Bob has some TLS connection abort problem on OpenBSD with CGI scripts, I cannot reproduce. When this is fixed, there will be a release. ## Questions? Do you have questions? ## Thanks Thanks you for listening. For further suggestions, contact me at Christoph Lohmann <20h@r-36.net>