forked from wedaa/LongTail-Openssh-honeypot-v2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
100 lines (82 loc) · 2.87 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
FROM ubuntu:18.04
MAINTAINER Daniel Nicolas Gisolfi
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y \
&& apt-get install -y \
build-essential \
openssh-server \
python3-pip \
zlib1g-dev \
tzdata \
wget \
gcc \
&& pip3 install --upgrade pip
EXPOSE 22
EXPOSE 2222
# Set the TimeZone
RUN cp /usr/share/zoneinfo/America/New_York /etc/localtime \
&& dpkg-reconfigure tzdata
WORKDIR /
# Install openssl version 1.0.2, newer versions cause issues
RUN wget https://openssl.org/source/openssl-1.0.2.tar.gz \
&& tar -xf openssl-1.0.2.tar.gz \
&& cd openssl-1.0.2 \
&& make clean \
&& ./config zlib \
&& make \
&& make install
WORKDIR /usr/local/source/openssh/openssh-22
# Install openssh into the directory
RUN wget ftp://ftp4.usa.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.2p1.tar.gz \
&& tar -xf openssh-7.2p1.tar.gz \
&& mv openssh-7.2p1 openssh-7.2p1-22
# replace config files with custom ones
WORKDIR /usr/local/source/openssh/openssh-22/openssh-7.2p1-22
# rename original files
RUN mv auth-passwd.c auth-passwd.c.orig \
&& mv sshd.c sshd.c.orig \
&& mv auth2-pubkey.c auth2-pubkey.c.orig
COPY ./src/sshd.c sshd.c
COPY ./src/client.c client.c
COPY ./src/sshd_config-22 sshd_config-22
COPY ./src/auth-passwd.c auth-passwd.c
# Get Custom files from eric wedaa's repository
RUN wget https://raw.githubusercontent.com/wedaa/LongTail-Openssh-honeypot-v2/master/auth2-pubkey.c \
&& cp sshd_config-22 /usr/local/etc
# Now confgure the ssh server with new configs
RUN ./configure \
&& make \
&& make install \
&& cp sshd /usr/local/sbin/sshd-22 \
&& chmod a+rx sshd /usr/local/sbin/sshd-22
WORKDIR /usr/local/source/openssh/openssh-2222
# Install openssh into the directory
RUN wget ftp://ftp4.usa.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.2p1.tar.gz \
&& tar -xf openssh-7.2p1.tar.gz \
&& mv openssh-7.2p1 openssh-7.2p1-2222
# replace config files with custom ones
WORKDIR /usr/local/source/openssh/openssh-2222/openssh-7.2p1-2222
# rename original files
RUN mv auth-passwd.c auth-passwd.c.orig \
&& mv sshd.c sshd.c.orig \
&& mv auth2-pubkey.c auth2-pubkey.c.orig
COPY ./src/sshd.c sshd.c
COPY ./src/client.c client.c
COPY ./src/sshd_config-2222 sshd_config-2222
COPY ./src/auth-passwd.c auth-passwd.c
# Get Custom files from eric wedaa's repository
RUN wget https://raw.githubusercontent.com/wedaa/LongTail-Openssh-honeypot-v2/master/auth2-pubkey.c \
&& cp sshd_config-2222 /usr/local/etc
# Now confgure the ssh server with new configs
RUN ./configure \
&& make \
&& make install \
&& cp sshd /usr/local/sbin/sshd-2222 \
&& chmod a+rx sshd /usr/local/sbin/sshd-2222
# Setup TCP Server
WORKDIR /TcpServer
COPY ./TcpServer .
RUN pip install -r requirements.txt \
&& chmod +x init.sh
ENTRYPOINT [ "/bin/bash" ]
CMD ["./init.sh"]