472,804 Members | 937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,804 software developers and data experts.

Connecting using an existing socket (libpq).

I have a 3 tier client/server application where the client connection
to the server which then uses PostgreSQL. I'd like to extend the
client to have direct access to PostgreSQL but do not want to open up
postgresql to the internet.

So, I'd like to tunnel the libpq connection over the existing secure
socket. My preferred solution would be for the client to pass libpq
an already connected file descriptor (so I can prevent binding a port
to localhost).

Is such a thing possible without hacking libpq? Are there other
options I should be looking at that don't involve PostgreSQL listening
on the evil internet?

Thanks.
Nov 12 '05 #1
1 2152
Quoting jb****@yahoo.com:
I have a 3 tier client/server application where the client connection
to the server which then uses PostgreSQL. I'd like to extend the
client to have direct access to PostgreSQL but do not want to open up
postgresql to the internet.

So, I'd like to tunnel the libpq connection over the existing secure
socket. My preferred solution would be for the client to pass libpq
an already connected file descriptor (so I can prevent binding a port
to localhost).

Is such a thing possible without hacking libpq? Are there other
options I should be looking at that don't involve PostgreSQL listening
on the evil internet?

Thanks.
I'm not sure if you could "tunnel" that connection in the way you're saying
because that connection terminates at (I'm assumming) your application server
and not the db server. At a minimum, I would think you would have to write
logic on the application sure to proxy the management traffic over to the db.
Seems messy but I think there are other options for you:

1) If you have compiled with SSL then you can enforce SSL connections for non
local network connections. You'd have to open up the database tcp/ip port on
your firewall which it sounds like you don't want to do. Keep in mind that the
PG port is arbitrary so you could run it on something none standard.

2) If you have a decide NAT/firewall system (e.g. Iptables on Linux) you could
do port forwarding. So even the db has a public nic, you could then set up and
IP/port only used for db management which then would be translated to real db
IP/port. Again, you would (should) only run this with clients like pgadmin.

That is pretty specific to PG but if your clients are Linux, then you can use
SSH port forward to tunnel anything you want. This is more complicated but in
the end is more flexible since there are no server side changes necessary and
non-ssl clients can be used.
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

--
Keith C. Perry, MS E.E.
Director of Networks & Applications
VCSN, Inc.
http://vcsn.com

____________________________________
This email account is being host by:
VCSN, Inc : http://vcsn.com

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Google Mike | last post by:
After a lot of thought and research, and playing with FreeTDS and InlineTDS, as well as various ODBC connections, I have determined that the fastest and cheapest way to get up and going with PHP on...
0
by: christian_stengel | last post by:
Hi *, I have just started to learn python and I am having a problem with an python client connecting to a perl server using ssl (I tried this with pyOpenSSL and with the build in SSL Module). ...
2
by: Bruce Vander Werf | last post by:
I am developing a network client application (using the Socket class) that will need to make simultaneous TCP connections to many (100 or more) servers. In this case, which would be a better...
0
by: Usman | last post by:
Hi I'm having problem with a scenarion where I have a server written in C# and client written in VC6++. Here is the server code that i'm using including the Callback function for handling...
10
by: gasfusion | last post by:
For some reason my socket isn't doing anything when i try connect. I have the header file and the class provided below. Everything works except for the socket_connect() function. Also, i do not...
0
by: bishnu12 | last post by:
Hi all, There are two questions 1. I am trying to write a programme which can query to a modem get the modem details. i am using normal send() and recv() functions. But when i try to fetch a...
9
by: darthghandi | last post by:
I am trying to create a server application using asynchronous sockets. I run into a problem when I try to connect to my server using a non-.net program. I can establish the connection, and send...
0
by: =?Utf-8?B?QWxwZXIgQUtDQVlPWg==?= | last post by:
Hello, First of all I wish you a good day. My help request is about .NET asynchrounus socket communication. I have developed Server-Client Windows Forms .NET applications in VC++ .NET v2003. I...
1
by: ElvisRS | last post by:
Hi, I'm writing a simple udp client using sockets. My code looks like this: initServer2 = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.