Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-14-2021, 04:51 AM
notorius7 notorius7 is offline
Registered User
 
Join Date: Apr 2021
Posts: 4
Connect to a host through a jump server

Hello guys!

I am new here and from one week ago, I'm working with SecureCRT and I have encountered some issues. I do not know to write code and I need to do some things like:

I have this script: RunCommandsOnMultipleHostsAndLogResults.py (https://forums.vandyke.com/showpost....94&postcount=1). It run very well until a jump server appeared. I can use only SSH connection. How can I do to connect to jump server and then to run this script? What to add in the code?


SecureCRT: Version 8.7.2
OS: Win 10.

Thank you!
Reply With Quote
  #2  
Old 04-14-2021, 08:35 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,596
Hi notorius7,

I am glad to hear you found the one example script.

There is one here for jump host scenario as well.

Does that work for you?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 04-15-2021, 01:41 AM
notorius7 notorius7 is offline
Registered User
 
Join Date: Apr 2021
Posts: 4
Thanks a lot for replying me!

I didn't try, but I thought that I can add in the script that I have another function that connect firstly to jump server via SSH and then to execute the commands, what do you think?
Reply With Quote
  #4  
Old 04-15-2021, 07:37 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,596
Hi notorious7,

As stated on the script examples sticky:

Quote:
The examples here merely provide you with a starting point for creating your own scripting solutions.
Although a script example may appear to do "exactly what you need", the scripts listed here will almost
always need to be modified to meet your own specific needs.
You are welcome to make any changes you feel comfortable doing to any of the example scripts.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 04-27-2021, 05:55 AM
notorius7 notorius7 is offline
Registered User
 
Join Date: Apr 2021
Posts: 4
I didn't succeed. I don't know how to change the code. Can someone help me with adding the code to connect to the jump host and then running the code from RunCommandsOnMultipleHostsAndLogResults.py (https://forums.vandyke.com/showpost....94&postcount=1)?

Steps:
1. Connect to jump host
2. Inside jump host send ssh command to host
3. Connect to host
4. Send commands to host
5. Get log for host
6. Exit from host
7. Do the same for another n hosts
8. Exit from jump host
Reply With Quote
  #6  
Old 04-28-2021, 11:22 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,596
Hi notorius7,

Do you have just one jump host?

Is your jump host capable of port forwarding?

If so, have you tried using dependent session?

That way if you create the firewall session in SecureCRT, you could then just edit the firewall line in the script you wish to use.

The syntax to use a dependent session as a firewall would be:
g_strFirewall = " /FIREWALL=Session:<Session Name>"
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #7  
Old 05-06-2021, 05:54 AM
notorius7 notorius7 is offline
Registered User
 
Join Date: Apr 2021
Posts: 4
Hi!

Yes, there is only one jump host which is not capable of port forwarding.
I read about firewall session, but the problem is that there are too many hosts and it is almost impossible to create all of the session with a firewall.
Reply With Quote
  #8  
Old 05-06-2021, 07:38 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,596
Hi notorius7,

You would not be saving sessions to the "end target", only the jumphost session. The hosts file would be the source for the end target connections. But if the jumphost does not support port forwarding, you cannot use dependent session.

Merging those two scripts would be too huge an undertaking right now. If we should ever come up with an example script we think will help you, we will post here.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 02:13 AM.