Skip to content

Commit

Permalink
Reenable SSH config (#578)
Browse files Browse the repository at this point in the history
  • Loading branch information
olivershen-wow authored Aug 22, 2023
1 parent 7b2355a commit 936a39b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
12 changes: 11 additions & 1 deletion center/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ COPY ${STARTUP_FOLDER_PATH}/${CENTER_INIT_SQLITE} /hydra/data/${CENTER_INIT_SQLI
COPY ${STARTUP_FOLDER_PATH}/record_release.apk /storage/local/pkgstore/2023/04/23/hydra_lab_android_client_release.apk
COPY ${STARTUP_FOLDER_PATH}/record_androidTest.apk /storage/local/pkgstore/2023/04/23/hydra_lab_android_client_androidTest.apk

# Config for SSH of Azure App Service
RUN apt-get install -y openssh-server \
&& echo "root:Docker!" | chpasswd
# Copy the sshd_config file to the /etc/ssh/ directory
COPY ${STARTUP_FOLDER_PATH}/sshd_config /etc/ssh/
# Copy and configure the ssh_setup file
COPY ${STARTUP_FOLDER_PATH}/ssh_setup.sh /tmp/
RUN chmod +x /tmp/ssh_setup.sh && \
(sleep 1;/tmp/ssh_setup.sh 2>&1 > /dev/null)

# Add config of scheduled cleaning pushgateway outdated data, run script every 1 minute
RUN echo '*/1 * * * * ( sh /opt/pushgatewayDataClean.sh & ) ' >> /etc/crontab \
# Add restart logic by triggering shell script every 1 minute
Expand All @@ -69,5 +79,5 @@ RUN echo '*/1 * * * * ( sh /opt/pushgatewayDataClean.sh & ) ' >> /etc/crontab \
LABEL org.opencontainers.image.source=https://github.com/microsoft/HydraLab

# Open port 2222 for SSH access, 80 for default app service
EXPOSE 80
EXPOSE 80 2222
ENTRYPOINT ["sh", "start.sh"]
9 changes: 9 additions & 0 deletions center/deploy_startup/ssh_setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

ssh-keygen -A

#prepare run dir
if [ ! -d "/var/run/sshd" ];
then
mkdir -p /var/run/sshd
fi
12 changes: 12 additions & 0 deletions center/deploy_startup/sshd_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Port 2222
ListenAddress 0.0.0.0
LoginGraceTime 180
X11Forwarding yes
Ciphers aes128-cbc,3des-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr
MACs hmac-sha1,hmac-sha1-96
StrictModes yes
SyslogFacility DAEMON
PasswordAuthentication yes
PermitEmptyPasswords no
PermitRootLogin yes
Subsystem sftp internal-sftp
1 change: 1 addition & 0 deletions center/deploy_startup/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if ${PUSHGATEWAY_ENABLED}; then
fi

/usr/sbin/nginx &
/usr/sbin/sshd &
/etc/init.d/cron start &

cd /
Expand Down

0 comments on commit 936a39b

Please sign in to comment.