Hi I've written a short patch for stunnel 4.15 adding support for PostgreSQL SSL negotiation. I hope it'll be useful.
http://vcielka.rec.uniba.sk/~peter/stunnel-pgsql.patch
PostgreSQL documentation explaining how to establish SSL connection: http://www.postgresql.org/docs/8.1/interactive/protocol-flow.html#AEN60652 http://www.postgresql.org/docs/8.1/interactive/protocol-message-formats.html
Regards Peter Kuma