Skip to content

kabirbaidhya/fakeserver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fakeserver

A docker container to emulate a remote server for testing. The primary purpose is to emulate and test running automated scripts and utilities over ssh in remote servers.

https://hub.docker.com/r/kabirbaidhya/fakeserver/

Uses https://github.com/panubo/docker-sshd as a base image to run OpenSSH sshd service.

Quick Spin Up

Set it up

➜ git clone https://github.com/kabirbaidhya/fakeserver.git
➜ cd fakeserver
➜ cat ~/.ssh/id_rsa.pub > .authorized_keys

Run the server

➜ ./up.sh

Test it out

➜ ssh app@localhost -p 2222

Custom Usage

Pull the image.

➜ docker pull kabirbaidhya/fakeserver

Set authorized keys for the server.

➜ cat ~/.ssh/id_rsa.pub > /path/to/authorized_keys

Run the fakeserver.

➜ docker run -d -p 2222:22 \
             -v "/path/to/authorized_keys:/etc/authorized_keys/tester" \
             -e SSH_USERS="tester:1001:1001" \
             --name=fakeserver kabirbaidhya/fakeserver

You can now use the fakeserver from any ssh client. For instance:

# SSH to the server
➜ ssh tester@localhost -p 2222

# Run a command in the server
➜ ssh tester@localhost -p 2222 "echo 'Hello World'"