Revisions based on feedback from Stuart: - Revert logging (DEBUG=1 isn't useful for upstream anyhow) - Revise README to make commands easier to copy/paste, and other fixes - Add section on rebuilding with effective debugging levels and notes on creating the log file
--Aaron On 2020-14-10 22:07 +0100, Stuart Henderson <[email protected]> wrote: > On 2020/10/14 14:38, Aaron Poffenberger wrote: > > + chown www:www ${WRKINST}${VARBASE}/www/logs/kcaldav-system.log > > chown is a noop here (builds are done as non-root) > > or, seeing as users need to follow the pkg-readme for setup anyway, > tell them to do it there. Removed, commented in README. > > + $ doas chmod 640 /var/www/caldav/kcaldav.db > > pkg-readmes are mixed, but for something like this which is > likely to be largely copy-and-pasted it's easier without the prefix Fixed throughout. > > + Remember to enable and start slowcgi(8). See rcctl(8). > > might as well show the rcctl commands? Done > > + > > kcaldav.cgi uses http authentication for user security. > > Install a tls certificate to ensure privacy of connection. > > + See ssl(8) for details. > > "tls certificate" nitpicking that should X.509 certificate, > and ssl(8) is not really helpful for the common case where somebody > just uses a letsencrypt client - might be better to say something > like this and leave it at that? needs more than just a certificate > installing, and the exact details depends on the type of webserver. > > kcaldav.cgi uses http authentication for user security. > Make sure your web server is configured to use https to ensure > privacy of connection. Done > > User Quick Start > > ================ > > - Users can manage their account settings, create calendars > > + Users can manage their account settings, create calendars, > > and find the URL for use with their calendar application > > - by browsing to: https://localhost/kcaldav/home.html > > + by browsing to: > > + > > + https://example.org/kcaldav/home.html > > + > > + The URL will look like: > > + > > + https://example.org:/cgi-bin/kcaldav/<username>/ > > + > > stray : ? probably breaks some client or other ;) This one perplexed me also. The kcaldav user page has that syntax. My client normalized the url to remove the colon, so I removed it from the example as well. --Aaron Index: Makefile =================================================================== RCS file: /cvs/ports/www/kcaldav/Makefile,v retrieving revision 1.17 diff -u -p -r1.17 Makefile --- Makefile 1 Feb 2020 20:44:16 -0000 1.17 +++ Makefile 14 Oct 2020 22:14:11 -0000 @@ -2,8 +2,7 @@ COMMENT = a simple, safe, and minimal CalDAV server -DISTNAME = kcaldav-0.1.11 -REVISION = 0 +DISTNAME = kcaldav-0.2.0 CATEGORIES = www HOMEPAGE = https://kristaps.bsd.lv/kcaldav/ @@ -13,7 +12,7 @@ MAINTAINER = Aaron Poffenberger <akp@hy PERMIT_PACKAGE = Yes # "make port-lib-depends-check" can help -WANTLIB += c expat m sqlite3 pthread +WANTLIB += c expat m sqlite3 MASTER_SITES = https://kristaps.bsd.lv/kcaldav/snapshots/ EXTRACT_SUFX = .tgz @@ -21,21 +20,18 @@ EXTRACT_SUFX = .tgz BUILD_DEPENDS = www/kcgi LIB_DEPENDS = databases/sqlite3 -CONFIGURE_STYLE = simple -USE_GMAKE = Yes -CONFIGURE_ARGS = CPPFLAGS="-I${LOCALBASE}/include" \ - LDFLAGS="-L${LOCALBASE}/lib" - FAKE_FLAGS = PREFIX=${WRKINST}${TRUEPREFIX} \ HTDOCSPREFIX=${VARBASE}/www/htdocs/kcaldav \ CGIPREFIX=${VARBASE}/www/cgi-bin \ CALPREFIX=${VARBASE}/www/caldav -# no doc on how to run tests -NO_TEST = Yes +CONFIGURE_STYLE = simple +CONFIGURE_ARGS = CPPFLAGS="-I${LOCALBASE}/include" \ + LDFLAGS="-L${LOCALBASE}/lib" ALL_TARGET = all libkcaldav.a INSTALL_TARGET = install installcgi +TEST_TARGET = regress post-install: ln -s kcaldav ${WRKINST}${VARBASE}/www/cgi-bin/kcaldav.cgi Index: distinfo =================================================================== RCS file: /cvs/ports/www/kcaldav/distinfo,v retrieving revision 1.6 diff -u -p -r1.6 distinfo --- distinfo 17 Nov 2019 09:28:23 -0000 1.6 +++ distinfo 14 Oct 2020 16:59:33 -0000 @@ -1,2 +1,2 @@ -SHA256 (kcaldav-0.1.11.tgz) = kdhMkW/oZWZemKDP+eSmDzqYB5nH9Pj2Rj2bhLeVerk= -SIZE (kcaldav-0.1.11.tgz) = 91960 +SHA256 (kcaldav-0.2.0.tgz) = ajCsg1iuhu33r7YG1dXXKFzVsQYxTbtz8zqLmChTyvQ= +SIZE (kcaldav-0.2.0.tgz) = 291932 Index: patches/patch-Makefile =================================================================== RCS file: /cvs/ports/www/kcaldav/patches/patch-Makefile,v retrieving revision 1.6 diff -u -p -r1.6 patch-Makefile --- patches/patch-Makefile 1 Feb 2020 20:44:16 -0000 1.6 +++ patches/patch-Makefile 15 Oct 2020 00:13:07 -0000 @@ -1,25 +1,14 @@ -$OpenBSD: patch-Makefile,v 1.6 2020/02/01 20:44:16 jung Exp $ +$OpenBSD$ Index: Makefile --- Makefile.orig +++ Makefile -@@ -27,8 +27,8 @@ HTDOCS = /kcaldav - - # This is the file-system directory of HTDOCS. - # I'm pretty sure you want to override this... --HTDOCSPREFIX = /var/www/vhosts/www.bsd.lv/htdocs/kcaldav --#HTDOCSPREFIX = /var/www/htdocs -+#HTDOCSPREFIX = /var/www/vhosts/www.bsd.lv/htdocs/kcaldav -+HTDOCSPREFIX = /var/www/htdocs/kcaldav - - # File-system directory where "installwww" installs. - # You probably aren't going to use that! -@@ -150,7 +150,7 @@ VERSION = 0.1.11 +@@ -144,7 +144,7 @@ VERSION = 0.2.0 CFLAGS += -DCALDIR=\"$(CALDIR)\" - CFLAGS += -DHTDOCS=\"$(HTDOCS)\" + CFLAGS += -DCALPREFIX=\"$(CALPREFIX)\" CFLAGS += -DVERSION=\"$(VERSION)\" -CFLAGS += -DLOGFILE=\"$(LOGFILE)\" +#CFLAGS += -DLOGFILE=\"$(LOGFILE)\" BHTMLS = collection.html \ home.html - DOTFLAGS = -h "BGCOLOR=\"red\"" \ + Index: patches/patch-kcaldav_sql =================================================================== RCS file: /cvs/ports/www/kcaldav/patches/patch-kcaldav_sql,v retrieving revision 1.2 diff -u -p -r1.2 patch-kcaldav_sql --- patches/patch-kcaldav_sql 8 Apr 2018 08:29:22 -0000 1.2 +++ patches/patch-kcaldav_sql 14 Oct 2020 17:04:10 -0000 @@ -4,7 +4,7 @@ Index: kcaldav.sql --- kcaldav.sql.orig +++ kcaldav.sql @@ -1,4 +1,3 @@ --PRAGMA journal_mode = WAL; +-PRAGMA journal_mode=WAL; PRAGMA foreign_keys=ON; -- A resource is a ``file'' managed by the CalDAV server. Index: pkg/PLIST =================================================================== RCS file: /cvs/ports/www/kcaldav/pkg/PLIST,v retrieving revision 1.5 diff -u -p -r1.5 PLIST --- pkg/PLIST 1 Feb 2020 20:44:16 -0000 1.5 +++ pkg/PLIST 14 Oct 2020 22:13:07 -0000 @@ -3,7 +3,11 @@ include/libkcaldav.h @static-lib lib/libkcaldav.a @man man/man1/kcaldav.passwd.1 -@man man/man3/libkcaldav.3 +@man man/man3/caldav_free.3 +@man man/man3/caldav_parse.3 +@man man/man3/ical_free.3 +@man man/man3/ical_parse.3 +@man man/man3/ical_print.3 @man man/man8/kcaldav.8 share/doc/pkg-readmes/${PKGSTEM} @cwd /var/www @@ -21,6 +25,4 @@ htdocs/kcaldav/collection.html htdocs/kcaldav/collection.min.js htdocs/kcaldav/home.html htdocs/kcaldav/home.min.js -htdocs/kcaldav/md5.min.js -htdocs/kcaldav/script.min.js htdocs/kcaldav/style.css Index: pkg/README =================================================================== RCS file: /cvs/ports/www/kcaldav/pkg/README,v retrieving revision 1.5 diff -u -p -r1.5 README --- pkg/README 4 Sep 2018 12:46:24 -0000 1.5 +++ pkg/README 15 Oct 2020 00:22:14 -0000 @@ -1,5 +1,6 @@ $OpenBSD: README,v 1.5 2018/09/04 12:46:24 espie Exp $ + +----------------------------------------------------------------------- | Running ${PKGSTEM} on OpenBSD +----------------------------------------------------------------------- @@ -12,9 +13,8 @@ Administrator Quick Start doas chown www:www /var/www/caldav/kcaldav.db doas chmod 640 /var/www/caldav/kcaldav.db - Read kcaldav.passwd(1) for more details about creating - new calenders for users, changing email address and other - options. + Read kcaldav.passwd(1) for more details about creating new + calenders for users, changing email address and other options. With httpd(8) the kcaldav CGI can be run through slowcgi(8) using a configuration snippet like the following: @@ -32,14 +32,28 @@ Administrator Quick Start } } - kcaldav.cgi uses http authentication for user security. - Install a tls certificate to ensure privacy of connection. + Remember to enable and start slowcgi(8): + + rcctl enable slowcgi + rcttl start slowcgi + + Also, kcaldav.cgi uses http authentication for user security. + Make sure your web server is configured to use https to ensure + privacy of connection. + User Quick Start ================ - Users can manage their account settings, create calendars - and find the URL for use with their calendar application - by browsing to: https://localhost/kcaldav/home.html + Users can manage their account settings, create calendars, + and find the URL for use with their calendar application by + browsing to: + + https://example.org/kcaldav/home.html + + The URL will look like: + + https://example.org/cgi-bin/kcaldav/<username>/ + Porting Notes: Write Ahead Logging ================================== @@ -53,26 +67,51 @@ Porting Notes: Write Ahead Logging Open the kcaldav.db: - % doas sqlite3 caldav/kcaldav.db + doas sqlite3 caldav/kcaldav.db Type: - sqlite> PRAGMA journal_mode=WAL; + sqlite> PRAGMA journal_mode=WAL; - To disable WAL later open the kcaldav db and type: + To disable WAL, open the kcaldav db and type: - sqlite> PRAGMA journal_mode=DELETE; + sqlite> PRAGMA journal_mode=DELETE; If you plan to run kcaldav in a chroot environment you must - create a /tmp directory in the chroot and it must be writable + create a /tmp directory in the chroot dir and make it writable by the httpd daemon account: - % doas mkdir /var/www/tmp - % doas chown www:daemon /var/www/tmp - % doas chmod 755 /var/www/tmp + doas mkdir /var/www/tmp + doas chown www:daemon /var/www/tmp + doas chmod 755 /var/www/tmp For more details about WAL and temp directory requirements see: https://www.sqlite.org/wal.html https://www.sqlite.org/c3ref/temp_directory.html + + +Porting Notes: Debug and Logging +================================ + + Logging in kcaldav is controlled by the LOGFILE and DEBUG + variables in the Makeile. LOGFILE sets the name and location + of the file to write to, DEBUG controls the amount of logging. + + The DEBUG level can only be set at build time. There are four + DEBUG levels in ascending order of vebosity: 0 - 3, where 0 + disables all debugging. This port disables logging by commenting + out the Makefile line: + + CFLAGS += -DLOGFILE=\"$(LOGFILE)\". + + When sending error reports upstream, re-enable the line above, + set DEBUG=3, and rebuild. + + LOGFILE defaults to /var/www/logs/kcaldav-system.log. This file + must be created by the user and permissions set: + + touch /var/www/logs/kcaldav-system.log + chown www:www /var/www/logs/kcaldav-system.log + chmod 644 /var/www/logs/kcaldav-system.log
