1

I try to setup a runner-script that will connect to the VM (where application runs) via SSH. In the environment Variables (CICD Config -> Variables) i store the private key (ed25519) which is used to connect to the VM-server. But then the following Error message occurs.. Does anybody know what to do? Suggestions for possible issues I can check to fix the problem?

Below you find the runner-script .gitlab-ci.yml and the occuring error message.

CI-RUNNER SCRIPT

build_job:
  stage: build
  script:
    - apt-get update -y
    - apt-get install openssh-client bash
    - mkdir ~/.ssh/
    - echo "$SSH_PRIVATE_KEY_CI_RUNNER" > ~/.ssh/id_ed25519
    - echo "$SSH_KNOWN_HOST_VM" > ~/.ssh/known_hosts
    - chmod -R 600 ~/.ssh/
 

    - ssh -v user@host -p 2222 "ls -a"

ERROR-MESSAGE

debug1: Host '[server-address]:2222' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: /root/.ssh/id_rsa 
debug1: Will attempt key: /root/.ssh/id_dsa 
debug1: Will attempt key: /root/.ssh/id_ecdsa 
debug1: Will attempt key: /root/.ssh/id_ed25519 
debug1: Will attempt key: /root/.ssh/id_xmss 
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /root/.ssh/id_xmss
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
debug1: read_passphrase: can't open /dev/tty: No such device or address
debug1: Authentications that can continue: publickey,password
debug1: No more authentication methods to try.
user@serveradress: Permission denied (publickey,password).
ERROR: Job failed: exit code 1
Ndrslmpk
  • 125
  • 9

1 Answers1

0

For testing, try first with an SSH private key which is not passphrase protected.

That will avoid the "read_passphrase: can't open /dev/tty: No such device or address" and validate that the key is working.

This assumes the public key was published to "host" ~user/.ssh/authorized_keys, and the SSH daemon is listening on the port 2222.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250