2

I manually login to one of my Application GUI consoles(https://localhost:port) hosted on a server on the enterprise internal network, through a jump server. These are the exact steps:

1. Open putty
2. ssh(port 22) to the jumpserverhost.domain.com(this is a linux server)
3. Enter user, and passcode(RSA token)
4. Ensure the putty session window is alive/open
5. Now open browser and open the Application console - https://localhost:port
   NOTE: "We don't use the direct server IP, we use localhost ip-127.0.0.1 and the port on which the application GUI is running"
6. Enter Application GUI user/password and do your work on the Application

My requirement is to automate the above steps for login to my Application GUI Login. This is what I have done

a. Use a pywinauto script to automate the exact human steps from steps 1-4 above

Please check my answer to how to pass variable in pywinauto.Application().start(cmd_line='') for the script I am using for the task.

Even though my pywinauto script is working just fine and logging in to the jump server via putty, I am not able to connect to the application GUI, see image below.

image

But every time I login to the jump server manually using steps 1-4 above, the application GUI login page opens on https://127.0.0.1:. See image below Success Image

Why is it changing behavior via automated script ?

I have also checked many articles which suggest to automate ssh connections through paramiko , will it work in this case ? (considering the ssh connection to the jump server needs to be alive till the time I'm connected to the Application GUI )

My knowledge of how jump servers work is very shallow, please help.

dig_123
  • 2,240
  • 6
  • 35
  • 59
  • To add more details, I also tried https://stackoverflow.com/questions/36490989/how-to-keep-ssh-session-not-expired-using-paramiko , to create ssh connection to the jump server and ensuring it doesn't expire. Even though the paramiko script works for me, but still not able to connect to the application GUI: `https://127.0.0.1:` – dig_123 Nov 13 '20 at 19:29
  • Further details , I also tried to automate the same human clicks to do the putty automation of jumpserver login from steps 1-4 mentioned in my original question using `pyautogui` . The script works fine, still I am not able to login to the application URL from browser, even though it is accessible when I do a manual login. Does it have something to do with how jumpservers behave ? – dig_123 Nov 14 '20 at 10:35

1 Answers1

1

So I suspect that the problem is that you use Putty to create an SSH tunnel connection to the server in question, while your pywinauto command might just open a normal SSH connection. You can check if there is an ssh tunnel configured under Connections > SSH > Tunnels in the Putty configuration for that server.

From what I read in your other question regarding pywinauto, it seems this is indeed the case as the command you issue there:

putty.exe -ssh uname@host.domain.com

Doesn't create a tunnel.

If you want to create an SSH Tunnel with the Putty command-line with pywinauto, you should do something like:

putty.exe -ssh uname@host.domain.com -L <server_port>:host.domain.com:<local_port>
Dharman
  • 30,962
  • 25
  • 85
  • 135
reverse_engineer
  • 4,239
  • 4
  • 18
  • 27