summaryrefslogtreecommitdiff
path: root/README.md
blob: 512453c29d56d1f4fee176cb1fbbe6db8a1b3d55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Vault

Vault is an opinionated web-based file manager. It is built in C for OpenBSD around the CGI standard, following these main principles:

* __secure__: a great amount of time has been devoted to avoid undefined behaviour and security issues
* __simple__: browse, create and delete folders; download and upload files. JavaScript support is optional on the client side and its absence should be handled gracefully. Everything should work from a terminal-based web browser
* __fast__: with the server running on an ARM SBC, there should not be any noticeable delay when loading a page

It should also compile and run on any POSIX OS with minor modifications, although this has not been tested (yet).

## Configure

The parameters and their documentation are in the `config.h` source file. You should read and adjust this file as needed before you build. The default config assumes a chrooted web server and sets a data directory `/vault-data` (that is `/var/www/vault-data` outside of the chroot).

## Build & run

Vault comes with a Makefile:

    $ make
    # make install

The vault binary will be installed as `/var/www/cgi-bin/vault`. Static resources will be installed in `/var/www/vault-static` and should be served from `/static`. You need to configure your web server accordingly, see below for a sample file. If the log file does not exist, you need to create it. Here is how to do it for a default installation:

    # mkdir -p /var/www/var/log
    # touch /var/www/var/log/vault.log
    # chown www /var/www/var/log/vault.log

By default on OpenBSD, the `slowcgi(8)` daemon allows a timeout of 2 minutes for CGI programs. This might not be enough if you want to allow users to download large files. This timeout can be increased by changing the `slowcgi(8)` parameters in `/etc/rc.conf.local`, for example to allow up to 10 minutes :

    slowcgi_flags="-t 600"

## Sample httpd.conf

    server "server" {
	    listen on * port 80
	    connection timeout 540
	    location "/cgi-bin/vault/*" {
		    fastcgi
		    root "/"
	    }
	    location "/static/*" {
		    root "/vault-static"
		    request strip 1
		    gzip-static
	    }
    }