[stunnel-users] Random Client Ports

Ludolf Holzheid lholzheid at bihl-wiedemann.de
Wed Sep 2 09:33:03 CEST 2009

On Tue, 2009-09-01 14:08:12 -0700, Matt Keoppel wrote:

> We are currently trying to add Stunnel to our application.  Each
> time one of our clients try to connect to the server it seems to
> make its call from a random port.

This is commonly the case for client/server relations on IP.

> We have set up the server config
> file to be:
> [OurApp]
> accept = 15366
> connect = 15365
> The config file on our client is set up as:
> client = yes
> [OurApp]
> accept = 1308
> connect = [serverIp]:15366

This looks o.k. (provided that you also have entries for the
certificates and key).

>  The problem that we are having is that the source port on our
> client changes every time we try to send data from our client to our
> server.

I don't see why this is a problem.

As far as I understand your setup (a client application, two stunnel
instances and a server application), there are three TCP connections
involved, using in total six sockets. Three of them are described in
your stunnel.conf files, the other three are chosen randomly:

     client app
  [random socket #1]
 1st stunnel instance
  [random socket #2]
 2nd stunnel instance
  [random socket #3]
  server application

I suppose you didn't recognize each IP connection is a connection
between two sockets, one at each end.



Ludolf Holzheid             Tel:    +49 621 339960
Bihl+Wiedemann GmbH         Fax:    +49 621 3392239
Floßwörthstraße 41          e-mail: lholzheid at bihl-wiedemann.de
D-68199 Mannheim, Germany

More information about the stunnel-users mailing list