Commit Briefs

97996b0baa Murilo Ijanc

Rename wp to wop (main)


1396fea0b2 Murilo Ijanc

Use local time instead of UTC for footer date


b38936bbf8 Murilo Ijanc

Add CGI search, security hardening, and pledge/unveil support

Add built-in CGI mode with INDEX.txt search, url_decode, and result limiting. Harden against XSS, path traversal, NUL injection, field injection, and javascript: URIs. Use pledge(2) and unveil(2) on OpenBSD to restrict filesystem access and syscalls.



Branches

Tags

This repository contains no tags

Tree

.gitignorecommits | blame
.rustfmt.tomlcommits | blame
LICENSEcommits | blame
Makefilecommits | blame
README.mdcommits | blame
assets/
wop.1commits | blame
wop.rscommits | blame

README.md

wop - where OpenBSD ports
========================
wop generates a static HTML site for browsing OpenBSD ports.
No JavaScript, works in lynx. Includes built-in CGI search.

Requirements
------------
- rustc

Building
--------
Edit Makefile to match your local setup (wop is installed
into the /usr/local/bin namespace by default).

Afterwards enter the following command to build and install
wop (if necessary as root):

    make
    make install

Running
-------
    wop -p /usr/ports -o /var/www/htdocs/ports

Options:
  -p portsdir   path to ports tree (default: /usr/ports)
  -o outdir     output directory (default: ./site)
  -d dump       use dump-vars output instead of parsing Makefiles

Search
------
wop has built-in CGI support. When the QUERY_STRING environment
variable is set, wop acts as a CGI program: it reads INDEX.txt
from the current directory and returns search results as HTML.

The search matches port names, descriptions, and maintainers.

CGI setup with httpd(8)
-----------------------
Generate the site:

    wop -p /usr/ports -o /var/www/htdocs/ports

Copy the binary and INDEX.txt into the chroot:

    cp /usr/local/bin/wop /var/www/cgi-bin/search.cgi
    cp /var/www/htdocs/ports/INDEX.txt /var/www/cgi-bin/INDEX.txt

OpenBSD does not support static binaries. Copy the required
shared libraries into the chroot:

    mkdir -p /var/www/usr/lib /var/www/usr/libexec
    cp /usr/lib/libc.so.* /var/www/usr/lib/
    cp /usr/lib/libm.so.* /var/www/usr/lib/
    cp /usr/lib/libpthread.so.* /var/www/usr/lib/
    cp /usr/lib/libc++abi.so.* /var/www/usr/lib/
    cp /usr/libexec/ld.so /var/www/usr/libexec/

Configure httpd.conf(5):

    server "ports.example.com" {
        listen on * port 80
        root "/htdocs/ports"
        location "/search.cgi" {
            fastcgi socket "/run/slowcgi.sock"
            root "/"
        }
    }

Enable and start slowcgi(8):

    rcctl enable slowcgi
    rcctl start slowcgi
    rcctl reload httpd

License
-------
ISC - see LICENSE.