@@ -118,9 +118,43 @@ jobs:
118
118
echo ::group::info:request
119
119
cat request.json || true; echo
120
120
echo ::endgroup::
121
+ - name : Debug container setup
122
+ run : |
123
+ echo ::group::debug_container_setup
124
+ for container in $(docker ps --format "table {{.Names}}" | tail -n +2); do
125
+ echo "=== Container: $container ==="
126
+
127
+ # Check if SSH service is actually running
128
+ echo "SSH service status:"
129
+ docker exec $container systemctl is-active ssh || docker exec $container service ssh status || echo "SSH service check failed"
130
+
131
+ # Check SSH daemon logs
132
+ echo "SSH daemon logs:"
133
+ docker exec $container journalctl -u ssh --no-pager -n 10 || docker exec $container tail -10 /var/log/auth.log || echo "No SSH logs found"
134
+
135
+ # Check root password is set
136
+ echo "Root account status:"
137
+ docker exec $container passwd -S root || echo "Cannot check root account"
138
+
139
+ # Try to manually set root password
140
+ echo "Setting root password to 'root':"
141
+ docker exec $container bash -c 'echo "root:root" | chpasswd' || echo "Failed to set root password"
142
+
143
+ # Check authorized_keys
144
+ echo "Authorized keys:"
145
+ docker exec $container cat /root/.ssh/authorized_keys 2>/dev/null || echo "No authorized_keys file"
146
+
147
+ # Check if we can exec into container
148
+ echo "Test container exec:"
149
+ docker exec $container whoami || echo "Cannot exec into container"
150
+ done
151
+ echo ::endgroup::
121
152
- name : Debug SSH connectivity
122
153
run : |
123
154
echo ::group::debug_ssh_connectivity
155
+ # Install sshpass for password authentication
156
+ sudo apt-get update && sudo apt-get install -y sshpass
157
+
124
158
# Check if containers are running
125
159
docker ps
126
160
@@ -130,7 +164,7 @@ jobs:
130
164
echo "SSH processes in $container:"
131
165
docker exec $container ps aux | grep sshd || echo "No sshd processes found in $container"
132
166
133
- # Test SSH connectivity directly
167
+ # Test SSH connectivity directly with password
134
168
echo "Testing direct SSH connection to $container:"
135
169
container_ip=$(docker inspect $container | jq -r '.[0].NetworkSettings.IPAddress')
136
170
echo "Container IP: $container_ip"
@@ -139,10 +173,23 @@ jobs:
139
173
ssh_port=$(docker port $container 22 | cut -d: -f2)
140
174
echo "SSH port mapping: localhost:$ssh_port -> $container:22"
141
175
142
- # Test SSH connection with timeout
143
- timeout 10 ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 -p $ssh_port root@localhost 'echo "SSH connection successful"' || echo "SSH connection failed to $container"
176
+ # Test SSH connection with sshpass and root password
177
+ echo "Testing SSH with sshpass and root/root:"
178
+ timeout 10 sshpass -p "root" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 -p $ssh_port root@localhost 'echo "SSH connection successful to '$container'"' || echo "SSH connection failed to $container"
179
+
180
+ # Also check what's actually listening on the SSH port
181
+ echo "Checking what's listening on port $ssh_port:"
182
+ netstat -ln | grep ":$ssh_port " || echo "Nothing listening on port $ssh_port"
183
+
184
+ # Check SSH config inside container
185
+ echo "SSH configuration in $container:"
186
+ docker exec $container cat /etc/ssh/sshd_config | grep -E "(PasswordAuthentication|PermitRootLogin|PubkeyAuthentication)" || true
187
+
188
+ # Check if root account is set up correctly
189
+ echo "Root account info in $container:"
190
+ docker exec $container passwd -S root || true
144
191
done
145
- echo ::endgroup::
192
+ echo ::endgroup::
146
193
- name : Wait for SSH to be ready
147
194
run : |
148
195
echo ::group::wait_for_ssh
0 commit comments