Skip to content

vahidhedayati/jssh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jssh

Side note - similar / related projects

Grails jssh Plugin based on j2ssh library, provides ssh connection with features/facilities to execute remote shell commands. Provides connection via websockets as well as ajax/polling.

Websocket ssh interaction can be incorporated to an existing grails app running ver 2>+. Supports both resource (pre 2.4) /assets (2.4+) based grails sites. Plugin will work with tomcat 7.0.54 + (8 as well) running java 1.7 +

Dependency (Grails 2.X):
compile ":jssh:1.10"

codebase for grails 2.X

Dependency (Grails 3.X) :
	compile "org.grails.plugins:jssh:3.0.2"

This plugin is a web based basic putty i.e. sshkey or username/password. It provides a variety of taglib calls that you can call from within your application to then interact with SSH connection(s) to Unix/Linux/OSx machines.

Once you have successfully configured connected. Your browser will provide something similar to a shell console and with the latter Websocket calls you can literally interact live with your SSH connection(s).

Config.groovy additions required:

Config.groovy variables

Test site:

grails 3 demo site refer to application.groovy for config values

grails 2 demo site

Change Release information

Change information

Videos

jssh 1.6 admin interface / cloning of accounts + viewing historical logs/commands

jssh 1.3 sshuser configuration per webuser + command restrictions(blacklist) / command rewrites

jssh 1.0 broadcast ssh commands to multiple remote hosts 8 Mins

Video of jssh 0.9, whilst waiting on creations of stuff there was some discussion into the back-end plugin code and how it interacts via websockets:

jssh 0.9 full walk through 43 mins? wow a lot of BS :)

Interaction Methods:

New Client/Server Websocket SSH tag lib call

1.3 Command blacklist / command rewrites

1.11 j2ssh some updates to the inner workings, issues getting it to work on latest ubuntu, are you having issues getting j2ssh to work with your open-ssh server ? if so read this

J2ssh issues with latest open-ssh-server

J2ssh was not working on the latest ubuntu for me, refer to the above link to find changes in debian ssh roll out.

<jssh:conn 
    hostname="${hostname}" 
    username="${username}"
	port="${port}" 
	password="${password}"
	userCommand="${userCommand}"
	realuser="${session.username}"
	jsshUser="${jsshUser}"  //do not set this if you want auto gen id  
	divId="${divId}"
	enablePong="true"
	pingRate="50000"
 />

jssh-websocket-taglib-call

wiki on jssh existing app using websockets

Socket taglib with pingpong

<jssh:socketconnect 
username="${username }"
password="${password }"
hostname="${hostname}" 
userCommand="${userCommand}"
divId="${divId}"
hideWhatsRunning="${hideWhatsRunning }"
hideDiscoButton="${hideDiscoButton }"
hidePauseControl="${hidePauseControl }"
hideSessionCtrl="${hideSessionCtrl }"
hideConsoleMenu="${hideConsoleMenu}"
hideSendBlock="${hideSendBlock}"
hideNewShellButton="${hideNewShellButton}"
enablePong="true"
pingRate="50000"
/>

2B> Socket Method -- Multipe calls - remoteForm -

As above but: refer to plugin connectSsh/index page and go to remote Form.. I have used this method and called it many times on 1 page by reusing the <jssh:socketconnect tag multiple times.

<jssh:socketconnect 
...
  divId="${divId}" />
<div id="${divId}"></div>

wiki on jssh existing app using ajax polling

ajax/polling tag lib call

<jssh:ajaxconnect hostname="${hostname}" username="${username}"
	port="${port}" password="${password}"
	userCommand="${userCommand.encodeAsJavaScript()}"
	jsshUser="${jsshUser}"  />

4> Admin interface (part of 1.4 release)

A new configuration item has been added to jsshUser DB table, called permissions.

If you want to use this plugin and define admin outside of the scope of usual app interaction, then you could try adding default admin accounts through your :

BootStrap.groovy

Otherwise you could add the following to your Config.groovy and any accounts generated from there on via the tool would have access to admin interface. You could do this to start with then change the defaultperm="user"

jssh.defaultperm="admin"

In order to access admin interface you need to call this taglib :

<jssh:loadAdmin jsshUser="your_userId" />

If you have added the admin account via Config.groovy then the account is not generated as yet so you need to make an initial connection to create the user:

<jssh:conn 
jsshUser="your_userId"
realUser="your_userId"
jobName="vahidsJob"
username="your_userId"
password=""
hostname="HOSTNAME" 
userCommand="tail -f /var/log/tomcat/catalina.out"
divId="abaa"
enablePing="true"
pingRate="60000"
/>

Once you have hit the initial start page and created that jssh account to match the same jsshUser as the admin account and have defined admin permission for the user, the admin interface will then come alive.

5> Specific user connection select boxes.

This is the component within admin menu that allows the end user to connect to a group of servers. It has been recreated as a taglib call so now you as the end user can define when/where your website users can choose to connect to a group of servers.

Most basic call with full access to all its features:

<jssh:connectUser 
jsshUser="${session.username}"  
/>

A more defined specific call with global broadcast and send blocks pers sever blocked, this also defines primary command to be run upon group selection:

<jssh:connectUser 
jsshUser="${session.username}"  
userCommand="something"
hideSendBlock="YES" 
hideBroadCastBlock="YES"
/>
Misc Calling methods:

Taglib example on resources based grails app

Taglib example on assets based grails app

gsp call

Extendable css div box

Easy scrolling tailing log test

Usercommand hacks

Bootstrap/jquery switch method

Screenshots

About

jssh: Grails ssh plugin websocket + ajax polling ssh connection and returns results to view uses j2ssh libraries. Live ssh connection interaction via websocket.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published