diff --git a/mkfile b/mkfile index fdb2822..b74aaaf 100644 --- a/mkfile +++ b/mkfile @@ -15,9 +15,9 @@ install:V: partage partage-trash/partage-trash chmod 755 ${DESTDIR}${PREFIX}/bin/partage chmod 755 ${DESTDIR}${PREFIX}/bin/partage-trash mkdir -p ${DESTDIR}${MANDIR}/man1 - cp man/partage.1 ${DESTDIR}${MANDIR}/man1/partage.1 - cp man/partage-trash.1 ${DESTDIR}${MANDIR}/man1/partage-trash.1 - cp man/partage.conf.5 ${DESTDIR}${MANDIR}/man5/partage.conf.5 + cp partage.1 ${DESTDIR}${MANDIR}/man1/partage.1 + cp partage-trash/partage-trash.1 ${DESTDIR}${MANDIR}/man1/partage-trash.1 + cp partage.conf.5 ${DESTDIR}${MANDIR}/man5/partage.conf.5 chmod 644 ${DESTDIR}${MANDIR}/man1/partage.1 chmod 644 ${DESTDIR}${MANDIR}/man1/partage-trash.1 chmod 644 ${DESTDIR}${MANDIR}/man5/partage.conf.5 diff --git a/partage-trash/partage-trash.1 b/partage-trash/partage-trash.1 new file mode 100644 index 0000000..a08eefd --- /dev/null +++ b/partage-trash/partage-trash.1 @@ -0,0 +1,41 @@ +.Dd 2021-11-03 +.Dt PARTAGE-TRASH 1 +.Os POSIX.1-2017 +.Sh NAME +.Nm partage-trash +.Nd Purge expired share files +.Sh SYNOPSIS +.Nm partage-trash +.Op Fl v +.Op Fl f Ar files +.Op Fl m Ar metadata +.Sh DESCRIPTION +Upon each run, +.Nm +will check expiration times for files in the +.Pa metadata +directory, and delete the according file in the +.Pa files +directory if the expiration time has passed. +.Pp +.Nm +is best run as a +.Xr cron 8 +job, as the same user as the +.Xr partage 1 +daemon. +.Bl -tag -width Ds +.It Fl v +Turn on verbose logging to +.Pa stderr +.It Fl f Ar files +Set the location of actual files to +.Pa files +.It Fl m Ar metadata +Lookup metadata files in directory +.Pa metadata +.El +.Sh SEE ALSO +.Xr partage 1 +.Sh AUTHOR +.An Willy Goiffon Aq Mt dev@z3bra.org diff --git a/partage.1 b/partage.1 new file mode 100644 index 0000000..dab9f29 --- /dev/null +++ b/partage.1 @@ -0,0 +1,33 @@ +.Dd 2021-11-03 +.Dt PARTAGE 1 +.Os POSIX.1-2017 +.Sh NAME +.Nm partage +.Nd HTTP based file upload system +.Sh SYNOPSIS +.Nm partage +.Op Fl v +.Op Fl f Ar file +.Sh DESCRIPTION +.Nm +is an HTTP server that permits temporary file uploads using PUT and +POST requests. +.Pp +Files uploaded are saved in a single directory and given random names +while retaining their original extension. +A configurable expiration time is set for each file, that can be used +to cleanup expired files thanks to +.Xr partage-trash 1 . +.Bl -tag -width Ds +.It Fl v +Turn on verbose logging to +.Pa stderr +.It Fl f Ar file +Load configuration from +.Pa file +.El +.Sh SEE ALSO +.Xr partage-trash 1 , +.Xr partage.conf 5 +.Sh AUTHOR +.An Willy Goiffon Aq Mt dev@z3bra.org diff --git a/partage.conf.5 b/partage.conf.5 new file mode 100644 index 0000000..aca79a9 --- /dev/null +++ b/partage.conf.5 @@ -0,0 +1,91 @@ +.Dd 2021-11-03 +.Dt PARTAGE.CONF 5 +.Os POSIX.1-2017 +.Sh NAME +.Nm partage.conf +.Nd partage configuration file format +.Sh DESCRIPTION +.Nm +is the configuration file for the HTTP file sharing system, +.Xr partage 1 . +.Sh CONFIGURATION +Here are the settings that can be set: +.Bl -tag -width Ds +.It Ic listen Ar socket +Have the program listen on +.Ar socket . +This socket can be specified either as a TCP socket: +.Ar host:port +or as a Unix socket: +.Ar /path/to/partage.sock . +When using Unix sockets, the program will serve content using the +.Em FastCGI +protocol. +.It Ic user Ar user +Username that the program will drop privileges to upon startup. When +using Unix sockets, the owner of the socket will be changed to this user. +.It Ic group Ar group +Group that the program will drop privileges to upon startup (require that +.Ic user +is set). When using Unix sockets, the owner group of the socket will be +changed to this group. +.It Ic chroot Pa dir +Directory to chroot into upon startup. When specified, all other path +must be set within the chroot directory. +.It Ic baseuri Ar uri +Base URI to use when constructing hyper links. +.It Ic rootdir Pa dir +Directory containing static files. +.It Ic tmplpath Pa dir +Directory containing template files. +.It Ic filepath Pa dir +Directory where uploaded files must be written to. +.It Ic metapath Pa dir +Directory where metadata for uploaded files will be saved. +.It Ic filectx Pa context +URI context to use for serving files. +.It Ic maxsize Ar size +Maximum size per file to accept for uploads. +.It Ic expiry Ar time +Default expiration time to set for uploads. +.El +.Sh EXAMPLE +Configuration suitable for use with +.Xr httpd 8 +using fastcgi: +.Bd -literal -offset indent +listen = /run/partage.sock +baseuri = https://domain.tld +user = www +group = daemon +chroot = /var/www +rootdir = /htdocs/static +filepath = /htdocs/files +metapath = /htdocs/meta +tmplpath = /htdocs/templates +filectx = /d/ +maxsize = 10737418240 # 10 Gib +expiry = 86400 # 24 hours +.Ed + +Mathing +.Xr httpd.conf 5 +configuration: +.Bd -literal -offset indent +server "domain.tld" { + listen on * tls port 443 + connection { max request body 10737418240 } + location "*" { + fastcgi socket "/run/partage.sock" + } +} +types { include "/usr/share/misc/mime.types" } +.Ed + +.Sh SEE ALSO +.Xr partage 1 , +.Xr partage-trash 1 , +.Xr httpd 8, +.Xr httpd.conf 5 +.Sh AUTHORS +.An Willy Goiffon Aq Mt dev@z3bra.org