Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kabirbaidhya/fakeserver

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

docker fake fakeserver integration-testing mock server ssh sshd test

Last synced: 2 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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
```bash
➜ git clone https://github.com/kabirbaidhya/fakeserver.git
➜ cd fakeserver
➜ cat ~/.ssh/id_rsa.pub > .authorized_keys
```
Run the server
```bash
➜ ./up.sh
```

Test it out
```bash
➜ ssh app@localhost -p 2222
```
## Custom Usage

Pull the image.

```bash
➜ docker pull kabirbaidhya/fakeserver
```

Set authorized keys for the server.

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

Run the fakeserver.

```bash
➜ 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:

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

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