Package: infinoted Version: 0.6.7-1 Severity: wishlist Tags: patch Dear Maintainer,
The attached patch adds the following: * init script and SystemD service file * /etc/defaults file * postinst to create infinoted user and group, and generate key and cert * config file with settings to use TLS with generated key and cert * prerm and postrm to clean up on purge This is partially based on the patch that eingousef submitted to #668592. -- James
From 0137a04b9339cc7e3ff18238ca5f4f92d2960947 Mon Sep 17 00:00:00 2001 From: James Valleroy <jvalle...@mailbox.org> Date: Tue, 12 Jan 2016 11:53:06 -0500 Subject: [PATCH] Import files from patch in Debian bug #668592. Install configuration files in /etc. Update dependencies. Fix lintian warnings. Add systemd service file. Create key and certificate after install. --- debian/control | 4 +- debian/infinoted.default | 12 +++++ debian/infinoted.init | 75 +++++++++++++++++++++++++++++++ debian/infinoted.install | 1 + debian/infinoted.postinst | 56 +++++++++++++++++++++++ debian/infinoted.postrm | 38 ++++++++++++++++ debian/infinoted.prerm | 24 ++++++++++ debian/infinoted.service | 12 +++++ debian/rules | 2 +- debian/usr/share/infinoted/infinoted.conf | 23 ++++++++++ 10 files changed, 244 insertions(+), 3 deletions(-) create mode 100644 debian/infinoted.default create mode 100755 debian/infinoted.init create mode 100755 debian/infinoted.postinst create mode 100755 debian/infinoted.postrm create mode 100755 debian/infinoted.prerm create mode 100644 debian/infinoted.service create mode 100644 debian/usr/share/infinoted/infinoted.conf diff --git a/debian/control b/debian/control index 3c236c3..cebe9c6 100644 --- a/debian/control +++ b/debian/control @@ -1,7 +1,7 @@ Source: libinfinity Priority: optional Maintainer: Philipp Kern <pk...@debian.org> -Build-Depends: debhelper (>= 9), autotools-dev, dh-autoreconf, libgnutls28-dev, libgsasl7-dev, libxml2-dev, libgtk-3-dev, libavahi-client-dev, gtk-doc-tools, libdaemon-dev, libpam-dev +Build-Depends: debhelper (>= 9), autotools-dev, dh-autoreconf, dh-systemd (>= 1.5), libgnutls28-dev, libgsasl7-dev, libxml2-dev, libgtk-3-dev, libavahi-client-dev, gtk-doc-tools, libdaemon-dev, libpam-dev Build-Conflicts: autoconf2.13, automake1.4 Standards-Version: 3.9.5 Section: libs @@ -85,7 +85,7 @@ Package: infinoted Section: net Architecture: any Pre-Depends: dpkg (>= 1.15.6) -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, ucf Replaces: infinoted-0.5 (<< 0.5.2-3~) Breaks: infinoted-0.5 (<< 0.5.2-3~) Conflicts: infinoted-0.4, infinoted-0.3 diff --git a/debian/infinoted.default b/debian/infinoted.default new file mode 100644 index 0000000..c8fa639 --- /dev/null +++ b/debian/infinoted.default @@ -0,0 +1,12 @@ +# defaults file for infinoted + +# Should infinoted be started by the init script? (true/false) +INFINOTED_ENABLED=true + +# The configuration file to be used. +INFINOTED_CONFIG=/etc/xdg/infinoted.conf + +# The session autosave file to be updated periodically and loaded +# upon startup. +INFINOTED_SESSION_FILE=/var/lib/infinoted + diff --git a/debian/infinoted.init b/debian/infinoted.init new file mode 100755 index 0000000..792543f --- /dev/null +++ b/debian/infinoted.init @@ -0,0 +1,75 @@ +#! /bin/sh + +### BEGIN INIT INFO +# Provides: infinoted +# Required-Start: $remote_fs $network +# Required-Stop: $remote_fs $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: collaborative text editor service +# Description: Infinoted is a dedicated server for collaborative text +# editor using the same protocol as Gobby. +### END INIT INFO + +set -e + +PRG=infinoted +DAEMON=/usr/bin/$PRG +PIDFILE=/var/run/$PRG.pid +DESC="collaborative text editor service" + + +test -x $DAEMON || exit 0 + +. /lib/lsb/init-functions + +# defaults +INFINOTED_ENABLED=true +INFINOTED_CONFIG=/etc/xdg/infinoted.conf +INFINOTED_SESSION_DIR=/var/lib/infinoted +[ -f /etc/default/$PRG ] && . /etc/default/$PRG + +[ "$INFINOTED_ENABLED" = "true" ] || exit 0 + +do_start() { + log_daemon_msg "Starting $DESC" + log_progress_msg "$PRG" + if start-stop-daemon --start --quiet --background \ + --pidfile $PIDFILE --make-pidfile \ + --chuid infinoted --chdir /var/lib/infinoted \ + --exec $DAEMON -- -r "$INFINOTED_SESSION_DIR" ; then + log_end_msg 0 + else + log_end_msg 1 + fi +} + +do_stop() { + log_daemon_msg "Stopping $DESC" + log_progress_msg "$PRG" + start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE + log_end_msg $? + rm -f $PIDFILE +} + +case "$1" in + start) + do_start + ;; + stop) + do_stop + ;; + reload|force-reload|restart) + do_stop + do_start + ;; + status) + status_of_proc -p $PIDFILE $DAEMON $PRG + ;; + *) + echo "Usage: /etc/init.d/$PRG {start|stop|reload|force-reload|restart|status}" + exit 1 + ;; +esac + +exit 0 diff --git a/debian/infinoted.install b/debian/infinoted.install index 9bc4ec4..9c1d354 100755 --- a/debian/infinoted.install +++ b/debian/infinoted.install @@ -4,4 +4,5 @@ usr/bin/infinoted* usr/lib/@DEB_HOST_MULTIARCH@/infinoted-*/plugins/*.so usr/lib/@DEB_HOST_MULTIARCH@/libinfinoted-plugin-manager-*.so.* usr/share/man/man*/infinoted* +debian/usr / EOF diff --git a/debian/infinoted.postinst b/debian/infinoted.postinst new file mode 100755 index 0000000..b804117 --- /dev/null +++ b/debian/infinoted.postinst @@ -0,0 +1,56 @@ +#!/bin/sh + +set -e + +DATADIR=/var/lib/infinoted +CONF=/etc/xdg/infinoted.conf +KEYDIR=/etc/infinoted + +case "$1" in + configure) + # create infinoted group + if ! getent group infinoted >/dev/null; then + addgroup --system infinoted + fi + + # create infinoted user + if ! getent passwd infinoted >/dev/null; then + adduser \ + --system \ + --ingroup infinoted \ + --home "$DATADIR" \ + --gecos "Infinoted collaborative editing server" \ + infinoted + fi + + if [ ! -d "$DATADIR" ]; then + mkdir -p "$DATADIR" + chown -R infinoted:infinoted "$DATADIR" + chmod 0750 "$DATADIR" + fi + + ucf --three-way /usr/share/infinoted/infinoted.conf "$CONF" + ucfr infinoted "$CONF" + + if [ ! -d "$KEYDIR" ]; then + # create key and certificate + mkdir -p "$KEYDIR" + chown infinoted:infinoted "$KEYDIR" + chown 0750 "$KEYDIR" + infinoted --create-key --create-certificate --daemonize + infinoted --kill-daemon + chown -R infinoted:infinoted "$KEYDIR" + chmod -R 0640 "$KEYDIR"/* + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/infinoted.postrm b/debian/infinoted.postrm new file mode 100755 index 0000000..8a67a63 --- /dev/null +++ b/debian/infinoted.postrm @@ -0,0 +1,38 @@ +#!/bin/sh + +set -e + +CONF=/etc/xdg/infinoted.conf + +case "$1" in + purge) + if getent passwd infinoted >/dev/null; then + if which deluser; then + deluser --system infinoted + fi + fi + if getent group infinoted >/dev/null; then + if which delgroup; then + delgroup --system infinoted + fi + fi + + rm -rf /etc/infinoted + rm -rf /var/lib/infinoted + + if [ -x "$(which ucf 2>/dev/null)" ]; then + ucf --purge "$CONF" + fi + rm -f "$CONF" + ;; + + remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/infinoted.prerm b/debian/infinoted.prerm new file mode 100755 index 0000000..9daaab5 --- /dev/null +++ b/debian/infinoted.prerm @@ -0,0 +1,24 @@ +#!/bin/sh + +set -e + +case "$1" in + remove|upgrade|deconfigure) + # Make sure the autosave file is actually writeable before stopping the + # server. + if [ -d /var/lib/infinoted ]; then + chown -R infinoted:infinoted /var/lib/infinoted + chmod 0750 /var/lib/infinoted + fi + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/infinoted.service b/debian/infinoted.service new file mode 100644 index 0000000..3472bd1 --- /dev/null +++ b/debian/infinoted.service @@ -0,0 +1,12 @@ +[Unit] +Description=collaborative text editor service +Documentation=man:infinoted(1) +After=network.target + +[Service] +User=infinoted +EnvironmentFile=-/etc/default/infinoted +ExecStart=/usr/bin/infinoted ${OPTIONS} + +[Install] +WantedBy=multi-user.target diff --git a/debian/rules b/debian/rules index 6ebde2a..604e456 100755 --- a/debian/rules +++ b/debian/rules @@ -4,7 +4,7 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all export DEB_DH_AUTORECONF_ARGS = -i %: - dh $@ --parallel --with autoreconf + dh $@ --parallel --with autoreconf --with systemd override_dh_auto_configure: dh_auto_configure -- \ diff --git a/debian/usr/share/infinoted/infinoted.conf b/debian/usr/share/infinoted/infinoted.conf new file mode 100644 index 0000000..826f1ec --- /dev/null +++ b/debian/usr/share/infinoted/infinoted.conf @@ -0,0 +1,23 @@ +[infinoted] + +# Possible values : no-tls, allow-tls, require-tls +security-policy=require-tls + +# Absolute path of the certificate file. +certificate-file=/etc/infinoted/infinoted-cert.pem + +# Absolute path of the private key file. +key-file=/etc/infinoted/infinoted-key.pem + +# Setting this to 0 disables autosave. +autosave-interval=60 + +# Specify a path to use a root certificate instead of a certificate-key pair. +#certificate-chain= + +#password= + +# If you want to regularly synchronize the saved documents. +#sync-directory + +#sync-interval= -- 2.7.0.rc3
signature.asc
Description: OpenPGP digital signature