From fd4070a85dc4ece77f2427b586c18bb1f4a04197 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Tue, 11 Dec 2018 04:14:34 +1100 Subject: import from package-debian-synapse --- debian/changelog | 630 +++++++++++++++++++++ debian/compat | 1 + debian/config | 9 + debian/control | 77 +++ debian/copyright | 118 ++++ debian/dirs | 3 + debian/gbp.conf | 5 + debian/hash_password.1 | 90 +++ debian/hash_password.ronn | 69 +++ debian/homeserver.yaml | 621 ++++++++++++++++++++ debian/install | 2 + debian/log.yaml | 35 ++ debian/manpages | 4 + debian/matrix-synapse.default | 2 + debian/matrix-synapse.init | 184 ++++++ debian/matrix-synapse.service | 15 + debian/patches/0001-tox.patch | 19 + debian/patches/0002-change_instructions.patch | 34 ++ debian/patches/0004-webclient-instructions.patch | 27 + ...n-t-require-strict-nacl-0.3.0-requirement.patch | 21 + debian/patches/bcrypt.patch | 30 + debian/patches/no_install_with_pip | 43 ++ debian/patches/remove-webclient.patch | 31 + debian/patches/series | 7 + debian/po/POTFILES.in | 1 + debian/po/templates.pot | 56 ++ debian/postinst | 39 ++ debian/pydist-overrides | 5 + debian/register_new_matrix_user.1 | 72 +++ debian/register_new_matrix_user.ronn | 61 ++ debian/rules | 18 + debian/source/format | 1 + debian/synapse_port_db.1 | 98 ++++ debian/synapse_port_db.ronn | 87 +++ debian/synctl.1 | 63 +++ debian/synctl.ronn | 70 +++ debian/templates | 19 + debian/watch | 11 + 38 files changed, 2678 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100755 debian/config create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/dirs create mode 100644 debian/gbp.conf create mode 100644 debian/hash_password.1 create mode 100644 debian/hash_password.ronn create mode 100644 debian/homeserver.yaml create mode 100644 debian/install create mode 100644 debian/log.yaml create mode 100644 debian/manpages create mode 100644 debian/matrix-synapse.default create mode 100755 debian/matrix-synapse.init create mode 100644 debian/matrix-synapse.service create mode 100644 debian/patches/0001-tox.patch create mode 100644 debian/patches/0002-change_instructions.patch create mode 100644 debian/patches/0004-webclient-instructions.patch create mode 100644 debian/patches/0006-Don-t-require-strict-nacl-0.3.0-requirement.patch create mode 100644 debian/patches/bcrypt.patch create mode 100644 debian/patches/no_install_with_pip create mode 100644 debian/patches/remove-webclient.patch create mode 100644 debian/patches/series create mode 100644 debian/po/POTFILES.in create mode 100644 debian/po/templates.pot create mode 100755 debian/postinst create mode 100644 debian/pydist-overrides create mode 100644 debian/register_new_matrix_user.1 create mode 100644 debian/register_new_matrix_user.ronn create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/synapse_port_db.1 create mode 100644 debian/synapse_port_db.ronn create mode 100644 debian/synctl.1 create mode 100644 debian/synctl.ronn create mode 100644 debian/templates create mode 100644 debian/watch (limited to 'debian') diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000000..20167978cf --- /dev/null +++ b/debian/changelog @@ -0,0 +1,630 @@ +matrix-synapse (0.33.9-1matrix1) stretch; urgency=medium + + [ Erik Johnston ] + * Remove dependency on python-pydenticon + + [ Richard van der Hoff ] + * New upstream version 0.33.9 + * Refresh patches for 0.33.9 + + -- Richard van der Hoff Tue, 20 Nov 2018 10:26:05 +0000 + +matrix-synapse (0.33.8-1) stretch; urgency=medium + + * New upstream version 0.33.8 + + -- Erik Johnston Thu, 01 Nov 2018 14:33:26 +0000 + +matrix-synapse (0.33.7-1matrix1) stretch; urgency=medium + + * New upstream version 0.33.7 + + -- Richard van der Hoff Thu, 18 Oct 2018 16:18:26 +0100 + +matrix-synapse (0.33.6-1matrix1) stretch; urgency=medium + + * Imported Upstream version 0.33.6 + * Remove redundant explicit dep on python-bcrypt + * Run the tests during build + * Add dependency on python-attr 16.0 + * Refresh patches for 0.33.6 + + -- Richard van der Hoff Thu, 04 Oct 2018 14:40:29 +0100 + +matrix-synapse (0.33.5.1-1matrix1) stretch; urgency=medium + + * Imported Upstream version 0.33.5.1 + + -- Richard van der Hoff Mon, 24 Sep 2018 18:20:51 +0100 + +matrix-synapse (0.33.5-1matrix1) stretch; urgency=medium + + * Imported Upstream version 0.33.5 + + -- Richard van der Hoff Mon, 24 Sep 2018 16:06:23 +0100 + +matrix-synapse (0.33.4-1mx1) stretch; urgency=medium + + * Imported Upstream version 0.33.4 + * Avoid telling people to install packages with pip + (fixes https://github.com/matrix-org/synapse/issues/3743) + + -- Richard van der Hoff Fri, 07 Sep 2018 14:06:17 +0100 + +matrix-synapse (0.33.3.1-1mx1) stretch; urgency=critical + + [ Richard van der Hoff ] + * Imported Upstream version 0.33.3.1 + + -- Richard van der Hoff Thu, 06 Sep 2018 11:20:37 +0100 + +matrix-synapse (0.33.3-2) stretch; urgency=medium + + * We now require python-twisted 17.1.0 or later + * Add recommendations for python-psycopg2 and python-lxml + + -- Richard van der Hoff Thu, 23 Aug 2018 19:04:08 +0100 + +matrix-synapse (0.33.3-1) jessie; urgency=medium + + * New upstream version 0.33.3 + + -- Richard van der Hoff Wed, 22 Aug 2018 14:50:30 +0100 + +matrix-synapse (0.33.2-1) jessie; urgency=medium + + * New upstream version 0.33.2 + + -- Richard van der Hoff Thu, 09 Aug 2018 15:40:42 +0100 + +matrix-synapse (0.33.1-1) jessie; urgency=medium + + * New upstream version 0.33.1 + + -- Erik Johnston Thu, 02 Aug 2018 15:52:19 +0100 + +matrix-synapse (0.33.0-1) jessie; urgency=medium + + * New upstream version 0.33.0 + + -- Richard van der Hoff Thu, 19 Jul 2018 13:38:41 +0100 + +matrix-synapse (0.32.1-1) jessie; urgency=medium + + * New upstream version 0.32.1 + + -- Richard van der Hoff Fri, 06 Jul 2018 17:16:29 +0100 + +matrix-synapse (0.32.0-1) jessie; urgency=medium + + * New upstream version 0.32.0 + + -- Erik Johnston Fri, 06 Jul 2018 15:34:06 +0100 + +matrix-synapse (0.31.2-1) jessie; urgency=high + + * New upstream version 0.31.2 + + -- Richard van der Hoff Thu, 14 Jun 2018 16:49:07 +0100 + +matrix-synapse (0.31.1-1) jessie; urgency=medium + + * New upstream version 0.31.1 + * Require python-prometheus-client >= 0.0.14 + + -- Richard van der Hoff Fri, 08 Jun 2018 16:11:55 +0100 + +matrix-synapse (0.31.0-1) jessie; urgency=medium + + * New upstream version 0.31.0 + + -- Richard van der Hoff Wed, 06 Jun 2018 17:23:10 +0100 + +matrix-synapse (0.30.0-1) jessie; urgency=medium + + [ Michael Kaye ] + * update homeserver.yaml to be somewhat more modern. + + [ Erik Johnston ] + * New upstream version 0.30.0 + + -- Erik Johnston Thu, 24 May 2018 16:43:16 +0100 + +matrix-synapse (0.29.0-1) jessie; urgency=medium + + * New upstream version 0.29.0 + + -- Erik Johnston Wed, 16 May 2018 17:43:06 +0100 + +matrix-synapse (0.28.1-1) jessie; urgency=medium + + * New upstream version 0.28.1 + + -- Erik Johnston Tue, 01 May 2018 19:21:39 +0100 + +matrix-synapse (0.28.0-1) jessie; urgency=medium + + * New upstream 0.28.0 + + -- Erik Johnston Fri, 27 Apr 2018 13:15:49 +0100 + +matrix-synapse (0.27.4-1) jessie; urgency=medium + + * Bump canonicaljson version + * New upstream 0.27.4 + + -- Erik Johnston Fri, 13 Apr 2018 13:37:47 +0100 + +matrix-synapse (0.27.3-1) jessie; urgency=medium + + * Report stats should default to off + * Refresh patches + * New upstream 0.27.3 + + -- Erik Johnston Wed, 11 Apr 2018 11:43:47 +0100 + +matrix-synapse (0.27.2-1) jessie; urgency=medium + + * New upstream version 0.27.2 + + -- Erik Johnston Mon, 26 Mar 2018 16:41:57 +0100 + +matrix-synapse (0.27.1-1) jessie; urgency=medium + + * New upstream version 0.27.1 + + -- Erik Johnston Mon, 26 Mar 2018 16:22:03 +0100 + +matrix-synapse (0.27.0-2) jessie; urgency=medium + + * Fix bcrypt dependency + + -- Erik Johnston Mon, 26 Mar 2018 16:00:26 +0100 + +matrix-synapse (0.27.0-1) jessie; urgency=medium + + * New upstream version 0.27.0 + + -- Erik Johnston Mon, 26 Mar 2018 15:07:52 +0100 + +matrix-synapse (0.26.1-1) jessie; urgency=medium + + * Ignore RC + * New upstream version 0.26.1 + + -- Erik Johnston Fri, 16 Mar 2018 00:40:08 +0000 + +matrix-synapse (0.26.0-1) jessie; urgency=medium + + [ Richard van der Hoff ] + * Remove `level` for `file` log handler + + [ Erik Johnston ] + + -- Erik Johnston Fri, 05 Jan 2018 11:21:26 +0000 + +matrix-synapse (0.25.1-1) jessie; urgency=medium + + * New upstream version 0.25.1 + + -- Erik Johnston Mon, 20 Nov 2017 10:05:37 +0000 + +matrix-synapse (0.25.0-1) jessie; urgency=medium + + * New upstream version 0.25.0 + + -- Erik Johnston Wed, 15 Nov 2017 11:36:32 +0000 + +matrix-synapse (0.24.1-1) jessie; urgency=medium + + * New upstream version 0.24.1 + + -- Erik Johnston Tue, 24 Oct 2017 15:05:03 +0100 + +matrix-synapse (0.24.0-1) jessie; urgency=medium + + * New upstream version 0.24.0 + + -- Erik Johnston Mon, 23 Oct 2017 14:11:46 +0100 + +matrix-synapse (0.23.1-1) xenial; urgency=medium + + * Imported upstream version 0.23.1 + + -- Erik Johnston Thu, 05 Oct 2017 15:28:25 +0100 + +matrix-synapse (0.23.0-1) jessie; urgency=medium + + * Fix patch after refactor + * Add patch to remove requirement on affinity package + * refresh webclient patch + + -- Erik Johnston Mon, 02 Oct 2017 15:34:57 +0100 + +matrix-synapse (0.22.1-1) jessie; urgency=medium + + * Imported Upstream version 0.22.1 + + -- Erik Johnston Thu, 06 Jul 2017 18:14:13 +0100 + +matrix-synapse (0.22.0-1) jessie; urgency=medium + + * Imported upstream version 0.22.0 + + -- Erik Johnston Thu, 06 Jul 2017 10:47:45 +0100 + +matrix-synapse (0.21.1-1) jessie; urgency=medium + + * Imported upstream version 0.21.1 + + -- Erik Johnston Thu, 15 Jun 2017 13:31:13 +0100 + +matrix-synapse (0.21.0-1) jessie; urgency=medium + + * Imported upstream version 0.21.0 + * Update patches + + -- Erik Johnston Thu, 18 May 2017 14:16:54 +0100 + +matrix-synapse (0.20.0-2) jessie; urgency=medium + + * Depend on python-jsonschema + + -- Erik Johnston Wed, 12 Apr 2017 10:41:46 +0100 + +matrix-synapse (0.20.0-1) jessie; urgency=medium + + * Imported upstream version 0.20.0 + + -- Erik Johnston Tue, 11 Apr 2017 12:58:26 +0100 + +matrix-synapse (0.19.3-1) jessie; urgency=medium + + * Imported upstream version 0.19.3 + + -- Erik Johnston Tue, 21 Mar 2017 13:45:41 +0000 + +matrix-synapse (0.19.2-1) jessie; urgency=medium + + [ Sunil Mohan Adapa ] + * Bump standards version to 3.9.8 + * Add debian/copyright file + * Don't ignore errors in debian/config + * Reformat depenedencies in debian/control + * Internationalize strings in template file + * Update package description + * Add lsb-base as dependency + * Update questions for debconf style + * Add man pages for all binaries + + [ Erik Johnston ] + * Imported upstream version 0.19.2 + + -- Erik Johnston Tue, 21 Feb 2017 13:55:00 +0000 + +matrix-synapse (0.19.1-1) jessie; urgency=medium + + * Imported upstream version 0.19.1 + + -- Erik Johnston Thu, 09 Feb 2017 11:53:27 +0000 + +matrix-synapse (0.19.0-1) jessie; urgency=medium + + This build requires python-twisted 0.19.0, which may need to be installed + from backports. + + [ Bryce Chidester ] + * Add EnvironmentFile to the systemd service + * Create matrix-synapse.default + + [ Erik Johnston ] + * Imported upstream version 0.19.0 + + -- Erik Johnston Sat, 04 Feb 2017 09:58:29 +0000 + +matrix-synapse (0.18.7-1) trusty; urgency=medium + + * Imported Upstream version 0.18.4 + + -- Erik Johnston Mon, 09 Jan 2017 15:10:21 +0000 + +matrix-synapse (0.18.5-1) trusty; urgency=medium + + * Imported Upstream version 0.18.5 + + -- Erik Johnston Fri, 16 Dec 2016 10:51:59 +0000 + +matrix-synapse (0.18.4-1) trusty; urgency=medium + + * Imported Upstream version 0.18.4 + + -- Erik Johnston Tue, 22 Nov 2016 10:33:41 +0000 + +matrix-synapse (0.18.3-1) trusty; urgency=medium + + * Imported Upstream version 0.18.3 + * Remove upstreamed ldap3 patch + + -- Erik Johnston Tue, 08 Nov 2016 15:01:49 +0000 + +matrix-synapse (0.18.2-2) trusty; urgency=high + + * Patch ldap3 support to workaround differences in python-ldap3 0.9, + bug allowed unauthorized logins if ldap3 0.9 was used. + + -- Erik Johnston Tue, 08 Nov 2016 13:48:09 +0000 + +matrix-synapse (0.18.2-1) trusty; urgency=medium + + * Imported Upstream version 0.18.2 + + -- Erik Johnston Tue, 01 Nov 2016 13:30:45 +0000 + +matrix-synapse (0.18.1-1) trusty; urgency=medium + + * Imported Upstream version 0.18.1 + + -- Erik Johnston Wed, 05 Oct 2016 14:52:53 +0100 + +matrix-synapse (0.18.0-1) trusty; urgency=medium + + * Imported Upstream version 0.18.0 + + -- Erik Johnston Mon, 19 Sep 2016 17:38:48 +0100 + +matrix-synapse (0.17.3-1) trusty; urgency=medium + + * Imported Upstream version 0.17.3 + + -- Erik Johnston Fri, 09 Sep 2016 11:18:18 +0100 + +matrix-synapse (0.17.2-1) trusty; urgency=medium + + * Imported Upstream version 0.17.2 + + -- Erik Johnston Thu, 08 Sep 2016 15:37:14 +0100 + +matrix-synapse (0.17.1-1) trusty; urgency=medium + + * Imported Upstream version 0.17.1 + + -- Erik Johnston Wed, 24 Aug 2016 15:11:29 +0100 + +matrix-synapse (0.17.0-1) trusty; urgency=medium + + * Imported Upstream version 0.17.0 + + -- Erik Johnston Mon, 08 Aug 2016 13:56:15 +0100 + +matrix-synapse (0.16.1-r1-1) trusty; urgency=medium + + * Imported Upstream version 0.16.1-r1 + + -- Erik Johnston Fri, 08 Jul 2016 16:47:35 +0100 + +matrix-synapse (0.16.1-2) trusty; urgency=critical + + * Apply security patch + + -- Erik Johnston Fri, 08 Jul 2016 11:05:27 +0100 + +matrix-synapse (0.16.1-1) trusty; urgency=medium + + * New upstream release + + -- Erik Johnston Tue, 21 Jun 2016 14:56:48 +0100 + +matrix-synapse (0.16.0-3) trusty; urgency=medium + + * Don't require strict nacl==0.3.0 requirement + + -- Erik Johnston Mon, 20 Jun 2016 13:24:22 +0100 + +matrix-synapse (0.16.0-2) trusty; urgency=medium + + * Also change the permissions of /etc/matrix-synapse + * Add apt webclient instructions + * Fix up patches + * Update default homeserver.yaml + * Add patch + + -- Erik Johnston Fri, 10 Jun 2016 14:06:20 +0100 + +matrix-synapse (0.16.0-1) trusty; urgency=medium + + [ David A Roberts ] + * systemd + + [ Erik Johnston ] + * Fixup postinst and matrix-synapse.service + * Handle email optional deps + * New upstream release + + -- Erik Johnston Thu, 09 Jun 2016 16:17:01 +0100 + +matrix-synapse (0.14.0-1) trusty; urgency=medium + + * Remove saml2 module requirements + + -- Erik Johnston Wed, 30 Mar 2016 14:31:17 +0100 + +matrix-synapse (0.13.3-1) trusty; urgency=medium + + * New upstream release + + -- Erik Johnston Thu, 11 Feb 2016 16:35:39 +0000 + +matrix-synapse (0.13.2-1) trusty; urgency=medium + + * New upstream release + + -- Erik Johnston Thu, 11 Feb 2016 11:01:16 +0000 + +matrix-synapse (0.13.0-1) trusty; urgency=medium + + * New upstream release + + -- Erik Johnston Wed, 10 Feb 2016 16:34:39 +0000 + +matrix-synapse (0.12.0-2) trusty; urgency=medium + + * Don't default `registerion_shared_secret` config option + + -- Erik Johnston Wed, 06 Jan 2016 16:34:02 +0000 + +matrix-synapse (0.12.0-1) stable; urgency=medium + + * Imported Upstream version 0.12.0 + + -- Mark Haines Mon, 04 Jan 2016 15:38:33 +0000 + +matrix-synapse (0.11.1-1) unstable; urgency=medium + + * Imported Upstream version 0.11.1 + + -- Erik Johnston Fri, 20 Nov 2015 17:56:52 +0000 + +matrix-synapse (0.11.0-r2-1) stable; urgency=medium + + * Imported Upstream version 0.11.0-r2 + * Add gbp.conf + + -- Erik Johnston Thu, 19 Nov 2015 13:52:36 +0000 + +matrix-synapse (0.11.0-1) wheezy; urgency=medium + + * Fix dependencies. + + -- Erik Johnston Tue, 17 Nov 2015 16:28:06 +0000 + +matrix-synapse (0.11.0-0) wheezy; urgency=medium + + * New upstream release + + -- Erik Johnston Tue, 17 Nov 2015 16:03:01 +0000 + +matrix-synapse (0.10.0-2) wheezy; urgency=medium + + * Rebuild for wheezy. + + -- Erik Johnston Fri, 04 Sep 2015 14:21:03 +0100 + +matrix-synapse (0.10.0-1) trusty; urgency=medium + + * New upstream release + + -- Erik Johnston Thu, 03 Sep 2015 10:08:34 +0100 + +matrix-synapse (0.10.0~rc6-3) trusty; urgency=medium + + * Create log directory. + + -- Erik Johnston Wed, 02 Sep 2015 17:49:07 +0100 + +matrix-synapse (0.10.0~rc6-2) trusty; urgency=medium + + * Add patch to work around upstream bug in config directory handling. + + -- Erik Johnston Wed, 02 Sep 2015 17:42:42 +0100 + +matrix-synapse (0.10.0~rc6-1) trusty; urgency=medium + + * New upstream release + + -- Erik Johnston Wed, 02 Sep 2015 17:21:21 +0100 + +matrix-synapse (0.10.0~rc5-3) trusty; urgency=medium + + * Update init script to work. + + -- Erik Johnston Fri, 28 Aug 2015 10:51:56 +0100 + +matrix-synapse (0.10.0~rc5-2) trusty; urgency=medium + + * Fix where python files are installed. + + -- Erik Johnston Thu, 27 Aug 2015 11:55:39 +0100 + +matrix-synapse (0.10.0~rc5-1) trusty; urgency=medium + + * New upstream release + + -- Erik Johnston Thu, 27 Aug 2015 11:26:54 +0100 + +matrix-synapse (0.10.0~rc4-1) trusty; urgency=medium + + * New upstream version. + + -- Erik Johnston Thu, 27 Aug 2015 10:29:31 +0100 + +matrix-synapse (0.10.0~rc3-7) trusty; urgency=medium + + * Add debian/watch + + -- Erik Johnston Wed, 26 Aug 2015 17:57:08 +0100 + +matrix-synapse (0.10.0~rc3-6) trusty; urgency=medium + + * Deps. + + -- Erik Johnston Wed, 26 Aug 2015 17:07:13 +0100 + +matrix-synapse (0.10.0~rc3-5) trusty; urgency=medium + + * Deps. + + -- Erik Johnston Wed, 26 Aug 2015 16:18:02 +0100 + +matrix-synapse (0.10.0~rc3-4) trusty; urgency=medium + + * More deps. + + -- Erik Johnston Wed, 26 Aug 2015 14:09:27 +0100 + +matrix-synapse (0.10.0~rc3-3) trusty; urgency=medium + + * Update deps. + + -- Erik Johnston Wed, 26 Aug 2015 13:49:20 +0100 + +matrix-synapse (0.10.0~rc3-2) trusty; urgency=medium + + * Add more deps. + + -- Erik Johnston Wed, 26 Aug 2015 13:25:45 +0100 + +matrix-synapse (0.10.0~rc3-1) trusty; urgency=medium + + * New upstream release + + -- Erik Johnston Tue, 25 Aug 2015 17:52:33 +0100 + +matrix-synapse (0.9.3-1~trusty1) trusty; urgency=medium + + * Rebuild for trusty. + + -- Erik Johnston Thu, 20 Aug 2015 15:05:43 +0100 + +matrix-synapse (0.9.3-1) wheezy; urgency=medium + + * New upstream release + * Create a user, "matrix-synapse", to run as + * Log to /var/log/matrix-synapse/ directory + * Override the way synapse looks for the angular SDK (syweb) so it finds the + packaged one + + -- Paul "LeoNerd" Evans Fri, 07 Aug 2015 15:32:12 +0100 + +matrix-synapse (0.9.2-2) wheezy; urgency=medium + + * Supply a default config file + * Create directory in /var/lib + * Use debconf to ask the user for the server name at installation time + + -- Paul "LeoNerd" Evans Thu, 06 Aug 2015 15:28:00 +0100 + +matrix-synapse (0.9.2-1) wheezy; urgency=low + + * source package automatically created by stdeb 0.8.2 + + -- Paul "LeoNerd" Evans Fri, 12 Jun 2015 14:32:03 +0100 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000000..ec635144f6 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/config b/debian/config new file mode 100755 index 0000000000..9fb6913298 --- /dev/null +++ b/debian/config @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule + +db_input high matrix-synapse/server-name || true +db_input high matrix-synapse/report-stats || true +db_go diff --git a/debian/control b/debian/control new file mode 100644 index 0000000000..854d9688f3 --- /dev/null +++ b/debian/control @@ -0,0 +1,77 @@ +Source: matrix-synapse +Maintainer: Erik Johnston +Section: python +Priority: optional +Build-Depends: + debhelper (>= 9), + dh-python, + dh-systemd (>= 1.5), + po-debconf, + python (>= 2.6.6-3), + python-bcrypt, + python-blist, + python-canonicaljson (>=1.1.3), + python-daemonize, + python-frozendict (>= 0.4), + python-lxml, + python-mock, + python-msgpack (>=0.3.0), + python-nacl (>= 0.3.0), + python-netaddr, + python-openssl (>= 0.14), + python-pil, + python-psutil, + python-pyasn1, + python-pydenticon, + python-pymacaroons-pynacl, + python-pysaml2, + python-service-identity (>= 1.0.0), + python-setuptools (>= 0.6b3), + python-signedjson (>= 1.0.0), + python-sortedcontainers, + python-syutil (>= 0.0.7), + python-treq (>= 15.1.0), + python-twisted (>= 17.1.0), + python-unpaddedbase64 (>= 1.0.1), + python-yaml, + python-phonenumbers (>= 8.2.0), + python-jsonschema (>=2.5.1), + python-prometheus-client, + python-attr +Standards-Version: 3.9.8 +X-Python-Version: >= 2.7 + +Package: matrix-synapse +Architecture: all +Depends: + ${misc:Depends}, + ${python:Depends}, + adduser, + debconf, + lsb-base (>= 3.0-6), + python-attr (>= 16.0.0), + python-twisted (>= 17.1.0), + python-canonicaljson (>=1.1.3), + python-prometheus-client (>=0.0.14), +Suggests: + python-bleach (>= 1.4.2), + python-jinja2 (>= 2.8), +Recommends: + python-psycopg2, + python-lxml, +Description: Open federated Instant Messaging and VoIP server + Matrix is an ambitious new ecosystem for open federated Instant + Messaging and VoIP. Synapse is a reference Matrix server + implementation. + . + Everything in Matrix happens in a room. Rooms are distributed and do + not exist on any single server. Rooms can be located using + convenience aliases like #matrix:matrix.org or #test:localhost:8448. + . + Matrix user IDs look like @matthew:matrix.org (although in the future + you will normally refer to yourself and others using a 3PID: email + address, phone number, etc rather than manipulating Matrix user IDs) + . + The overall architecture is: + client <------> homeserver <=============> homeserver <------> client + https://a.org/_matrix https://b.net/_matrix diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000000..35597e0804 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,118 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: synapse +Source: https://github.com/matrix-org/synapse + +Files: * +Copyright: 2014-2017, OpenMarket Ltd +License: Apache-2.0 + +Files: synapse/config/saml2.py +Copyright: 2015, Ericsson +License: Apache-2.0 + +Files: synapse/config/jwt.py +Copyright: 2015, Niklas Riekenbrauck +License: Apache-2.0 + +Files: synapse/config/workers.py +Copyright: 2016, matrix.org +License: Apache-2.0 + +Files: synapse/config/repository.py +Copyright: 2014-2015, matrix.org +License: Apache-2.0 + +Files: contrib/jitsimeetbridge/unjingle/strophe/base64.js +Copyright: Public Domain (Tyler Akins http://rumkin.com) +License: public-domain + This code was written by Tyler Akins and has been placed in the + public domain. It would be nice if you left this header intact. + Base64 code from Tyler Akins -- http://rumkin.com + +Files: contrib/jitsimeetbridge/unjingle/strophe/md5.js +Copyright: 1999-2002, Paul Johnston & Contributors +License: BSD-3-clause + +Files: contrib/jitsimeetbridge/unjingle/strophe/strophe.js +Copyright: 2006-2008, OGG, LLC +License: Expat + +Files: contrib/jitsimeetbridge/unjingle/strophe/XMLHttpRequest.js +Copyright: 2010 passive.ly LLC +License: Expat + +Files: contrib/jitsimeetbridge/unjingle/*.js +Copyright: 2014 Jitsi +License: Apache-2.0 + +Files: debian/* +Copyright: 2016-2017, Erik Johnston + 2017, Rahul De + 2017, Sunil Mohan Adapa +License: Apache-2.0 + +License: Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + http://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian systems, the full text of the Apache License version + 2.0 can be found in the file + `/usr/share/common-licenses/Apache-2.0'. + +License: BSD-3-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following + disclaimer. Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided with + the distribution. + . + Neither the name of the author nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: Expat + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + . + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000000..9d2a980c92 --- /dev/null +++ b/debian/dirs @@ -0,0 +1,3 @@ +etc/matrix-synapse +var/lib/matrix-synapse +var/log/matrix-synapse diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000000..0432accfa0 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,5 @@ +[DEFAULT] +debian-branch = debian + +[dch] +distribution = stable diff --git a/debian/hash_password.1 b/debian/hash_password.1 new file mode 100644 index 0000000000..383f452991 --- /dev/null +++ b/debian/hash_password.1 @@ -0,0 +1,90 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "HASH_PASSWORD" "1" "February 2017" "" "" +. +.SH "NAME" +\fBhash_password\fR \- Calculate the hash of a new password, so that passwords can be reset +. +.SH "SYNOPSIS" +\fBhash_password\fR [\fB\-p\fR|\fB\-\-password\fR [password]] [\fB\-c\fR|\fB\-\-config\fR \fIfile\fR] +. +.SH "DESCRIPTION" +\fBhash_password\fR calculates the hash of a supplied password using bcrypt\. +. +.P +\fBhash_password\fR takes a password as an parameter either on the command line or the \fBSTDIN\fR if not supplied\. +. +.P +It accepts an YAML file which can be used to specify parameters like the number of rounds for bcrypt and password_config section having the pepper value used for the hashing\. By default \fBbcrypt_rounds\fR is set to \fB10\fR\. +. +.P +The hashed password is written on the \fBSTDOUT\fR\. +. +.SH "FILES" +A sample YAML file accepted by \fBhash_password\fR is described below: +. +.P +bcrypt_rounds: 17 password_config: pepper: "random hashing pepper" +. +.SH "OPTIONS" +. +.TP +\fB\-p\fR, \fB\-\-password\fR +Read the password form the command line if [password] is supplied\. If not, prompt the user and read the password form the \fBSTDIN\fR\. It is not recommended to type the password on the command line directly\. Use the STDIN instead\. +. +.TP +\fB\-c\fR, \fB\-\-config\fR +Read the supplied YAML \fIfile\fR containing the options \fBbcrypt_rounds\fR and the \fBpassword_config\fR section containing the \fBpepper\fR value\. +. +.SH "EXAMPLES" +Hash from the command line: +. +.IP "" 4 +. +.nf + +$ hash_password \-p "p@ssw0rd" +$2b$12$VJNqWQYfsWTEwcELfoSi4Oa8eA17movHqqi8\.X8fWFpum7SxZ9MFe +. +.fi +. +.IP "" 0 +. +.P +Hash from the STDIN: +. +.IP "" 4 +. +.nf + +$ hash_password +Password: +Confirm password: +$2b$12$AszlvfmJl2esnyhmn8m/kuR2tdXgROWtWxnX\.rcuAbM8ErLoUhybG +. +.fi +. +.IP "" 0 +. +.P +Using a config file: +. +.IP "" 4 +. +.nf + +$ hash_password \-c config\.yml +Password: +Confirm password: +$2b$12$CwI\.wBNr\.w3kmiUlV3T5s\.GT2wH7uebDCovDrCOh18dFedlANK99O +. +.fi +. +.IP "" 0 +. +.SH "COPYRIGHT" +This man page was written by Rahul De <\fIrahulde@swecha\.net\fR> for Debian GNU/Linux distribution\. +. +.SH "SEE ALSO" +synctl(1), synapse_port_db(1), register_new_matrix_user(1) diff --git a/debian/hash_password.ronn b/debian/hash_password.ronn new file mode 100644 index 0000000000..0b2afa7374 --- /dev/null +++ b/debian/hash_password.ronn @@ -0,0 +1,69 @@ +hash_password(1) -- Calculate the hash of a new password, so that passwords can be reset +======================================================================================== + +## SYNOPSIS + +`hash_password` [`-p`|`--password` [password]] [`-c`|`--config` ] + +## DESCRIPTION + +**hash_password** calculates the hash of a supplied password using bcrypt. + +`hash_password` takes a password as an parameter either on the command line +or the `STDIN` if not supplied. + +It accepts an YAML file which can be used to specify parameters like the +number of rounds for bcrypt and password_config section having the pepper +value used for the hashing. By default `bcrypt_rounds` is set to **10**. + +The hashed password is written on the `STDOUT`. + +## FILES + +A sample YAML file accepted by `hash_password` is described below: + + bcrypt_rounds: 17 + password_config: + pepper: "random hashing pepper" + +## OPTIONS + + * `-p`, `--password`: + Read the password form the command line if [password] is supplied. + If not, prompt the user and read the password form the `STDIN`. + It is not recommended to type the password on the command line + directly. Use the STDIN instead. + + * `-c`, `--config`: + Read the supplied YAML containing the options `bcrypt_rounds` + and the `password_config` section containing the `pepper` value. + +## EXAMPLES + +Hash from the command line: + + $ hash_password -p "p@ssw0rd" + $2b$12$VJNqWQYfsWTEwcELfoSi4Oa8eA17movHqqi8.X8fWFpum7SxZ9MFe + +Hash from the STDIN: + + $ hash_password + Password: + Confirm password: + $2b$12$AszlvfmJl2esnyhmn8m/kuR2tdXgROWtWxnX.rcuAbM8ErLoUhybG + +Using a config file: + + $ hash_password -c config.yml + Password: + Confirm password: + $2b$12$CwI.wBNr.w3kmiUlV3T5s.GT2wH7uebDCovDrCOh18dFedlANK99O + +## COPYRIGHT + +This man page was written by Rahul De <> +for Debian GNU/Linux distribution. + +## SEE ALSO + +synctl(1), synapse_port_db(1), register_new_matrix_user(1) diff --git a/debian/homeserver.yaml b/debian/homeserver.yaml new file mode 100644 index 0000000000..04ece25d49 --- /dev/null +++ b/debian/homeserver.yaml @@ -0,0 +1,621 @@ +# vim:ft=yaml +# PEM encoded X509 certificate for TLS. +# You can replace the self-signed certificate that synapse +# autogenerates on launch with your own SSL certificate + key pair +# if you like. Any required intermediary certificates can be +# appended after the primary certificate in hierarchical order. +tls_certificate_path: "/etc/matrix-synapse/homeserver.tls.crt" + +# PEM encoded private key for TLS +tls_private_key_path: "/etc/matrix-synapse/homeserver.tls.key" + +# PEM dh parameters for ephemeral keys +tls_dh_params_path: "/etc/matrix-synapse/homeserver.tls.dh" + +# Don't bind to the https port +no_tls: False + +# List of allowed TLS fingerprints for this server to publish along +# with the signing keys for this server. Other matrix servers that +# make HTTPS requests to this server will check that the TLS +# certificates returned by this server match one of the fingerprints. +# +# Synapse automatically adds the fingerprint of its own certificate +# to the list. So if federation traffic is handled directly by synapse +# then no modification to the list is required. +# +# If synapse is run behind a load balancer that handles the TLS then it +# will be necessary to add the fingerprints of the certificates used by +# the loadbalancers to this list if they are different to the one +# synapse is using. +# +# Homeservers are permitted to cache the list of TLS fingerprints +# returned in the key responses up to the "valid_until_ts" returned in +# key. It may be necessary to publish the fingerprints of a new +# certificate and wait until the "valid_until_ts" of the previous key +# responses have passed before deploying it. +# +# You can calculate a fingerprint from a given TLS listener via: +# openssl s_client -connect $host:$port < /dev/null 2> /dev/null | +# openssl x509 -outform DER | openssl sha256 -binary | base64 | tr -d '=' +# or by checking matrix.org/federationtester/api/report?server_name=$host +# +tls_fingerprints: [] +# tls_fingerprints: [{"sha256": ""}] + + +## Server ## + +# When running as a daemon, the file to store the pid in +pid_file: "/var/run/matrix-synapse.pid" + +# CPU affinity mask. Setting this restricts the CPUs on which the +# process will be scheduled. It is represented as a bitmask, with the +# lowest order bit corresponding to the first logical CPU and the +# highest order bit corresponding to the last logical CPU. Not all CPUs +# may exist on a given system but a mask may specify more CPUs than are +# present. +# +# For example: +# 0x00000001 is processor #0, +# 0x00000003 is processors #0 and #1, +# 0xFFFFFFFF is all processors (#0 through #31). +# +# Pinning a Python process to a single CPU is desirable, because Python +# is inherently single-threaded due to the GIL, and can suffer a +# 30-40% slowdown due to cache blow-out and thread context switching +# if the scheduler happens to schedule the underlying threads across +# different cores. See +# https://www.mirantis.com/blog/improve-performance-python-programs-restricting-single-cpu/. +# +# cpu_affinity: 0xFFFFFFFF + +# Whether to serve a web client from the HTTP/HTTPS root resource. +web_client: False + +# The root directory to server for the above web client. +# If left undefined, synapse will serve the matrix-angular-sdk web client. +# Make sure matrix-angular-sdk is installed with pip if web_client is True +# and web_client_location is undefined +# web_client_location: "/path/to/web/root" + +# The public-facing base URL for the client API (not including _matrix/...) +# public_baseurl: https://example.com:8448/ + +# Set the soft limit on the number of file descriptors synapse can use +# Zero is used to indicate synapse should set the soft limit to the +# hard limit. +soft_file_limit: 0 + +# The GC threshold parameters to pass to `gc.set_threshold`, if defined +# gc_thresholds: [700, 10, 10] + +# Set the limit on the returned events in the timeline in the get +# and sync operations. The default value is -1, means no upper limit. +# filter_timeline_limit: 5000 + +# Whether room invites to users on this server should be blocked +# (except those sent by local server admins). The default is False. +# block_non_admin_invites: True + +# Restrict federation to the following whitelist of domains. +# N.B. we recommend also firewalling your federation listener to limit +# inbound federation traffic as early as possible, rather than relying +# purely on this application-layer restriction. If not specified, the +# default is to whitelist everything. +# +# federation_domain_whitelist: +# - lon.example.com +# - nyc.example.com +# - syd.example.com + +# List of ports that Synapse should listen on, their purpose and their +# configuration. +listeners: + # Main HTTPS listener + # For when matrix traffic is sent directly to synapse. + - + # The port to listen for HTTPS requests on. + port: 8448 + + # Local addresses to listen on. + # On Linux and Mac OS, `::` will listen on all IPv4 and IPv6 + # addresses by default. For most other OSes, this will only listen + # on IPv6. + bind_addresses: + - '::' + - '0.0.0.0' + + # This is a 'http' listener, allows us to specify 'resources'. + type: http + + tls: true + + # Use the X-Forwarded-For (XFF) header as the client IP and not the + # actual client IP. + x_forwarded: false + + # List of HTTP resources to serve on this listener. + resources: + - + # List of resources to host on this listener. + names: + - client # The client-server APIs, both v1 and v2 + - webclient # The bundled webclient. + + # Should synapse compress HTTP responses to clients that support it? + # This should be disabled if running synapse behind a load balancer + # that can do automatic compression. + compress: true + + - names: [federation] # Federation APIs + compress: false + + # optional list of additional endpoints which can be loaded via + # dynamic modules + # additional_resources: + # "/_matrix/my/custom/endpoint": + # module: my_module.CustomRequestHandler + # config: {} + + # Unsecure HTTP listener, + # For when matrix traffic passes through loadbalancer that unwraps TLS. + - port: 8008 + tls: false + bind_addresses: ['::', '0.0.0.0'] + type: http + + x_forwarded: false + + resources: + - names: [client, webclient] + compress: true + - names: [federation] + compress: false + + # Turn on the twisted ssh manhole service on localhost on the given + # port. + # - port: 9000 + # bind_addresses: ['::1', '127.0.0.1'] + # type: manhole + + +# Database configuration +database: + # The database engine name + name: "sqlite3" + # Arguments to pass to the engine + args: + # Path to the database + database: "/var/lib/matrix-synapse/homeserver.db" + +# Number of events to cache in memory. +event_cache_size: "10K" + + +# A yaml python logging config file +log_config: "/etc/matrix-synapse/log.yaml" + + + +## Ratelimiting ## + +# Number of messages a client can send per second +rc_messages_per_second: 0.2 + +# Number of message a client can send before being throttled +rc_message_burst_count: 10.0 + +# The federation window size in milliseconds +federation_rc_window_size: 1000 + +# The number of federation requests from a single server in a window +# before the server will delay processing the request. +federation_rc_sleep_limit: 10 + +# The duration in milliseconds to delay processing events from +# remote servers by if they go over the sleep limit. +federation_rc_sleep_delay: 500 + +# The maximum number of concurrent federation requests allowed +# from a single server +federation_rc_reject_limit: 50 + +# The number of federation requests to concurrently process from a +# single server +federation_rc_concurrent: 3 + + + +# Directory where uploaded images and attachments are stored. +media_store_path: "/var/lib/matrix-synapse/media" + +# Media storage providers allow media to be stored in different +# locations. +# media_storage_providers: +# - module: file_system +# # Whether to write new local files. +# store_local: false +# # Whether to write new remote media +# store_remote: false +# # Whether to block upload requests waiting for write to this +# # provider to complete +# store_synchronous: false +# config: +# directory: /mnt/some/other/directory + +# Directory where in-progress uploads are stored. +uploads_path: "/var/lib/matrix-synapse/uploads" + +# The largest allowed upload size in bytes +max_upload_size: "10M" + +# Maximum number of pixels that will be thumbnailed +max_image_pixels: "32M" + +# Whether to generate new thumbnails on the fly to precisely match +# the resolution requested by the client. If true then whenever +# a new resolution is requested by the client the server will +# generate a new thumbnail. If false the server will pick a thumbnail +# from a precalculated list. +dynamic_thumbnails: false + +# List of thumbnail to precalculate when an image is uploaded. +thumbnail_sizes: +- width: 32 + height: 32 + method: crop +- width: 96 + height: 96 + method: crop +- width: 320 + height: 240 + method: scale +- width: 640 + height: 480 + method: scale +- width: 800 + height: 600 + method: scale + +# Is the preview URL API enabled? If enabled, you *must* specify +# an explicit url_preview_ip_range_blacklist of IPs that the spider is +# denied from accessing. +url_preview_enabled: False + +# List of IP address CIDR ranges that the URL preview spider is denied +# from accessing. There are no defaults: you must explicitly +# specify a list for URL previewing to work. You should specify any +# internal services in your network that you do not want synapse to try +# to connect to, otherwise anyone in any Matrix room could cause your +# synapse to issue arbitrary GET requests to your internal services, +# causing serious security issues. +# +# url_preview_ip_range_blacklist: +# - '127.0.0.0/8' +# - '10.0.0.0/8' +# - '172.16.0.0/12' +# - '192.168.0.0/16' +# - '100.64.0.0/10' +# - '169.254.0.0/16' +# +# List of IP address CIDR ranges that the URL preview spider is allowed +# to access even if they are specified in url_preview_ip_range_blacklist. +# This is useful for specifying exceptions to wide-ranging blacklisted +# target IP ranges - e.g. for enabling URL previews for a specific private +# website only visible in your network. +# +# url_preview_ip_range_whitelist: +# - '192.168.1.1' + +# Optional list of URL matches that the URL preview spider is +# denied from accessing. You should use url_preview_ip_range_blacklist +# in preference to this, otherwise someone could define a public DNS +# entry that points to a private IP address and circumvent the blacklist. +# This is more useful if you know there is an entire shape of URL that +# you know that will never want synapse to try to spider. +# +# Each list entry is a dictionary of url component attributes as returned +# by urlparse.urlsplit as applied to the absolute form of the URL. See +# https://docs.python.org/2/library/urlparse.html#urlparse.urlsplit +# The values of the dictionary are treated as an filename match pattern +# applied to that component of URLs, unless they start with a ^ in which +# case they are treated as a regular expression match. If all the +# specified component matches for a given list item succeed, the URL is +# blacklisted. +# +# url_preview_url_blacklist: +# # blacklist any URL with a username in its URI +# - username: '*' +# +# # blacklist all *.google.com URLs +# - netloc: 'google.com' +# - netloc: '*.google.com' +# +# # blacklist all plain HTTP URLs +# - scheme: 'http' +# +# # blacklist http(s)://www.acme.com/foo +# - netloc: 'www.acme.com' +# path: '/foo' +# +# # blacklist any URL with a literal IPv4 address +# - netloc: '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$' + +# The largest allowed URL preview spidering size in bytes +max_spider_size: "10M" + + + + +## Captcha ## +# See docs/CAPTCHA_SETUP for full details of configuring this. + +# This Home Server's ReCAPTCHA public key. +recaptcha_public_key: "YOUR_PUBLIC_KEY" + +# This Home Server's ReCAPTCHA private key. +recaptcha_private_key: "YOUR_PRIVATE_KEY" + +# Enables ReCaptcha checks when registering, preventing signup +# unless a captcha is answered. Requires a valid ReCaptcha +# public/private key. +enable_registration_captcha: False + +# A secret key used to bypass the captcha test entirely. +#captcha_bypass_secret: "YOUR_SECRET_HERE" + +# The API endpoint to use for verifying m.login.recaptcha responses. +recaptcha_siteverify_api: "https://www.google.com/recaptcha/api/siteverify" + + +## Turn ## + +# The public URIs of the TURN server to give to clients +turn_uris: [] + +# The shared secret used to compute passwords for the TURN server +turn_shared_secret: "YOUR_SHARED_SECRET" + +# The Username and password if the TURN server needs them and +# does not use a token +#turn_username: "TURNSERVER_USERNAME" +#turn_password: "TURNSERVER_PASSWORD" + +# How long generated TURN credentials last +turn_user_lifetime: "1h" + +# Whether guests should be allowed to use the TURN server. +# This defaults to True, otherwise VoIP will be unreliable for guests. +# However, it does introduce a slight security risk as it allows users to +# connect to arbitrary endpoints without having first signed up for a +# valid account (e.g. by passing a CAPTCHA). +turn_allow_guests: False + + +## Registration ## + +# Enable registration for new users. +enable_registration: False + +# The user must provide all of the below types of 3PID when registering. +# +# registrations_require_3pid: +# - email +# - msisdn + +# Mandate that users are only allowed to associate certain formats of +# 3PIDs with accounts on this server. +# +# allowed_local_3pids: +# - medium: email +# pattern: ".*@matrix\.org" +# - medium: email +# pattern: ".*@vector\.im" +# - medium: msisdn +# pattern: "\+44" + +# If set, allows registration by anyone who also has the shared +# secret, even if registration is otherwise disabled. +# registration_shared_secret: + +# Set the number of bcrypt rounds used to generate password hash. +# Larger numbers increase the work factor needed to generate the hash. +# The default number is 12 (which equates to 2^12 rounds). +# N.B. that increasing this will exponentially increase the time required +# to register or login - e.g. 24 => 2^24 rounds which will take >20 mins. +bcrypt_rounds: 12 + +# Allows users to register as guests without a password/email/etc, and +# participate in rooms hosted on this server which have been made +# accessible to anonymous users. +allow_guest_access: False + +# The list of identity servers trusted to verify third party +# identifiers by this server. +trusted_third_party_id_servers: + - matrix.org + - vector.im + - riot.im + +# Users who register on this homeserver will automatically be joined +# to these rooms +#auto_join_rooms: +# - "#example:example.com" + + +## Metrics ### + +# Enable collection and rendering of performance metrics +enable_metrics: False + +## API Configuration ## + +# A list of event types that will be included in the room_invite_state +room_invite_state_types: + - "m.room.join_rules" + - "m.room.canonical_alias" + - "m.room.avatar" + - "m.room.name" + + +# A list of application service config file to use +app_service_config_files: [] + + +# macaroon_secret_key: + +# Used to enable access token expiration. +expire_access_token: False + +## Signing Keys ## + +# Path to the signing key to sign messages with +signing_key_path: "/etc/matrix-synapse/homeserver.signing.key" + +# The keys that the server used to sign messages with but won't use +# to sign new messages. E.g. it has lost its private key +old_signing_keys: {} +# "ed25519:auto": +# # Base64 encoded public key +# key: "The public part of your old signing key." +# # Millisecond POSIX timestamp when the key expired. +# expired_ts: 123456789123 + +# How long key response published by this server is valid for. +# Used to set the valid_until_ts in /key/v2 APIs. +# Determines how quickly servers will query to check which keys +# are still valid. +key_refresh_interval: "1d" # 1 Day. + +# The trusted servers to download signing keys from. +perspectives: + servers: + "matrix.org": + verify_keys: + "ed25519:auto": + key: "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw" + + + +# Enable SAML2 for registration and login. Uses pysaml2 +# config_path: Path to the sp_conf.py configuration file +# idp_redirect_url: Identity provider URL which will redirect +# the user back to /login/saml2 with proper info. +# See pysaml2 docs for format of config. +#saml2_config: +# enabled: true +# config_path: "/home/erikj/git/synapse/sp_conf.py" +# idp_redirect_url: "http://test/idp" + + + +# Enable CAS for registration and login. +#cas_config: +# enabled: true +# server_url: "https://cas-server.com" +# service_url: "https://homeserver.domain.com:8448" +# #required_attributes: +# # name: value + + +# The JWT needs to contain a globally unique "sub" (subject) claim. +# +# jwt_config: +# enabled: true +# secret: "a secret" +# algorithm: "HS256" + + + +# Enable password for login. +password_config: + enabled: true + # Uncomment and change to a secret random string for extra security. + # DO NOT CHANGE THIS AFTER INITIAL SETUP! + #pepper: "" + + + +# Enable sending emails for notification events +# Defining a custom URL for Riot is only needed if email notifications +# should contain links to a self-hosted installation of Riot; when set +# the "app_name" setting is ignored. +# +# If your SMTP server requires authentication, the optional smtp_user & +# smtp_pass variables should be used +# +#email: +# enable_notifs: false +# smtp_host: "localhost" +# smtp_port: 25 +# smtp_user: "exampleusername" +# smtp_pass: "examplepassword" +# require_transport_security: False +# notif_from: "Your Friendly %(app)s Home Server " +# app_name: Matrix +# template_dir: res/templates +# notif_template_html: notif_mail.html +# notif_template_text: notif_mail.txt +# notif_for_new_users: True +# riot_base_url: "http://localhost/riot" + + +# password_providers: +# - module: "ldap_auth_provider.LdapAuthProvider" +# config: +# enabled: true +# uri: "ldap://ldap.example.com:389" +# start_tls: true +# base: "ou=users,dc=example,dc=com" +# attributes: +# uid: "cn" +# mail: "email" +# name: "givenName" +# #bind_dn: +# #bind_password: +# #filter: "(objectClass=posixAccount)" + + + +# Clients requesting push notifications can either have the body of +# the message sent in the notification poke along with other details +# like the sender, or just the event ID and room ID (`event_id_only`). +# If clients choose the former, this option controls whether the +# notification request includes the content of the event (other details +# like the sender are still included). For `event_id_only` push, it +# has no effect. + +# For modern android devices the notification content will still appear +# because it is loaded by the app. iPhone, however will send a +# notification saying only that a message arrived and who it came from. +# +#push: +# include_content: true + + +# spam_checker: +# module: "my_custom_project.SuperSpamChecker" +# config: +# example_option: 'things' + + +# Whether to allow non server admins to create groups on this server +enable_group_creation: false + +# If enabled, non server admins can only create groups with local parts +# starting with this prefix +# group_creation_prefix: "unofficial/" + + + +# User Directory configuration +# +# 'search_all_users' defines whether to search all users visible to your HS +# when searching the user directory, rather than limiting to users visible +# in public rooms. Defaults to false. If you set it True, you'll have to run +# UPDATE user_directory_stream_pos SET stream_id = NULL; +# on your database to tell it to rebuild the user_directory search indexes. +# +#user_directory: +# search_all_users: false diff --git a/debian/install b/debian/install new file mode 100644 index 0000000000..d1f42c8be6 --- /dev/null +++ b/debian/install @@ -0,0 +1,2 @@ +debian/homeserver.yaml etc/matrix-synapse +debian/log.yaml etc/matrix-synapse diff --git a/debian/log.yaml b/debian/log.yaml new file mode 100644 index 0000000000..b44a8901f6 --- /dev/null +++ b/debian/log.yaml @@ -0,0 +1,35 @@ + +version: 1 + +formatters: + precise: + format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s- %(message)s' + +filters: + context: + (): synapse.util.logcontext.LoggingContextFilter + request: "" + +handlers: + file: + class: logging.handlers.RotatingFileHandler + formatter: precise + filename: /var/log/matrix-synapse/homeserver.log + maxBytes: 104857600 + backupCount: 10 + filters: [context] + console: + class: logging.StreamHandler + formatter: precise + level: WARN + +loggers: + synapse: + level: INFO + + synapse.storage.SQL: + level: INFO + +root: + level: INFO + handlers: [file, console] diff --git a/debian/manpages b/debian/manpages new file mode 100644 index 0000000000..2c30583530 --- /dev/null +++ b/debian/manpages @@ -0,0 +1,4 @@ +debian/hash_password.1 +debian/register_new_matrix_user.1 +debian/synapse_port_db.1 +debian/synctl.1 diff --git a/debian/matrix-synapse.default b/debian/matrix-synapse.default new file mode 100644 index 0000000000..65dc2f33d8 --- /dev/null +++ b/debian/matrix-synapse.default @@ -0,0 +1,2 @@ +# Specify environment variables used when running Synapse +# SYNAPSE_CACHE_FACTOR=1 (default) diff --git a/debian/matrix-synapse.init b/debian/matrix-synapse.init new file mode 100755 index 0000000000..7a9e8b3296 --- /dev/null +++ b/debian/matrix-synapse.init @@ -0,0 +1,184 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: matrix-synapse +# Required-Start: $local_fs $network $remote_fs $syslog +# Required-Stop: $local_fs $network $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: +# Description: +# <...> +# <...> +### END INIT INFO + +# Author: Paul "LeoNerd" Evans + +# Do NOT "set -e" + +# PATH should only include /usr/* if it runs after the mountnfs.sh script +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC="matrix-synapse" +NAME=matrix-synapse +SCRIPTNAME=/etc/init.d/$NAME + +PYTHON="/usr/bin/python" +CONFIGS="--config-path /etc/matrix-synapse/homeserver.yaml --config-path /etc/matrix-synapse/conf.d/" +USER="matrix-synapse" +SHAREDIR=/var/lib/$NAME + +# Exit if the package is not installed +[ -f "/etc/matrix-synapse/homeserver.yaml" ] || exit 0 + +# Read configuration variable file if it is present +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Load the VERBOSE setting and other rcS variables +. /lib/init/vars.sh + +# Define LSB log_* functions. +# Depend on lsb-base (>= 3.2-14) to ensure that this file is present +# and status_of_proc is working. +. /lib/lsb/init-functions + +get_config_key() +{ + python -m synapse.config read "$1" $CONFIGS || return 2 +} + +# +# Function that starts the daemon/service +# +do_start() +{ + # Running --generate-config to create keys if any are absent. + # Doesn't matter if not + $PYTHON -m "synapse.app.homeserver" $CONFIGS --generate-keys || return 2 + + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + PIDFILE=`get_config_key "pid_file"` + RETVAL=$? + if [ "$RETVAL" != 0 ]; then + return $RETVAL + fi + if [ -r "$PIDFILE" ]; then + kill -0 `cat $PIDFILE` && return 1 + fi + + export PYTHONPATH + + # Create the PID file so that synapse can write to it as nonroot + touch $PIDFILE + chown $USER:nogroup $PIDFILE + chown $USER:nogroup $SHAREDIR/media/ + chown $USER:nogroup $SHAREDIR/uploads/ + + start-stop-daemon --start --pidfile $PIDFILE --chuid $USER \ + --exec $PYTHON -- -m "synapse.app.homeserver" $CONFIGS --daemonize || return 2 + + return 0 +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + PIDFILE=`get_config_key "pid_file"` + RETVAL=$? + if [ "$RETVAL" != 0 ]; then + return $RETVAL + fi + + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --user $USER --exec $PYTHON + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + + # Many daemons don't delete their pidfiles when they exit. + rm -f $PIDFILE + return "$RETVAL" +} + +# +# Function that sends a SIGHUP to the daemon/service +# +do_reload() { + # + # If the daemon can reload its configuration without + # restarting (for example, when it is sent a SIGHUP), + # then implement that here. + # + return 1 +} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + PIDFILE=`get_config_key "pid_file"` + RETVAL=$? + if [ "$RETVAL" != 0 ]; then + return $RETVAL + fi + status_of_proc -p "$PIDFILE" "$PYTHON" "$NAME" && exit 0 || exit $? + ;; + #reload|force-reload) + # + # If do_reload() is not implemented then leave this commented out + # and leave 'force-reload' as an alias for 'restart'. + # + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # + # If the "reload" option is implemented then remove the + # 'force-reload' alias + # + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/debian/matrix-synapse.service b/debian/matrix-synapse.service new file mode 100644 index 0000000000..ab94e073a6 --- /dev/null +++ b/debian/matrix-synapse.service @@ -0,0 +1,15 @@ +[Unit] +Description=Synapse Matrix homeserver + +[Service] +Type=simple +User=matrix-synapse +WorkingDirectory=/var/lib/matrix-synapse +EnvironmentFile=/etc/default/matrix-synapse +ExecStartPre=/usr/bin/python -m synapse.app.homeserver --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/ --generate-keys +ExecStart=/usr/bin/python -m synapse.app.homeserver --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/ +Restart=always +RestartSec=3 + +[Install] +WantedBy=multi-user.target diff --git a/debian/patches/0001-tox.patch b/debian/patches/0001-tox.patch new file mode 100644 index 0000000000..2cf3ec0fe8 --- /dev/null +++ b/debian/patches/0001-tox.patch @@ -0,0 +1,19 @@ +From: Erik Johnston +Date: Fri, 10 Jun 2016 10:57:07 +0100 +Subject: tox + +--- + tox.ini | 1 + + 1 file changed, 1 insertion(+) + +Index: package-synapse-debian/tox.ini +=================================================================== +--- package-synapse-debian.orig/tox.ini ++++ package-synapse-debian/tox.ini +@@ -1,5 +1,6 @@ + [tox] + envlist = packaging, py27, py36, pep8, check_isort ++sitepackages = True + + [base] + deps = diff --git a/debian/patches/0002-change_instructions.patch b/debian/patches/0002-change_instructions.patch new file mode 100644 index 0000000000..933de3ab94 --- /dev/null +++ b/debian/patches/0002-change_instructions.patch @@ -0,0 +1,34 @@ +From: Erik Johnston +Date: Fri, 10 Jun 2016 10:57:07 +0100 +Subject: change_instructions + +--- + synapse/config/_base.py | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/synapse/config/_base.py ++++ b/synapse/config/_base.py +@@ -31,6 +31,11 @@ + MISSING_REPORT_STATS_CONFIG_INSTRUCTIONS = """\ + Please opt in or out of reporting anonymized homeserver usage statistics, by + setting the `report_stats` key in your config file to either True or False. ++ ++To set it run: ++ ++ dpkg-reconfigure matrix-synapse ++ + """ + + MISSING_REPORT_STATS_SPIEL = """\ +@@ -45,6 +50,11 @@ + + MISSING_SERVER_NAME = """\ + Missing mandatory `server_name` config option. ++ ++To set it run: ++ ++ dpkg-reconfigure matrix-synapse ++ + """ + + diff --git a/debian/patches/0004-webclient-instructions.patch b/debian/patches/0004-webclient-instructions.patch new file mode 100644 index 0000000000..e2e61a8446 --- /dev/null +++ b/debian/patches/0004-webclient-instructions.patch @@ -0,0 +1,27 @@ +From: Erik Johnston +Date: Fri, 10 Jun 2016 10:57:07 +0100 +Subject: webclient-instructions + +--- + synapse/app/homeserver.py | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +Index: package-synapse-debian/synapse/app/homeserver.py +=================================================================== +--- package-synapse-debian.orig/synapse/app/homeserver.py ++++ package-synapse-debian/synapse/app/homeserver.py +@@ -86,12 +86,11 @@ def build_resource_for_web_client(hs): + "Please either install the matrix-angular-sdk or configure\n" + "the location of the source to serve via the configuration\n" + "option `web_client_location`\n\n" +- "To install the `matrix-angular-sdk` via pip, run:\n\n" +- " pip install '%(dep)s'\n" ++ "To install the `matrix-angular-sdk` via apt-get, run:\n\n" ++ " apt-get install matrix-synapse-angular-client\n" + "\n" + "You can also disable hosting of the webclient via the\n" + "configuration option `web_client`\n" +- % {"dep": CONDITIONAL_REQUIREMENTS["web_client"].keys()[0]} + ) + syweb_path = os.path.dirname(syweb.__file__) + webclient_path = os.path.join(syweb_path, "webclient") diff --git a/debian/patches/0006-Don-t-require-strict-nacl-0.3.0-requirement.patch b/debian/patches/0006-Don-t-require-strict-nacl-0.3.0-requirement.patch new file mode 100644 index 0000000000..8370c96166 --- /dev/null +++ b/debian/patches/0006-Don-t-require-strict-nacl-0.3.0-requirement.patch @@ -0,0 +1,21 @@ +From: Erik Johnston +Date: Mon, 20 Jun 2016 13:20:37 +0100 +Subject: Don't require strict nacl==0.3.0 requirement + +--- + synapse/python_dependencies.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: package-synapse-debian/synapse/python_dependencies.py +=================================================================== +--- package-synapse-debian.orig/synapse/python_dependencies.py ++++ package-synapse-debian/synapse/python_dependencies.py +@@ -37,7 +37,7 @@ REQUIREMENTS = { + "unpaddedbase64>=1.1.0": ["unpaddedbase64>=1.1.0"], + "canonicaljson>=1.1.3": ["canonicaljson>=1.1.3"], + "signedjson>=1.0.0": ["signedjson>=1.0.0"], +- "pynacl>=1.2.1": ["nacl>=1.2.1", "nacl.bindings"], ++ "pynacl>=0.3.0": ["nacl>=0.3.0", "nacl.bindings"], + "service_identity>=16.0.0": ["service_identity>=16.0.0"], + "Twisted>=17.1.0": ["twisted>=17.1.0"], + "treq>=15.1": ["treq>=15.1"], diff --git a/debian/patches/bcrypt.patch b/debian/patches/bcrypt.patch new file mode 100644 index 0000000000..a962949920 --- /dev/null +++ b/debian/patches/bcrypt.patch @@ -0,0 +1,30 @@ +Index: package-synapse-debian/synapse/handlers/auth.py +=================================================================== +--- package-synapse-debian.orig/synapse/handlers/auth.py ++++ package-synapse-debian/synapse/handlers/auth.py +@@ -921,10 +921,10 @@ class AuthHandler(BaseHandler): + # Normalise the Unicode in the password + pw = unicodedata.normalize("NFKC", password) + +- return bcrypt.checkpw( ++ return bcrypt.hashpw( + pw.encode('utf8') + self.hs.config.password_pepper.encode("utf8"), + stored_hash +- ) ++ ) == stored_hash + + if stored_hash: + if not isinstance(stored_hash, bytes): +Index: package-synapse-debian/synapse/python_dependencies.py +=================================================================== +--- package-synapse-debian.orig/synapse/python_dependencies.py ++++ package-synapse-debian/synapse/python_dependencies.py +@@ -49,7 +49,7 @@ REQUIREMENTS = { + "pyasn1>=0.1.9": ["pyasn1"], + "pyasn1-modules>=0.0.7": ["pyasn1_modules"], + "daemonize>=2.3.1": ["daemonize"], +- "bcrypt>=3.1.0": ["bcrypt>=3.1.0"], ++ "bcrypt": ["bcrypt"], + "pillow>=3.1.2": ["PIL"], + "sortedcontainers>=1.4.4": ["sortedcontainers"], + "psutil>=2.0.0": ["psutil>=2.0.0"], diff --git a/debian/patches/no_install_with_pip b/debian/patches/no_install_with_pip new file mode 100644 index 0000000000..654656f596 --- /dev/null +++ b/debian/patches/no_install_with_pip @@ -0,0 +1,43 @@ +Index: package-synapse-debian/synapse/app/__init__.py +=================================================================== +--- package-synapse-debian.orig/synapse/app/__init__.py ++++ package-synapse-debian/synapse/app/__init__.py +@@ -25,8 +25,8 @@ try: + except python_dependencies.MissingRequirementError as e: + message = "\n".join([ + "Missing Requirement: %s" % (str(e),), +- "To install run:", +- " pip install --upgrade --force \"%s\"" % (e.dependency,), ++ "To install, try:", ++ " sudo apt-get install python-%s" % (e.dependency,), + "", + ]) + sys.stderr.writelines(message) +Index: package-synapse-debian/synapse/config/jwt_config.py +=================================================================== +--- package-synapse-debian.orig/synapse/config/jwt_config.py ++++ package-synapse-debian/synapse/config/jwt_config.py +@@ -19,7 +19,7 @@ MISSING_JWT = ( + """Missing jwt library. This is required for jwt login. + + Install by running: +- pip install pyjwt ++ sudo apt-get install python-jwt + """ + ) + +Index: package-synapse-debian/synapse/config/repository.py +=================================================================== +--- package-synapse-debian.orig/synapse/config/repository.py ++++ package-synapse-debian/synapse/config/repository.py +@@ -27,9 +27,7 @@ MISSING_LXML = ( + """Missing lxml library. This is required for URL preview API. + + Install by running: +- pip install lxml +- +- Requires libxslt1-dev system package. ++ sudo apt-get install python-lxml + """ + ) + diff --git a/debian/patches/remove-webclient.patch b/debian/patches/remove-webclient.patch new file mode 100644 index 0000000000..bfd2fce576 --- /dev/null +++ b/debian/patches/remove-webclient.patch @@ -0,0 +1,31 @@ +Index: package-synapse-debian/synapse/app/homeserver.py +=================================================================== +--- package-synapse-debian.orig/synapse/app/homeserver.py ++++ package-synapse-debian/synapse/app/homeserver.py +@@ -124,7 +124,7 @@ class SynapseHomeServer(HomeServer): + for res in listener_config["resources"]: + for name in res["names"]: + resources.update(self._configure_named_resource( +- name, res.get("compress", False), ++ config, name, res.get("compress", False), + )) + + additional_resources = listener_config.get("additional_resources", {}) +@@ -171,7 +171,7 @@ class SynapseHomeServer(HomeServer): + ) + logger.info("Synapse now listening on port %d", port) + +- def _configure_named_resource(self, name, compress=False): ++ def _configure_named_resource(self, config, name, compress=False): + """Build a resource map for a named resource + + Args: +@@ -235,7 +235,7 @@ class SynapseHomeServer(HomeServer): + if name in ["keys", "federation"]: + resources[SERVER_KEY_V2_PREFIX] = KeyApiV2Resource(self) + +- if name == "webclient": ++ if name == "webclient" and config.web_client: + resources[WEB_CLIENT_PREFIX] = build_resource_for_web_client(self) + + if name == "metrics" and self.get_config().enable_metrics: diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000000..ae46209e92 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,7 @@ +0001-tox.patch +0002-change_instructions.patch +0004-webclient-instructions.patch +0006-Don-t-require-strict-nacl-0.3.0-requirement.patch +remove-webclient.patch +bcrypt.patch +no_install_with_pip diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in new file mode 100644 index 0000000000..cef83a3407 --- /dev/null +++ b/debian/po/POTFILES.in @@ -0,0 +1 @@ +[type: gettext/rfc822deb] templates diff --git a/debian/po/templates.pot b/debian/po/templates.pot new file mode 100644 index 0000000000..84d960761a --- /dev/null +++ b/debian/po/templates.pot @@ -0,0 +1,56 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the matrix-synapse package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: matrix-synapse\n" +"Report-Msgid-Bugs-To: matrix-synapse@packages.debian.org\n" +"POT-Creation-Date: 2017-02-21 07:51+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: string +#. Description +#: ../templates:1001 +msgid "Name of the server:" +msgstr "" + +#. Type: string +#. Description +#: ../templates:1001 +msgid "" +"The name that this homeserver will appear as, to clients and other servers " +"via federation. This name should match the SRV record published in DNS." +msgstr "" + +#. Type: boolean +#. Description +#: ../templates:2001 +msgid "Report anonymous statistics?" +msgstr "" + +#. Type: boolean +#. Description +#: ../templates:2001 +msgid "" +"Developers of Matrix and Synapse really appreciate helping the project out " +"by reporting anonymized usage statistics from this homeserver. Only very " +"basic aggregate data (e.g. number of users) will be reported, but it helps " +"track the growth of the Matrix community, and helps in making Matrix a " +"success, as well as to convince other networks that they should peer with " +"Matrix." +msgstr "" + +#. Type: boolean +#. Description +#: ../templates:2001 +msgid "Thank you." +msgstr "" diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000000..0509acd0a4 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,39 @@ +#!/bin/sh -e + +. /usr/share/debconf/confmodule + +CONFIGFILE_SERVERNAME="/etc/matrix-synapse/conf.d/server_name.yaml" +CONFIGFILE_REPORTSTATS="/etc/matrix-synapse/conf.d/report_stats.yaml" +USER="matrix-synapse" + +case "$1" in + configure|reconfigure) + # Set server name in config file + mkdir -p "/etc/matrix-synapse/conf.d/" + db_get matrix-synapse/server-name + + if [ "$RET" ]; then + echo "server_name: $RET" > $CONFIGFILE_SERVERNAME + fi + + db_get matrix-synapse/report-stats + if [ "$RET" ]; then + echo "report_stats: $RET" > $CONFIGFILE_REPORTSTATS + fi + + if ! getent passwd $USER >/dev/null; then + adduser --quiet --system --no-create-home --home /var/lib/matrix-synapse $USER + fi + + for DIR in /var/lib/matrix-synapse /var/log/matrix-synapse /etc/matrix-synapse; do + if ! dpkg-statoverride --list --quiet $DIR >/dev/null; then + dpkg-statoverride --force --quiet --update --add $USER nogroup 0755 $DIR + fi + done + + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/pydist-overrides b/debian/pydist-overrides new file mode 100644 index 0000000000..e2e34b7d30 --- /dev/null +++ b/debian/pydist-overrides @@ -0,0 +1,5 @@ +matrix-angular-sdk +jinja2 +bleach +ldap3 +matrix-synapse-ldap3 diff --git a/debian/register_new_matrix_user.1 b/debian/register_new_matrix_user.1 new file mode 100644 index 0000000000..99156a7354 --- /dev/null +++ b/debian/register_new_matrix_user.1 @@ -0,0 +1,72 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "REGISTER_NEW_MATRIX_USER" "1" "February 2017" "" "" +. +.SH "NAME" +\fBregister_new_matrix_user\fR \- Used to register new users with a given home server when registration has been disabled +. +.SH "SYNOPSIS" +\fBregister_new_matrix_user\fR options\.\.\. +. +.SH "DESCRIPTION" +\fBregister_new_matrix_user\fR registers new users with a given home server when registration has been disabled\. For this to work, the home server must be configured with the \'registration_shared_secret\' option set\. +. +.P +This accepts the user credentials like the username, password, is user an admin or not and registers the user onto the homeserver database\. Also, a YAML file containing the shared secret can be provided\. If not, the shared secret can be provided via the command line\. +. +.P +By default it assumes the home server URL to be \fBhttps://localhost:8448\fR\. This can be changed via the \fBserver_url\fR command line option\. +. +.SH "FILES" +A sample YAML file accepted by \fBregister_new_matrix_user\fR is described below: +. +.IP "" 4 +. +.nf + +registration_shared_secret: "s3cr3t" +. +.fi +. +.IP "" 0 +. +.SH "OPTIONS" +. +.TP +\fB\-u\fR, \fB\-\-user\fR +Local part of the new user\. Will prompt if omitted\. +. +.TP +\fB\-p\fR, \fB\-\-password\fR +New password for user\. Will prompt if omitted\. Supplying the password on the command line is not recommended\. Use the STDIN instead\. +. +.TP +\fB\-a\fR, \fB\-\-admin\fR +Register new user as an admin\. Will prompt if omitted\. +. +.TP +\fB\-c\fR, \fB\-\-config\fR +Path to server config file containing the shared secret\. +. +.TP +\fB\-k\fR, \fB\-\-shared\-secret\fR +Shared secret as defined in server config file\. This is an optional parameter as it can be also supplied via the YAML file\. +. +.TP +\fBserver_url\fR +URL of the home server\. Defaults to \'https://localhost:8448\'\. +. +.SH "EXAMPLES" +. +.nf + +$ register_new_matrix_user \-u user1 \-p p@ssword \-a \-c config\.yaml +. +.fi +. +.SH "COPYRIGHT" +This man page was written by Rahul De <\fIrahulde@swecha\.net\fR> for Debian GNU/Linux distribution\. +. +.SH "SEE ALSO" +synctl(1), synapse_port_db(1), hash_password(1) diff --git a/debian/register_new_matrix_user.ronn b/debian/register_new_matrix_user.ronn new file mode 100644 index 0000000000..4c22e74dde --- /dev/null +++ b/debian/register_new_matrix_user.ronn @@ -0,0 +1,61 @@ +register_new_matrix_user(1) -- Used to register new users with a given home server when registration has been disabled +====================================================================================================================== + +## SYNOPSIS + +`register_new_matrix_user` options... + +## DESCRIPTION + +**register_new_matrix_user** registers new users with a given home server when +registration has been disabled. For this to work, the home server must be +configured with the 'registration_shared_secret' option set. + +This accepts the user credentials like the username, password, is user an +admin or not and registers the user onto the homeserver database. Also, +a YAML file containing the shared secret can be provided. If not, the +shared secret can be provided via the command line. + +By default it assumes the home server URL to be `https://localhost:8448`. +This can be changed via the `server_url` command line option. + +## FILES + +A sample YAML file accepted by `register_new_matrix_user` is described below: + + registration_shared_secret: "s3cr3t" + +## OPTIONS + + * `-u`, `--user`: + Local part of the new user. Will prompt if omitted. + + * `-p`, `--password`: + New password for user. Will prompt if omitted. Supplying the password + on the command line is not recommended. Use the STDIN instead. + + * `-a`, `--admin`: + Register new user as an admin. Will prompt if omitted. + + * `-c`, `--config`: + Path to server config file containing the shared secret. + + * `-k`, `--shared-secret`: + Shared secret as defined in server config file. This is an optional + parameter as it can be also supplied via the YAML file. + + * `server_url`: + URL of the home server. Defaults to 'https://localhost:8448'. + +## EXAMPLES + + $ register_new_matrix_user -u user1 -p p@ssword -a -c config.yaml + +## COPYRIGHT + +This man page was written by Rahul De <> +for Debian GNU/Linux distribution. + +## SEE ALSO + +synctl(1), synapse_port_db(1), hash_password(1) diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000000..ad0e95c83d --- /dev/null +++ b/debian/rules @@ -0,0 +1,18 @@ +#!/usr/bin/make -f + +# This file was automatically generated by stdeb 0.8.2 at +# Fri, 12 Jun 2015 14:32:03 +0100 +export PYBUILD_NAME=matrix-synapse +%: + dh $@ --with python2 --with systemd --buildsystem=pybuild --no-guessing-deps + +override_dh_auto_install: + python setup.py install --root=debian/matrix-synapse --install-layout=deb + +override_dh_auto_build: + +override_dh_installinit: + dh_installinit --no-start + +override_dh_auto_test: + PYTHONPATH=. trial tests diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000000..163aaf8d82 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/synapse_port_db.1 b/debian/synapse_port_db.1 new file mode 100644 index 0000000000..4e6bc04827 --- /dev/null +++ b/debian/synapse_port_db.1 @@ -0,0 +1,98 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "SYNAPSE_PORT_DB" "1" "February 2017" "" "" +. +.SH "NAME" +\fBsynapse_port_db\fR \- A script to port an existing synapse SQLite database to a new PostgreSQL database\. +. +.SH "SYNOPSIS" +\fBsynapse_port_db\fR [\-v] \-\-sqlite\-database=\fIdbfile\fR \-\-postgres\-config=\fIyamlconfig\fR [\-\-curses] [\-\-batch\-size=\fIbatch\-size\fR] +. +.SH "DESCRIPTION" +\fBsynapse_port_db\fR ports an existing synapse SQLite database to a new PostgreSQL database\. +. +.P +SQLite database is specified with \fB\-\-sqlite\-database\fR option and PostgreSQL configuration required to connect to PostgreSQL database is provided using \fB\-\-postgres\-config\fR configuration\. The configuration is specified in YAML format\. +. +.SH "OPTIONS" +. +.TP +\fB\-v\fR +Print log messages in \fBdebug\fR level instead of \fBinfo\fR level\. +. +.TP +\fB\-\-sqlite\-database\fR +The snapshot of the SQLite database file\. This must not be currently used by a running synapse server\. +. +.TP +\fB\-\-postgres\-config\fR +The database config file for the PostgreSQL database\. +. +.TP +\fB\-\-curses\fR +Display a curses based progress UI\. +. +.SH "CONFIG FILE" +The postgres configuration file must be a valid YAML file with the following options\. +. +.IP "\(bu" 4 +\fBdatabase\fR: Database configuration section\. This section header can be ignored and the options below may be specified as top level keys\. +. +.IP "\(bu" 4 +\fBname\fR: Connector to use when connecting to the database\. This value must be \fBpsycopg2\fR\. +. +.IP "\(bu" 4 +\fBargs\fR: DB API 2\.0 compatible arguments to send to the \fBpsycopg2\fR module\. +. +.IP "\(bu" 4 +\fBdbname\fR \- the database name +. +.IP "\(bu" 4 +\fBuser\fR \- user name used to authenticate +. +.IP "\(bu" 4 +\fBpassword\fR \- password used to authenticate +. +.IP "\(bu" 4 +\fBhost\fR \- database host address (defaults to UNIX socket if not provided) +. +.IP "\(bu" 4 +\fBport\fR \- connection port number (defaults to 5432 if not provided) +. +.IP "" 0 + +. +.IP "\(bu" 4 +\fBsynchronous_commit\fR: Optional\. Default is True\. If the value is \fBFalse\fR, enable asynchronous commit and don\'t wait for the server to call fsync before ending the transaction\. See: https://www\.postgresql\.org/docs/current/static/wal\-async\-commit\.html +. +.IP "" 0 + +. +.IP "" 0 +. +.P +Following example illustrates the configuration file format\. +. +.IP "" 4 +. +.nf + +database: + name: psycopg2 + args: + dbname: synapsedb + user: synapseuser + password: ORohmi9Eet=ohphi + host: localhost + synchronous_commit: false +. +.fi +. +.IP "" 0 +. +.SH "COPYRIGHT" +This man page was written by Sunil Mohan Adapa <\fIsunil@medhas\.org\fR> for Debian GNU/Linux distribution\. +. +.SH "SEE ALSO" +synctl(1), hash_password(1), register_new_matrix_user(1) diff --git a/debian/synapse_port_db.ronn b/debian/synapse_port_db.ronn new file mode 100644 index 0000000000..fcb32ebd0d --- /dev/null +++ b/debian/synapse_port_db.ronn @@ -0,0 +1,87 @@ +synapse_port_db(1) -- A script to port an existing synapse SQLite database to a new PostgreSQL database. +============================================= + +## SYNOPSIS + +`synapse_port_db` [-v] --sqlite-database= --postgres-config= [--curses] [--batch-size=] + +## DESCRIPTION + +**synapse_port_db** ports an existing synapse SQLite database to a new +PostgreSQL database. + +SQLite database is specified with `--sqlite-database` option and +PostgreSQL configuration required to connect to PostgreSQL database is +provided using `--postgres-config` configuration. The configuration +is specified in YAML format. + +## OPTIONS + + * `-v`: + Print log messages in `debug` level instead of `info` level. + + * `--sqlite-database`: + The snapshot of the SQLite database file. This must not be + currently used by a running synapse server. + + * `--postgres-config`: + The database config file for the PostgreSQL database. + + * `--curses`: + Display a curses based progress UI. + +## CONFIG FILE + +The postgres configuration file must be a valid YAML file with the +following options. + + * `database`: + Database configuration section. This section header can be + ignored and the options below may be specified as top level + keys. + + * `name`: + Connector to use when connecting to the database. This value must + be `psycopg2`. + + * `args`: + DB API 2.0 compatible arguments to send to the `psycopg2` module. + + * `dbname` - the database name + + * `user` - user name used to authenticate + + * `password` - password used to authenticate + + * `host` - database host address (defaults to UNIX socket if not + provided) + + * `port` - connection port number (defaults to 5432 if not + provided) + + + * `synchronous_commit`: + Optional. Default is True. If the value is `False`, enable + asynchronous commit and don't wait for the server to call fsync + before ending the transaction. See: + https://www.postgresql.org/docs/current/static/wal-async-commit.html + +Following example illustrates the configuration file format. + + database: + name: psycopg2 + args: + dbname: synapsedb + user: synapseuser + password: ORohmi9Eet=ohphi + host: localhost + synchronous_commit: false + +## COPYRIGHT + +This man page was written by Sunil Mohan Adapa <> for +Debian GNU/Linux distribution. + +## SEE ALSO + +synctl(1), hash_password(1), register_new_matrix_user(1) diff --git a/debian/synctl.1 b/debian/synctl.1 new file mode 100644 index 0000000000..437f8f9e0e --- /dev/null +++ b/debian/synctl.1 @@ -0,0 +1,63 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "SYNCTL" "1" "February 2017" "" "" +. +.SH "NAME" +\fBsynctl\fR \- Synapse server control interface +. +.SH "SYNOPSIS" +Start, stop or restart synapse server\. +. +.P +\fBsynctl\fR {start|stop|restart} [configfile] [\-w|\-\-worker=\fIWORKERCONFIG\fR] [\-a|\-\-all\-processes=\fIWORKERCONFIGDIR\fR] +. +.SH "DESCRIPTION" +\fBsynctl\fR can be used to start, stop or restart Synapse server\. The control operation can be done on all processes or a single worker process\. +. +.SH "OPTIONS" +. +.TP +\fBaction\fR +The value of action should be one of \fBstart\fR, \fBstop\fR or \fBrestart\fR\. +. +.TP +\fBconfigfile\fR +Optional path of the configuration file to use\. Default value is \fBhomeserver\.yaml\fR\. The configuration file must exist for the operation to succeed\. +. +.TP +\fB\-w\fR, \fB\-\-worker\fR: +. +.IP +Perform start, stop or restart operations on a single worker\. Incompatible with \fB\-a\fR|\fB\-\-all\-processes\fR\. Value passed must be a valid worker\'s configuration file\. +. +.TP +\fB\-a\fR, \fB\-\-all\-processes\fR: +. +.IP +Perform start, stop or restart operations on all the workers in the given directory and the main synapse process\. Incompatible with \fB\-w\fR|\fB\-\-worker\fR\. Value passed must be a directory containing valid work configuration files\. All files ending with \fB\.yaml\fR extension shall be considered as configuration files and all other files in the directory are ignored\. +. +.SH "CONFIGURATION FILE" +Configuration file may be generated as follows: +. +.IP "" 4 +. +.nf + +$ python \-B \-m synapse\.app\.homeserver \-c config\.yaml \-\-generate\-config \-\-server\-name= +. +.fi +. +.IP "" 0 +. +.SH "ENVIRONMENT" +. +.TP +\fBSYNAPSE_CACHE_FACTOR\fR +Synapse\'s architecture is quite RAM hungry currently \- a lot of recent room data and metadata is deliberately cached in RAM in order to speed up common requests\. This will be improved in future, but for now the easiest way to either reduce the RAM usage (at the risk of slowing things down) is to set the SYNAPSE_CACHE_FACTOR environment variable\. Roughly speaking, a SYNAPSE_CACHE_FACTOR of 1\.0 will max out at around 3\-4GB of resident memory \- this is what we currently run the matrix\.org on\. The default setting is currently 0\.1, which is probably around a ~700MB footprint\. You can dial it down further to 0\.02 if desired, which targets roughly ~512MB\. Conversely you can dial it up if you need performance for lots of users and have a box with a lot of RAM\. +. +.SH "COPYRIGHT" +This man page was written by Sunil Mohan Adapa <\fIsunil@medhas\.org\fR> for Debian GNU/Linux distribution\. +. +.SH "SEE ALSO" +synapse_port_db(1), hash_password(1), register_new_matrix_user(1) diff --git a/debian/synctl.ronn b/debian/synctl.ronn new file mode 100644 index 0000000000..a73c832f62 --- /dev/null +++ b/debian/synctl.ronn @@ -0,0 +1,70 @@ +synctl(1) -- Synapse server control interface +============================================= + +## SYNOPSIS + Start, stop or restart synapse server. + +`synctl` {start|stop|restart} [configfile] [-w|--worker=] [-a|--all-processes=] + +## DESCRIPTION + +**synctl** can be used to start, stop or restart Synapse server. The +control operation can be done on all processes or a single worker +process. + +## OPTIONS + + * `action`: + The value of action should be one of `start`, `stop` or `restart`. + + * `configfile`: + Optional path of the configuration file to use. Default value is + `homeserver.yaml`. The configuration file must exist for the + operation to succeed. + + * `-w`, `--worker`: + + Perform start, stop or restart operations on a single worker. + Incompatible with `-a`|`--all-processes`. Value passed must be a + valid worker's configuration file. + + * `-a`, `--all-processes`: + + Perform start, stop or restart operations on all the workers in + the given directory and the main synapse process. Incompatible + with `-w`|`--worker`. Value passed must be a directory containing + valid work configuration files. All files ending with `.yaml` + extension shall be considered as configuration files and all other + files in the directory are ignored. + +## CONFIGURATION FILE + +Configuration file may be generated as follows: + + $ python -B -m synapse.app.homeserver -c config.yaml --generate-config --server-name= + +## ENVIRONMENT + + * `SYNAPSE_CACHE_FACTOR`: + Synapse's architecture is quite RAM hungry currently - a lot of + recent room data and metadata is deliberately cached in RAM in + order to speed up common requests. This will be improved in + future, but for now the easiest way to either reduce the RAM usage + (at the risk of slowing things down) is to set the + SYNAPSE_CACHE_FACTOR environment variable. Roughly speaking, a + SYNAPSE_CACHE_FACTOR of 1.0 will max out at around 3-4GB of + resident memory - this is what we currently run the matrix.org + on. The default setting is currently 0.1, which is probably around + a ~700MB footprint. You can dial it down further to 0.02 if + desired, which targets roughly ~512MB. Conversely you can dial it + up if you need performance for lots of users and have a box with a + lot of RAM. + +## COPYRIGHT + +This man page was written by Sunil Mohan Adapa <> for +Debian GNU/Linux distribution. + +## SEE ALSO + +synapse_port_db(1), hash_password(1), register_new_matrix_user(1) diff --git a/debian/templates b/debian/templates new file mode 100644 index 0000000000..647358731c --- /dev/null +++ b/debian/templates @@ -0,0 +1,19 @@ +Template: matrix-synapse/server-name +Type: string +_Description: Name of the server: + The name that this homeserver will appear as, to clients and other + servers via federation. This name should match the SRV record + published in DNS. + +Template: matrix-synapse/report-stats +Type: boolean +Default: false +_Description: Report anonymous statistics? + Developers of Matrix and Synapse really appreciate helping the + project out by reporting anonymized usage statistics from this + homeserver. Only very basic aggregate data (e.g. number of users) + will be reported, but it helps track the growth of the Matrix + community, and helps in making Matrix a success, as well as to + convince other networks that they should peer with Matrix. + . + Thank you. diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000000..b1b10d4cd0 --- /dev/null +++ b/debian/watch @@ -0,0 +1,11 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +# See uscan(1) for format + +# Compulsory line, this is a version 3 file +version=3 + + +opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/matrix-synapse-$1\.tar\.gz/,uversionmangle=s/-?rc/~rc/ \ + https://github.com/matrix-org/synapse/tags .*/v?(\d[^\s\-]*)\.tar\.gz debian uupdate -- cgit 1.4.1 From 1a6d5bfa08b4ba618dcab68e4ed524c4db07da2b Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 20 Dec 2018 11:33:29 +0000 Subject: Debian packaging via dh_virtualenv (#4285) --- .dockerignore | 2 + .gitignore | 8 +- MANIFEST.in | 1 + changelog.d/4212.misc | 1 + debian/.gitignore | 7 + debian/NEWS | 22 +++ debian/build_virtualenv | 48 ++++++ debian/changelog | 11 ++ debian/control | 92 +++-------- debian/copyright | 2 +- debian/gbp.conf | 5 - debian/homeserver.yaml | 10 +- debian/matrix-synapse-py3.links | 4 + debian/matrix-synapse-py3.postinst | 39 +++++ debian/matrix-synapse-py3.preinst | 31 ++++ debian/matrix-synapse-py3.triggers | 9 + debian/matrix-synapse.init | 184 --------------------- debian/matrix-synapse.service | 4 +- debian/patches/0001-tox.patch | 19 --- debian/patches/0002-change_instructions.patch | 34 ---- debian/patches/0004-webclient-instructions.patch | 27 --- ...n-t-require-strict-nacl-0.3.0-requirement.patch | 21 --- debian/patches/bcrypt.patch | 30 ---- debian/patches/no_install_with_pip | 43 ----- debian/patches/remove-webclient.patch | 31 ---- debian/patches/series | 7 - debian/postinst | 39 ----- debian/pydist-overrides | 5 - debian/rules | 28 ++-- debian/source/format | 2 +- debian/watch | 11 -- docker/Dockerfile-dhvirtualenv | 35 ++++ docker/build_debian.sh | 41 +++++ docker/build_debian_packages.sh | 39 +++++ synapse/python_dependencies.py | 2 +- synapse/storage/e2e_room_keys.py | 2 +- tox.ini | 1 + 37 files changed, 349 insertions(+), 548 deletions(-) create mode 100644 changelog.d/4212.misc create mode 100644 debian/.gitignore create mode 100644 debian/NEWS create mode 100755 debian/build_virtualenv delete mode 100644 debian/gbp.conf create mode 100644 debian/matrix-synapse-py3.links create mode 100644 debian/matrix-synapse-py3.postinst create mode 100644 debian/matrix-synapse-py3.preinst create mode 100644 debian/matrix-synapse-py3.triggers delete mode 100755 debian/matrix-synapse.init delete mode 100644 debian/patches/0001-tox.patch delete mode 100644 debian/patches/0002-change_instructions.patch delete mode 100644 debian/patches/0004-webclient-instructions.patch delete mode 100644 debian/patches/0006-Don-t-require-strict-nacl-0.3.0-requirement.patch delete mode 100644 debian/patches/bcrypt.patch delete mode 100644 debian/patches/no_install_with_pip delete mode 100644 debian/patches/remove-webclient.patch delete mode 100644 debian/patches/series delete mode 100755 debian/postinst delete mode 100644 debian/pydist-overrides delete mode 100644 debian/watch create mode 100644 docker/Dockerfile-dhvirtualenv create mode 100644 docker/build_debian.sh create mode 100755 docker/build_debian_packages.sh (limited to 'debian') diff --git a/.dockerignore b/.dockerignore index 0180602e56..3c3996eb4c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,3 +5,5 @@ demo/etc tox.ini .git/* .tox/* +debian/matrix-synapse/ +debian/matrix-synapse-*/ diff --git a/.gitignore b/.gitignore index 3b2252ad8a..1b632646bb 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,7 @@ homeserver*.db homeserver*.log homeserver*.log.* homeserver*.pid -homeserver*.yaml +/homeserver*.yaml *.signing.key *.tls.crt @@ -26,6 +26,8 @@ homeserver*.yaml *.tls.key .coverage +.coverage.* +!.coverage.rc htmlcov demo/*/*.db @@ -57,3 +59,7 @@ env/ .vscode/ .ropeproject/ + +*.deb + +/debs diff --git a/MANIFEST.in b/MANIFEST.in index ec18819bc9..29303cc8b5 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -36,6 +36,7 @@ prune demo/etc prune docker prune .circleci prune .coveragerc +prune debian exclude jenkins* recursive-exclude jenkins *.sh diff --git a/changelog.d/4212.misc b/changelog.d/4212.misc new file mode 100644 index 0000000000..42f2546cf9 --- /dev/null +++ b/changelog.d/4212.misc @@ -0,0 +1 @@ +Debian packages utilising a virtualenv with bundled dependencies can now be built. diff --git a/debian/.gitignore b/debian/.gitignore new file mode 100644 index 0000000000..f027374ae2 --- /dev/null +++ b/debian/.gitignore @@ -0,0 +1,7 @@ +/matrix-synapse-py3.*.debhelper +/matrix-synapse-py3.debhelper.log +/matrix-synapse-py3.substvars +/matrix-synapse-*/ +/files +/debhelper-build-stamp +/.debhelper diff --git a/debian/NEWS b/debian/NEWS new file mode 100644 index 0000000000..367e08f851 --- /dev/null +++ b/debian/NEWS @@ -0,0 +1,22 @@ +matrix-synapse-py3 (0.34.0) stable; urgency=medium + + matrix-synapse-py3 is intended as a drop-in replacement for the existing + matrix-synapse package. The replacement should be relatively seamless, + however, please note the following important differences to matrix-synapse: + + * Most importantly, the matrix-synapse service now runs under Python 3 rather + than Python 2.7. + + * Synapse is installed into its own virtualenv (in /opt/venvs/matrix-synapse) + instead of using the system python libraries. (This may mean that you can + remove a number of old dependencies with `apt-get autoremove`). + + matrix-synapse-py3 will take over responsibility for the existing + configuration files, including the matrix-synapse systemd service. + + Beware, however, that `apt-get purge matrix-synapse` will *disable* the + matrix-synapse service (so that it will not be started on reboot), even + though that service is no longer being provided by the matrix-synapse + package. It can be re-enabled with `systemctl enable matrix-synapse`. + + -- Richard van der Hoff Wed, 19 Dec 2018 14:00:00 +0000 diff --git a/debian/build_virtualenv b/debian/build_virtualenv new file mode 100755 index 0000000000..61ffb13192 --- /dev/null +++ b/debian/build_virtualenv @@ -0,0 +1,48 @@ +#!/bin/bash +# +# runs dh_virtualenv to build the virtualenv in the build directory, +# and then runs the trial tests against the installed synapse. + +set -e + +export DH_VIRTUALENV_INSTALL_ROOT=/opt/venvs +SNAKE=/usr/bin/python3 + +# try to set the CFLAGS so any compiled C extensions are compiled with the most +# generic as possible x64 instructions, so that compiling it on a new Intel chip +# doesn't enable features not available on older ones or AMD. +# +# TODO: add similar things for non-amd64, or figure out a more generic way to +# do this. + +case `dpkg-architecture -q DEB_HOST_ARCH` in + amd64) + export CFLAGS=-march=x86-64 + ;; +esac + +# Use --builtin-venv to use the better `venv` module from CPython 3.4+ rather +# than the 2/3 compatible `virtualenv`. + +dh_virtualenv \ + --install-suffix "matrix-synapse" \ + --builtin-venv \ + --setuptools \ + --python "$SNAKE" \ + --upgrade-pip \ + --preinstall="lxml" \ + --preinstall="mock" \ + --extra-pip-arg="--no-cache-dir" \ + --extra-pip-arg="--compile" + +# we copy the tests to a temporary directory so that we can put them on the +# PYTHONPATH without putting the uninstalled synapse on the pythonpath. +tmpdir=`mktemp -d` +trap "rm -r $tmpdir" EXIT + +cp -r tests "$tmpdir" +cd debian/matrix-synapse-py3 + +PYTHONPATH="$tmpdir" \ + ./opt/venvs/matrix-synapse/bin/python \ + -B -m twisted.trial --reporter=text -j2 tests diff --git a/debian/changelog b/debian/changelog index 20167978cf..040c8e7cd3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +matrix-synapse-py3 (0.34.0) stable; urgency=medium + + * New synapse release 0.34.0. + * Synapse is now installed into a Python 3 virtual environment with + up-to-date dependencies. + * The matrix-synapse service will now be restarted when the package is + upgraded. + (Fixes https://github.com/matrix-org/package-synapse-debian/issues/18) + + -- Synapse packaging team Wed, 19 Dec 2018 14:00:00 +0000 + matrix-synapse (0.33.9-1matrix1) stretch; urgency=medium [ Erik Johnston ] diff --git a/debian/control b/debian/control index 854d9688f3..552a81dcb0 100644 --- a/debian/control +++ b/debian/control @@ -1,77 +1,37 @@ -Source: matrix-synapse -Maintainer: Erik Johnston -Section: python -Priority: optional +Source: matrix-synapse-py3 +Section: contrib/python +Priority: extra +Maintainer: Synapse Packaging team Build-Depends: debhelper (>= 9), - dh-python, - dh-systemd (>= 1.5), - po-debconf, - python (>= 2.6.6-3), - python-bcrypt, - python-blist, - python-canonicaljson (>=1.1.3), - python-daemonize, - python-frozendict (>= 0.4), - python-lxml, - python-mock, - python-msgpack (>=0.3.0), - python-nacl (>= 0.3.0), - python-netaddr, - python-openssl (>= 0.14), - python-pil, - python-psutil, - python-pyasn1, - python-pydenticon, - python-pymacaroons-pynacl, - python-pysaml2, - python-service-identity (>= 1.0.0), - python-setuptools (>= 0.6b3), - python-signedjson (>= 1.0.0), - python-sortedcontainers, - python-syutil (>= 0.0.7), - python-treq (>= 15.1.0), - python-twisted (>= 17.1.0), - python-unpaddedbase64 (>= 1.0.1), - python-yaml, - python-phonenumbers (>= 8.2.0), - python-jsonschema (>=2.5.1), - python-prometheus-client, - python-attr -Standards-Version: 3.9.8 -X-Python-Version: >= 2.7 + dh-systemd, + dh-virtualenv (>= 1.0), + lsb-release, + python3-dev, + python3, + python3-setuptools, + python3-pip, + python3-venv, + tar, +Standards-Version: 3.9.5 +Homepage: https://github.com/matrix-org/synapse -Package: matrix-synapse -Architecture: all +Package: matrix-synapse-py3 +Architecture: amd64 +Conflicts: matrix-synapse +Pre-Depends: dpkg (>= 1.16.1) Depends: - ${misc:Depends}, - ${python:Depends}, adduser, debconf, - lsb-base (>= 3.0-6), - python-attr (>= 16.0.0), - python-twisted (>= 17.1.0), - python-canonicaljson (>=1.1.3), - python-prometheus-client (>=0.0.14), + python3-distutils|libpython3-stdlib (<< 3.6), + python3, + ${misc:Depends}, +# some of our scripts use perl, but none of them are important, +# so we put perl:Depends in Suggests rather than Depends. Suggests: - python-bleach (>= 1.4.2), - python-jinja2 (>= 2.8), -Recommends: - python-psycopg2, - python-lxml, + sqlite3, + ${perl:Depends}, Description: Open federated Instant Messaging and VoIP server Matrix is an ambitious new ecosystem for open federated Instant Messaging and VoIP. Synapse is a reference Matrix server implementation. - . - Everything in Matrix happens in a room. Rooms are distributed and do - not exist on any single server. Rooms can be located using - convenience aliases like #matrix:matrix.org or #test:localhost:8448. - . - Matrix user IDs look like @matthew:matrix.org (although in the future - you will normally refer to yourself and others using a 3PID: email - address, phone number, etc rather than manipulating Matrix user IDs) - . - The overall architecture is: - client <------> homeserver <=============> homeserver <------> client - https://a.org/_matrix https://b.net/_matrix diff --git a/debian/copyright b/debian/copyright index 35597e0804..95c21ea12a 100644 --- a/debian/copyright +++ b/debian/copyright @@ -3,7 +3,7 @@ Upstream-Name: synapse Source: https://github.com/matrix-org/synapse Files: * -Copyright: 2014-2017, OpenMarket Ltd +Copyright: 2014-2017, OpenMarket Ltd, 2017-2018 New Vector Ltd License: Apache-2.0 Files: synapse/config/saml2.py diff --git a/debian/gbp.conf b/debian/gbp.conf deleted file mode 100644 index 0432accfa0..0000000000 --- a/debian/gbp.conf +++ /dev/null @@ -1,5 +0,0 @@ -[DEFAULT] -debian-branch = debian - -[dch] -distribution = stable diff --git a/debian/homeserver.yaml b/debian/homeserver.yaml index 04ece25d49..188a2d5483 100644 --- a/debian/homeserver.yaml +++ b/debian/homeserver.yaml @@ -70,13 +70,9 @@ pid_file: "/var/run/matrix-synapse.pid" # # cpu_affinity: 0xFFFFFFFF -# Whether to serve a web client from the HTTP/HTTPS root resource. -web_client: False - -# The root directory to server for the above web client. -# If left undefined, synapse will serve the matrix-angular-sdk web client. -# Make sure matrix-angular-sdk is installed with pip if web_client is True -# and web_client_location is undefined +# The path to the web client which will be served at /_matrix/client/ +# if 'webclient' is configured under the 'listeners' configuration. +# # web_client_location: "/path/to/web/root" # The public-facing base URL for the client API (not including _matrix/...) diff --git a/debian/matrix-synapse-py3.links b/debian/matrix-synapse-py3.links new file mode 100644 index 0000000000..bf19efa562 --- /dev/null +++ b/debian/matrix-synapse-py3.links @@ -0,0 +1,4 @@ +opt/venvs/matrix-synapse/bin/hash_password usr/bin/hash_password +opt/venvs/matrix-synapse/bin/register_new_matrix_user usr/bin/register_new_matrix_user +opt/venvs/matrix-synapse/bin/synapse_port_db usr/bin/synapse_port_db +opt/venvs/matrix-synapse/bin/synctl usr/bin/synctl diff --git a/debian/matrix-synapse-py3.postinst b/debian/matrix-synapse-py3.postinst new file mode 100644 index 0000000000..0509acd0a4 --- /dev/null +++ b/debian/matrix-synapse-py3.postinst @@ -0,0 +1,39 @@ +#!/bin/sh -e + +. /usr/share/debconf/confmodule + +CONFIGFILE_SERVERNAME="/etc/matrix-synapse/conf.d/server_name.yaml" +CONFIGFILE_REPORTSTATS="/etc/matrix-synapse/conf.d/report_stats.yaml" +USER="matrix-synapse" + +case "$1" in + configure|reconfigure) + # Set server name in config file + mkdir -p "/etc/matrix-synapse/conf.d/" + db_get matrix-synapse/server-name + + if [ "$RET" ]; then + echo "server_name: $RET" > $CONFIGFILE_SERVERNAME + fi + + db_get matrix-synapse/report-stats + if [ "$RET" ]; then + echo "report_stats: $RET" > $CONFIGFILE_REPORTSTATS + fi + + if ! getent passwd $USER >/dev/null; then + adduser --quiet --system --no-create-home --home /var/lib/matrix-synapse $USER + fi + + for DIR in /var/lib/matrix-synapse /var/log/matrix-synapse /etc/matrix-synapse; do + if ! dpkg-statoverride --list --quiet $DIR >/dev/null; then + dpkg-statoverride --force --quiet --update --add $USER nogroup 0755 $DIR + fi + done + + ;; +esac + +#DEBHELPER# + +exit 0 diff --git a/debian/matrix-synapse-py3.preinst b/debian/matrix-synapse-py3.preinst new file mode 100644 index 0000000000..4b5612f050 --- /dev/null +++ b/debian/matrix-synapse-py3.preinst @@ -0,0 +1,31 @@ +#!/bin/sh -e + +# Attempt to undo some of the braindamage caused by +# https://github.com/matrix-org/package-synapse-debian/issues/18. +# +# Due to reasons [1], the old python2 matrix-synapse package will not stop the +# service when the package is uninstalled. Our maintainer scripts will do the +# right thing in terms of ensuring the service is enabled and unmasked, but +# then do a `systemctl start matrix-synapse`, which of course does nothing - +# leaving the old (py2) service running. +# +# There should normally be no reason for the service to be running during our +# preinst, so we assume that if it *is* running, it's due to that situation, +# and stop it. +# +# [1] dh_systemd_start doesn't do anything because it sees that there is an +# init.d script with the same name, so leaves it to dh_installinit. +# +# dh_installinit doesn't do anything because somebody gave it a --no-start +# for unknown reasons. + +if [ -x /bin/systemctl ]; then + if /bin/systemctl --quiet is-active -- matrix-synapse; then + echo >&2 "stopping existing matrix-synapse service" + /bin/systemctl stop matrix-synapse || true + fi +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/matrix-synapse-py3.triggers b/debian/matrix-synapse-py3.triggers new file mode 100644 index 0000000000..f8c1fdb021 --- /dev/null +++ b/debian/matrix-synapse-py3.triggers @@ -0,0 +1,9 @@ +# Register interest in Python interpreter changes and +# don't make the Python package dependent on the virtualenv package +# processing (noawait) +interest-noawait /usr/bin/python3.5 +interest-noawait /usr/bin/python3.6 +interest-noawait /usr/bin/python3.7 + +# Also provide a symbolic trigger for all dh-virtualenv packages +interest dh-virtualenv-interpreter-update diff --git a/debian/matrix-synapse.init b/debian/matrix-synapse.init deleted file mode 100755 index 7a9e8b3296..0000000000 --- a/debian/matrix-synapse.init +++ /dev/null @@ -1,184 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: matrix-synapse -# Required-Start: $local_fs $network $remote_fs $syslog -# Required-Stop: $local_fs $network $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: -# Description: -# <...> -# <...> -### END INIT INFO - -# Author: Paul "LeoNerd" Evans - -# Do NOT "set -e" - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC="matrix-synapse" -NAME=matrix-synapse -SCRIPTNAME=/etc/init.d/$NAME - -PYTHON="/usr/bin/python" -CONFIGS="--config-path /etc/matrix-synapse/homeserver.yaml --config-path /etc/matrix-synapse/conf.d/" -USER="matrix-synapse" -SHAREDIR=/var/lib/$NAME - -# Exit if the package is not installed -[ -f "/etc/matrix-synapse/homeserver.yaml" ] || exit 0 - -# Read configuration variable file if it is present -[ -r /etc/default/$NAME ] && . /etc/default/$NAME - -# Load the VERBOSE setting and other rcS variables -. /lib/init/vars.sh - -# Define LSB log_* functions. -# Depend on lsb-base (>= 3.2-14) to ensure that this file is present -# and status_of_proc is working. -. /lib/lsb/init-functions - -get_config_key() -{ - python -m synapse.config read "$1" $CONFIGS || return 2 -} - -# -# Function that starts the daemon/service -# -do_start() -{ - # Running --generate-config to create keys if any are absent. - # Doesn't matter if not - $PYTHON -m "synapse.app.homeserver" $CONFIGS --generate-keys || return 2 - - # Return - # 0 if daemon has been started - # 1 if daemon was already running - # 2 if daemon could not be started - PIDFILE=`get_config_key "pid_file"` - RETVAL=$? - if [ "$RETVAL" != 0 ]; then - return $RETVAL - fi - if [ -r "$PIDFILE" ]; then - kill -0 `cat $PIDFILE` && return 1 - fi - - export PYTHONPATH - - # Create the PID file so that synapse can write to it as nonroot - touch $PIDFILE - chown $USER:nogroup $PIDFILE - chown $USER:nogroup $SHAREDIR/media/ - chown $USER:nogroup $SHAREDIR/uploads/ - - start-stop-daemon --start --pidfile $PIDFILE --chuid $USER \ - --exec $PYTHON -- -m "synapse.app.homeserver" $CONFIGS --daemonize || return 2 - - return 0 -} - -# -# Function that stops the daemon/service -# -do_stop() -{ - # Return - # 0 if daemon has been stopped - # 1 if daemon was already stopped - # 2 if daemon could not be stopped - # other if a failure occurred - PIDFILE=`get_config_key "pid_file"` - RETVAL=$? - if [ "$RETVAL" != 0 ]; then - return $RETVAL - fi - - start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --user $USER --exec $PYTHON - RETVAL="$?" - [ "$RETVAL" = 2 ] && return 2 - - # Many daemons don't delete their pidfiles when they exit. - rm -f $PIDFILE - return "$RETVAL" -} - -# -# Function that sends a SIGHUP to the daemon/service -# -do_reload() { - # - # If the daemon can reload its configuration without - # restarting (for example, when it is sent a SIGHUP), - # then implement that here. - # - return 1 -} - -case "$1" in - start) - [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" - do_start - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - stop) - [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" - do_stop - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - status) - PIDFILE=`get_config_key "pid_file"` - RETVAL=$? - if [ "$RETVAL" != 0 ]; then - return $RETVAL - fi - status_of_proc -p "$PIDFILE" "$PYTHON" "$NAME" && exit 0 || exit $? - ;; - #reload|force-reload) - # - # If do_reload() is not implemented then leave this commented out - # and leave 'force-reload' as an alias for 'restart'. - # - #log_daemon_msg "Reloading $DESC" "$NAME" - #do_reload - #log_end_msg $? - #;; - restart|force-reload) - # - # If the "reload" option is implemented then remove the - # 'force-reload' alias - # - log_daemon_msg "Restarting $DESC" "$NAME" - do_stop - case "$?" in - 0|1) - do_start - case "$?" in - 0) log_end_msg 0 ;; - 1) log_end_msg 1 ;; # Old process is still running - *) log_end_msg 1 ;; # Failed to start - esac - ;; - *) - # Failed to stop - log_end_msg 1 - ;; - esac - ;; - *) - #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 - exit 3 - ;; -esac - -: diff --git a/debian/matrix-synapse.service b/debian/matrix-synapse.service index ab94e073a6..2e9cd83b5f 100644 --- a/debian/matrix-synapse.service +++ b/debian/matrix-synapse.service @@ -6,8 +6,8 @@ Type=simple User=matrix-synapse WorkingDirectory=/var/lib/matrix-synapse EnvironmentFile=/etc/default/matrix-synapse -ExecStartPre=/usr/bin/python -m synapse.app.homeserver --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/ --generate-keys -ExecStart=/usr/bin/python -m synapse.app.homeserver --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/ +ExecStartPre=/opt/venvs/matrix-synapse/bin/python -m synapse.app.homeserver --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/ --generate-keys +ExecStart=/opt/venvs/matrix-synapse/bin/python -m synapse.app.homeserver --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/ Restart=always RestartSec=3 diff --git a/debian/patches/0001-tox.patch b/debian/patches/0001-tox.patch deleted file mode 100644 index 2cf3ec0fe8..0000000000 --- a/debian/patches/0001-tox.patch +++ /dev/null @@ -1,19 +0,0 @@ -From: Erik Johnston -Date: Fri, 10 Jun 2016 10:57:07 +0100 -Subject: tox - ---- - tox.ini | 1 + - 1 file changed, 1 insertion(+) - -Index: package-synapse-debian/tox.ini -=================================================================== ---- package-synapse-debian.orig/tox.ini -+++ package-synapse-debian/tox.ini -@@ -1,5 +1,6 @@ - [tox] - envlist = packaging, py27, py36, pep8, check_isort -+sitepackages = True - - [base] - deps = diff --git a/debian/patches/0002-change_instructions.patch b/debian/patches/0002-change_instructions.patch deleted file mode 100644 index 933de3ab94..0000000000 --- a/debian/patches/0002-change_instructions.patch +++ /dev/null @@ -1,34 +0,0 @@ -From: Erik Johnston -Date: Fri, 10 Jun 2016 10:57:07 +0100 -Subject: change_instructions - ---- - synapse/config/_base.py | 10 ++++++++++ - 1 file changed, 10 insertions(+) - ---- a/synapse/config/_base.py -+++ b/synapse/config/_base.py -@@ -31,6 +31,11 @@ - MISSING_REPORT_STATS_CONFIG_INSTRUCTIONS = """\ - Please opt in or out of reporting anonymized homeserver usage statistics, by - setting the `report_stats` key in your config file to either True or False. -+ -+To set it run: -+ -+ dpkg-reconfigure matrix-synapse -+ - """ - - MISSING_REPORT_STATS_SPIEL = """\ -@@ -45,6 +50,11 @@ - - MISSING_SERVER_NAME = """\ - Missing mandatory `server_name` config option. -+ -+To set it run: -+ -+ dpkg-reconfigure matrix-synapse -+ - """ - - diff --git a/debian/patches/0004-webclient-instructions.patch b/debian/patches/0004-webclient-instructions.patch deleted file mode 100644 index e2e61a8446..0000000000 --- a/debian/patches/0004-webclient-instructions.patch +++ /dev/null @@ -1,27 +0,0 @@ -From: Erik Johnston -Date: Fri, 10 Jun 2016 10:57:07 +0100 -Subject: webclient-instructions - ---- - synapse/app/homeserver.py | 8 +++----- - 1 file changed, 3 insertions(+), 5 deletions(-) - -Index: package-synapse-debian/synapse/app/homeserver.py -=================================================================== ---- package-synapse-debian.orig/synapse/app/homeserver.py -+++ package-synapse-debian/synapse/app/homeserver.py -@@ -86,12 +86,11 @@ def build_resource_for_web_client(hs): - "Please either install the matrix-angular-sdk or configure\n" - "the location of the source to serve via the configuration\n" - "option `web_client_location`\n\n" -- "To install the `matrix-angular-sdk` via pip, run:\n\n" -- " pip install '%(dep)s'\n" -+ "To install the `matrix-angular-sdk` via apt-get, run:\n\n" -+ " apt-get install matrix-synapse-angular-client\n" - "\n" - "You can also disable hosting of the webclient via the\n" - "configuration option `web_client`\n" -- % {"dep": CONDITIONAL_REQUIREMENTS["web_client"].keys()[0]} - ) - syweb_path = os.path.dirname(syweb.__file__) - webclient_path = os.path.join(syweb_path, "webclient") diff --git a/debian/patches/0006-Don-t-require-strict-nacl-0.3.0-requirement.patch b/debian/patches/0006-Don-t-require-strict-nacl-0.3.0-requirement.patch deleted file mode 100644 index 8370c96166..0000000000 --- a/debian/patches/0006-Don-t-require-strict-nacl-0.3.0-requirement.patch +++ /dev/null @@ -1,21 +0,0 @@ -From: Erik Johnston -Date: Mon, 20 Jun 2016 13:20:37 +0100 -Subject: Don't require strict nacl==0.3.0 requirement - ---- - synapse/python_dependencies.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: package-synapse-debian/synapse/python_dependencies.py -=================================================================== ---- package-synapse-debian.orig/synapse/python_dependencies.py -+++ package-synapse-debian/synapse/python_dependencies.py -@@ -37,7 +37,7 @@ REQUIREMENTS = { - "unpaddedbase64>=1.1.0": ["unpaddedbase64>=1.1.0"], - "canonicaljson>=1.1.3": ["canonicaljson>=1.1.3"], - "signedjson>=1.0.0": ["signedjson>=1.0.0"], -- "pynacl>=1.2.1": ["nacl>=1.2.1", "nacl.bindings"], -+ "pynacl>=0.3.0": ["nacl>=0.3.0", "nacl.bindings"], - "service_identity>=16.0.0": ["service_identity>=16.0.0"], - "Twisted>=17.1.0": ["twisted>=17.1.0"], - "treq>=15.1": ["treq>=15.1"], diff --git a/debian/patches/bcrypt.patch b/debian/patches/bcrypt.patch deleted file mode 100644 index a962949920..0000000000 --- a/debian/patches/bcrypt.patch +++ /dev/null @@ -1,30 +0,0 @@ -Index: package-synapse-debian/synapse/handlers/auth.py -=================================================================== ---- package-synapse-debian.orig/synapse/handlers/auth.py -+++ package-synapse-debian/synapse/handlers/auth.py -@@ -921,10 +921,10 @@ class AuthHandler(BaseHandler): - # Normalise the Unicode in the password - pw = unicodedata.normalize("NFKC", password) - -- return bcrypt.checkpw( -+ return bcrypt.hashpw( - pw.encode('utf8') + self.hs.config.password_pepper.encode("utf8"), - stored_hash -- ) -+ ) == stored_hash - - if stored_hash: - if not isinstance(stored_hash, bytes): -Index: package-synapse-debian/synapse/python_dependencies.py -=================================================================== ---- package-synapse-debian.orig/synapse/python_dependencies.py -+++ package-synapse-debian/synapse/python_dependencies.py -@@ -49,7 +49,7 @@ REQUIREMENTS = { - "pyasn1>=0.1.9": ["pyasn1"], - "pyasn1-modules>=0.0.7": ["pyasn1_modules"], - "daemonize>=2.3.1": ["daemonize"], -- "bcrypt>=3.1.0": ["bcrypt>=3.1.0"], -+ "bcrypt": ["bcrypt"], - "pillow>=3.1.2": ["PIL"], - "sortedcontainers>=1.4.4": ["sortedcontainers"], - "psutil>=2.0.0": ["psutil>=2.0.0"], diff --git a/debian/patches/no_install_with_pip b/debian/patches/no_install_with_pip deleted file mode 100644 index 654656f596..0000000000 --- a/debian/patches/no_install_with_pip +++ /dev/null @@ -1,43 +0,0 @@ -Index: package-synapse-debian/synapse/app/__init__.py -=================================================================== ---- package-synapse-debian.orig/synapse/app/__init__.py -+++ package-synapse-debian/synapse/app/__init__.py -@@ -25,8 +25,8 @@ try: - except python_dependencies.MissingRequirementError as e: - message = "\n".join([ - "Missing Requirement: %s" % (str(e),), -- "To install run:", -- " pip install --upgrade --force \"%s\"" % (e.dependency,), -+ "To install, try:", -+ " sudo apt-get install python-%s" % (e.dependency,), - "", - ]) - sys.stderr.writelines(message) -Index: package-synapse-debian/synapse/config/jwt_config.py -=================================================================== ---- package-synapse-debian.orig/synapse/config/jwt_config.py -+++ package-synapse-debian/synapse/config/jwt_config.py -@@ -19,7 +19,7 @@ MISSING_JWT = ( - """Missing jwt library. This is required for jwt login. - - Install by running: -- pip install pyjwt -+ sudo apt-get install python-jwt - """ - ) - -Index: package-synapse-debian/synapse/config/repository.py -=================================================================== ---- package-synapse-debian.orig/synapse/config/repository.py -+++ package-synapse-debian/synapse/config/repository.py -@@ -27,9 +27,7 @@ MISSING_LXML = ( - """Missing lxml library. This is required for URL preview API. - - Install by running: -- pip install lxml -- -- Requires libxslt1-dev system package. -+ sudo apt-get install python-lxml - """ - ) - diff --git a/debian/patches/remove-webclient.patch b/debian/patches/remove-webclient.patch deleted file mode 100644 index bfd2fce576..0000000000 --- a/debian/patches/remove-webclient.patch +++ /dev/null @@ -1,31 +0,0 @@ -Index: package-synapse-debian/synapse/app/homeserver.py -=================================================================== ---- package-synapse-debian.orig/synapse/app/homeserver.py -+++ package-synapse-debian/synapse/app/homeserver.py -@@ -124,7 +124,7 @@ class SynapseHomeServer(HomeServer): - for res in listener_config["resources"]: - for name in res["names"]: - resources.update(self._configure_named_resource( -- name, res.get("compress", False), -+ config, name, res.get("compress", False), - )) - - additional_resources = listener_config.get("additional_resources", {}) -@@ -171,7 +171,7 @@ class SynapseHomeServer(HomeServer): - ) - logger.info("Synapse now listening on port %d", port) - -- def _configure_named_resource(self, name, compress=False): -+ def _configure_named_resource(self, config, name, compress=False): - """Build a resource map for a named resource - - Args: -@@ -235,7 +235,7 @@ class SynapseHomeServer(HomeServer): - if name in ["keys", "federation"]: - resources[SERVER_KEY_V2_PREFIX] = KeyApiV2Resource(self) - -- if name == "webclient": -+ if name == "webclient" and config.web_client: - resources[WEB_CLIENT_PREFIX] = build_resource_for_web_client(self) - - if name == "metrics" and self.get_config().enable_metrics: diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index ae46209e92..0000000000 --- a/debian/patches/series +++ /dev/null @@ -1,7 +0,0 @@ -0001-tox.patch -0002-change_instructions.patch -0004-webclient-instructions.patch -0006-Don-t-require-strict-nacl-0.3.0-requirement.patch -remove-webclient.patch -bcrypt.patch -no_install_with_pip diff --git a/debian/postinst b/debian/postinst deleted file mode 100755 index 0509acd0a4..0000000000 --- a/debian/postinst +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -e - -. /usr/share/debconf/confmodule - -CONFIGFILE_SERVERNAME="/etc/matrix-synapse/conf.d/server_name.yaml" -CONFIGFILE_REPORTSTATS="/etc/matrix-synapse/conf.d/report_stats.yaml" -USER="matrix-synapse" - -case "$1" in - configure|reconfigure) - # Set server name in config file - mkdir -p "/etc/matrix-synapse/conf.d/" - db_get matrix-synapse/server-name - - if [ "$RET" ]; then - echo "server_name: $RET" > $CONFIGFILE_SERVERNAME - fi - - db_get matrix-synapse/report-stats - if [ "$RET" ]; then - echo "report_stats: $RET" > $CONFIGFILE_REPORTSTATS - fi - - if ! getent passwd $USER >/dev/null; then - adduser --quiet --system --no-create-home --home /var/lib/matrix-synapse $USER - fi - - for DIR in /var/lib/matrix-synapse /var/log/matrix-synapse /etc/matrix-synapse; do - if ! dpkg-statoverride --list --quiet $DIR >/dev/null; then - dpkg-statoverride --force --quiet --update --add $USER nogroup 0755 $DIR - fi - done - - ;; -esac - -#DEBHELPER# - -exit 0 diff --git a/debian/pydist-overrides b/debian/pydist-overrides deleted file mode 100644 index e2e34b7d30..0000000000 --- a/debian/pydist-overrides +++ /dev/null @@ -1,5 +0,0 @@ -matrix-angular-sdk -jinja2 -bleach -ldap3 -matrix-synapse-ldap3 diff --git a/debian/rules b/debian/rules index ad0e95c83d..05cbbdde08 100755 --- a/debian/rules +++ b/debian/rules @@ -1,18 +1,22 @@ #!/usr/bin/make -f +# +# Build Debian package using https://github.com/spotify/dh-virtualenv +# -# This file was automatically generated by stdeb 0.8.2 at -# Fri, 12 Jun 2015 14:32:03 +0100 -export PYBUILD_NAME=matrix-synapse -%: - dh $@ --with python2 --with systemd --buildsystem=pybuild --no-guessing-deps +override_dh_systemd_enable: + dh_systemd_enable --name=matrix-synapse -override_dh_auto_install: - python setup.py install --root=debian/matrix-synapse --install-layout=deb +override_dh_installinit: + dh_installinit --name=matrix-synapse -override_dh_auto_build: +override_dh_strip: -override_dh_installinit: - dh_installinit --no-start +override_dh_shlibdeps: -override_dh_auto_test: - PYTHONPATH=. trial tests +override_dh_virtualenv: + ./debian/build_virtualenv + +# We are restricted to compat level 9 (because xenial), so have to +# enable the systemd bits manually. +%: + dh $@ --with python-virtualenv --with systemd diff --git a/debian/source/format b/debian/source/format index 163aaf8d82..89ae9db8f8 100644 --- a/debian/source/format +++ b/debian/source/format @@ -1 +1 @@ -3.0 (quilt) +3.0 (native) diff --git a/debian/watch b/debian/watch deleted file mode 100644 index b1b10d4cd0..0000000000 --- a/debian/watch +++ /dev/null @@ -1,11 +0,0 @@ -# Example watch control file for uscan -# Rename this file to "watch" and then you can run the "uscan" command -# to check for upstream updates and more. -# See uscan(1) for format - -# Compulsory line, this is a version 3 file -version=3 - - -opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/matrix-synapse-$1\.tar\.gz/,uversionmangle=s/-?rc/~rc/ \ - https://github.com/matrix-org/synapse/tags .*/v?(\d[^\s\-]*)\.tar\.gz debian uupdate diff --git a/docker/Dockerfile-dhvirtualenv b/docker/Dockerfile-dhvirtualenv new file mode 100644 index 0000000000..ea6b650af2 --- /dev/null +++ b/docker/Dockerfile-dhvirtualenv @@ -0,0 +1,35 @@ +# A dockerfile which builds a docker image for building a debian package for +# synapse. The distro to build for is passed as a docker build var. +# +# The default entrypoint expects the synapse source to be mounted as a +# (read-only) volume at /synapse/source, and an output directory at /debs. +# +# A pair of environment variables (TARGET_USERID and TARGET_GROUPID) can be +# passed to the docker container; if these are set, the build script will chown +# the build products accordingly, to avoid ending up with things owned by root +# in the host filesystem. + +# Get the distro we want to pull from as a dynamic build variable +ARG distro="" +FROM ${distro} + +# Install the build dependencies +RUN apt-get update -qq -o Acquire::Languages=none \ + && env DEBIAN_FRONTEND=noninteractive apt-get install \ + -yqq --no-install-recommends -o Dpkg::Options::=--force-unsafe-io \ + build-essential \ + debhelper \ + devscripts \ + dh-systemd \ + dh-virtualenv \ + equivs \ + lsb-release \ + python3-dev \ + python3-pip \ + python3-setuptools \ + python3-venv \ + sqlite3 \ + wget + +WORKDIR /synapse/source +ENTRYPOINT ["bash","/synapse/source/docker/build_debian.sh"] diff --git a/docker/build_debian.sh b/docker/build_debian.sh new file mode 100644 index 0000000000..cea5067fe9 --- /dev/null +++ b/docker/build_debian.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# The script to build the Debian package, as ran inside the Docker image. + +set -ex + +DIST=`lsb_release -c -s` + +# We need to build a newer dh_virtualenv on older OSes like Xenial. +if [ "$DIST" = 'xenial' ]; then + mkdir -p /tmp/dhvenv + cd /tmp/dhvenv + wget https://github.com/spotify/dh-virtualenv/archive/1.1.tar.gz + tar xvf 1.1.tar.gz + cd dh-virtualenv-1.1/ + env DEBIAN_FRONTEND=noninteractive mk-build-deps -ri -t "apt-get -yqq --no-install-recommends -o Dpkg::Options::=--force-unsafe-io" + dpkg-buildpackage -us -uc -b + cd /tmp/dhvenv + apt-get install -yqq ./dh-virtualenv_1.1-1_all.deb +fi + + +# we get a read-only copy of the source: make a writeable copy +cp -aT /synapse/source /synapse/build +cd /synapse/build + +# add an entry to the changelog for this distribution +dch -M -l "+$DIST" "build for $DIST" +dch -M -r "" --force-distribution --distribution "$DIST" + +dpkg-buildpackage -us -uc + +ls -l .. + +# copy the build results out, setting perms if necessary +shopt -s nullglob +for i in ../*.deb ../*.dsc ../*.tar.xz ../*.changes ../*.buildinfo; do + [ -z "$TARGET_USERID" ] || chown "$TARGET_USERID" "$i" + [ -z "$TARGET_GROUPID" ] || chgrp "$TARGET_GROUPID" "$i" + mv "$i" /debs +done diff --git a/docker/build_debian_packages.sh b/docker/build_debian_packages.sh new file mode 100755 index 0000000000..eafed4ac41 --- /dev/null +++ b/docker/build_debian_packages.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# Build the Debian packages using Docker images. +# +# This script builds the Docker images and then executes them sequentially, each +# one building a Debian package for the targeted operating system. It is +# designed to be a "single command" to produce all the images. +# +# By default, builds for all known distributions, but a list of distributions +# can be passed on the commandline for debugging. + +set -ex + +cd `dirname $0` + +if [ $# -lt 1 ]; then + DISTS=(debian:stretch debian:sid ubuntu:xenial ubuntu:bionic ubuntu:cosmic) +else + DISTS=("$@") +fi + +# Make the dir where the debs will live. +# +# Note that we deliberately put this outside the source tree, otherwise we tend +# to get source packages which are full of debs. (We could hack around that +# with more magic in the build_debian.sh script, but that doesn't solve the +# problem for natively-run dpkg-buildpakage). + +mkdir -p ../../debs + +# Build each OS image; +for i in "${DISTS[@]}"; do + TAG=$(echo ${i} | cut -d ":" -f 2) + docker build --tag dh-venv-builder:${TAG} --build-arg distro=${i} -f Dockerfile-dhvirtualenv . + docker run -it --rm --volume=$(pwd)/../\:/synapse/source:ro --volume=$(pwd)/../../debs:/debs \ + -e TARGET_USERID=$(id -u) \ + -e TARGET_GROUPID=$(id -g) \ + dh-venv-builder:${TAG} +done diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py index 92422c6ffc..96cd154234 100644 --- a/synapse/python_dependencies.py +++ b/synapse/python_dependencies.py @@ -78,7 +78,7 @@ CONDITIONAL_REQUIREMENTS = { }, "postgres": { "psycopg2>=2.6": ["psycopg2"] - } + }, } diff --git a/synapse/storage/e2e_room_keys.py b/synapse/storage/e2e_room_keys.py index 16b7f005aa..45cebe61d1 100644 --- a/synapse/storage/e2e_room_keys.py +++ b/synapse/storage/e2e_room_keys.py @@ -182,7 +182,7 @@ class EndToEndRoomKeyStore(SQLBaseStore): keyvalues = { "user_id": user_id, - "version": version, + "version": int(version), } if room_id: keyvalues['room_id'] = room_id diff --git a/tox.ini b/tox.ini index 731094b5da..44371f211f 100644 --- a/tox.ini +++ b/tox.ini @@ -119,6 +119,7 @@ setenv = [testenv:packaging] +skip_install=True deps = check-manifest commands = -- cgit 1.4.1 From 8957a11979dd25687a075eb4c94d9925da4701c8 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 20 Dec 2018 12:06:31 +0000 Subject: Update log config for debian packages Better follow our own release notes. --- debian/log.yaml | 1 + 1 file changed, 1 insertion(+) (limited to 'debian') diff --git a/debian/log.yaml b/debian/log.yaml index b44a8901f6..206b65f1ac 100644 --- a/debian/log.yaml +++ b/debian/log.yaml @@ -18,6 +18,7 @@ handlers: maxBytes: 104857600 backupCount: 10 filters: [context] + encoding: utf8 console: class: logging.StreamHandler formatter: precise -- cgit 1.4.1 From d731b75c7bcada708f1acbb83e2521da6a7d97a9 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 20 Dec 2018 14:55:41 +0000 Subject: Clarify that py2 packages will continue to exist --- debian/NEWS | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'debian') diff --git a/debian/NEWS b/debian/NEWS index 367e08f851..8f0d9d0acf 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -19,4 +19,8 @@ matrix-synapse-py3 (0.34.0) stable; urgency=medium though that service is no longer being provided by the matrix-synapse package. It can be re-enabled with `systemctl enable matrix-synapse`. + The matrix.org team will continue to provide Python 2 `matrix-synapse` + packages for the next couple of releases, to allow time for system + administrators to test the new packages. + -- Richard van der Hoff Wed, 19 Dec 2018 14:00:00 +0000 -- cgit 1.4.1 From a7aca672dfbd21f6dc3bbf8fba15ffabb1ffb5db Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Thu, 20 Dec 2018 22:05:27 +0000 Subject: clarify that installing -py3 removes the old pkg --- debian/NEWS | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'debian') diff --git a/debian/NEWS b/debian/NEWS index 8f0d9d0acf..b70ed098e7 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -1,7 +1,8 @@ matrix-synapse-py3 (0.34.0) stable; urgency=medium matrix-synapse-py3 is intended as a drop-in replacement for the existing - matrix-synapse package. The replacement should be relatively seamless, + matrix-synapse package. When the package is installed, matrix-synapse will + be automatically uninstalled. The replacement should be relatively seamless, however, please note the following important differences to matrix-synapse: * Most importantly, the matrix-synapse service now runs under Python 3 rather @@ -9,12 +10,12 @@ matrix-synapse-py3 (0.34.0) stable; urgency=medium * Synapse is installed into its own virtualenv (in /opt/venvs/matrix-synapse) instead of using the system python libraries. (This may mean that you can - remove a number of old dependencies with `apt-get autoremove`). + remove a number of old dependencies with `apt autoremove`). matrix-synapse-py3 will take over responsibility for the existing configuration files, including the matrix-synapse systemd service. - Beware, however, that `apt-get purge matrix-synapse` will *disable* the + Beware, however, that `apt purge matrix-synapse` will *disable* the matrix-synapse service (so that it will not be started on reboot), even though that service is no longer being provided by the matrix-synapse package. It can be re-enabled with `systemctl enable matrix-synapse`. -- cgit 1.4.1 From ad1c68ad940b2313471723bf64c1948825bd196b Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 20 Dec 2018 23:27:29 +0000 Subject: Mention updating extensions --- debian/NEWS | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'debian') diff --git a/debian/NEWS b/debian/NEWS index b70ed098e7..7b032d86bd 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -1,8 +1,8 @@ matrix-synapse-py3 (0.34.0) stable; urgency=medium matrix-synapse-py3 is intended as a drop-in replacement for the existing - matrix-synapse package. When the package is installed, matrix-synapse will - be automatically uninstalled. The replacement should be relatively seamless, + matrix-synapse package. When the package is installed, matrix-synapse will be + automatically uninstalled. The replacement should be relatively seamless, however, please note the following important differences to matrix-synapse: * Most importantly, the matrix-synapse service now runs under Python 3 rather @@ -12,6 +12,11 @@ matrix-synapse-py3 (0.34.0) stable; urgency=medium instead of using the system python libraries. (This may mean that you can remove a number of old dependencies with `apt autoremove`). + * If you have previously manually installed any custom python extensions + (such as matrix-synapse-rest-auth) into the system python directories, you + will need to reinstall them in the new virtualenv. Please consult the + documentation of the relevant extensions for further details. + matrix-synapse-py3 will take over responsibility for the existing configuration files, including the matrix-synapse systemd service. -- cgit 1.4.1 From 7134832c017fab1e4e6b90df9ad39dd618656427 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Wed, 2 Jan 2019 07:17:39 +0000 Subject: Install the optional dependencies into the debian package (#4325) since #4298, the optional dependencies are no longer installed with a simple `pip install .`, which meant that they were not being included in the debian package. The easy fix to that is dh_virtualenv --extras, but that needs dh_virtualenv 1.1... --- changelog.d/4325.feature | 1 + debian/build_virtualenv | 3 ++- debian/control | 2 +- docker/Dockerfile-dhvirtualenv | 37 +++++++++++++++++++++++++++++++++---- docker/build_debian.sh | 14 -------------- 5 files changed, 37 insertions(+), 20 deletions(-) create mode 100644 changelog.d/4325.feature (limited to 'debian') diff --git a/changelog.d/4325.feature b/changelog.d/4325.feature new file mode 100644 index 0000000000..05ad70fe72 --- /dev/null +++ b/changelog.d/4325.feature @@ -0,0 +1 @@ +Synapse can now have its conditional/extra dependencies installed by pip. This functionality can be used by using `pip install matrix-synapse[feature]`, where feature is a comma separated list with the possible values "email.enable_notifs", "ldap3", "postgres", "saml2", "url_preview", and "test". If you want to install all optional dependencies, you can use "all" instead. diff --git a/debian/build_virtualenv b/debian/build_virtualenv index 61ffb13192..e9ef245476 100755 --- a/debian/build_virtualenv +++ b/debian/build_virtualenv @@ -33,7 +33,8 @@ dh_virtualenv \ --preinstall="lxml" \ --preinstall="mock" \ --extra-pip-arg="--no-cache-dir" \ - --extra-pip-arg="--compile" + --extra-pip-arg="--compile" \ + --extras="all" # we copy the tests to a temporary directory so that we can put them on the # PYTHONPATH without putting the uninstalled synapse on the pythonpath. diff --git a/debian/control b/debian/control index 552a81dcb0..9606a4c135 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,7 @@ Maintainer: Synapse Packaging team Build-Depends: debhelper (>= 9), dh-systemd, - dh-virtualenv (>= 1.0), + dh-virtualenv (>= 1.1), lsb-release, python3-dev, python3, diff --git a/docker/Dockerfile-dhvirtualenv b/docker/Dockerfile-dhvirtualenv index ea6b650af2..ab28e49291 100644 --- a/docker/Dockerfile-dhvirtualenv +++ b/docker/Dockerfile-dhvirtualenv @@ -11,6 +11,35 @@ # Get the distro we want to pull from as a dynamic build variable ARG distro="" + +### +### Stage 0: build a dh-virtualenv +### +FROM ${distro} as builder + +RUN apt-get update -qq -o Acquire::Languages=none +RUN env DEBIAN_FRONTEND=noninteractive apt-get install \ + -yqq --no-install-recommends \ + build-essential \ + ca-certificates \ + devscripts \ + equivs \ + wget + +# fetch and unpack the package +RUN wget -q -O /dh-virtuenv-1.1.tar.gz https://github.com/spotify/dh-virtualenv/archive/1.1.tar.gz +RUN tar xvf /dh-virtuenv-1.1.tar.gz + +# install its build deps +RUN cd dh-virtualenv-1.1/ \ + && env DEBIAN_FRONTEND=noninteractive mk-build-deps -ri -t "apt-get -yqq --no-install-recommends" + +# build it +RUN cd dh-virtualenv-1.1 && dpkg-buildpackage -us -uc -b + +### +### Stage 1 +### FROM ${distro} # Install the build dependencies @@ -21,15 +50,15 @@ RUN apt-get update -qq -o Acquire::Languages=none \ debhelper \ devscripts \ dh-systemd \ - dh-virtualenv \ - equivs \ lsb-release \ python3-dev \ python3-pip \ python3-setuptools \ python3-venv \ - sqlite3 \ - wget + sqlite3 + +COPY --from=builder /dh-virtualenv_1.1-1_all.deb / +RUN apt-get install -yq /dh-virtualenv_1.1-1_all.deb WORKDIR /synapse/source ENTRYPOINT ["bash","/synapse/source/docker/build_debian.sh"] diff --git a/docker/build_debian.sh b/docker/build_debian.sh index cea5067fe9..6ed2b39898 100644 --- a/docker/build_debian.sh +++ b/docker/build_debian.sh @@ -6,20 +6,6 @@ set -ex DIST=`lsb_release -c -s` -# We need to build a newer dh_virtualenv on older OSes like Xenial. -if [ "$DIST" = 'xenial' ]; then - mkdir -p /tmp/dhvenv - cd /tmp/dhvenv - wget https://github.com/spotify/dh-virtualenv/archive/1.1.tar.gz - tar xvf 1.1.tar.gz - cd dh-virtualenv-1.1/ - env DEBIAN_FRONTEND=noninteractive mk-build-deps -ri -t "apt-get -yqq --no-install-recommends -o Dpkg::Options::=--force-unsafe-io" - dpkg-buildpackage -us -uc -b - cd /tmp/dhvenv - apt-get install -yqq ./dh-virtualenv_1.1-1_all.deb -fi - - # we get a read-only copy of the source: make a writeable copy cp -aT /synapse/source /synapse/build cd /synapse/build -- cgit 1.4.1 From e9cdfedff3a3dd4b6d60187561d0538cdc2ac519 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Wed, 2 Jan 2019 07:30:31 +0000 Subject: Avoid packaging _trial_temp directory (#4326) Make sure we don't put the _trial_temp directory in the package target directory. Fixes https://github.com/matrix-org/synapse/issues/4322 --- changelog.d/4326.bugfix | 2 ++ debian/build_virtualenv | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog.d/4326.bugfix (limited to 'debian') diff --git a/changelog.d/4326.bugfix b/changelog.d/4326.bugfix new file mode 100644 index 0000000000..acce6266b8 --- /dev/null +++ b/changelog.d/4326.bugfix @@ -0,0 +1,2 @@ +Avoid packaging _trial_temp directory in -py3 debian packages + diff --git a/debian/build_virtualenv b/debian/build_virtualenv index e9ef245476..83346c40f1 100755 --- a/debian/build_virtualenv +++ b/debian/build_virtualenv @@ -42,8 +42,7 @@ tmpdir=`mktemp -d` trap "rm -r $tmpdir" EXIT cp -r tests "$tmpdir" -cd debian/matrix-synapse-py3 PYTHONPATH="$tmpdir" \ - ./opt/venvs/matrix-synapse/bin/python \ + debian/matrix-synapse-py3/opt/venvs/matrix-synapse/bin/python \ -B -m twisted.trial --reporter=text -j2 tests -- cgit 1.4.1 From 29f20a8a1abf2e2450a1df0202dd1c02b6873701 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Fri, 4 Jan 2019 17:24:13 +0000 Subject: Update debian Conflicts specifications (#4349) ... to allow installation alongside our matrix-synapse transitional package. --- changelog.d/4349.misc | 1 + debian/changelog | 7 +++++++ debian/control | 8 ++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 changelog.d/4349.misc (limited to 'debian') diff --git a/changelog.d/4349.misc b/changelog.d/4349.misc new file mode 100644 index 0000000000..61bd4439cb --- /dev/null +++ b/changelog.d/4349.misc @@ -0,0 +1 @@ +Update debian packaging for compatibility with transitional package \ No newline at end of file diff --git a/debian/changelog b/debian/changelog index 040c8e7cd3..fc8218bee7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +matrix-synapse-py3 (0.34.0.1) UNRELEASED; urgency=medium + + * Update Conflicts specifications to allow installation alongside our + matrix-synapse transitional package. + + -- Synapse Packaging team Wed, 02 Jan 2019 17:48:40 +0000 + matrix-synapse-py3 (0.34.0) stable; urgency=medium * New synapse release 0.34.0. diff --git a/debian/control b/debian/control index 9606a4c135..500348bc9a 100644 --- a/debian/control +++ b/debian/control @@ -13,12 +13,16 @@ Build-Depends: python3-pip, python3-venv, tar, -Standards-Version: 3.9.5 +Standards-Version: 3.9.8 Homepage: https://github.com/matrix-org/synapse Package: matrix-synapse-py3 Architecture: amd64 -Conflicts: matrix-synapse +Provides: matrix-synapse +Breaks: + matrix-synapse-ldap3, + matrix-synapse (<< 0.34.0-0matrix2), + matrix-synapse (>= 0.34.0-1), Pre-Depends: dpkg (>= 1.16.1) Depends: adduser, -- cgit 1.4.1 From 998f5225c13e1c19f1d323c6afd72d3b5561e41a Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 9 Jan 2019 14:53:54 +0000 Subject: 0.34.1 --- CHANGES.md | 9 +++++++++ changelog.d/4361.misc | 1 - changelog.d/4362.misc | 1 - debian/changelog | 5 +++-- synapse/__init__.py | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) delete mode 100644 changelog.d/4361.misc delete mode 100644 changelog.d/4362.misc (limited to 'debian') diff --git a/CHANGES.md b/CHANGES.md index abbc65ab8e..e403a65d17 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,12 @@ +Synapse 0.34.1 (2019-01-09) +=========================== + +Internal Changes +---------------- + +- Add better logging for unexpected errors while sending transactions ([\#4361](https://github.com/matrix-org/synapse/issues/4361), [\#4362](https://github.com/matrix-org/synapse/issues/4362)) + + Synapse 0.34.1rc1 (2019-01-08) ============================== diff --git a/changelog.d/4361.misc b/changelog.d/4361.misc deleted file mode 100644 index 020dacb547..0000000000 --- a/changelog.d/4361.misc +++ /dev/null @@ -1 +0,0 @@ -Add better logging for unexpected errors while sending transactions diff --git a/changelog.d/4362.misc b/changelog.d/4362.misc deleted file mode 100644 index 020dacb547..0000000000 --- a/changelog.d/4362.misc +++ /dev/null @@ -1 +0,0 @@ -Add better logging for unexpected errors while sending transactions diff --git a/debian/changelog b/debian/changelog index fc8218bee7..95edf92206 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,10 @@ -matrix-synapse-py3 (0.34.0.1) UNRELEASED; urgency=medium +matrix-synapse-py3 (0.34.1) stable; urgency=medium + * New synapse release 0.34.1. * Update Conflicts specifications to allow installation alongside our matrix-synapse transitional package. - -- Synapse Packaging team Wed, 02 Jan 2019 17:48:40 +0000 + -- Synapse Packaging team Wed, 09 Jan 2019 14:52:24 +0000 matrix-synapse-py3 (0.34.0) stable; urgency=medium diff --git a/synapse/__init__.py b/synapse/__init__.py index 7819cfbcbb..2935238fa2 100644 --- a/synapse/__init__.py +++ b/synapse/__init__.py @@ -27,4 +27,4 @@ try: except ImportError: pass -__version__ = "0.34.1rc1" +__version__ = "0.34.1" -- cgit 1.4.1 From 2394e832a8df3643f5f8440606d4eeddfbe6c5f7 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 9 Jan 2019 15:35:11 +0000 Subject: debian: Remove Breaks: matrix-synapse-ldap3 --- debian/changelog | 8 ++++++++ debian/control | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 95edf92206..921f7021d8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +matrix-synapse-py3 (0.34.1+1) stable; urgency=medium + + * Remove 'Breaks: matrix-synapse-ldap3'. (matrix-synapse-py3 includes + the matrix-synapse-ldap3 python files, which makes the + matrix-synapse-ldap3 debian package redundant but not broken. + + -- Synapse Packaging team Wed, 09 Jan 2019 15:30:00 +0000 + matrix-synapse-py3 (0.34.1) stable; urgency=medium * New synapse release 0.34.1. diff --git a/debian/control b/debian/control index 500348bc9a..634f04284a 100644 --- a/debian/control +++ b/debian/control @@ -20,7 +20,6 @@ Package: matrix-synapse-py3 Architecture: amd64 Provides: matrix-synapse Breaks: - matrix-synapse-ldap3, matrix-synapse (<< 0.34.0-0matrix2), matrix-synapse (>= 0.34.0-1), Pre-Depends: dpkg (>= 1.16.1) -- cgit 1.4.1 From c0dba73aa0575da91d627d279d8d0f69a2578c42 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Fri, 11 Jan 2019 02:20:29 +1100 Subject: changelog, for debian --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 921f7021d8..09bb0001e5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +matrix-synapse-py3 (0.34.1.1) stable; urgency=high + + * New synapse release 0.34.1.1 + + -- Synapse Packaging team Thu, 10 Jan 2019 15:04:52 +0000 + matrix-synapse-py3 (0.34.1+1) stable; urgency=medium * Remove 'Breaks: matrix-synapse-ldap3'. (matrix-synapse-py3 includes -- cgit 1.4.1 From 91fa34b3fa93eded7aad45dcc44885124ad76960 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 11 Jan 2019 17:05:45 +0000 Subject: s/Breaks/Conflicts/ in debian/control Otherwise people can't upgrade from matrix-synapse without removing it first --- debian/changelog | 6 ++++++ debian/control | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 09bb0001e5..29d55496e6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +matrix-synapse-py3 (0.34.1.1+1) UNRELEASED; urgency=medium + + * Update conflicts specifications to allow smoother transition from matrix-synapse. + + -- Synapse Packaging team Fri, 11 Jan 2019 17:04:28 +0000 + matrix-synapse-py3 (0.34.1.1) stable; urgency=high * New synapse release 0.34.1.1 diff --git a/debian/control b/debian/control index 634f04284a..b85e36c6ca 100644 --- a/debian/control +++ b/debian/control @@ -19,9 +19,9 @@ Homepage: https://github.com/matrix-org/synapse Package: matrix-synapse-py3 Architecture: amd64 Provides: matrix-synapse -Breaks: - matrix-synapse (<< 0.34.0-0matrix2), - matrix-synapse (>= 0.34.0-1), +Conflicts: + matrix-synapse (<< 0.34.0.1-0matrix2), + matrix-synapse (>= 0.34.0.1-1), Pre-Depends: dpkg (>= 1.16.1) Depends: adduser, -- cgit 1.4.1 From 4fd051f9c395efff4de53422b136103f7d4b1c30 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Sat, 12 Jan 2019 13:02:20 +0000 Subject: moar plusses! turns out that 0.34.1.1+1 comes before 0.34.1.1+bionic (etc). The version may only contain "~ 0-9 A-Z a-z + - ." (sorting in that order). Option 1: replace "+" with something that sorts after +. Options are "-" (but dpkg-source complains about that) or "." (but that would mean we couldn't distinguish packaging-only changes from real changes). Option 2: stick with + and just find something that sorts after 'xenial'. The only options there are "-", "." (same problems as before), "z", and "+". Hence, ++1. Sorry. --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 29d55496e6..e6c174e02d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -matrix-synapse-py3 (0.34.1.1+1) UNRELEASED; urgency=medium +matrix-synapse-py3 (0.34.1.1++1) stable; urgency=medium * Update conflicts specifications to allow smoother transition from matrix-synapse. - -- Synapse Packaging team Fri, 11 Jan 2019 17:04:28 +0000 + -- Synapse Packaging team Sat, 12 Jan 2019 12:58:35 +0000 matrix-synapse-py3 (0.34.1.1) stable; urgency=high -- cgit 1.4.1 From 23b08135998e932d5d600941bd42389db0628a11 Mon Sep 17 00:00:00 2001 From: Amber Brown Date: Tue, 22 Jan 2019 21:58:50 +1100 Subject: Require ECDH key exchange & remove dh_params (#4429) * remove dh_params and set better cipher string --- README.rst | 2 +- changelog.d/4229.feature | 1 + debian/homeserver.yaml | 3 --- demo/demo.tls.dh | 9 --------- docker/conf/homeserver.yaml | 1 - synapse/config/tls.py | 40 --------------------------------------- synapse/crypto/context_factory.py | 6 ++++-- tests/config/test_generate.py | 1 - 8 files changed, 6 insertions(+), 57 deletions(-) create mode 100644 changelog.d/4229.feature delete mode 100644 demo/demo.tls.dh (limited to 'debian') diff --git a/README.rst b/README.rst index 8bff55e78e..05a3bb3751 100644 --- a/README.rst +++ b/README.rst @@ -220,7 +220,7 @@ is configured to use TLS with a self-signed certificate. If you would like to do initial test with a client without having to setup a reverse proxy, you can temporarly use another certificate. (Note that a self-signed certificate is fine for `Federation`_). You can do so by changing -``tls_certificate_path``, ``tls_private_key_path`` and ``tls_dh_params_path`` +``tls_certificate_path`` and ``tls_private_key_path`` in ``homeserver.yaml``; alternatively, you can use a reverse-proxy, but be sure to read `Using a reverse proxy with Synapse`_ when doing so. diff --git a/changelog.d/4229.feature b/changelog.d/4229.feature new file mode 100644 index 0000000000..0d1996c7e8 --- /dev/null +++ b/changelog.d/4229.feature @@ -0,0 +1 @@ +Synapse's cipher string has been updated to require ECDH key exchange. Configuring and generating dh_params is no longer required, and they will be ignored. diff --git a/debian/homeserver.yaml b/debian/homeserver.yaml index 188a2d5483..0bb2d22a95 100644 --- a/debian/homeserver.yaml +++ b/debian/homeserver.yaml @@ -9,9 +9,6 @@ tls_certificate_path: "/etc/matrix-synapse/homeserver.tls.crt" # PEM encoded private key for TLS tls_private_key_path: "/etc/matrix-synapse/homeserver.tls.key" -# PEM dh parameters for ephemeral keys -tls_dh_params_path: "/etc/matrix-synapse/homeserver.tls.dh" - # Don't bind to the https port no_tls: False diff --git a/demo/demo.tls.dh b/demo/demo.tls.dh deleted file mode 100644 index cbc58272a0..0000000000 --- a/demo/demo.tls.dh +++ /dev/null @@ -1,9 +0,0 @@ -2048-bit DH parameters taken from rfc3526 ------BEGIN DH PARAMETERS----- -MIIBCAKCAQEA///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxOb -IlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjft -awv/XLb0Brft7jhr+1qJn6WunyQRfEsf5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT -mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVSu57VKQdwlpZtZww1Tkq8mATxdGwIyhgh -fDKQXkYuNs474553LBgOhgObJ4Oi7Aeij7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq -5RXSJhiY+gUQFXKOWoqsqmj//////////wIBAg== ------END DH PARAMETERS----- diff --git a/docker/conf/homeserver.yaml b/docker/conf/homeserver.yaml index c2b8576a32..529118d184 100644 --- a/docker/conf/homeserver.yaml +++ b/docker/conf/homeserver.yaml @@ -4,7 +4,6 @@ tls_certificate_path: "/data/{{ SYNAPSE_SERVER_NAME }}.tls.crt" tls_private_key_path: "/data/{{ SYNAPSE_SERVER_NAME }}.tls.key" -tls_dh_params_path: "/data/{{ SYNAPSE_SERVER_NAME }}.tls.dh" no_tls: {{ "True" if SYNAPSE_NO_TLS else "False" }} tls_fingerprints: [] diff --git a/synapse/config/tls.py b/synapse/config/tls.py index fef1ea99cb..bb8952c672 100644 --- a/synapse/config/tls.py +++ b/synapse/config/tls.py @@ -14,7 +14,6 @@ # limitations under the License. import os -import subprocess from hashlib import sha256 from unpaddedbase64 import encode_base64 @@ -23,8 +22,6 @@ from OpenSSL import crypto from ._base import Config -GENERATE_DH_PARAMS = False - class TlsConfig(Config): def read_config(self, config): @@ -42,10 +39,6 @@ class TlsConfig(Config): config.get("tls_private_key_path") ) - self.tls_dh_params_path = self.check_file( - config.get("tls_dh_params_path"), "tls_dh_params" - ) - self.tls_fingerprints = config["tls_fingerprints"] # Check that our own certificate is included in the list of fingerprints @@ -72,7 +65,6 @@ class TlsConfig(Config): tls_certificate_path = base_key_name + ".tls.crt" tls_private_key_path = base_key_name + ".tls.key" - tls_dh_params_path = base_key_name + ".tls.dh" return """\ # PEM encoded X509 certificate for TLS. @@ -85,9 +77,6 @@ class TlsConfig(Config): # PEM encoded private key for TLS tls_private_key_path: "%(tls_private_key_path)s" - # PEM dh parameters for ephemeral keys - tls_dh_params_path: "%(tls_dh_params_path)s" - # Don't bind to the https port no_tls: False @@ -131,7 +120,6 @@ class TlsConfig(Config): def generate_files(self, config): tls_certificate_path = config["tls_certificate_path"] tls_private_key_path = config["tls_private_key_path"] - tls_dh_params_path = config["tls_dh_params_path"] if not self.path_exists(tls_private_key_path): with open(tls_private_key_path, "wb") as private_key_file: @@ -165,31 +153,3 @@ class TlsConfig(Config): cert_pem = crypto.dump_certificate(crypto.FILETYPE_PEM, cert) certificate_file.write(cert_pem) - - if not self.path_exists(tls_dh_params_path): - if GENERATE_DH_PARAMS: - subprocess.check_call([ - "openssl", "dhparam", - "-outform", "PEM", - "-out", tls_dh_params_path, - "2048" - ]) - else: - with open(tls_dh_params_path, "w") as dh_params_file: - dh_params_file.write( - "2048-bit DH parameters taken from rfc3526\n" - "-----BEGIN DH PARAMETERS-----\n" - "MIIBCAKCAQEA///////////JD9qiIWjC" - "NMTGYouA3BzRKQJOCIpnzHQCC76mOxOb\n" - "IlFKCHmONATd75UZs806QxswKwpt8l8U" - "N0/hNW1tUcJF5IW1dmJefsb0TELppjft\n" - "awv/XLb0Brft7jhr+1qJn6WunyQRfEsf" - "5kkoZlHs5Fs9wgB8uKFjvwWY2kg2HFXT\n" - "mmkWP6j9JM9fg2VdI9yjrZYcYvNWIIVS" - "u57VKQdwlpZtZww1Tkq8mATxdGwIyhgh\n" - "fDKQXkYuNs474553LBgOhgObJ4Oi7Aei" - "j7XFXfBvTFLJ3ivL9pVYFxg5lUl86pVq\n" - "5RXSJhiY+gUQFXKOWoqsqmj/////////" - "/wIBAg==\n" - "-----END DH PARAMETERS-----\n" - ) diff --git a/synapse/crypto/context_factory.py b/synapse/crypto/context_factory.py index 02b76dfcfb..6ba3eca7b2 100644 --- a/synapse/crypto/context_factory.py +++ b/synapse/crypto/context_factory.py @@ -46,8 +46,10 @@ class ServerContextFactory(ContextFactory): if not config.no_tls: context.use_privatekey(config.tls_private_key) - context.load_tmp_dh(config.tls_dh_params_path) - context.set_cipher_list("!ADH:HIGH+kEDH:!AECDH:HIGH+kEECDH") + # https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/ + context.set_cipher_list( + "ECDH+AESGCM:ECDH+CHACHA20:ECDH+AES256:ECDH+AES128:!aNULL:!SHA1" + ) def getContext(self): return self._context diff --git a/tests/config/test_generate.py b/tests/config/test_generate.py index 0c23068bcf..b5ad99348d 100644 --- a/tests/config/test_generate.py +++ b/tests/config/test_generate.py @@ -51,7 +51,6 @@ class ConfigGenerationTestCase(unittest.TestCase): "lemurs.win.log.config", "lemurs.win.signing.key", "lemurs.win.tls.crt", - "lemurs.win.tls.dh", "lemurs.win.tls.key", ] ), -- cgit 1.4.1 From 2f88881c933d957885fec6ac565b553e4c7d9a3d Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Wed, 23 Jan 2019 11:43:04 +0000 Subject: debian package: symlink to python-3.X (#4433) In the debian package, make the virtualenv symlink python to /usr/bin/python3.X rather than /usr/bin/python3. Also make sure we depend on the right python3.x package. This might help a bit with subtle failures when people install a package from the wrong distro (https://github.com/matrix-org/synapse/issues/4431). --- changelog.d/4433.misc | 1 + debian/build_virtualenv | 15 ++++++++++++++- debian/control | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 changelog.d/4433.misc (limited to 'debian') diff --git a/changelog.d/4433.misc b/changelog.d/4433.misc new file mode 100644 index 0000000000..30f2912db2 --- /dev/null +++ b/changelog.d/4433.misc @@ -0,0 +1 @@ +debian package: symlink to explicit python version diff --git a/debian/build_virtualenv b/debian/build_virtualenv index 83346c40f1..8b51b9e074 100755 --- a/debian/build_virtualenv +++ b/debian/build_virtualenv @@ -6,7 +6,16 @@ set -e export DH_VIRTUALENV_INSTALL_ROOT=/opt/venvs -SNAKE=/usr/bin/python3 + +# make sure that the virtualenv links to the specific version of python, by +# dereferencing the python3 symlink. +# +# Otherwise, if somebody tries to install (say) the stretch package on buster, +# they will get a confusing error about "No module named 'synapse'", because +# python won't look in the right directory. At least this way, the error will +# be a *bit* more obvious. +# +SNAKE=`readlink -e /usr/bin/python3` # try to set the CFLAGS so any compiled C extensions are compiled with the most # generic as possible x64 instructions, so that compiling it on a new Intel chip @@ -46,3 +55,7 @@ cp -r tests "$tmpdir" PYTHONPATH="$tmpdir" \ debian/matrix-synapse-py3/opt/venvs/matrix-synapse/bin/python \ -B -m twisted.trial --reporter=text -j2 tests + +# add a dependency on the right version of python to substvars. +PYPKG=`basename $SNAKE` +echo "synapse:pydepends=$PYPKG" >> debian/matrix-synapse-py3.substvars diff --git a/debian/control b/debian/control index b85e36c6ca..4abfa02051 100644 --- a/debian/control +++ b/debian/control @@ -27,8 +27,8 @@ Depends: adduser, debconf, python3-distutils|libpython3-stdlib (<< 3.6), - python3, ${misc:Depends}, + ${synapse:pydepends}, # some of our scripts use perl, but none of them are important, # so we put perl:Depends in Suggests rather than Depends. Suggests: -- cgit 1.4.1 From 8c58c1069727ced7d625fde3b2e8214882b08535 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Thu, 24 Jan 2019 13:39:01 +0000 Subject: Generate the debian config during build (#4444) Rather than hardcoding a config which we always forget to update, generate it from the default config. --- changelog.d/4444.misc | 1 + debian/build_virtualenv | 34 ++- debian/homeserver.yaml | 614 ------------------------------------------------ debian/install | 1 - 4 files changed, 33 insertions(+), 617 deletions(-) create mode 100644 changelog.d/4444.misc delete mode 100644 debian/homeserver.yaml (limited to 'debian') diff --git a/changelog.d/4444.misc b/changelog.d/4444.misc new file mode 100644 index 0000000000..1be84188c6 --- /dev/null +++ b/changelog.d/4444.misc @@ -0,0 +1 @@ +Generate the debian config during build diff --git a/debian/build_virtualenv b/debian/build_virtualenv index 8b51b9e074..bead3ebc6e 100755 --- a/debian/build_virtualenv +++ b/debian/build_virtualenv @@ -45,6 +45,10 @@ dh_virtualenv \ --extra-pip-arg="--compile" \ --extras="all" +PACKAGE_BUILD_DIR="debian/matrix-synapse-py3" +VIRTUALENV_DIR="${PACKAGE_BUILD_DIR}${DH_VIRTUALENV_INSTALL_ROOT}/matrix-synapse" +TARGET_PYTHON="${VIRTUALENV_DIR}/bin/python" + # we copy the tests to a temporary directory so that we can put them on the # PYTHONPATH without putting the uninstalled synapse on the pythonpath. tmpdir=`mktemp -d` @@ -53,8 +57,34 @@ trap "rm -r $tmpdir" EXIT cp -r tests "$tmpdir" PYTHONPATH="$tmpdir" \ - debian/matrix-synapse-py3/opt/venvs/matrix-synapse/bin/python \ - -B -m twisted.trial --reporter=text -j2 tests + "${TARGET_PYTHON}" -B -m twisted.trial --reporter=text -j2 tests + +# build the config file +"${TARGET_PYTHON}" -B "${VIRTUALENV_DIR}/bin/generate_config" \ + --config-dir="/etc/matrix-synapse" \ + --data-dir="/var/lib/matrix-synapse" | + perl -pe ' +# tweak the paths to the tls certs and signing keys +/^tls_.*_path:/ and s/SERVERNAME/homeserver/; +/^signing_key_path:/ and s/SERVERNAME/homeserver/; + +# tweak the pid file location +/^pid_file:/ and s#:.*#: "/var/run/matrix-synapse.pid"#; + +# tweak the path to the log config +/^log_config:/ and s/SERVERNAME\.log\.config/log.yaml/; + +# tweak the path to the media store +/^media_store_path:/ and s#/media_store#/media#; + +# remove the server_name setting, which is set in a separate file +/^server_name:/ and $_ = "#\n# This is set in /etc/matrix-synapse/conf.d/server_name.yaml for Debian installations.\n# $_"; + +# remove the report_stats setting, which is set in a separate file +/^# report_stats:/ and $_ = ""; + +' > "${PACKAGE_BUILD_DIR}/etc/matrix-synapse/homeserver.yaml" + # add a dependency on the right version of python to substvars. PYPKG=`basename $SNAKE` diff --git a/debian/homeserver.yaml b/debian/homeserver.yaml deleted file mode 100644 index 0bb2d22a95..0000000000 --- a/debian/homeserver.yaml +++ /dev/null @@ -1,614 +0,0 @@ -# vim:ft=yaml -# PEM encoded X509 certificate for TLS. -# You can replace the self-signed certificate that synapse -# autogenerates on launch with your own SSL certificate + key pair -# if you like. Any required intermediary certificates can be -# appended after the primary certificate in hierarchical order. -tls_certificate_path: "/etc/matrix-synapse/homeserver.tls.crt" - -# PEM encoded private key for TLS -tls_private_key_path: "/etc/matrix-synapse/homeserver.tls.key" - -# Don't bind to the https port -no_tls: False - -# List of allowed TLS fingerprints for this server to publish along -# with the signing keys for this server. Other matrix servers that -# make HTTPS requests to this server will check that the TLS -# certificates returned by this server match one of the fingerprints. -# -# Synapse automatically adds the fingerprint of its own certificate -# to the list. So if federation traffic is handled directly by synapse -# then no modification to the list is required. -# -# If synapse is run behind a load balancer that handles the TLS then it -# will be necessary to add the fingerprints of the certificates used by -# the loadbalancers to this list if they are different to the one -# synapse is using. -# -# Homeservers are permitted to cache the list of TLS fingerprints -# returned in the key responses up to the "valid_until_ts" returned in -# key. It may be necessary to publish the fingerprints of a new -# certificate and wait until the "valid_until_ts" of the previous key -# responses have passed before deploying it. -# -# You can calculate a fingerprint from a given TLS listener via: -# openssl s_client -connect $host:$port < /dev/null 2> /dev/null | -# openssl x509 -outform DER | openssl sha256 -binary | base64 | tr -d '=' -# or by checking matrix.org/federationtester/api/report?server_name=$host -# -tls_fingerprints: [] -# tls_fingerprints: [{"sha256": ""}] - - -## Server ## - -# When running as a daemon, the file to store the pid in -pid_file: "/var/run/matrix-synapse.pid" - -# CPU affinity mask. Setting this restricts the CPUs on which the -# process will be scheduled. It is represented as a bitmask, with the -# lowest order bit corresponding to the first logical CPU and the -# highest order bit corresponding to the last logical CPU. Not all CPUs -# may exist on a given system but a mask may specify more CPUs than are -# present. -# -# For example: -# 0x00000001 is processor #0, -# 0x00000003 is processors #0 and #1, -# 0xFFFFFFFF is all processors (#0 through #31). -# -# Pinning a Python process to a single CPU is desirable, because Python -# is inherently single-threaded due to the GIL, and can suffer a -# 30-40% slowdown due to cache blow-out and thread context switching -# if the scheduler happens to schedule the underlying threads across -# different cores. See -# https://www.mirantis.com/blog/improve-performance-python-programs-restricting-single-cpu/. -# -# cpu_affinity: 0xFFFFFFFF - -# The path to the web client which will be served at /_matrix/client/ -# if 'webclient' is configured under the 'listeners' configuration. -# -# web_client_location: "/path/to/web/root" - -# The public-facing base URL for the client API (not including _matrix/...) -# public_baseurl: https://example.com:8448/ - -# Set the soft limit on the number of file descriptors synapse can use -# Zero is used to indicate synapse should set the soft limit to the -# hard limit. -soft_file_limit: 0 - -# The GC threshold parameters to pass to `gc.set_threshold`, if defined -# gc_thresholds: [700, 10, 10] - -# Set the limit on the returned events in the timeline in the get -# and sync operations. The default value is -1, means no upper limit. -# filter_timeline_limit: 5000 - -# Whether room invites to users on this server should be blocked -# (except those sent by local server admins). The default is False. -# block_non_admin_invites: True - -# Restrict federation to the following whitelist of domains. -# N.B. we recommend also firewalling your federation listener to limit -# inbound federation traffic as early as possible, rather than relying -# purely on this application-layer restriction. If not specified, the -# default is to whitelist everything. -# -# federation_domain_whitelist: -# - lon.example.com -# - nyc.example.com -# - syd.example.com - -# List of ports that Synapse should listen on, their purpose and their -# configuration. -listeners: - # Main HTTPS listener - # For when matrix traffic is sent directly to synapse. - - - # The port to listen for HTTPS requests on. - port: 8448 - - # Local addresses to listen on. - # On Linux and Mac OS, `::` will listen on all IPv4 and IPv6 - # addresses by default. For most other OSes, this will only listen - # on IPv6. - bind_addresses: - - '::' - - '0.0.0.0' - - # This is a 'http' listener, allows us to specify 'resources'. - type: http - - tls: true - - # Use the X-Forwarded-For (XFF) header as the client IP and not the - # actual client IP. - x_forwarded: false - - # List of HTTP resources to serve on this listener. - resources: - - - # List of resources to host on this listener. - names: - - client # The client-server APIs, both v1 and v2 - - webclient # The bundled webclient. - - # Should synapse compress HTTP responses to clients that support it? - # This should be disabled if running synapse behind a load balancer - # that can do automatic compression. - compress: true - - - names: [federation] # Federation APIs - compress: false - - # optional list of additional endpoints which can be loaded via - # dynamic modules - # additional_resources: - # "/_matrix/my/custom/endpoint": - # module: my_module.CustomRequestHandler - # config: {} - - # Unsecure HTTP listener, - # For when matrix traffic passes through loadbalancer that unwraps TLS. - - port: 8008 - tls: false - bind_addresses: ['::', '0.0.0.0'] - type: http - - x_forwarded: false - - resources: - - names: [client, webclient] - compress: true - - names: [federation] - compress: false - - # Turn on the twisted ssh manhole service on localhost on the given - # port. - # - port: 9000 - # bind_addresses: ['::1', '127.0.0.1'] - # type: manhole - - -# Database configuration -database: - # The database engine name - name: "sqlite3" - # Arguments to pass to the engine - args: - # Path to the database - database: "/var/lib/matrix-synapse/homeserver.db" - -# Number of events to cache in memory. -event_cache_size: "10K" - - -# A yaml python logging config file -log_config: "/etc/matrix-synapse/log.yaml" - - - -## Ratelimiting ## - -# Number of messages a client can send per second -rc_messages_per_second: 0.2 - -# Number of message a client can send before being throttled -rc_message_burst_count: 10.0 - -# The federation window size in milliseconds -federation_rc_window_size: 1000 - -# The number of federation requests from a single server in a window -# before the server will delay processing the request. -federation_rc_sleep_limit: 10 - -# The duration in milliseconds to delay processing events from -# remote servers by if they go over the sleep limit. -federation_rc_sleep_delay: 500 - -# The maximum number of concurrent federation requests allowed -# from a single server -federation_rc_reject_limit: 50 - -# The number of federation requests to concurrently process from a -# single server -federation_rc_concurrent: 3 - - - -# Directory where uploaded images and attachments are stored. -media_store_path: "/var/lib/matrix-synapse/media" - -# Media storage providers allow media to be stored in different -# locations. -# media_storage_providers: -# - module: file_system -# # Whether to write new local files. -# store_local: false -# # Whether to write new remote media -# store_remote: false -# # Whether to block upload requests waiting for write to this -# # provider to complete -# store_synchronous: false -# config: -# directory: /mnt/some/other/directory - -# Directory where in-progress uploads are stored. -uploads_path: "/var/lib/matrix-synapse/uploads" - -# The largest allowed upload size in bytes -max_upload_size: "10M" - -# Maximum number of pixels that will be thumbnailed -max_image_pixels: "32M" - -# Whether to generate new thumbnails on the fly to precisely match -# the resolution requested by the client. If true then whenever -# a new resolution is requested by the client the server will -# generate a new thumbnail. If false the server will pick a thumbnail -# from a precalculated list. -dynamic_thumbnails: false - -# List of thumbnail to precalculate when an image is uploaded. -thumbnail_sizes: -- width: 32 - height: 32 - method: crop -- width: 96 - height: 96 - method: crop -- width: 320 - height: 240 - method: scale -- width: 640 - height: 480 - method: scale -- width: 800 - height: 600 - method: scale - -# Is the preview URL API enabled? If enabled, you *must* specify -# an explicit url_preview_ip_range_blacklist of IPs that the spider is -# denied from accessing. -url_preview_enabled: False - -# List of IP address CIDR ranges that the URL preview spider is denied -# from accessing. There are no defaults: you must explicitly -# specify a list for URL previewing to work. You should specify any -# internal services in your network that you do not want synapse to try -# to connect to, otherwise anyone in any Matrix room could cause your -# synapse to issue arbitrary GET requests to your internal services, -# causing serious security issues. -# -# url_preview_ip_range_blacklist: -# - '127.0.0.0/8' -# - '10.0.0.0/8' -# - '172.16.0.0/12' -# - '192.168.0.0/16' -# - '100.64.0.0/10' -# - '169.254.0.0/16' -# -# List of IP address CIDR ranges that the URL preview spider is allowed -# to access even if they are specified in url_preview_ip_range_blacklist. -# This is useful for specifying exceptions to wide-ranging blacklisted -# target IP ranges - e.g. for enabling URL previews for a specific private -# website only visible in your network. -# -# url_preview_ip_range_whitelist: -# - '192.168.1.1' - -# Optional list of URL matches that the URL preview spider is -# denied from accessing. You should use url_preview_ip_range_blacklist -# in preference to this, otherwise someone could define a public DNS -# entry that points to a private IP address and circumvent the blacklist. -# This is more useful if you know there is an entire shape of URL that -# you know that will never want synapse to try to spider. -# -# Each list entry is a dictionary of url component attributes as returned -# by urlparse.urlsplit as applied to the absolute form of the URL. See -# https://docs.python.org/2/library/urlparse.html#urlparse.urlsplit -# The values of the dictionary are treated as an filename match pattern -# applied to that component of URLs, unless they start with a ^ in which -# case they are treated as a regular expression match. If all the -# specified component matches for a given list item succeed, the URL is -# blacklisted. -# -# url_preview_url_blacklist: -# # blacklist any URL with a username in its URI -# - username: '*' -# -# # blacklist all *.google.com URLs -# - netloc: 'google.com' -# - netloc: '*.google.com' -# -# # blacklist all plain HTTP URLs -# - scheme: 'http' -# -# # blacklist http(s)://www.acme.com/foo -# - netloc: 'www.acme.com' -# path: '/foo' -# -# # blacklist any URL with a literal IPv4 address -# - netloc: '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$' - -# The largest allowed URL preview spidering size in bytes -max_spider_size: "10M" - - - - -## Captcha ## -# See docs/CAPTCHA_SETUP for full details of configuring this. - -# This Home Server's ReCAPTCHA public key. -recaptcha_public_key: "YOUR_PUBLIC_KEY" - -# This Home Server's ReCAPTCHA private key. -recaptcha_private_key: "YOUR_PRIVATE_KEY" - -# Enables ReCaptcha checks when registering, preventing signup -# unless a captcha is answered. Requires a valid ReCaptcha -# public/private key. -enable_registration_captcha: False - -# A secret key used to bypass the captcha test entirely. -#captcha_bypass_secret: "YOUR_SECRET_HERE" - -# The API endpoint to use for verifying m.login.recaptcha responses. -recaptcha_siteverify_api: "https://www.google.com/recaptcha/api/siteverify" - - -## Turn ## - -# The public URIs of the TURN server to give to clients -turn_uris: [] - -# The shared secret used to compute passwords for the TURN server -turn_shared_secret: "YOUR_SHARED_SECRET" - -# The Username and password if the TURN server needs them and -# does not use a token -#turn_username: "TURNSERVER_USERNAME" -#turn_password: "TURNSERVER_PASSWORD" - -# How long generated TURN credentials last -turn_user_lifetime: "1h" - -# Whether guests should be allowed to use the TURN server. -# This defaults to True, otherwise VoIP will be unreliable for guests. -# However, it does introduce a slight security risk as it allows users to -# connect to arbitrary endpoints without having first signed up for a -# valid account (e.g. by passing a CAPTCHA). -turn_allow_guests: False - - -## Registration ## - -# Enable registration for new users. -enable_registration: False - -# The user must provide all of the below types of 3PID when registering. -# -# registrations_require_3pid: -# - email -# - msisdn - -# Mandate that users are only allowed to associate certain formats of -# 3PIDs with accounts on this server. -# -# allowed_local_3pids: -# - medium: email -# pattern: ".*@matrix\.org" -# - medium: email -# pattern: ".*@vector\.im" -# - medium: msisdn -# pattern: "\+44" - -# If set, allows registration by anyone who also has the shared -# secret, even if registration is otherwise disabled. -# registration_shared_secret: - -# Set the number of bcrypt rounds used to generate password hash. -# Larger numbers increase the work factor needed to generate the hash. -# The default number is 12 (which equates to 2^12 rounds). -# N.B. that increasing this will exponentially increase the time required -# to register or login - e.g. 24 => 2^24 rounds which will take >20 mins. -bcrypt_rounds: 12 - -# Allows users to register as guests without a password/email/etc, and -# participate in rooms hosted on this server which have been made -# accessible to anonymous users. -allow_guest_access: False - -# The list of identity servers trusted to verify third party -# identifiers by this server. -trusted_third_party_id_servers: - - matrix.org - - vector.im - - riot.im - -# Users who register on this homeserver will automatically be joined -# to these rooms -#auto_join_rooms: -# - "#example:example.com" - - -## Metrics ### - -# Enable collection and rendering of performance metrics -enable_metrics: False - -## API Configuration ## - -# A list of event types that will be included in the room_invite_state -room_invite_state_types: - - "m.room.join_rules" - - "m.room.canonical_alias" - - "m.room.avatar" - - "m.room.name" - - -# A list of application service config file to use -app_service_config_files: [] - - -# macaroon_secret_key: - -# Used to enable access token expiration. -expire_access_token: False - -## Signing Keys ## - -# Path to the signing key to sign messages with -signing_key_path: "/etc/matrix-synapse/homeserver.signing.key" - -# The keys that the server used to sign messages with but won't use -# to sign new messages. E.g. it has lost its private key -old_signing_keys: {} -# "ed25519:auto": -# # Base64 encoded public key -# key: "The public part of your old signing key." -# # Millisecond POSIX timestamp when the key expired. -# expired_ts: 123456789123 - -# How long key response published by this server is valid for. -# Used to set the valid_until_ts in /key/v2 APIs. -# Determines how quickly servers will query to check which keys -# are still valid. -key_refresh_interval: "1d" # 1 Day. - -# The trusted servers to download signing keys from. -perspectives: - servers: - "matrix.org": - verify_keys: - "ed25519:auto": - key: "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw" - - - -# Enable SAML2 for registration and login. Uses pysaml2 -# config_path: Path to the sp_conf.py configuration file -# idp_redirect_url: Identity provider URL which will redirect -# the user back to /login/saml2 with proper info. -# See pysaml2 docs for format of config. -#saml2_config: -# enabled: true -# config_path: "/home/erikj/git/synapse/sp_conf.py" -# idp_redirect_url: "http://test/idp" - - - -# Enable CAS for registration and login. -#cas_config: -# enabled: true -# server_url: "https://cas-server.com" -# service_url: "https://homeserver.domain.com:8448" -# #required_attributes: -# # name: value - - -# The JWT needs to contain a globally unique "sub" (subject) claim. -# -# jwt_config: -# enabled: true -# secret: "a secret" -# algorithm: "HS256" - - - -# Enable password for login. -password_config: - enabled: true - # Uncomment and change to a secret random string for extra security. - # DO NOT CHANGE THIS AFTER INITIAL SETUP! - #pepper: "" - - - -# Enable sending emails for notification events -# Defining a custom URL for Riot is only needed if email notifications -# should contain links to a self-hosted installation of Riot; when set -# the "app_name" setting is ignored. -# -# If your SMTP server requires authentication, the optional smtp_user & -# smtp_pass variables should be used -# -#email: -# enable_notifs: false -# smtp_host: "localhost" -# smtp_port: 25 -# smtp_user: "exampleusername" -# smtp_pass: "examplepassword" -# require_transport_security: False -# notif_from: "Your Friendly %(app)s Home Server " -# app_name: Matrix -# template_dir: res/templates -# notif_template_html: notif_mail.html -# notif_template_text: notif_mail.txt -# notif_for_new_users: True -# riot_base_url: "http://localhost/riot" - - -# password_providers: -# - module: "ldap_auth_provider.LdapAuthProvider" -# config: -# enabled: true -# uri: "ldap://ldap.example.com:389" -# start_tls: true -# base: "ou=users,dc=example,dc=com" -# attributes: -# uid: "cn" -# mail: "email" -# name: "givenName" -# #bind_dn: -# #bind_password: -# #filter: "(objectClass=posixAccount)" - - - -# Clients requesting push notifications can either have the body of -# the message sent in the notification poke along with other details -# like the sender, or just the event ID and room ID (`event_id_only`). -# If clients choose the former, this option controls whether the -# notification request includes the content of the event (other details -# like the sender are still included). For `event_id_only` push, it -# has no effect. - -# For modern android devices the notification content will still appear -# because it is loaded by the app. iPhone, however will send a -# notification saying only that a message arrived and who it came from. -# -#push: -# include_content: true - - -# spam_checker: -# module: "my_custom_project.SuperSpamChecker" -# config: -# example_option: 'things' - - -# Whether to allow non server admins to create groups on this server -enable_group_creation: false - -# If enabled, non server admins can only create groups with local parts -# starting with this prefix -# group_creation_prefix: "unofficial/" - - - -# User Directory configuration -# -# 'search_all_users' defines whether to search all users visible to your HS -# when searching the user directory, rather than limiting to users visible -# in public rooms. Defaults to false. If you set it True, you'll have to run -# UPDATE user_directory_stream_pos SET stream_id = NULL; -# on your database to tell it to rebuild the user_directory search indexes. -# -#user_directory: -# search_all_users: false diff --git a/debian/install b/debian/install index d1f42c8be6..3d916a9718 100644 --- a/debian/install +++ b/debian/install @@ -1,2 +1 @@ -debian/homeserver.yaml etc/matrix-synapse debian/log.yaml etc/matrix-synapse -- cgit 1.4.1 From 3bd9daf4b86ed811c9ced95a4adb9aa58b681399 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 5 Feb 2019 18:33:02 +0000 Subject: v0.99.0 --- CHANGES.md | 71 +++++++++++------------------------------------- changelog.d/4547.misc | 1 - changelog.d/4557.misc | 1 - changelog.d/4558.feature | 1 - changelog.d/4562.misc | 1 - changelog.d/4564.bugfix | 1 - changelog.d/4566.feature | 1 - changelog.d/4572.misc | 1 - debian/changelog | 6 ++++ synapse/__init__.py | 2 +- 10 files changed, 23 insertions(+), 63 deletions(-) delete mode 100644 changelog.d/4547.misc delete mode 100644 changelog.d/4557.misc delete mode 100644 changelog.d/4558.feature delete mode 100644 changelog.d/4562.misc delete mode 100644 changelog.d/4564.bugfix delete mode 100644 changelog.d/4566.feature delete mode 100644 changelog.d/4572.misc (limited to 'debian') diff --git a/CHANGES.md b/CHANGES.md index 66991340a4..e330aea9e3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,52 +1,5 @@ -Synapse 0.99.0rc4 (2019-02-01) -============================== - -Internal Changes ----------------- - -- Update federation routing logic to check .well-known before SRV ([\#4539](https://github.com/matrix-org/synapse/issues/4539)) -- Improve performance of handling servers with invalid .well-known ([\#4542](https://github.com/matrix-org/synapse/issues/4542)) -- Treat an invalid .well-known file the same as an absent one ([\#4544](https://github.com/matrix-org/synapse/issues/4544)) - - -Synapse 0.99.0rc3 (2019-01-31) -============================== - -Bugfixes --------- - -- Fix infinite loop when an event is redacted in a v3 room ([\#4535](https://github.com/matrix-org/synapse/issues/4535)) - - -Improved Documentation ----------------------- - -- Update debian installation instructions ([\#4526](https://github.com/matrix-org/synapse/issues/4526)) - - -Internal Changes ----------------- - -- Add some debug for membership syncing issues ([\#4538](https://github.com/matrix-org/synapse/issues/4538)) - - -Synapse 0.99.0rc2 (2019-01-30) -============================== - -Bugfixes --------- - -- Fix bug when rejecting remote invites. ([\#4527](https://github.com/matrix-org/synapse/issues/4527)) -- Fix incorrect rendering of server capabilities. ([81b7e7eed](https://github.com/matrix-org/synapse/commit/81b7e7eed323f55d6550e7a270a9dc2c4c7b0fe0)) - -Improved Documentation ----------------------- - -- Add documentation on enabling ACME support when upgrading to v0.99. ([\#4528](https://github.com/matrix-org/synapse/issues/4528)) - - -Synapse 0.99.0rc1 (2019-01-30) -============================== +Synapse 0.99.0 (2019-02-05) +=========================== Synapse v0.99.x is a precursor to the upcoming Synapse v1.0 release. It contains foundational changes to room architecture and the federation security model necessary to support the upcoming r0 release of the Server to Server API. @@ -54,15 +7,15 @@ Features -------- - Synapse's cipher string has been updated to require ECDH key exchange. Configuring and generating dh_params is no longer required, and they will be ignored. ([\#4229](https://github.com/matrix-org/synapse/issues/4229)) -- Synapse can now automatically provision TLS certificates via ACME (the protocol used by CAs like Let's Encrypt). ([\#4384](https://github.com/matrix-org/synapse/issues/4384), [\#4492](https://github.com/matrix-org/synapse/issues/4492), [\#4525](https://github.com/matrix-org/synapse/issues/4525)) -- Implement MSC1708 (.well-known routing for server-server federation) ([\#4408](https://github.com/matrix-org/synapse/issues/4408), [\#4409](https://github.com/matrix-org/synapse/issues/4409), [\#4426](https://github.com/matrix-org/synapse/issues/4426), [\#4427](https://github.com/matrix-org/synapse/issues/4427), [\#4428](https://github.com/matrix-org/synapse/issues/4428), [\#4464](https://github.com/matrix-org/synapse/issues/4464), [\#4468](https://github.com/matrix-org/synapse/issues/4468), [\#4487](https://github.com/matrix-org/synapse/issues/4487), [\#4488](https://github.com/matrix-org/synapse/issues/4488), [\#4489](https://github.com/matrix-org/synapse/issues/4489), [\#4497](https://github.com/matrix-org/synapse/issues/4497), [\#4511](https://github.com/matrix-org/synapse/issues/4511), [\#4516](https://github.com/matrix-org/synapse/issues/4516), [\#4520](https://github.com/matrix-org/synapse/issues/4520), [\#4521](https://github.com/matrix-org/synapse/issues/4521)) +- Synapse can now automatically provision TLS certificates via ACME (the protocol used by CAs like Let's Encrypt). ([\#4384](https://github.com/matrix-org/synapse/issues/4384), [\#4492](https://github.com/matrix-org/synapse/issues/4492), [\#4525](https://github.com/matrix-org/synapse/issues/4525), [\#4572](https://github.com/matrix-org/synapse/issues/4572), [\#4564](https://github.com/matrix-org/synapse/issues/4564), [\#4566](https://github.com/matrix-org/synapse/issues/4566), [\#4547](https://github.com/matrix-org/synapse/issues/4547), [\#4557](https://github.com/matrix-org/synapse/issues/4557)) +- Implement MSC1708 (.well-known routing for server-server federation) ([\#4408](https://github.com/matrix-org/synapse/issues/4408), [\#4409](https://github.com/matrix-org/synapse/issues/4409), [\#4426](https://github.com/matrix-org/synapse/issues/4426), [\#4427](https://github.com/matrix-org/synapse/issues/4427), [\#4428](https://github.com/matrix-org/synapse/issues/4428), [\#4464](https://github.com/matrix-org/synapse/issues/4464), [\#4468](https://github.com/matrix-org/synapse/issues/4468), [\#4487](https://github.com/matrix-org/synapse/issues/4487), [\#4488](https://github.com/matrix-org/synapse/issues/4488), [\#4489](https://github.com/matrix-org/synapse/issues/4489), [\#4497](https://github.com/matrix-org/synapse/issues/4497), [\#4511](https://github.com/matrix-org/synapse/issues/4511), [\#4516](https://github.com/matrix-org/synapse/issues/4516), [\#4520](https://github.com/matrix-org/synapse/issues/4520), [\#4521](https://github.com/matrix-org/synapse/issues/4521), [\#4539](https://github.com/matrix-org/synapse/issues/4539), [\#4542](https://github.com/matrix-org/synapse/issues/4542), [\#4544](https://github.com/matrix-org/synapse/issues/4544)) - Search now includes results from predecessor rooms after a room upgrade. ([\#4415](https://github.com/matrix-org/synapse/issues/4415)) - Config option to disable requesting MSISDN on registration. ([\#4423](https://github.com/matrix-org/synapse/issues/4423)) - Add a metric for tracking event stream position of the user directory. ([\#4445](https://github.com/matrix-org/synapse/issues/4445)) -- Support exposing server capabilities in CS API (MSC1753, MSC1804) ([\#4472](https://github.com/matrix-org/synapse/issues/4472)) -- Add support for room version 3 ([\#4483](https://github.com/matrix-org/synapse/issues/4483), [\#4499](https://github.com/matrix-org/synapse/issues/4499), [\#4515](https://github.com/matrix-org/synapse/issues/4515), [\#4523](https://github.com/matrix-org/synapse/issues/4523)) +- Support exposing server capabilities in CS API (MSC1753, MSC1804) ([\#4472](https://github.com/matrix-org/synapse/issues/4472), [81b7e7eed](https://github.com/matrix-org/synapse/commit/81b7e7eed323f55d6550e7a270a9dc2c4c7b0fe0))) +- Add support for room version 3 ([\#4483](https://github.com/matrix-org/synapse/issues/4483), [\#4499](https://github.com/matrix-org/synapse/issues/4499), [\#4515](https://github.com/matrix-org/synapse/issues/4515), [\#4523](https://github.com/matrix-org/synapse/issues/4523), [\#4535](https://github.com/matrix-org/synapse/issues/4535)) - Synapse will now reload TLS certificates from disk upon SIGHUP. ([\#4495](https://github.com/matrix-org/synapse/issues/4495), [\#4524](https://github.com/matrix-org/synapse/issues/4524)) - +- The matrixdotorg/synapse Docker images now use Python 3 by default. ([\#4558](https://github.com/matrix-org/synapse/issues/4558)) Bugfixes -------- @@ -71,7 +24,7 @@ Bugfixes - Fix typo in ALL_USER_TYPES definition to ensure type is a tuple ([\#4392](https://github.com/matrix-org/synapse/issues/4392)) - Fix high CPU usage due to remote devicelist updates ([\#4397](https://github.com/matrix-org/synapse/issues/4397)) - Fix potential bug where creating or joining a room could fail ([\#4404](https://github.com/matrix-org/synapse/issues/4404)) -- Fix bug when rejecting remote invites ([\#4405](https://github.com/matrix-org/synapse/issues/4405)) +- Fix bug when rejecting remote invites ([\#4405](https://github.com/matrix-org/synapse/issues/4405), [\#4527](https://github.com/matrix-org/synapse/issues/4527)) - Fix incorrect logcontexts after a Deferred was cancelled ([\#4407](https://github.com/matrix-org/synapse/issues/4407)) - Ensure encrypted room state is persisted across room upgrades. ([\#4411](https://github.com/matrix-org/synapse/issues/4411)) - Copy over whether a room is a direct message and any associated room tags on room upgrade. ([\#4412](https://github.com/matrix-org/synapse/issues/4412)) @@ -89,6 +42,12 @@ Deprecations and Removals - Synapse no longer generates self-signed TLS certificates when generating a configuration file. ([\#4509](https://github.com/matrix-org/synapse/issues/4509)) +Improved Documentation +---------------------- + +- Update debian installation instructions ([\#4526](https://github.com/matrix-org/synapse/issues/4526)) + + Internal Changes ---------------- @@ -111,6 +70,8 @@ Internal Changes - Make it possible to set the log level for tests via an environment variable ([\#4506](https://github.com/matrix-org/synapse/issues/4506)) - Reduce the log level of linearizer lock acquirement to DEBUG. ([\#4507](https://github.com/matrix-org/synapse/issues/4507)) - Fix code to comply with linting in PyFlakes 3.7.1. ([\#4519](https://github.com/matrix-org/synapse/issues/4519)) +- Add some debug for membership syncing issues ([\#4538](https://github.com/matrix-org/synapse/issues/4538)) +- Docker: only copy what we need to the build image ([\#4562](https://github.com/matrix-org/synapse/issues/4562)) Synapse 0.34.1.1 (2019-01-11) diff --git a/changelog.d/4547.misc b/changelog.d/4547.misc deleted file mode 100644 index b6e421d095..0000000000 --- a/changelog.d/4547.misc +++ /dev/null @@ -1 +0,0 @@ -Add docs for ACME setup to README. \ No newline at end of file diff --git a/changelog.d/4557.misc b/changelog.d/4557.misc deleted file mode 100644 index 7ebfb23f43..0000000000 --- a/changelog.d/4557.misc +++ /dev/null @@ -1 +0,0 @@ -Fix comment typo in TLS section of config diff --git a/changelog.d/4558.feature b/changelog.d/4558.feature deleted file mode 100644 index 40724d1c3f..0000000000 --- a/changelog.d/4558.feature +++ /dev/null @@ -1 +0,0 @@ -The matrixdotorg/synapse Docker images now use Python 3 by default. \ No newline at end of file diff --git a/changelog.d/4562.misc b/changelog.d/4562.misc deleted file mode 100644 index f7185fa768..0000000000 --- a/changelog.d/4562.misc +++ /dev/null @@ -1 +0,0 @@ -Docker: only copy what we need to the build image diff --git a/changelog.d/4564.bugfix b/changelog.d/4564.bugfix deleted file mode 100644 index 78e78504b4..0000000000 --- a/changelog.d/4564.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix default ACME config for py2 diff --git a/changelog.d/4566.feature b/changelog.d/4566.feature deleted file mode 100644 index 11fc07476e..0000000000 --- a/changelog.d/4566.feature +++ /dev/null @@ -1 +0,0 @@ -enable ACME support in the docker image diff --git a/changelog.d/4572.misc b/changelog.d/4572.misc deleted file mode 100644 index ea5d49b706..0000000000 --- a/changelog.d/4572.misc +++ /dev/null @@ -1 +0,0 @@ -FAQ to help server admins configure TLS certs in 0.99.0 diff --git a/debian/changelog b/debian/changelog index e6c174e02d..04b5d69053 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +matrix-synapse-py3 (0.99.0) stable; urgency=medium + + * New synapse release 0.99.0 + + -- Synapse Packaging team Tue, 5 Feb 2019 18:25:00 +0000 + matrix-synapse-py3 (0.34.1.1++1) stable; urgency=medium * Update conflicts specifications to allow smoother transition from matrix-synapse. diff --git a/synapse/__init__.py b/synapse/__init__.py index 54745af283..048d6e572f 100644 --- a/synapse/__init__.py +++ b/synapse/__init__.py @@ -27,4 +27,4 @@ try: except ImportError: pass -__version__ = "0.99.0rc4" +__version__ = "0.99.0" -- cgit 1.4.1 From a214ba93e0770f87c1a13a62375a11fd6c60bf64 Mon Sep 17 00:00:00 2001 From: Дамјан Георгиевски Date: Thu, 14 Feb 2019 14:44:22 +0100 Subject: implement `reload` by sending the HUP signal (#4622) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * implement `reload` by sending the HUP signal According to the 0.99 release info* synapse now uses the HUP signal to reload certificates: > Synapse will now reload TLS certificates from disk upon SIGHUP. (#4495, #4524) So the matrix-synapse.service unit file should include a reload directive. Signed-off-by: Дамјан Георгиевски --- debian/changelog | 6 ++++++ debian/matrix-synapse.service | 1 + 2 files changed, 7 insertions(+) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 04b5d69053..d4b9ed8ed7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +matrix-synapse-py3 (0.99.1) UNRELEASED; urgency=medium + + * Added ExecReload= in service unit file to send a HUP signal + + -- Damjan Georgievski Thu, 14 Feb 2019 12:53:13 +0000 + matrix-synapse-py3 (0.99.0) stable; urgency=medium * New synapse release 0.99.0 diff --git a/debian/matrix-synapse.service b/debian/matrix-synapse.service index 2e9cd83b5f..942e4b83fe 100644 --- a/debian/matrix-synapse.service +++ b/debian/matrix-synapse.service @@ -8,6 +8,7 @@ WorkingDirectory=/var/lib/matrix-synapse EnvironmentFile=/etc/default/matrix-synapse ExecStartPre=/opt/venvs/matrix-synapse/bin/python -m synapse.app.homeserver --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/ --generate-keys ExecStart=/opt/venvs/matrix-synapse/bin/python -m synapse.app.homeserver --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/ +ExecReload=/bin/kill -HUP $MAINPID Restart=always RestartSec=3 -- cgit 1.4.1 From 06cd757ae718ca4ec01c8e6480547f48f9410cfa Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 14 Feb 2019 14:24:24 +0000 Subject: 0.99.1 --- CHANGES.md | 15 +++------------ debian/changelog | 8 ++++++-- synapse/__init__.py | 4 ++-- 3 files changed, 11 insertions(+), 16 deletions(-) (limited to 'debian') diff --git a/CHANGES.md b/CHANGES.md index d0b3437b2d..872ac440b5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,14 +1,5 @@ -Synapse 0.99.1rc2 (2019-02-13) -============================== - -Bugfixes --------- - -- Fix errors when using default bind_addresses with replication/metrics listeners. ([\#4636](https://github.com/matrix-org/synapse/issues/4636)) - - -Synapse 0.99.1rc1 (2019-02-12) -============================== +Synapse 0.99.1 (2019-02-14) +=========================== Features -------- @@ -19,7 +10,7 @@ Features - Add ability to update backup versions ([\#4580](https://github.com/matrix-org/synapse/issues/4580)) - Allow the "unavailable" presence status for /sync. This change makes Synapse compliant with r0.4.0 of the Client-Server specification. ([\#4592](https://github.com/matrix-org/synapse/issues/4592)) -- There is no longer any need to specify `no_tls`: it is inferred from the absence of TLS listeners ([\#4613](https://github.com/matrix-org/synapse/issues/4613), [\#4615](https://github.com/matrix-org/synapse/issues/4615), [\#4617](https://github.com/matrix-org/synapse/issues/4617)) +- There is no longer any need to specify `no_tls`: it is inferred from the absence of TLS listeners ([\#4613](https://github.com/matrix-org/synapse/issues/4613), [\#4615](https://github.com/matrix-org/synapse/issues/4615), [\#4617](https://github.com/matrix-org/synapse/issues/4617), [\#4636](https://github.com/matrix-org/synapse/issues/4636)) - The default configuration no longer requires TLS certificates. ([\#4614](https://github.com/matrix-org/synapse/issues/4614)) diff --git a/debian/changelog b/debian/changelog index d4b9ed8ed7..bc1ba153e3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,12 @@ -matrix-synapse-py3 (0.99.1) UNRELEASED; urgency=medium +matrix-synapse-py3 (0.99.1) stable; urgency=medium + [ Damjan Georgievski ] * Added ExecReload= in service unit file to send a HUP signal - -- Damjan Georgievski Thu, 14 Feb 2019 12:53:13 +0000 + [ Synapse Packaging team ] + * New synapse release 0.99.1 + + -- Synapse Packaging team Thu, 14 Feb 2019 14:12:26 +0000 matrix-synapse-py3 (0.99.0) stable; urgency=medium diff --git a/synapse/__init__.py b/synapse/__init__.py index 4629fa76ec..f7bac0ea4e 100644 --- a/synapse/__init__.py +++ b/synapse/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd -# Copyright 2018 New Vector Ltd +# Copyright 2018-9 New Vector Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -27,4 +27,4 @@ try: except ImportError: pass -__version__ = "0.99.1rc2" +__version__ = "0.99.1" -- cgit 1.4.1 From f595d6ac577696744e56da3429a53b2a0eb1d952 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 14 Feb 2019 17:20:02 +0000 Subject: 0.99.1.1 --- CHANGES.md | 10 ++++++++++ changelog.d/4648.bugfix | 2 -- debian/changelog | 6 ++++++ synapse/__init__.py | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) delete mode 100644 changelog.d/4648.bugfix (limited to 'debian') diff --git a/CHANGES.md b/CHANGES.md index 872ac440b5..f1a9d58e4d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,13 @@ +Synapse 0.99.1.1 (2019-02-14) +============================= + +Bugfixes +-------- + +- Fix "TypeError: '>' not supported" when starting without an existing certificate. + Fix a bug where an existing certificate would be reprovisoned every day. ([\#4648](https://github.com/matrix-org/synapse/issues/4648)) + + Synapse 0.99.1 (2019-02-14) =========================== diff --git a/changelog.d/4648.bugfix b/changelog.d/4648.bugfix deleted file mode 100644 index bd117e8664..0000000000 --- a/changelog.d/4648.bugfix +++ /dev/null @@ -1,2 +0,0 @@ -Fix "TypeError: '>' not supported" when starting without an existing certificate. -Fix a bug where an existing certificate would be reprovisoned every day. diff --git a/debian/changelog b/debian/changelog index bc1ba153e3..124128920b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +matrix-synapse-py3 (0.99.1.1) stable; urgency=medium + + * New synapse release 0.99.1.1 + + -- Synapse Packaging team Thu, 14 Feb 2019 17:19:44 +0000 + matrix-synapse-py3 (0.99.1) stable; urgency=medium [ Damjan Georgievski ] diff --git a/synapse/__init__.py b/synapse/__init__.py index f7bac0ea4e..2004375f98 100644 --- a/synapse/__init__.py +++ b/synapse/__init__.py @@ -27,4 +27,4 @@ try: except ImportError: pass -__version__ = "0.99.1" +__version__ = "0.99.1.1" -- cgit 1.4.1 From 0969d688e321e0a419e427e728b425fdfcdea8ec Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Fri, 22 Feb 2019 15:02:39 +0000 Subject: Debian: fix overwriting of config settings on upgrade (#4696) Make sure that users' changes to the config files are preserved. Fixes #4440. --- debian/changelog | 6 ++ debian/config | 9 --- debian/install | 1 + debian/manage_debconf.pl | 130 +++++++++++++++++++++++++++++++++++++ debian/matrix-synapse-py3.config | 12 ++++ debian/matrix-synapse-py3.postinst | 33 +++++++--- 6 files changed, 174 insertions(+), 17 deletions(-) delete mode 100755 debian/config create mode 100755 debian/manage_debconf.pl create mode 100755 debian/matrix-synapse-py3.config (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 124128920b..7631406a68 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +matrix-synapse-py3 (0.99.2) UNRELEASED; urgency=medium + + * Fix overwriting of config settings on upgrade. + + -- Synapse Packaging team Wed, 20 Feb 2019 17:11:25 +0000 + matrix-synapse-py3 (0.99.1.1) stable; urgency=medium * New synapse release 0.99.1.1 diff --git a/debian/config b/debian/config deleted file mode 100755 index 9fb6913298..0000000000 --- a/debian/config +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -set -e - -. /usr/share/debconf/confmodule - -db_input high matrix-synapse/server-name || true -db_input high matrix-synapse/report-stats || true -db_go diff --git a/debian/install b/debian/install index 3d916a9718..43dc8c6904 100644 --- a/debian/install +++ b/debian/install @@ -1 +1,2 @@ debian/log.yaml etc/matrix-synapse +debian/manage_debconf.pl /opt/venvs/matrix-synapse/lib/ diff --git a/debian/manage_debconf.pl b/debian/manage_debconf.pl new file mode 100755 index 0000000000..be8ed32050 --- /dev/null +++ b/debian/manage_debconf.pl @@ -0,0 +1,130 @@ +#!/usr/bin/perl +# +# Interface between our config files and the debconf database. +# +# Usage: +# +# manage_debconf.pl +# +# where can be: +# +# read: read the configuration from the yaml into debconf +# update: update the yaml config according to the debconf database +use strict; +use warnings; + +use Debconf::Client::ConfModule (qw/get set/); + +# map from the name of a setting in our .yaml file to the relevant debconf +# setting. +my %MAPPINGS=( + server_name => 'matrix-synapse/server-name', + report_stats => 'matrix-synapse/report-stats', +); + +# enable debug if dpkg --debug +my $DEBUG = $ENV{DPKG_MAINTSCRIPT_DEBUG}; + +sub read_config { + my @files = @_; + + foreach my $file (@files) { + print STDERR "reading $file\n" if $DEBUG; + + open my $FH, "<", $file or next; + + # rudimentary parsing which (a) avoids having to depend on a yaml library, + # and (b) is tolerant of yaml errors + while($_ = <$FH>) { + while (my ($setting, $debconf) = each %MAPPINGS) { + $setting = quotemeta $setting; + if(/^${setting}\s*:(.*)$/) { + my $val = $1; + + # remove leading/trailing whitespace + $val =~ s/^\s*//; + $val =~ s/\s*$//; + + # remove surrounding quotes + if ($val =~ /^"(.*)"$/ || $val =~ /^'(.*)'$/) { + $val = $1; + } + + print STDERR ">> $debconf = $val\n" if $DEBUG; + set($debconf, $val); + } + } + } + close $FH; + } +} + +sub update_config { + my @files = @_; + + my %substs = (); + while (my ($setting, $debconf) = each %MAPPINGS) { + my @res = get($debconf); + $substs{$setting} = $res[1] if $res[0] == 0; + } + + foreach my $file (@files) { + print STDERR "checking $file\n" if $DEBUG; + + open my $FH, "<", $file or next; + + my $updated = 0; + + # read the whole file into memory + my @lines = <$FH>; + + while (my ($setting, $val) = each %substs) { + $setting = quotemeta $setting; + + map { + if (/^${setting}\s*:\s*(.*)\s*$/) { + my $current = $1; + if ($val ne $current) { + $_ = "${setting}: $val\n"; + $updated = 1; + } + } + } @lines; + } + close $FH; + + next unless $updated; + + print STDERR "updating $file\n" if $DEBUG; + open $FH, ">", $file or die "unable to update $file"; + print $FH @lines; + close $FH; + } +} + + +my $cmd = $ARGV[0]; + +my $read = 0; +my $update = 0; + +if (not $cmd) { + die "must specify a command to perform\n"; +} elsif ($cmd eq 'read') { + $read = 1; +} elsif ($cmd eq 'update') { + $update = 1; +} else { + die "unknown command '$cmd'\n"; +} + +my @files = ( + "/etc/matrix-synapse/homeserver.yaml", + glob("/etc/matrix-synapse/conf.d/*.yaml"), +); + +if ($read) { + read_config(@files); +} elsif ($update) { + update_config(@files); +} diff --git a/debian/matrix-synapse-py3.config b/debian/matrix-synapse-py3.config new file mode 100755 index 0000000000..3bda3292f1 --- /dev/null +++ b/debian/matrix-synapse-py3.config @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e + +. /usr/share/debconf/confmodule + +# try to update the debconf db according to whatever is in the config files +/opt/venvs/matrix-synapse/lib/manage_debconf.pl read || true + +db_input high matrix-synapse/server-name || true +db_input high matrix-synapse/report-stats || true +db_go diff --git a/debian/matrix-synapse-py3.postinst b/debian/matrix-synapse-py3.postinst index 0509acd0a4..c0dd7e5534 100644 --- a/debian/matrix-synapse-py3.postinst +++ b/debian/matrix-synapse-py3.postinst @@ -8,19 +8,36 @@ USER="matrix-synapse" case "$1" in configure|reconfigure) - # Set server name in config file - mkdir -p "/etc/matrix-synapse/conf.d/" - db_get matrix-synapse/server-name - if [ "$RET" ]; then - echo "server_name: $RET" > $CONFIGFILE_SERVERNAME + # generate template config files if they don't exist + mkdir -p "/etc/matrix-synapse/conf.d/" + if [ ! -e "$CONFIGFILE_SERVERNAME" ]; then + cat > "$CONFIGFILE_SERVERNAME" < $CONFIGFILE_REPORTSTATS + if [ ! -e "$CONFIGFILE_REPORTSTATS" ]; then + cat > "$CONFIGFILE_REPORTSTATS" </dev/null; then adduser --quiet --system --no-create-home --home /var/lib/matrix-synapse $USER fi -- cgit 1.4.1