Greg greg
  • Joined on 2018-11-05
greg commented on issue kosmos/chef#160 2020-05-14 10:44:17 +00:00
Set up Postgres replication

If we only want to encrypt the traffic and do not care about the root cert's validity then there's no need to create an issue for ejabberd, or to wait for a verify-ca feature.

I think the PR is good to go, since right now Mastodon and ejabberd connect to PostgreSQL using localhost, so the ejabberd cookbook will only need to be updated to create a cluster with the new server

greg pushed to feature/160-postgres_replication at kosmos/chef 2020-05-14 10:37:07 +00:00
124ee5e6f3 Update the README
greg commented on issue kosmos/chef#160 2020-05-14 09:19:03 +00:00
Set up Postgres replication

Good implementations of PostgreSQL clients give you the option of verifying the cert was generated with the root cert, verify-ca. For example Gitea calls it verify-ca like the PostgreSQL documentation: https://docs.gitea.io/en-us/config-cheat-sheet/#database-database

Since we decided to use IPs, we wouldn't want to check the hostname (or use it), but ejabberd has no option for verify-ca, so ejabberd wouldn't verify anything

See https://www.postgresql.org/docs/12/libpq-ssl.html#LIBPQ-SSL-PROTECTION for the implication of every option

greg commented on issue kosmos/chef#160 2020-05-14 07:02:22 +00:00
Set up Postgres replication

In ejabberd you pass it a path to the CA root certs (https://docs.ejabberd.im/admin/configuration/toplevel/#sql-ssl-cafile). This part works, it fails verifying the hostname

greg commented on issue kosmos/chef#160 2020-05-13 17:18:39 +00:00
Set up Postgres replication

I have pushed changes to my PR (#163) to switch over to a self-signed certificate. In VMs I got it to work, including with psql's verify-ca option.

In my experiments I could not get ejabberd's sql_ssl_cafile and sql_ssl_verify to ever work. At first I thought it was because my cert was a wildcard cert, but I got the same issue with a certicate generated for an example domain (primary.kosmos.org with an /etc/hosts entry) too.

I am always getting this error in ejabberd, so we will do have to do without cert validation, or create an issue: TLS client: In state certify at ssl_handshake.erl:1372 generated CLIENT ALERT: Fatal - Handshake Failure - {bad_cert,hostname_check_failed}.

I also noticed that ejabberd does not support connecting to PostgreSQL servers with only TLS v1.3 enabled, so I have configured it to enable a minimum of v1.2 (

additional_config[:ssl_min_protocol_version] = "TLSv1.2"
)

greg pushed to feature/160-postgres_replication at kosmos/chef 2020-05-13 17:11:21 +00:00
0063776297 Remove unused dependencies
8d2ab785fc Use a self-signed TLS certificate for PostgreSQL
84cb3de4a0 Remove outdated comment
Compare 3 commits »
greg pushed to feature/160-postgres_replication at kosmos/chef 2020-05-13 13:36:22 +00:00
f3f8e47cce Add replication_password to the postgresql credentials
51b23c2f47 Add postgresql roles
Compare 2 commits »
greg commented on pull request kosmos/chef#163 2020-05-12 14:07:34 +00:00
Add recipe to set up PostgreSQL replication, rewrite kosmos-postgresql cookbook

Thanks, I've pushed a fix for the typo

greg pushed to feature/160-postgres_replication at kosmos/chef 2020-05-12 14:05:28 +00:00
eb98aa1bac Clarify the firewall and client authentication rules
0180da1aa6 Fix a typo in the README
Compare 2 commits »
greg pushed to feature/160-postgres_replication at kosmos/chef 2020-05-12 10:11:28 +00:00
254f9020ae Enable firewall rules to allow primary/replica to connect
greg commented on issue kosmos/chef#160 2020-05-12 10:03:09 +00:00
Set up Postgres replication

TLS with Let's Encrypt is easier to set up than a self signed cert on all machines. In my experience generating self-signed certs in a pain in the ass.

If the primary PostgreSQL server is for example andromeda.kosmos.org with TLS, changing it to another server in the client configs is the same amount of work as changing an IP (changing the FQDN)

greg created pull request kosmos/chef#163 2020-05-11 16:31:46 +00:00
Add recipe to set up PostgreSQL replication, rewrite kosmos-postgresql cookbook
greg pushed to feature/160-postgres_replication at kosmos/chef 2020-05-11 16:27:52 +00:00
80c7263a72 Upgrade PostgreSQL from 10 to 12
b22a7e3c0f Update the postgresql upstream cookbook
21119fff08 Add a custom resource to set up PostgreSQL 12
greg commented on issue kosmos/chef#160 2020-05-11 09:52:02 +00:00
Set up Postgres replication

re: TLS, it's still useful between clients and servers even with firewall rules and access rules

greg commented on issue kosmos/chef#160 2020-05-11 09:51:21 +00:00
Set up Postgres replication

I ran into a Chef bug that appears to be caused by the implementation of custom resources. Notifications are broken, so adding an access rule using the postgresql_access does not reload the service: https://github.com/sous-chefs/postgresql/issues/648

The custom resource I wrote was really useful since so much code is identical between a primary and a replica, but I might have to rewrite it another way (move the access rules to the recipe, for example). With this bug reloading the PostgreSQL service manually is needed after adding a new rule

I created a repo to reproduce the issue, a maintainer will take a look at it

greg commented on issue kosmos/chef#160 2020-05-07 09:02:13 +00:00
Set up Postgres replication

This took more work than I originally thought to get it right, but I'm getting satisfied with the Chef resource I wrote to set up a PostgreSQL primary or replica, with a TLS cert provided by Let's Encrypt.

Now I'm going to perform the PostgreSQL upgrade in a VM and make sure everything goes smoothly

greg deleted branch feature/turn_ip_config from kosmos/chef 2020-05-02 12:43:46 +00:00
greg closed issue kosmos/chef#159 2020-05-02 12:43:41 +00:00
STUN and TURN discovery for ejabberd
greg merged pull request kosmos/chef#162 2020-05-02 12:43:40 +00:00
Make audio/video calls work