Pastebin

Documentation
Login
PASTEBIN(1)                                                        PASTEBIN(1)

NAME
     pastebin – Simplistic web pastebin

SYNOPSIS
     pastebin configfile

DESCRIPTION
     pastebin is a simple web pastebin, that can be used in HTTP or CGI mode.
     People can post without any restriction (except a size limit).

     An API, accessible via an API key, let the administrator manage the
     pastebin (purge old pastes, list pastes, delete a single paste).

CONFIGURATION FILE
     pastebin configuration file is made of key/value pairs:

   pasteurl
     Specify the base url of this pastebin server (required). This value is
     used to generate valid pastes URL. When pastebin is used behind an http
     proxy, the public URL should be specified here.

     Example:
           pasteurl: https://domain.test/pastebin

     Using the value above, the pastes URL will have the following form:
           https://domain.test/pastebin/e2bd5143bd

     And the administator API will be available as:
           https://domain.test/pastebin/api/...

   dbpath
     Specify the location of the sqlite3 database (required). The database is
     created automatically if not present.

     Example:
           dbpath: /var/db/pastebin.sqlite3

   sizelimit
     Specify the POST size limit in bytes. If this value is missing, POST are
     unlimited. The value can have a K or M suffix to specify a size in Kilo
     or Mega bytes.

     Example:
           sizelimit: 10M

   apikey
     API key to access the admin API. The key should be at leat 10 characters
     long. If this field is missing, the admin API is disabled.

     Example:
           apikey: 810a5bdaaf

   httpport
     Specify the port to bind for HTTP connections. If the value is 0,
     pastebin work in CGI mode. Default value is 8080.

     Example:
           httpport: 80

SAMPLE HTTP CONFIG
     Here goes a complete configuration in HTTP mode:

           $ cat pastebin.cfg
           pasteurl: https://domain.test/pastebin
           dbpath: /var/db/pastebin.sqlite3
           apikey: 810a5bdaaf
           sizelimit: 10M

     And the pastebin server can be started this way:

           $ pastebin pastebin.cfg

SAMPLE CGI CONFIG
     A CGI script can be setup in a single file, using pastebin as a shebang
     interpreter, and the rest of the file for configuration pragmas:

           $ cat pastebin.cgi
           #!/usr/local/bin/pastebin
           pasteurl: https://domain.test/pastebin.cgi
           dbpath: /var/db/pastebin.sqlite3
           apikey: 810a5bdaaf
           sizelimit: 10M
           httpport: 0

     Then, a web server has to be configured to serve this CGI script.

USAGE
     The pastebin can be used from a web browser:

           $ firefox https://domain.test/pastebin

     or from the command line:

           $ curl -F 'data=<-' https://domain.test/pastebin < image.jpg
           https://domain.test/pastebin/1bbe793662

ADMIN API
     Pastebin provide a small API to manage pastes.

   <pasteurl>/api/list
     List pastes in JSON format.

     Example:

           $ curl -d apikey="810a5bdaaf" https://domain.test/pastebin/api/list
           [
             {
               "url": "https://domain.test/pastebin/46dbac46ae",
               "inserttime": "2019-10-28T15:38:10Z",
               "mimetype": "text/plain; charset=UTF-8"
             },
             {
               "url": "https://domain.test/pastebin/1085a72014",
               "inserttime": "2019-11-04T12:45:10Z",
               "mimetype": "application/json"
             }
           ]

   <pasteurl>/api/purge/<ndays>
     Purge pastes older than <ndays> days.

     Example:

           $ curl -d apikey="810a5bdaaf" https://domain.test/pastebin/api/purge/10

   <pasteurl>/api/del/<pasteid>
     Delete a single paste. The <pasteid> argument must be the 10
     characters hexadecimal value assigned to a paste.

     Example:

           $ curl -d apikey="810a5bdaaf" https://domain.test/pastebin/api/del/1085a72014

AUTHOR
     Gerome Fournier <jef@foutaise.org>.

                                 November 2019