This documentation is no longer maintained. It may be out of date, or simply wrong. I will leave it online, as long as it think it may still be useful.
fnord is a small, fast and secure httpd. It is written and maintained by Felix von Leiter. fnord requires an inetd-like superdaemon, to accept TCP Connection. In this HOWTO, we will use tcpserver from the UCSPI-TCP Package, which was written by Dan Bernstein.
First, we need to compile and install fnord, and set it up as a plain http server. This step doesn't require OpenSSL or stunnel
# mkdir -p /etc/fnord/{log,env}
# mkdir /var/log/fnord
# chmod -R 700 /etc/fnord
# chown fnordlog.fnordlog /var/log/fnord
# cat <<'EOF' >/etc/fnord/run
#!/bin/sh
DOCROOT=`head -1 ./env/DOCROOT`
USER=`head -1 ./env/USER`
cd ${DOCROOT}
exec envuidgid ${USER} tcpserver -RHl localhost 0 80 /command/fnord-httpd 2>&1
EOF
# chmod 700 /etc/fnord/run
# cat <<'EOF' >/etc/fnord/log/run
#!/bin/sh
LOGUSER=`head -1 ../env/LOGUSER`
exec setuidgid ${LOGUSER} multilog t s1000000 /var/log/fnord
EOF
# chmod 700 /etc/fnord/log/run
# echo "fnord" > /etc/fnord/env/USER # echo "fnordlog" > /etc/fnord/env/LOGUSER # echo "/var/www" > /etc/fnord/env/DOCROOT
$ telnet localhost 80 GET / HTTP/1.0<return> <return> <!DOCTYPE html....
To setup fnord to provide https, you need an up and running plain http fnord.
Be aware that there are two methods on how to setup fnord using SSL. One is to use ucspi-ssl, or to use a patched version of ucspi-tcp. The patch can be found here. These two methods are a bit different. Specifics for each variant are marked in simple braces. For Example: (ucspi-ssl) or (patches ucspi-tcp)
# mkdir -p /etc/fnords/log # ln -s /etc/fnord/env /etc/fnords/ # mkdir /var/log/fnords # chmod -R 700 /etc/fnords # chown fnord.fnord /etc/fnords # chown fnordlog.fnordlog /var/log/fnords
openssl genrsa -out /etc/ssl/private/server.key 1024 openssl req -new -key /etc/ssl/private/server.key \ -out /etc/ssl/private/server.csr openssl x509 -req -days 365 -in /etc/ssl/private/server.csr \ -signkey /etc/ssl/private/server.key -out /etc/ssl/server.crt
# mv newcert.pem /etc/fnords/fnord-cert.pemOpen /etc/fnords/fnord-cert.pem using $EDITOR, and delete from
# mv newreq.pem /etc/fnords/fnord-key.pemAnd make sure that it only contains a RSA PRIVATE KEY section. (You will have to remove the CERTIFICATE REQUEST section).
-----BEGIN CERTIFICATE----- [ BASE 64 ] -----END CERTIFICATE-----
-----BEGIN RSA PRIVATE KEY----- [ BASE 64 ] -----END RSA PRIVATE KEY-----
# cat newcert.pem newreq.pem >> /etc/fnords/fnord-key.pem
# chmod 400 /etc/fnords/fnord-cert.pem /etc/fnords/fnord-key.pem
# echo /etc/fnords/fnords-cert.pem >/etc/fnords/env/CERTFILE
# echo /etc/fnords/dh1024.pem >/etc/fnords/env/DHFILE
# echo /etc/fnords/fnords-key.pem >/etc/fnords/env/KEYFILE
# cat <<'EOF' >/etc/fnords/run
#!/bin/sh
DOCROOT=`head -1 ./env/DOCROOT`
USER=`head -1 ./env/USER`
CONFDIR=`pwd`
cd ${DOCROOT}
exec envdir ${CONFDIR}/env/ envuidgid ${USER} sslserver -RHl localhost 0 443 /command/fnord-httpd 2>&1
EOF
# chmod 700 /etc/fnords/run
# echo /etc/fnords/fnords-key.pem >/etc/fnords/env/KEYFILE
# cat <<'EOF' >/etc/fnords/run
#!/bin/sh
DOCROOT=`head -1 ./env/DOCROOT`
USER=`head -1 ./env/USER`
KEYFILE=`head -1 ./env/KEYFILE`
cd ${DOCROOT}
exec tcpserver -u `id -u ${USER}` -g `id -g ${USER}` -n ${KEYFILE} -RHl localhost 0 443 /command/fnord-httpd 2>&1
EOF
# chmod 700 /etc/fnords/run
# cat <<'EOF' >/etc/fnords/log/run
#!/bin/sh
LOGUSER=`cat ../env/LOGUSER`
exec setuidgid ${LOGUSER} multilog t s1000000 /var/log/fnords
EOF
# chmod 700 /etc/fnords/run
# sslconnect 127.0.0.1 443 GET / HTTP/1.0<return> <return> <!DOCTYPE html....
If it does not work for you, and you get an error while loading the ssl cert, please check your permissions. Use setuidgid fnord cat /etc/fnords/fnords-key.pem for testing wheter your permissions are okay or not
fnord and fnords should be running smoothly now. If you have any questions or suggestions don't hesitate to contact me.
This document is public domain.