@@ -2476,34 +2476,39 @@ openssl x509 -req -in server.csr -text -days 365 \
2476
2476
First make sure that an <application>SSH</application> server is
2477
2477
running properly on the same machine as the
2478
2478
<productname>PostgreSQL</productname> server and that you can log in using
2479
- <command>ssh</command> as some user. Then you can establish a secure
2480
- tunnel with a command like this from the client machine:
2479
+ <command>ssh</command> as some user; you then can establish a
2480
+ secure tunnel to the remote server. A secure tunnel listens on a
2481
+ local port and forwards all traffic to a port on the remote machine.
2482
+ Traffic sent to the remote port can arrive on its
2483
+ <literal>localhost</literal> address, or different bind
2484
+ address if desired; it does not appear as coming from your
2485
+ local machine. This command creates a secure tunnel from the client
2486
+ machine to the remote machine <literal>foo.com</literal>:
2481
2487
<programlisting>
2482
2488
ssh -L 63333:localhost:5432 joe@foo.com
2483
2489
</programlisting>
2484
2490
The first number in the <option>-L</option> argument, 63333, is the
2485
- port number of your end of the tunnel; it can be any unused port.
2486
- (IANA reserves ports 49152 through 65535 for private use.) The
2487
- second number, 5432, is the remote end of the tunnel: the port
2488
- number your server is using. The name or IP address between the
2489
- port numbers is the host with the database server you are going to
2490
- connect to, as seen from the host you are logging in to, which
2491
- is <literal>foo.com</literal> in this example. In order to connect
2492
- to the database server using this tunnel, you connect to port 63333
2493
- on the local machine:
2491
+ local port number of the tunnel; it can be any unused port. (IANA
2492
+ reserves ports 49152 through 65535 for private use.) The name or IP
2493
+ address after this is the remote bind address you are connecting to,
2494
+ i.e., <literal>localhost</literal>, which is the default. The second
2495
+ number, 5432, is the remote end of the tunnel, e.g., the port number
2496
+ your database server is using. In order to connect to the database
2497
+ server using this tunnel, you connect to port 63333 on the local
2498
+ machine:
2494
2499
<programlisting>
2495
2500
psql -h localhost -p 63333 postgres
2496
2501
</programlisting>
2497
- To the database server it will then look as though you are really
2502
+ To the database server it will then look as though you are
2498
2503
user <literal>joe</literal> on host <literal>foo.com</literal>
2499
- connecting to <literal>localhost</literal> in that context , and it
2504
+ connecting to the <literal>localhost</literal> bind address , and it
2500
2505
will use whatever authentication procedure was configured for
2501
- connections from this user and host . Note that the server will not
2506
+ connections by that user to that bind address . Note that the server will not
2502
2507
think the connection is SSL-encrypted, since in fact it is not
2503
2508
encrypted between the
2504
2509
<application>SSH</application> server and the
2505
2510
<productname>PostgreSQL</productname> server. This should not pose any
2506
- extra security risk as long as they are on the same machine.
2511
+ extra security risk because they are on the same machine.
2507
2512
</para>
2508
2513
2509
2514
<para>
@@ -2515,12 +2520,12 @@ psql -h localhost -p 63333 postgres
2515
2520
</para>
2516
2521
2517
2522
<para>
2518
- You could also have set up the port forwarding as
2523
+ You could also have set up port forwarding as
2519
2524
<programlisting>
2520
2525
ssh -L 63333:foo.com:5432 joe@foo.com
2521
2526
</programlisting>
2522
2527
but then the database server will see the connection as coming in
2523
- on its <literal>foo.com</literal> interface , which is not opened by
2528
+ on its <literal>foo.com</literal> bind address , which is not opened by
2524
2529
the default setting <literal>listen_addresses =
2525
2530
'localhost'</literal>. This is usually not what you want.
2526
2531
</para>
0 commit comments