NAME
App::Phoebe::Spartan - implement the Spartan protocol for Phoebe
DESCRIPTION
This extension serves your Gemini pages via the Spartan protocol and generates a few automatic pages for you, such as the main page.
Warning! If you install this code, anybody can write to your site using the Spartan protocol. There is no token being checked.
To configure, you need to specify the Spartan port(s) in your Phoebe config file. The default port is 300. This is a priviledge port. Thus, you either need to grant Perl the permission to listen on a priviledged port, or you need to run Phoebe as a super user. Both are potential security risk, but the first option is much less of a problem, I think.
If you want to try this, run the following as root:
setcap 'cap_net_bind_service=+ep' $(which perl)
Verify it:
getcap $(which perl)
If you want to undo this:
setcap -r $(which perl)
Once you do that, no further configuration is necessary. Just add the following to your config file:
use App::Phoebe::Spartan;
The alternative is to use a port number above 1024. Here's a way to do that:
package App::Phoebe::Spartan;
our $spartan_port = 7000; # listen on port 7000
use App::Phoebe::Spartan;
If you don't do any of the above, you'll get a permission error on startup: "Mojo::Reactor::Poll: Timer failed: Can't create listen socket: Permission denied…"