ConfigServer Firewall blocks PySFTP outgoing connection

334 Views Asked by At

I am writing a python script (3.7) that tries to send files via PySFTP to a remote storage server.

The script i am using is working fine on my local machine, but not on the server i want it to run. I get the error then:

 "Unable to connect to {}: {}".format(hostname, reason)
  paramiko.ssh_exception.SSHException: Unable to connect to 
  example.com: [Errno 111] Connection refused

When I disable the ConfigServer Firewall on the server though, it works.

The CSF has the SSH port listed as open outgoing port. Are there any additional ports needed when opening a SFTP Session via PySFTP from within the server?

Thank you for any input

EDIT: I used wireshark on my local network to investigate the connection, apparently PySFTP is using a high port on the host server to establish the SFTP connection.

Is there a way to define in PySFTP which port(range) it can use or to have dynamic port opening in CSF?

0

There are 0 best solutions below