title: Can ActiveRecord connect to PostgreSQL remotely and protect the DB password?
body: <p>I have a PostgreSQL DB on a remote VPS server (CentOS 5) and I'd like to connect to have a Rails application connect to it from my local Mac laptop. On my laptop, I have the ActiveRecord PostgreSQL adapter installed -- <code>postgres (0.7.9.2008.01.28)</code>.</p>
  
  <p>I read in the <a href="http://www.postgresql.org/docs/8.1/interactive/auth-methods.html" rel="nofollow noreferrer">PostgreSQL docs</a>:</p>
  
  <blockquote>
    <p>The password-based authentication methods are md5, crypt, and password. These methods operate similarly except for the way that the password is sent across the connection: respectively, MD5-hashed, crypt-encrypted, and clear-text.</p>
  </blockquote>
  
  <p>[...]</p>
  
  <blockquote>
    <p>If you are at all concerned about password "sniffing" attacks then md5 is preferred...Plain password should be avoided especially for connections over the open Internet (unless you use SSL, SSH, or another communications security wrapper around the connection).</p>
  </blockquote>
  
  <p>In a standard Rails <code>database.yml</code> would have something like this for a localhost connection...</p>
  
  <pre><code>development:
    adapter: postgresql
    database: journalapp_development
    username: xxx
    password: yyy
    host: localhost
  </code></pre>
  
  <p>But there's nothing in there about the authentication method discussed in the PostgreSQL docs. Is there as option to have something like "<code>auth_method: md5</code>"?</p>