Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have two PostgreSQL servers:

server 1: 192.168.0.1 server 2: 192.168.0.2

I want to connect to the database on server 2 from server 1. I do it like this:

SELECT dblink_connect('hostaddr=192.168.0.2 port=5432 dbname=mydb user=postgres password=mypasswd');

My question is that when I do such connect my password is send as plaintext or its somehow encrypted during the transmission to the server 2?

I use PostgreSQL 9.3 on Linuxx Mint 16 (server 1) and Xubuntu 13.10 (server 2).

share|improve this question

1 Answer 1

Basically, dblink uses a libpq-style connection info string.
Add sslmode=require to your connection string or a more restrictive setting to disallow unencrypted transfers. More details in the manual here.

I would also advice not to have the password in your SQL statement at all. SQL statements may get logged. Or backups are stored in an insecure location ... I use the password file .pgpass for dblink connections.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.