-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (35 loc) · 1.44 KB
/
Dockerfile
File metadata and controls
47 lines (35 loc) · 1.44 KB
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
FROM ubuntu:22.04
LABEL maintainer="Per Böhlin <per.bohlin@devconsoft.se>"
LABEL description="Service Gateway Server, \
A SSHd proxy server to be placed on the Internet \
that allows trusted clients to expose private service \
ports to those authorized to use the gateway."
ENV DEBIAN_FRONTEND noninteractive
# ---- SSH Server ----
RUN mkdir -p /run/sshd
RUN \
apt-get update \
&& apt-get --yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install --no-install-recommends \
openssh-server \
net-tools \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --chmod=400 --chown=root:root app/config/sshd_config /etc/ssh/
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
# ---- Users ----
RUN \
useradd --home-dir /home/client --create-home --user-group client \
&& useradd --home-dir /home/access --create-home --user-group access
# ---- Service Gateway ----
RUN \
mkdir -p /opt/servicegwd/bin \
&& mkdir -p /etc/servicegwd/ \
&& touch /etc/servicegwd/authorized_keys \
chmod 555 /etc/servicegwd/authorized_keys
COPY --chmod=755 app/bin /opt/servicegwd/bin
ENV PATH="/opt/servicegwd/bin:${PATH}"
EXPOSE 22
ENTRYPOINT ["/usr/sbin/sshd", "-e", "-D", "-f", "/etc/ssh/sshd_config"]
HEALTHCHECK CMD /bin/netstat -nl | grep 0.0.0.0:22 | grep LISTEN