Gitlab CI/CD runner can't connect my server through ssh
Hi devs. I'm trying to connect my server via ssh pair keys from gitlab runners. My server runs on ubuntu 22.04 on Hetzner clouds. My ssh key pair works well, I've tried it individually.
Sample gitlab configuration is:
deploy:
stage: deploy
image: alpine
before_script:
- apk add --no-cache openssh-client
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -e "Host $SERVER_IP\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
script:
- ssh -p $PORT root@$SERVER_IP 'whoami && pwd'
There are no firewall on my server. I've checked iptables, I couldn't see any restriction for port 22.
I am able to connect my another centos 7 installed server which is also hosted on hetzner cloud only modifying env variables.
So, I'm not sure what is the problem and I don't know where to look. All of my servers has a plesk installation. You are free to ask for any log or information. My server auth logs:
Jun 26 14:14:18 wonderful-austin.xx-xx-xx-xx.plesk.page sshd[40080]: fatal: Timeout before authentication for xx.xx.xx.xx port 39056
Jun 26 14:16:08 wonderful-austin.xx-xx-xx-xx.plesk.page sshd[40129]: error: kex_exchange_identification: Connection closed by remote host
gitlab runner logs:
$ ssh -p $PORT root@$SERVER_IP 'whoami && pwd'
ssh: connect to host <hostname_hidden> port 22: Operation timed out
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit code 255
Please or to participate in this conversation.