summaryrefslogtreecommitdiff
path: root/Docker/Dockerfile
blob: 3ff17f3ac7abe562767ede4595b62c3d49104071 (plain)
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
101
102
103
104
105
106
107
108
109
110

# See https://hub.docker.com/_/debian/
FROM debian:stretch

# See http://label-schema.org/rc1/#build-time-labels
LABEL org.label-schema.name="Chrysalide Community"
LABEL org.label-schema.url="https://www.chrysalide.re/"
LABEL org.label-schema.vcs-url="http://git.0xdeadc0de.fr/cgi-bin/cgit.cgi/chrysalide.git/"
LABEL org.label-schema.docker.cmd="docker run -a stderr --rm -p 5022:22 --name chrysalide chrysalide:community"
LABEL org.label-schema.description="Showcase for Chrysalide, which provides reverse-engineering \
facilities. Some samples and snippets are available in the chrysalide user home directory."
LABEL maintainer="Cyrille Bagard <nocbos {at} gmail {dot} com>"


ENV REFRESHED_AT 2018-08-12

ENV ROOT_PASSWORD "rootpass"
ENV USER_PASSWORD "chrysalide"


# Available users

RUN groupadd re
RUN useradd -m -g re -s /bin/bash chrysalide

RUN echo "root:$ROOT_PASSWORD" | chpasswd
RUN echo "chrysalide:$USER_PASSWORD" | chpasswd


# Basic

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update


# SSH server
# See https://docs.docker.com/engine/examples/running_ssh_service/#build-an-eg_sshd-image

RUN apt-get install -yqq openssh-server
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN echo "X11UseLocalhost no" >> /etc/ssh/sshd_config

# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd

ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
RUN echo "export LC_ALL=C" >> /etc/profile

EXPOSE 22

RUN mkdir /var/run/sshd


# Starters

RUN apt-get install -yqq git

WORKDIR /home/chrysalide

RUN git clone http://git.0xdeadc0de.fr/cgi-bin/cgit.cgi/samples.git/ && \
    chown -R chrysalide:re samples

RUN git clone http://git.0xdeadc0de.fr/cgi-bin/cgit.cgi/snippets.git/ && \
    chown -R chrysalide:re snippets


# Chrysalide

RUN apt-get install -yqq autoconf automake bison flex gettext \
    libtool git libgtk-3-dev libxml2-dev python3-dev python-gi-dev \
    libarchive-dev libsqlite3-dev libssl-dev

RUN apt-get install -yqq libcanberra-gtk3-module

WORKDIR /usr/local/src

RUN git clone http://git.0xdeadc0de.fr/chrysalide.git

WORKDIR /usr/local/src/chrysalide

RUN autopoint && \
    ./tools/ipf/init_potfiles.sh && \
    sed -i 's/po\/Makefile.in \(po\/Makefile.in *\)*/po\/Makefile.in /' configure.ac && \
    sed -i 's/EXTRA_DIST.*$/EXTRA_DIST = config.rpath  ChangeLog/' Makefile.am && \
    rm po/Makevars.template && \
    cp /usr/share/gettext/gettext.h . && \
    echo "timestamp" > stamp-h.in && \
    touch plugins/arm/v7/opcodes/gencode.mk && \
    touch plugins/dalvik/v35/opcodes/gencode.mk && \
    touch ChangeLog && \
    libtoolize --force && \
    aclocal -Im4 && \
    autoheader && \
    automake --add-missing --copy && \
    autoconf && \
    ./configure --prefix=/usr/local --enable-silent-rules

RUN cd /usr/local/src/chrysalide && \
    make -j5 && \
    make install

RUN ldconfig


# Entrypoint

CMD ["/usr/sbin/sshd", "-d", "-D"]