: asapien/signet

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 
47 
48 
# Include from /etc/lighttpd/lighttpd.conf:  include "lighttpd-signet.conf"
# Authelia sits in front (via nginx/reverse proxy upstream) and sets Remote-User / Remote-Groups.
# This config is served behind Authelia — all requests have already been authenticated.

server.modules += ( "mod_alias", "mod_fastcgi", "mod_webdav", "mod_setenv" )

server.max-request-size = 34000   # KiB; DAM/WebDAV policy is unchanged
# kcgi buffers whole requests: 32 MiB PDFs travel as authenticated 256 KiB chunks.
# Match all FastCGI prefixes, including unknown suffixes that still reach kcgi.
# Dense encodings allocate a kpair per few bytes; retain large fields via multipart.
$HTTP["url"] =~ "^/(api|pim-api)" {
    server.max-request-size = 16
    $REQUEST_HEADER["Content-Type"] =~ "(?i)^multipart/form-data[ \\t]*;" {
        server.max-request-size = 1100
    }
}

alias.url += (
    "/dam/" => "/var/www/dam/",
    "/pim/" => "/var/www/pim/",
)
# everything else is served from server.document-root = /var/www/signet

fastcgi.server += (
    "/api" => ((
        "socket"      => "/run/signet/api.sock",
        "check-local" => "disable",
    )),
    "/pim-api" => ((
        "socket"      => "/run/signet/pim.sock",
        "check-local" => "disable",
    )),
)

# DAM as a network drive.  Reads are open to any authenticated user (the
# browser needs seals and fonts); restrict writes at the proxy, e.g. an
# Authelia rule allowing PUT/DELETE/MKCOL/MOVE on /dam/ to the dam-admins group.
$HTTP["url"] =~ "^/dam/" {
    webdav.activate    = "enable"
    webdav.is-readonly = "disable"
    webdav.sqlite-db-name = "/var/lib/lighttpd/webdav.db"
    setenv.add-response-header = ( "Cache-Control" => "private, max-age=300" )
}

setenv.add-response-header += (
    "X-Content-Type-Options" => "nosniff",
    "Content-Security-Policy" => "default-src 'self'; img-src 'self' blob: data:; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:",
)