View Single Post
  #1  
Old 02-14-2018, 05:36 AM
ogun ogun is offline
Registered User
 
Join Date: Sep 2013
Posts: 15
Script for centrally managed sessions

Hello all.

Just figured I would share the script we're using to share a common set of sessions.

There are three parts, a client installation script that configures a securecrt client after installation, a client script that runs on each startup and a server script that exports the sessions to be used.

The server script fetches data in our case from the IPAM and generates a json file with the the shared sessions to use. This file is places on a windows file server and on a webserver for windows and linux clients respectively. I will not share the server script but I will share an example data file, the format is trivial in any case.

The client installer script will fetch and install the shared session script, set up a bastion session with dynamic port forwarding, configure a firewall for that port and then finally modify the default session to use that firewall. It also sets up the bastion connection as an autoconnection and the session script as a login script to update the sessions.

Finally the shared session script fetches the json file created by the server script and parses it into sessions. It does delta diffs and will only create/remove sessions as needed. Before deleting any session it will show how many would be deleted. It creates sessions by copying the default session.

The code is somewhat commented but should be fairly straight forward to read in any case.
Attached Files
File Type: txt devices.json.txt (209 Bytes, 175 views)
File Type: txt install.py.txt (4.6 KB, 199 views)
File Type: txt sessions.py.txt (7.1 KB, 264 views)
Reply With Quote