Skip to content

Commit

Permalink
ci(ssh): avoid ssh timeouts from the server
Browse files Browse the repository at this point in the history
Motivation:
We've been trying multiple solutions to our SSH connection issues, our last
try solving this issues was PR https://github.com/ZcashFoundation/zebra/pull/5367/files

Depends-On: #5367

Expected behavior:
An SSH connection should not be terminated by the server, the connection
must be kept alive indefinitely until it's killed by GitHub Actions

Solution:
Disable TCP keepalive messages from the server and set `ClientAliveCountMax`
to 0, which disables connection termination
  • Loading branch information
gustavovalverde committed Oct 10, 2022
1 parent 2b72323 commit 6538777
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/scripts/gcp-vm-startup-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
# Increase the Google Cloud instance sshd connection limit
#
# This script appends 'MaxStartups 500' to /etc/ssh/sshd_config allowing up to 500
# unauthenticated connections to Google Cloud instances.
# unauthenticated connections to Google Cloud instances
#
# It also adds 'ClientAliveCountMax 0' and 'TCPKeepAlive no' to avoid SSH timeout from
# the server
ps auxwww | grep sshd
echo
sudo grep MaxStartups /etc/ssh/sshd_config
Expand All @@ -11,6 +14,8 @@ sudo cat /etc/ssh/sshd_config
echo
echo 'Modifying config:'
echo 'MaxStartups 500' | sudo tee --append /etc/ssh/sshd_config \
echo 'TCPKeepAlive no' | sudo tee --append /etc/ssh/sshd_config \
echo 'ClientAliveCountMax 0' | sudo tee --append /etc/ssh/sshd_config \
|| \
(echo "updating instance sshd config failed: failing test"; exit 1)
sudo grep MaxStartups /etc/ssh/sshd_config
Expand Down

0 comments on commit 6538777

Please sign in to comment.