Skip to content

Commit 2ec280d

Browse files
committed
update bastion/dockerfile and dockercomose
1 parent e731e75 commit 2ec280d

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

bastion/Dockerfile

+8-13
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ RUN apt-get update
1616

1717
# Install git
1818
RUN apt-get install -y \
19-
git \
2019
sed \
21-
ca-certificates \
2220
openssh-client \
2321
openssh-server \
24-
&& update-ca-certificates
22+
vim
2523

2624
# Clean up packages: Saves space by removing unnecessary package files and lists
2725
RUN apt-get clean
@@ -42,18 +40,15 @@ RUN mkdir -p /home/sysadmin/.ssh && \
4240
# Create privilege separation directory for SSH
4341
RUN mkdir -p /run/sshd
4442

45-
# Follows the instructions here:
46-
# https://ovh.github.io/the-bastion/installation/basic.html
47-
RUN git clone https://github.com/ovh/the-bastion /opt/bastion
48-
RUN git -C /opt/bastion checkout $(git -C /opt/bastion tag | tail -1)
49-
RUN /opt/bastion/bin/admin/packages-check.sh -i
50-
RUN /opt/bastion/bin/admin/install --new-install
43+
# Update SSH configuration to disable password authentication
44+
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config && \
45+
sed -i 's/#PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config && \
46+
echo "AllowTcpForwarding yes" >> /etc/ssh/sshd_config && \
47+
echo "GatewayPorts yes" >> /etc/ssh/sshd_config
5148

52-
# Allow SSH jumping
53-
RUN sed -i 's/AllowTcpForwarding no/AllowTcpForwarding yes/' /etc/ssh/sshd_config
5449

5550
# Expose SSH port
5651
EXPOSE 22
5752

58-
# Start SSH service
59-
ENTRYPOINT ["/opt/bastion/docker/entrypoint.sh"]
53+
# Start the SSH daemon
54+
CMD ["/usr/sbin/sshd", "-D"]

docker-compose.yml

+4
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ services:
102102
- ./sysadmin-ssh-keys/rsa_sysadmin.pub:/home/sysadmin/.ssh/id_rsa.pub:ro
103103
- ./sysadmin-ssh-keys/rsa_sysadmin.pub:/home/sysadmin/.ssh/authorized_keys:ro
104104
- ./bastion/etc-bastion-config/config:/home/sysadmin/.ssh/config:ro
105+
106+
105107
volumes:
106108
db-data:
107109
name: db-data
@@ -111,5 +113,7 @@ volumes:
111113
networks:
112114
dev-backend:
113115
name: dev-backend
116+
driver: bridge
117+
114118
dev-frontend:
115119
name: dev-frontend

0 commit comments

Comments
 (0)