Skip to content

jstavel/ssh-tools

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SSH tools for automated testing

Contains some extensions to a SSH library that make running remote command easier (see SSHCommandRunner). Allows running commands on remote host and returning separate stdout, stderr. Also has some functions to copy and move files from one host to another (see RemoteFileTasks).

Prerequisities of testing

  • ssh into a test server to accept a server key
ssh root@my-server.domain.com
  • copy a test key to the test server
ssh-copy-id -i src/test/resources/test_rsa.pub root@my-server.domain.com
  • try to use the key with ssh
ssh -i src/test/resources/test_rsa root@my-server.domain.com

Testing

Most tests are written in clojure. You can see them in src/test/clojure. Or see src/test/java for junit tests.

Configuration of tests is placed in src/test/resources.

The vulnerable part of config file is read from a system environment.

export SERVER_HOSTNAME="some-rserver.domain.com"
export SERVER_USER="root"
export SERVER_PASSWORD="user-password"
export PRIVATE_KEY_PASSWORD="key-password"
lein test-refresh

Emergency Timeout

There is a way to set a default emergencyTimeoutMS variable.

You can use a system property ssh.emergencyTimeoutMS to do so.

java -Dssh.emergencyTimeoutMS=10000 run-this.java```

About

SSH utilities

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 80.9%
  • Clojure 19.1%