Skip to content

Commit baaa3e7

Browse files
committed
Updated Docker documentation. Added Makefile for Docker image building.
1 parent 48c8a5a commit baaa3e7

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

Makefile.docker

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
VERSION = $(shell grep SSH_MITM_VERSION *.patch | grep -E -o "\"(.*)\"" | head -1 | tr -d "\"")
2+
ifeq ($(VERSION),)
3+
$(error "could not determine version!")
4+
endif
5+
6+
FORWARDING_ENABLED = $(shell sysctl net.ipv4.ip_forward | grep -E -o "net.ipv4.ip_forward = 1")
7+
ifeq ($(FORWARDING_ENABLED),)
8+
$(warning "IP forwarding is not enabled. Building the image may fail. Fix with: sysctl net.ipv4.ip_forward=1")
9+
endif
10+
11+
all:
12+
@echo "\nBuilding Docker image for SSH-MITM ${VERSION}\n"
13+
docker build -t positronsecurity/ssh-mitm:${VERSION} .
14+
docker tag positronsecurity/ssh-mitm:${VERSION} positronsecurity/ssh-mitm:latest
15+
16+
upload:
17+
docker login
18+
docker push positronsecurity/ssh-mitm:${VERSION}
19+
docker push positronsecurity/ssh-mitm:latest

README.md

+20-4
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,28 @@ Of course, the victim's SSH client will complain that the server's key has chang
2222
* v1.0: May 16, 2017: Initial revision.
2323

2424

25-
## To Do
25+
## Running The Docker Image
2626

27-
The following list tracks areas to improve:
27+
The quickest & easiest way to get started is to use the Docker image with SSH MITM pre-built.
2828

29-
* Add port forwarding support.
30-
* Create wrapper script that detects when user is trying to use key authentication only, and de-spoof them automatically.
29+
1.) Obtain the image from Dockerhub with:
30+
31+
$ docker pull positronsecurity/ssh-mitm
32+
33+
2.) Next, run the container with:
34+
35+
$ mkdir -p ${PWD}/ssh_mitm_logs && docker run --network=host -it --rm -v ${PWD}/ssh_mitm_logs:/home/ssh-mitm/log positronsecurity/ssh-mitm
36+
37+
3.) Enable IP forwarding and NATing routes on your host machine:
38+
39+
# echo 1 > /proc/sys/net/ipv4/ip_forward
40+
# iptables -P FORWARD ACCEPT
41+
# iptables -A INPUT -p tcp --dport 2222 -j ACCEPT
42+
# iptables -t nat -A PREROUTING -p tcp --dport 22 -j REDIRECT --to-ports 2222
43+
44+
4.) Find targets on the LAN, and ARP spoof them (see below).
45+
46+
5.) Shell and SFTP sessions will be logged in the `ssh_mitm_logs` directory.
3147

3248

3349
## Initial Setup

0 commit comments

Comments
 (0)