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-03-2018, 04:47 PM
bcochofel bcochofel is offline
Registered User
 
Join Date: Apr 2018
Posts: 2
Import Sessions with SSH public key

Hi,

I've found the script that allows to import sessions from a csv file but I need to know how to change some more fields like authentication method (want to use specific ssh key) for some reason the logfile I've configured globally gets changed in the import so I need to change that also.

Where can I find the python way to change some of those defaults?

Thanks,
Bruno
Reply With Quote
  #2  
Old 04-03-2018, 05:20 PM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi bcochofel,

It sound like you're using the script found here, is that the case?

If so, the Python version of the script would be where you would want to start modification. Will all of your imported sessions require Public Key authentication? With the same key?

If so, the easiest option would be to simply add them using a SetOption. Locate the line in the script that contains Add other "SetOption" calls desired here... (line 667) and add the appropriate lines where directed. The two lines you would want to add would look something like:

Code:
objConfig.SetOption("SSH2 Authentications V2", "publickey")
objConfig.SetOption("Identity Filename V2", "C:\SSHKeys\Identity")
SSH2 Authentications V2 is a comma separated list, if you need methods other than publickey enabled you could do so and keep public key as the first option with something like:
Code:
objConfig.SetOption("SSH2 Authentications V2", "publickey,keyboard-interactive,password")
To modify the log file information it would be a similar edit. Locate the line:

Code:
objConfig.SetOption("Log Filename V2", "${VDS_USER_DATA_PATH}\_ScrtLog(%S)_%Y%M%D_%h%m%s.%t.txt")
You will then want to modify the portion after the comma to reflect the logging path you would like to use.

Does this help get you the behavior you're looking for?
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 04-04-2018, 01:40 AM
bcochofel bcochofel is offline
Registered User
 
Join Date: Apr 2018
Posts: 2
Quote:
Originally Posted by ekoranyi View Post
Hi bcochofel,

It sound like you're using the script found here, is that the case?

If so, the Python version of the script would be where you would want to start modification. Will all of your imported sessions require Public Key authentication? With the same key?

If so, the easiest option would be to simply add them using a SetOption. Locate the line in the script that contains Add other "SetOption" calls desired here... (line 667) and add the appropriate lines where directed. The two lines you would want to add would look something like:

Code:
objConfig.SetOption("SSH2 Authentications V2", "publickey")
objConfig.SetOption("Identity Filename V2", "C:\SSHKeys\Identity")
SSH2 Authentications V2 is a comma separated list, if you need methods other than publickey enabled you could do so and keep public key as the first option with something like:
Code:
objConfig.SetOption("SSH2 Authentications V2", "publickey,keyboard-interactive,password")
To modify the log file information it would be a similar edit. Locate the line:

Code:
objConfig.SetOption("Log Filename V2", "${VDS_USER_DATA_PATH}\_ScrtLog(%S)_%Y%M%D_%h%m%s.%t.txt")
You will then want to modify the portion after the comma to reflect the logging path you would like to use.

Does this help get you the behavior you're looking for?
Hi,
Thanks for the answer. I will use 2 users, so I can handle different way keys with a simple if condition.
Is there a place I can see the full list of available options to use?

Thanks,
Bruno
Reply With Quote
  #4  
Old 04-04-2018, 09:30 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi bcochofel,

I'm glad to hear that helped get you the behavior you're looking for.

All options are available for review in any of your sessions ini files. Each session has it's own configuration file that contains all of the available session options in a text file. To locate and review one of these files you will first want to locate your configuration folder. To do this navigate to Options > Global Options > Configuration Paths. Inside the configuration folder you will find a Sessions folder that contains the ini files for all of your sessions. Opening any one of these with your favorite text editor will list all available options.

Modifying your sessions via a script always carries some risk, I typically recommend creating a backup of your configuration prior to making any bulk changes. The easiest way to do this is to use the Export Settings option found in the main Tools drop down menu.

Does this help?
__________________
Thanks,
--Eric

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 03:04 PM.