Skip to content

Commit 6b11dc1

Browse files
committed
update db files to start the ssh service
1 parent 22a8e1d commit 6b11dc1

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

db/Dockerfile

+7-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ RUN mkdir -p /home/sysadmin/.ssh && \
2828
# Create privilege separation directory for SSH
2929
RUN mkdir -p /run/sshd
3030

31+
# Configure SSH for agent forwarding and secure settings
32+
RUN echo "AllowAgentForwarding yes" >> /etc/ssh/sshd_config && \
33+
echo "PermitRootLogin prohibit-password" >> /etc/ssh/sshd_config && \
34+
echo "PasswordAuthentication no" >> /etc/ssh/sshd_config && \
35+
echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config
36+
3137
# Expose SSH port
3238
EXPOSE 22
3339
EXPOSE 3306
@@ -37,4 +43,4 @@ COPY ./db/startupservice.sh /startupservice.sh
3743
RUN chmod +x /startupservice.sh
3844

3945
ENTRYPOINT ["/startupservice.sh"]
40-
CMD ["mariadbd"]
46+
CMD ["mariadbd"]

db/startupservice.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ set -o nounset
66
E0="$(printf "\e[0m")" # reset
77
E1="$(printf "\e[1m")" # bold
88

9-
# Start SSH service
10-
/usr/sbin/sshd -D
11-
129
echo "${E1}Starting mariadb: http://127.0.0.1:3306${E0}"
1310

1411
# Start mariadb in the background
15-
docker-entrypoint.sh "$@"
12+
docker-entrypoint.sh "$@"
13+
14+
# Start SSH service
15+
/usr/sbin/sshd -D

docker-compose.yml

-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ services:
9292
dockerfile: bastion/Dockerfile
9393
networks:
9494
- dev-backend
95-
- dev-frontend
9695
expose:
9796
- 22/tcp
9897
ports:
@@ -115,5 +114,3 @@ networks:
115114
name: dev-backend
116115
driver: bridge
117116

118-
dev-frontend:
119-
name: dev-frontend

0 commit comments

Comments
 (0)