@@ -2509,34 +2509,39 @@ openssl x509 -req -in server.csr -text -days 365 \
2509
2509
First make sure that an <application>SSH</application> server is
2510
2510
running properly on the same machine as the
2511
2511
<productname>PostgreSQL</productname> server and that you can log in using
2512
- <command>ssh</command> as some user. Then you can establish a secure
2513
- tunnel with a command like this from the client machine:
2512
+ <command>ssh</command> as some user; you then can establish a
2513
+ secure tunnel to the remote server. A secure tunnel listens on a
2514
+ local port and forwards all traffic to a port on the remote machine.
2515
+ Traffic sent to the remote port can arrive on its
2516
+ <literal>localhost</literal> address, or different bind
2517
+ address if desired; it does not appear as coming from your
2518
+ local machine. This command creates a secure tunnel from the client
2519
+ machine to the remote machine <literal>foo.com</literal>:
2514
2520
<programlisting>
2515
2521
ssh -L 63333:localhost:5432 joe@foo.com
2516
2522
</programlisting>
2517
2523
The first number in the <option>-L</option> argument, 63333, is the
2518
- port number of your end of the tunnel; it can be any unused port.
2519
- (IANA reserves ports 49152 through 65535 for private use.) The
2520
- second number, 5432, is the remote end of the tunnel: the port
2521
- number your server is using. The name or IP address between the
2522
- port numbers is the host with the database server you are going to
2523
- connect to, as seen from the host you are logging in to, which
2524
- is <literal>foo.com</literal> in this example. In order to connect
2525
- to the database server using this tunnel, you connect to port 63333
2526
- on the local machine:
2524
+ local port number of the tunnel; it can be any unused port. (IANA
2525
+ reserves ports 49152 through 65535 for private use.) The name or IP
2526
+ address after this is the remote bind address you are connecting to,
2527
+ i.e., <literal>localhost</literal>, which is the default. The second
2528
+ number, 5432, is the remote end of the tunnel, e.g., the port number
2529
+ your database server is using. In order to connect to the database
2530
+ server using this tunnel, you connect to port 63333 on the local
2531
+ machine:
2527
2532
<programlisting>
2528
2533
psql -h localhost -p 63333 postgres
2529
2534
</programlisting>
2530
- To the database server it will then look as though you are really
2535
+ To the database server it will then look as though you are
2531
2536
user <literal>joe</literal> on host <literal>foo.com</literal>
2532
- connecting to <literal>localhost</literal> in that context , and it
2537
+ connecting to the <literal>localhost</literal> bind address , and it
2533
2538
will use whatever authentication procedure was configured for
2534
- connections from this user and host . Note that the server will not
2539
+ connections by that user to that bind address . Note that the server will not
2535
2540
think the connection is SSL-encrypted, since in fact it is not
2536
2541
encrypted between the
2537
2542
<application>SSH</application> server and the
2538
2543
<productname>PostgreSQL</productname> server. This should not pose any
2539
- extra security risk as long as they are on the same machine.
2544
+ extra security risk because they are on the same machine.
2540
2545
</para>
2541
2546
2542
2547
<para>
@@ -2548,12 +2553,12 @@ psql -h localhost -p 63333 postgres
2548
2553
</para>
2549
2554
2550
2555
<para>
2551
- You could also have set up the port forwarding as
2556
+ You could also have set up port forwarding as
2552
2557
<programlisting>
2553
2558
ssh -L 63333:foo.com:5432 joe@foo.com
2554
2559
</programlisting>
2555
2560
but then the database server will see the connection as coming in
2556
- on its <literal>foo.com</literal> interface , which is not opened by
2561
+ on its <literal>foo.com</literal> bind address , which is not opened by
2557
2562
the default setting <literal>listen_addresses =
2558
2563
'localhost'</literal>. This is usually not what you want.
2559
2564
</para>
0 commit comments