File tree 2 files changed +28
-4
lines changed
2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -17,16 +17,40 @@ RUN apt-get update
17
17
# Install git
18
18
RUN apt-get install -y \
19
19
git \
20
+ sed \
20
21
ca-certificates \
22
+ openssh-client \
23
+ openssh-server \
21
24
&& update-ca-certificates
22
25
26
+ # Clean up packages: Saves space by removing unnecessary package files and lists
27
+ RUN apt-get clean
28
+ RUN rm -rf /var/lib/apt/lists/*
29
+
30
+ # Create sysadmin user and add to sudoers
31
+ RUN useradd -m -s /bin/bash sysadmin && echo "sysadmin:sysadmin" | chpasswd && \
32
+ usermod -aG sudo sysadmin
33
+
34
+ # Ensure SSH directory exists with correct permissions
35
+ RUN mkdir -p /home/sysadmin/.ssh && \
36
+ chown sysadmin:sysadmin /home/sysadmin/.ssh && \
37
+ chmod 700 /home/sysadmin/.ssh
38
+
39
+ # Create privilege separation directory for SSH
40
+ RUN mkdir -p /run/sshd
41
+
23
42
# Follows the instructions here:
24
43
# https://ovh.github.io/the-bastion/installation/basic.html
25
44
RUN git clone https://github.com/ovh/the-bastion /opt/bastion
26
45
RUN git -C /opt/bastion checkout $(git -C /opt/bastion tag | tail -1)
27
-
28
46
RUN /opt/bastion/bin/admin/packages-check.sh -i
29
-
30
47
RUN /opt/bastion/bin/admin/install --new-install
31
48
32
- RUN /opt/bastion/bin/admin/setup-first-admin-account.sh sysadmin auto
49
+ # Allow SSH jumping
50
+ RUN sed -i 's/AllowTcpForwarding no/AllowTcpForwarding yes/' /etc/ssh/sshd_config
51
+
52
+ # Expose SSH port
53
+ EXPOSE 22
54
+
55
+ # Start SSH service
56
+ ENTRYPOINT ["/opt/bastion/docker/entrypoint.sh" ]
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ services:
101
101
- ./sysadmin-ssh-keys/rsa_sysadmin:/home/sysadmin/.ssh/id_rsa:ro
102
102
- ./sysadmin-ssh-keys/rsa_sysadmin.pub:/home/sysadmin/.ssh/id_rsa.pub:ro
103
103
- ./sysadmin-ssh-keys/rsa_sysadmin.pub:/home/sysadmin/.ssh/authorized_keys:ro
104
-
104
+
105
105
volumes :
106
106
db-data :
107
107
name : db-data
You can’t perform that action at this time.
0 commit comments