In short, I have a pipeline in GitLab CI that runs on an alpine:latest image. In the pipeline I run to install ssh:
apk update && apk upgrade && apk add --update openssh
And then I run an scp command:
scp -P $SSH_PORT $FILES $SSH_USER@$SSH_HOST:~/
Which fails with:
ssh: connect to host <host> port <port>: Connection refused
scp: Connection closed
And on the server I can see the log:
Unable to negotiate with <ip> port <port>: no matching host key type found. Their offer: sk-ecdsa-sha2-nistp256@openssh.com [preauth]
Unable to negotiate with <ip> port <port>: no matching host key type found. Their offer: sk-ssh-ed25519@openssh.com [preauth]
After researching and trying to understand how the whole process works, I tried adding the PubkeyAcceptedKeyTypes option in the scp command so that the client accepts the Host Key provided for authentication by the server:
scp -o 'PubkeyAcceptedKeyTypes=+sk-ssh-ed25519@openssh.com' -P $SSH_PORT $FILES $SSH_USER@$SSH_HOST:~/
But unfortunately nothing has changed.
Would anyone have any ideas?