SPACECOOKIE(1)
β¨ SPACECOOKIE(1) β¨
okay bestie, so this is the manual page for spacecookie from the General Commands Manual β and honestly? it's giving iconic gopher daemon energy π
πΈ NAME πΈ
spacecookie β a gopher server daemon, no cap π¦
π SYNOPSIS π
spacecookie [--version] config.json
π DESCRIPTION π
okay so picture this: spacecookie is literally a simple-to-use gopher daemon for serving static files. it's either invoked with the --version flag to print its version (vibe check: passed β¨) or with the path to its config file as the single argument. the minimal config file needs to tell spacecookie about the directory to serve and the server's name β i.e. the hostname or IP address the server is reachable through. all the configuration options, the format, and default values are explained in spacecookie.json(5), iykyk π
on startup, spacecookie will check if it has been started with systemd socket activation. if that's true, it will use the socket passed from systemd; if not, it will set up the socket itself. after that it will call setuid(2) to switch to a less privileged user if configured to do so, and then start accepting incoming gopher requests on the socket. note that using socket activation eliminates the need for starting as a privileged user in the first place because systemd will take care of the socket β main character energy from systemd, honestly π the systemd integration is explained in more detail in its own section.
spacecookie will not fork itself to the background or otherwise daemonize β which can, however, be achieved using a supervisor. logs are always written to stderr and can be collected and rotated by another daemon or tool if desired. it's lowkey giving "I don't do drama, I just log" π
incoming requests are filtered: no files or directories outside the served directory or that start with a dot may be accessed by clients. allowed files are returned to clients unfiltered. for directories, spacecookie checks if they contain a .gophermap file: if they contain one, it is used to generate the directory response; otherwise one is generated automatically, which involves guessing all file types from file extensions. the default file type is '0', text file. the file format of the .gophermap files and its use are explained in spacecookie.gophermap(5) ποΈ
π¦ SYSTEMD INTEGRATION π¦
spacecookie optionally supports two systemd-specific features: it acts as a notify type service and supports socket activation. periodt.
if you are writing a systemd.service(5) file, be sure to use the 'Type=notify' directive which allows spacecookie to tell systemd when it has finished starting up and when it is stopping before actually exiting. it's literally keeping systemd in the loop, bestie π«Ά
for socket activation, create a systemd.socket(5) file that starts the spacecookie service. this has several advantages: for one, it allows starting spacecookie on demand only and reducing the load on server startup. additionally it means that the daemon doesn't ever need to be started as root because it won't need to set up a socket bound to a well-known port. slay π
mind the following points when configuring socket activation:
- the port set in the
systemd.socket(5)file must match the port configured inspacecookie.json(5)β οΈ - the socket set up by
systemd(1)must use the IPv6 address family and the TCP protocol. it is recommended to always set'BindIPv6Only=both'insystemd.socket(5). to listen on an IPv4 address only, you can use an IPv6 socket with a mapped IPv4 address π - as always, the hostname setting must match the public address or hostname the socket is listening on π
make sure to check your socket configuration settings carefully sincespacecookiedoesn't run any sanity checks on the socket received fromsystemd(1)yet. not me warning you to double-check your work π
an example systemd.service(5) and systemd.socket(5) file are provided in the spacecookie source distribution in the etc directory π
π₯ SEE ALSO π₯
spacecookie.json(5)β the config file lorespacecookie.gophermap(5)β gophermap format explainedsystemd.service(5)β systemd service unit realnesssystemd.socket(5)β systemd socket unit vibes
for writing custom gopher applications using the spacecookie library, refer to the API documentation: https://hackage.haskell.org/package/spacecookie π
β STANDARDS β
by default, spacecookie always behaves like a gopher server as described in RFC1436: https://tools.ietf.org/html/rfc1436. fr fr, that's the standard.
however, users can configure spacecookie to utilize common protocol extensions like the 'h' and 'i' types and URLs to other protocols: http://gopher.quux.org:70/Archives/Mailing%20Lists/gopher/gopher.2002-02%7C/MBOX-MESSAGE/34 π§
π AUTHORS π
spacecookie has been written and documented by sternenseemann, sterni-spacecookie@systemli.org. iconic behavior, honestly π
π SECURITY CONSIDERATIONS π
spacecookie supports no mitigations or attack surface reduction measures other than automatically switching to a less privileged user after binding. it is recommended to use this feature and to make use of containering or sandboxing like, for example, systemd.exec(5) supports. protect yourself bestie π‘οΈ
TLS-enabled gopher, like the 'gophers://' protocol supported by curl(1), is not natively supported by spacecookie at this time. sorry, no encrypted gopher era just yet π
β¨ sending love from the Debian fam on $Mdocdate$ β signed, SPACECOOKIE(1) πππ¦
π¦ where this page comes from
- nixos 26.05: spacecookie 1.1.0.1
- nixpkgs unstable: spacecookie 1.1.0.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms