Commit Graph

856 Commits

Author SHA1 Message Date
Anders Kaseorg 0ae2c5c96e nginx: Enable TLS 1.3 if supported.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-30 13:09:57 -07:00
Anders Kaseorg ee9a6071fd 5xx.html: Build with webpack.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-10-28 15:53:15 -07:00
Tim Abbott f84c037225 puppet: Tune check_postgres_locks parameters.
This has been a spurious alert for a long time.

It's unclear that this check is useful at all, but if it spikes
dramatically above what's normal, there's perhaps still utility in
being alerted.
2019-10-23 15:04:38 -07:00
Tim Abbott e4dee9532c nagios: Update configuration for user_activity worker change.
Since LoopQueueProcessingWorker jobs cannot be monitored by checking
for connected consumers (since they poll, rather than consuming as
events arrive), they can't be monitored with check_consumers.  It's
OK, because that monitoring was redundant with monitoring for
potential growth in their queue that we have as well.

Also clean up the block comments for the two other similar queue
procesors.
2019-09-23 11:49:46 -07:00
Anders Kaseorg b72bb8171b nginx: Add CORS, HSTS, and X-Frame-Options headers to error responses.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-09-19 12:10:18 -07:00
Anders Kaseorg 6701c4463c search: Remove now unnecessary tsearch_extra dependency.
Now that we're implemented tsearch_extras in pure postgres, we no
longer need a custom extension.  This should help us considerably, as
it means we no longer need to ship custom apt packages at all.

Fixes #467.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-29 12:49:26 -07:00
Anders Kaseorg b2e1af90fc process_fts_updates: Reconnect on OperationalError.
This allows process_fts_updates to recover if Postgres is restarted.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-21 11:00:58 -07:00
Anders Kaseorg fb42cd3af9 process_fts_updates: Fix log message.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-21 11:00:58 -07:00
Anders Kaseorg 473c4abca5 process_fts_updates: Use psycopg2.connect kwargs.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-21 11:00:58 -07:00
Anders Kaseorg fa11b2d806 nginx: Don’t gzip files that are already compressed.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-21 10:51:37 -07:00
Anders Kaseorg 4e620ed43c nginx: Enable http2 in on-premise configuration.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-21 10:51:37 -07:00
Hemanth V. Alluri dac068df31 production: Finish adding production support for Zulip on Debian Buster.
This commit finishes adding end-to-end support for the install script
on Debian Buster (making it production ready). Some support for this
was already added in prior commits such as
99414e2d96.

We plan to revert the postgres hunks of this once we've built
tsearch_extras for our packagecloud archive.

Fixes #9828.
2019-08-17 12:22:32 -07:00
Hemanth V. Alluri 083723b6a9 puppet: Add Zulip specific postgres configuration for 11.
Based on the work done in a03e4784c7.
2019-08-17 11:41:11 -07:00
Hemanth V. Alluri 792283c441 puppet: Commit an upstream version of postgres 11 config.
In preparation for adding production support for Debian Buster. Based
on the work done in commit 964a1ac8a7.
2019-08-17 11:41:11 -07:00
Hemanth V. Alluri 5dd45b4b2e puppet: Fix the release detection regex patterns in base.pp.
The issue here was that the '.' character was unescaped and the
regex was not anchored with a terminal '$'. This was detected by
Anders Kaseorg.

Co-authored-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-17 11:41:11 -07:00
Anders Kaseorg 66649d84cb puppet: Reload postfix on /etc/postfix/virtual changes.
`/etc/postfix/virtual` is of `regexp:` type, not `hash:` type, so
running `postmap` on it has no effect; we need to reload Postfix when
it changes.

http://www.postfix.org/DATABASE_README.html#detect

In the interest of forcing a reload now, optimize the regexes by
eliding the unanchored `.*`s at the beginnings and ends.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-15 22:45:26 -07:00
rht 61be9fb4bd puppet: Add Zulip-specific postgres configuration for 10 on Centos. 2019-08-14 14:31:16 -07:00
rht 03fb4b5f90 puppet: Commit an upstream CentOS version of postgres 10 sample config. 2019-08-14 14:31:16 -07:00
Anders Kaseorg 263d71bf2b nginx: Add CORS headers to /user_uploads.
Fixes: #12980.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-12 15:35:35 -07:00
Anders Kaseorg 2e57f3ffae puppet: “Resolve” puppet-lint warnings.
Introduced by #12966.

puppet/zulip/manifests/base.pp - WARNING: double quoted string containing no variables on line 93
puppet/zulip/manifests/base.pp - WARNING: string containing only a variable on line 93

scanf doesn’t accept a number as input, so uh, add a dummy space
character.

What.  You can’t give me a bad language and then complain when I write
bad programs in it.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-12 15:29:23 -07:00
Anders Kaseorg 820165e4da Merge pull request #12968 from andersk/ffdhe2048
nginx: Use fixed ffdhe2048 DH parameter (RFC 7919)
2019-08-09 16:29:10 -07:00
Anders Kaseorg 4e9fb05c4f puppet: Use built-in memorysize_mb fact.
Fixes this warning:

    Warning: The string '8167976' was automatically coerced to the numerical value 8167976 (file: /root/zulip/puppet/zulip/manifests/base.pp, line: 93, column: 19)

Fixes #9682.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-09 16:28:09 -07:00
Tim Abbott de0a41bc9c provision: Fix missing dependency on unzip.
Because this is often installed by default, we hadn't noticed that our
Slack importer doesn't run without it.

Thanks to Ray Kraesig for the report.
2019-08-08 10:49:20 -07:00
Anders Kaseorg 0962393933 cleanup: Delete trailing newlines.
Delete trailing newlines from all files, except
tools/ci/success-http-headers.txt and tools/setup/dev-motd, where they
are significant, and static/third, where we want to stay close to
upstream.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-06 23:29:11 -07:00
Anders Kaseorg becef760bf cleanup: Delete leading newlines.
Previous cleanups (mostly the removals of Python __future__ imports)
were done in a way that introduced leading newlines.  Delete leading
newlines from all files, except static/assets/zulip-emoji/NOTICE,
which is a verbatim copy of the Apache 2.0 license.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-06 23:29:11 -07:00
Anders Kaseorg 68dd8e4ec8 mypy: Migrate from mypy_extensions to typing_extensions.
This gives us access to typing_extensions.Deque, which was not added
to typing until 3.5.4.

(PROVISION_VERSION is not bumped because the transitive dependency set
in dev.txt hasn’t changed.)

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-08-05 17:24:09 -07:00
Wyatt Hoodes a109508e34 typing: Remove now-unnecessary conditional import.
As a result of dropping support for trusty, we can remove our old
pattern of putting `if False` before importing the typing module,
which was essential for Python 3.4 support, but not required and maybe
harmful on newer versions.

cron_file_helper
check_rabbitmq_consumers
hash_reqs
check_zephyr_mirror
check_personal_zephyr_mirrors
check_cron_file
zulip_tools
check_postgres_replication_lag
api_test_helpers
purge-old-deployments
setup_venv
node_cache
clean_venv_cache
clean_node_cache
clean_emoji_cache
pg_backup_and_purge
restore-backup
generate_secrets
zulip-ec2-configure-interfaces
diagnose
check_user_zephyr_mirror_liveness
2019-07-29 15:18:22 -07:00
Anders Kaseorg b758ed5ac1 nginx: Remove invalid extra headers for OPTIONS /api/v1/events.
Since 204 responses don’t contain a payload body, Content-Type is
neither required nor encouraged (RFC 7231 §3.1.1.5), and ours was
missing a semicolon to boot; Content-Length is expressly
forbidden (RFC 7230 §3.3.2).

Furthermore, these add_header directives were silencing the CORS
headers set in api_headers, because add_header inheritance doesn’t
work the way you think it does, as was known before commit
5614d51afc.

Fixes: #12902.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-29 14:58:35 -07:00
Anders Kaseorg 6d5a20ac62 requirements: Remove django-pipeline.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-24 17:40:31 -07:00
Tim Abbott 2eb855b302 puppet: Include . separator in email mirror rules.
This is required for the postfix-localmail integration to use the new
`.` format email addresses.
2019-07-22 11:13:36 -07:00
Wyatt Hoodes e331a758c3 python: Migrate open statements to use with.
This is low priority, but it's nice to be consistently using the best
practice pattern.

Fixes: #12419.
2019-07-20 15:48:52 -07:00
Anders Kaseorg c97ca677c9 nginx: Update TLS settings based on Mozilla recommendations 5.0.
Disable TLS 1.0 and TLS 1.1.  (We no longer need to support IE8 on
Windows XP.)

Prefer client-selected cipher order.  (Now that all enabled ciphers
provide good security, this allows mobile clients lacking AES hardware
acceleration to pick ChaCha20 for better performance.)

Disable session tickets.  (Mozilla discourages them based on
https://www.imperialviolet.org/2013/06/27/botchingpfs.html.)

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-08 15:51:02 -07:00
Anders Kaseorg 079ddae4c8 minify-js: Remove; everything has been migrated to Webpack.
min/sockjs-0.3.4.min.js is not used.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-07-03 13:58:21 -07:00
Tim Abbott aea1279e8c puppet: Remove trusty configuration for static_asset_compiler.
Trusty is desupported.
2019-06-26 11:32:06 -07:00
Tim Abbott 8fbd965ab5 puppet: Remove legacy pgtune related configuration for trusty.
Since we no longer support Ubuntu Trusty, we no longer need this
backwards-compatibility cruft (which we only kept around to avoid
randomizing configuration for existing systems).
2019-06-26 11:32:06 -07:00
Anders Kaseorg 33c941407b puppet: Remove legacy unauthenticated local uploads backend.
This was only used in Ubuntu 14.04 Trusty.

Removing this also finally lets us simplify our security model
discussion of uploaded files.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2019-06-26 11:31:46 -07:00
Tim Abbott 271319fb13 puppet: Fix hacky release test for whether we're in EC2.
The result is still a bit hacky, but guaranteed to be correct if we
adjust the OS version of our systems, which we of course will do over
time.
2019-06-25 22:19:04 -07:00
Tim Abbott 8d8cfb314b puppet: Remove zulip_ops configuration for trusty.
There are no longer any zulip_ops systems using trusty.
2019-06-25 22:09:06 -07:00
Tim Abbott 88b77af54f puppet: Add support for changing the nginx port directly.
This provides a clean process for changing Zulip's nginx port.
2019-06-17 12:24:22 -07:00
Fabian Stanke 51ba9ddd89 postfix: Inserted compulsory setting for postfix ≥ 2.10.
One of smtpd_relay_restrictions or smtpd_recipient_restrictions is
required by postfix ≥ 2.10 (see
http://www.postfix.org/SMTPD_ACCESS_README.html).

This is important for using the email mirror on Ubuntu Bionic.
2019-06-16 18:48:39 -07:00
Tim Abbott b41c2d93d1 puppet: Exclude squashfs filesystems from nagios disk checks.
These generally aren't being written to.
2019-06-16 16:22:23 -07:00
Tim Abbott 0ec1b4e82c puppet: Move check_send_receive_time to the _once ruleset.
We don't actually want to run this bundle of message-sending Nagios
checks to run on every single server.
2019-06-16 15:48:35 -07:00
Tim Abbott df83979c76 zulip_ops: Extract a prod_app_frontend_once ruleset. 2019-06-16 15:48:35 -07:00
Tim Abbott 738cfe54c3 puppet: Move app_frontend_once out of prod configuration.
That logic made it inconvenient to run multiple prod servers with the
same top-level puppet configuration.
2019-06-16 15:24:20 -07:00
Tim Abbott e85250941d puppet: Fix quoting of commented-out python3-boto.
This will avoid a linter error if/when we uncomment it.
2019-06-13 14:39:24 -07:00
Tim Abbott 337efe0fb7 puppet: Remove puppet-el, which no longer exists.
This package was only every available on Ubuntu Xenial.
2019-06-13 14:39:24 -07:00
Tim Abbott afb0d1ccce Revert "puppet: Use nice to deprioritize various processes."
This reverts commit d959de7a89.

This broken our Travis CI, so I'm pulling it off while we investigate.
2019-06-05 12:55:56 -07:00
Tim Abbott d959de7a89 puppet: Use nice to deprioritize various processes.
Our priority hierarchy is:
(1) Tornado and base services like memcached, redis, etc.
(2) Django and message sender queue workers.
(3) Everything else.

Ideally, we'd have something a bit more fine-grained (e.g. some queue
workers are potentially in the sending path, while others aren't), but
this should have a big impact on ensuring Tornado gets the resources
it needs during load spikes.

I think this has a good chance of causing some load spikes that would
previously have resulted in a user-facing delivery delays no longer
having any significant user-facing impact.
2019-06-05 11:56:48 -07:00
Tim Abbott cd1ec37404 puppet: Make uwsgi listen backlog limit configurable.
This can be useful for busy servers to limit the risk of bursts of
traffic causing them to reject requests.
2019-05-17 12:38:56 -07:00
Tim Abbott ca48b4ec9f puppet: Set postgres max_connections to 1000.
There isn't much legitimate reason to have a limit as low as 100,
given how few resources a connection consumes.
2019-05-13 17:19:31 -07:00