I'm trying to set up an OACS server to connect to a database on a separate server over an stunnel connection. The stunnel was setup like so:
On the database server:stunnel -d 5555 -r localhost:5432Which sets up a tunnel receiveing connections on port 5555 and forwarding them to 5432 (pgsql)
On the web server:stunnel -c -d 55432 -r dataserver:5555Which sets up a client tunnel listening on 55432 and forwarding to the listening end of the stunnel on the database server at port 5555.
I'm doing this because the webserver will be going into our DMZ and we want to encrypt the traffic (passwords, y'know), but for the moment it's not in the DMZ, so as a user I can connect to the ACS database one of two ways (skipping any discussion of pg_hba.conf):
- via the stunnel: psql -U nsadmin -h localhost -p 55432 acsdb
- via a normal remote connection: psql -U nsadmin -h dataserver acsdb
The server can connect via method #2 with the following setup in ns_section ns/db/pool/pool1 (and pool2 and pool3):
But it cannot connect via method #1 (stunnel), even though it works for psql:ns_param driver postgres ns_param datasource dataserver::acsdb ns_param user nsadmin ns_param password ""
In the logs I find the message:ns_param driver postgres ns_param datasource localhost:55432:acsdb ns_param user nsadmin ns_param password ""
Error: Ns_PgOpenDb(postgres): Could not connect to localhost:55432:acsdb: could not connect to server: No such file or directoryOf course the answer is "no," but it looks perhaps like the postgres driver is trying to use a file socket instead of a network socket (because it's localhost?).
Is the server running locally and accepting connections on Unix domain socket "/tmp.s.PGSQL.55432"?
Any ideas what to do?