prospero(8)             FreeBSD System Manager's Manual            prospero(8)

NAME
     Prospero - Minimal Event-Driven HTTPS/1.1 Server

SYNOPSIS
     prospero -r <server-root> -f <config-file> [-i <interface> -p <port> -q <queue-size> -m <max-conns> -u <user> -g <group>]

DESCRIPTION
     Prospero is a minimal, secure, event-driven web server.  Prospero serves
     files and does WebSocket and SCGI forwarding for a single hostname.

   PROSPERO SUPPORTS:
     o   IPv4 and IPv6 connections.

     o   TLS encrypted connections ONLY, with:

         o   TLS >= 1.0

         o   Session resumption.

         o   Perfect forward secrecy.

     o   HEAD, GET, and POST request methods.

     o   HTTP/1.1 persistent connections.

     o   A custom pipelining extension described in caliban.8

     o   Graceful stops.

     o   WebSocket forwarding for a single local WebSocket server listening on
         a UNIX socket.

     o   SCGI forwarding for a single local SCGI application server listening
         on a UNIX socket.

   PROSPERO DOES NOT SUPPORT:
     o   Name-based virtual hosting.

     o   HTTP/2.

     o   CGI.

     o   Access authentication.

     o   Content negotiation beyond "If-Modified-Since", and "If-Unmodified-
         Since".

     o   Transaction logging.

     o   Etags

     o   Directory listings.

     o   The ~user notation in URLS.

   SYSTEM CONFIGURATION
     By default, FreeBSD limits each process to a low number of maximum
     simultaneously open descriptors.  This places a limit on the number of
     connections prospero may multiplex.  Set these values at the command-line
     with the "sysctl" utility, or enable them permanently by placing these
     lines in /etc/sysctl.conf on the host machine.  Your system will complain
     about these values if it lacks resources.

     kern.maxfiles=262144
     kern.maxfilesperproc=131072
     kern.kq_calloutmax=131072

   CROSS-ORIGIN REQUESTS
     Prospero rejects requests with "Host" header lines that do not specify
     the host for which prospero is configured to serve content.  This
     prevents third parties from pointing their domains to your server.

     Prospero rejects requests with "Referer" or "Origin" header lines that do
     not match prospero's hostname unless the requested resources' filenames
     end in .html, .tgz, .txz, or .gz.  This prevents third party web pages
     from linking to resources on your host except for web pages and archives.

   CONTENT TYPES
     Files served by prospero reside in the directory specified by the -r
     option.  Files must be owned by the user specified by the -u option or be
     in the group specified by the -g option.  Files must be readable by the
     user or group.  Note that prospero refuses to serve files owned by
     another user and group even if the files are world-readable.

     Only the following filename suffix mappings are recognized:

     html     text/html; charset=utf-8
     css      text/css,
     js       application/x-javascript

     ttf      font/opentype
     otf      font/opentype
     appcache text/cache-manifest
     txt      text/plain; charset=utf-8

     png      image/png
     jpg      image/jpeg
     gif      image/gif
     ico      image/vnd.microsoft.icon
     svg      image/svg+xml

     gz       application/x-gzip
     tgz      application/x-compressed
     zip      application/zip
     pdf      application/pdf
     mp3      audio/mpeg

     To be able to restart on signals and bind to port 443, the prospero
     executable is installed setuid root and executable by user and group.
     For restarting to work, you need to manually chgrp(1) the executable into
     the same group you specify with the -g option.

     When waiting for a request, prospero drops connections after 10 seconds
     of inactivity.

   PROSPERO CONFIGURATION
     Prospero writes its pid into /var/run/prospero.pid if it can (ie., it is
     started as root).  You stop prospero with a SIGTERM and restart it with a
     SIGHUP.

     A rc.d script is installed in /usr/local/etc/rc.d/.  Add the following
     lines to /etc/rc.conf to start prospero on system boot.  Replace the
     items in brackets with values appropriate for your system.  These are the
     minimal set of options you should start with.  The available options are
     described in full at the end of this manual page.

     prospero_enable="YES"
     prospero_flags="-r <server-root> -f <config-file> -u <user> -g <group>"

     Start, stop, or restart prospero, or determine if it is running with the
     following commands.

     /usr/local/etc/rc.d/prospero start
     /usr/local/etc/rc.d/prospero stop
     /usr/local/etc/rc.d/prospero restart
     /usr/local/etc/rc.d/prospero status

     If you do not want prospero started on system start, set

     prospero_enable="NO"

     and use the following commands.

     /usr/local/etc/rc.d/prospero forcestart
     /usr/local/etc/rc.d/prospero forcestop
     /usr/local/etc/rc.d/prospero forcerestart
     /usr/local/etc/rc.d/prospero forcestatus

   PERCENT ESCAPES
     In the resource names of requests, prospero converts every sequence of
     bytes consisting of a percent sign followed by two hexadecimal digits
     into the byte specified by the hexadecimal value.  Whitespace,
     semicolons, and percent signs must all be percent-escaped to be
     recognized in resource names.

   COMPOUND REQUESTS WITH PIPELINED RESPONSES
     Prospero recognizes compound requests as described the caliban.8 manual
     and delivers pipelined responses to those requests.

   TLS CONFIGURATION
     The TLS configuration is described with a text file.  The -f command line
     option must be set to the filename of the configuration file.  The file
     must contain 6 newline-terminated lines of text.  The lines describe, in
     order:

     1.   The hostname for which Prospero serves content.  This line may be
          blank to cause the server to take the hostname from the system
          hostname.  In requests, prospero recognizes the hostname with or
          without the "www" subdomain.  Do not include the "www" subdomain in
          the hostname.  In addition to the hostname, prospero recognizes the
          IP addresses of listening interfaces.

     2.   The absolute path to the file containing the server's TLS key.

     3.   The TLS key password.  This line can be blank if there is no
          password.

     4.   The absolute path to the file containing the TLS certificate chain.

     5.   The absolute path to the UNIX socket for the WebSocket Server.  This
          line can be blank if no WebSocket service is available.

          To be recognized as a WebSocket upgrade, the requested resource must
          begin with the path: /websocket/

          When a client initiates a WebSocket upgrade, prospero performs the
          WebSocket handshake and then connects to the WebSocket server.
          Propero ignores Sec-WebSocket-Protocol headers.  Clients must NOT
          specify a protocol, or handshakes may not complete successfully with
          all browsers.  Prospero then sends to the WebSocket server the
          content of the Cookie header line submitted with the upgrade
          request.  The cookie is terminated with a single newline.  The
          cookie line is empty if the client did not submit a Cookie header.
          From then on, prospero transfers data back and forth between the
          WebSocket server and the client.  The client and WebSocket server
          are responsible for framing and unframing data.

     6.   The absolute path to the UNIX socket for the SCGI application
          server.  This line can be blank if no SCGI service is available.

          To be recognized as an SCGI request, a request must begin with the
          path: /scgi/

          The following environment variables are set for the SCGI server:

          CONTENT_TYPE
          CONTENT_LENGTH
          REQUEST_METHOD
          QUERY_STRING
          SCRIPT_NAME
          HTTP_REFERRER
          HTTP_ORIGIN
          HTTP_COOKIE
          REMOTE_ADDR

          Prospero does not pass on every response header line generated by
          the SCGI application.  Prospero plucks out the content of the:

          Content-Type
          Content-Length
          Content-Disposition
          Cache-Control
          Location
          Set-Cookie x 5

          header lines and formats its own response header.  Only the
          "Content-Type" header line is necessary.  If it is missing, Prospero
          inserts "Content-Type: text/plain; charset=utf-8" into the response
          header.

          Responses from the SCGI server that contain a "Location" header line
          are formatted into "303 see other" responses.  Those responses must
          not contain bodies.  All other SCGI server responses are formatted
          into "200 OK" responses and must contain bodies.  This means that
          error messages must be delivered to the client as HTML.

   COMMAND-LINE OPTIONS
     The following options are recognized.

     -f  The -f option is mandatory and specifies the TLS configuration file.

     -r  The -r option is mandatory and specifies the server root directory.
         The root resource must be named "index.html".  Requests for paths
         that end in the directory separator are interpreted as requests for
         "index.html" in the directories specified by those paths.

     -m  The -m option specifies the maximum number of simultaneous
         connections that prospero services.  If not set, prospero maintains
         no more than 50000 simultaneous connections.

     -p  The -p option specifies the port to listen on.  This defaults to 443.

     -i  The -i option limits prospero to accepting connections only from a
         specified interface.  Supply the IP address of the desired interface
         as argument.  By default, prospero accepts connections on all
         interfaces capable of IPv4 or IPv6.

     -q  The -q option sets the number of incoming connections queued by the
         operating system for the server.  The queue defaults to 2048
         connections.  increasing this value may help the server cope with
         high demand if the server is dropping connections.

     -u

     -g  The -u and the -g options specify the user and group of prospero
         server processes.  If not specified, both values default to "nobody".

     -x  The -x option prevents prospero from becoming a daemon.  Prospero
         runs in the foreground of the terminal where it was started and is
         stopped with signals (ie., Control-C).  When the -x option is
         present, prospero does not write its pid to /var/run/prospero.pid.

AUTHORS
     James Bailie <jimmy@mammothcheese.ca>
     http://www.mammothcheese.ca

                               February 23, 2017