Git Product home page Git Product logo

ssh-test's Introduction

SSH-Test by Tim Chen <[email protected]> Date: Wed May 11 02:39:31 CST 2011
-------------------------------------------------------------------------------
Tools to test for the following the SSH authentications.

public key authentication
host-based authentication
password authentication

-------------------------------------------------------------------------------
usage: ssh-test.py [-h] -a {0,1,2} -u USER -o HOST

SSH authentication test.

optional arguments:
  -h, --help  show this help message and exit
  -a {0,1,2}  the authentication type, 0: public key, 1: password, 2: host-
              based.
  -u USER     the user for public key and password authentication.
  -o HOST     the host to perform the SSH test, for host-based authenticaion,
              the host name must be in FQDN. default: localhost.localdomain
-------------------------------------------------------------------------------
Manual test cases:

public key authentication:
	Run ssh command to do the test
	Require: 
			1)ssh
			2)add user public key to authorized_keys
	Steps to test:
		1) run ssh command: 
			ssh -o StrictHostKeyChecking=no -o PreferredAuthentications=publickey \
			USER@HOST /bin/sh -c exit
		2) check the return code: echo $?
	Expected result:
		Test ok on return code = 0, otherwise test failed.		

host-based authentication:
	Run ssh command to do the test
	Require: 
			1)ssh 
			2)turn on HostbasedAuthentication in server side sshd_config 
			3)add host public key to ssh_known_hosts
	Steps to test:
		1) run ssh command: 
			ssh -o StrictHostKeyChecking=no -o PreferredAuthentications=hostbased \
			HOST /bin/sh -c exit
		2) check the return code: echo $?
	Expected result:
		Test ok on return code = 0, otherwise test failed.

password authentication:
	Use sshpass tool to do the test 
	Require: 
			1)sshpass
			2)ssh
			3)add user password to PASSWORDFILE.
	Steps to test:
		1) run sshpass command: 
			sshpass -f PASSWORDFILE ssh -o StrictHostKeyChecking=no \
			-o PreferredAuthentications=password USER@HOST /bin/sh -c exit
		2) check the return code: echo $?
	Expected result:
		Test ok on return code = 0, otherwise test failed.

-------------------------------------------------------------------------------
Authentication verified on the server side
	Check file /var/log/auth.log

	May 13 14:39:09 xxx sshd[4246]: Accepted publickey for tim from ::1 port 50973 ssh2
	May 13 15:12:51 xxx sshd[4894]: Accepted password for tim from 127.0.0.1 port 36879 ssh2
	May 13 15:12:54 xxx sshd[4973]: Accepted hostbased for tim from 127.0.0.1 port 42451 ssh2

ssh-test's People

Contributors

timchen86 avatar

Watchers

 avatar

ssh-test's Issues

bug in runproc()

    try:
            proc.communicate()
            signal.alarm(0)
    except Alarm:
            print('subprocess.Popen() takes too long. Exit.')
            return False

something wrong with except Alarm:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.