ETLMCPData Conveyance Works
Log in Start free
Guides

PostgreSQL SSL modes and etlmcp

Which sslmode etlmcp uses to reach your PostgreSQL server, what that mode protects against, and why only verify-ca and verify-full stop a man in the middle.

etlmcp connects to your PostgreSQL destination with sslmode set to require. That mode encrypts the connection, so nobody on the network path can read the rows or your password in transit, and it refuses to fall back to a plain connection. It does not prove that the server at the other end is yours. In PostgreSQL's own table of modes, only verify-ca and verify-full protect against a man-in-the-middle attack.

What each mode protects

PostgreSQL's client library, libpq, offers six values for sslmode. Its documentation rates each one on two questions: does it stop eavesdropping, and does it stop an attacker who sits between client and server and pretends to be the server.

Mode Stops eavesdropping Stops a man in the middle
disable No No
allow Maybe No
prefer Maybe No
require Yes No
verify-ca Yes Depends on the CA's policy
verify-full Yes Yes

What the modes mean in practice:

  • The client library's own default is prefer, which may end up unencrypted. PostgreSQL describes it as kept for backward compatibility and not suited to secure setups. A tool that leaves sslmode unset uses it.
  • require trusts the network to deliver the connection to the right server. It encrypts, but it does not check the certificate chain.
  • verify-ca checks that the server's certificate chains to a root certificate the client trusts.
  • verify-full adds a check that the host name you connect to matches the certificate. With a certificate from a public authority, PostgreSQL advises verify-full, because verify-ca would accept any server whose owner got a certificate from that same authority. With your own private CA or a self-signed certificate, verify-ca is often enough.
  • If a root certificate file is present on the client, require behaves like verify-ca. PostgreSQL calls this a compatibility behavior and advises against relying on it: set the verify mode you want explicitly.

How etlmcp sets the mode

The mode is one setting for the whole etlmcp service, not a field on your destination. Its default is require, and the production settings template sets require too. When the service starts in production it checks the value and refuses to start unless it is require, verify-ca or verify-full, so disable, allow and prefer can never be in use for customer databases.

The PostgreSQL destination's form asks for the host, port, database, user, schema, table and password. It has no field for a root certificate, a client certificate or a client key. So:

  • Your server must accept SSL connections. A server that only takes plain connections cannot be loaded.
  • Authentication is by password. A pg_hba.conf rule that demands a client certificate will turn etlmcp away.

etlmcp also checks the host name before it connects: the name must resolve to public addresses, and a host that resolves to a private or local address is refused. That guards etlmcp's own network, and it is separate from TLS.

What to tell a security reviewer

  • In transit, the connection between etlmcp and your database is encrypted, and etlmcp will not connect without encryption.
  • Server identity is not checked by certificate under require. The remaining risk is someone able to redirect traffic for your database's host name or address to a server they control.
  • You can lower that risk on your side: use a host name you control in DNS, keep a dedicated database user for etlmcp with only the rights it needs (see PostgreSQL privileges for etlmcp), and allow only etlmcp's address in your firewall.
  • Your BI tools are separate clients. Each picks its own mode, and many can use verify-full with your root certificate; set them to a mode that never falls back to plain text.

For the connection fields and what each error message means, see the PostgreSQL destination and PostgreSQL destination errors.

Related

Sources

  1. SSL Support — www.postgresql.org, checked