Jenkins

Jenkins Gerrit 서버 등록 에러 (id_rsa is not a valid key file)

thxxyj 2023. 6. 13. 07:56
728x90

[문제]

Jenkins Gerrit Trigger plugin을 사용하기 위해 Gerrit 서버를 등록하는데

"/var/lib/jenkins/.ssh/id_rsa" is not a valid key file. 에러 발생

 

 

[원인]

id_rsa 키가 openssh private key로 등록되었기때문

$ cat id_rsa

-----BEGIN OPENSSH PRIVATE KEY-----
....
-----END OPENSSH PRIVATE KEY-----

 

 

[해결방법] 

OPENSSH RSA키가 아닌 RSA 키로 생성하기

$ ssh-keygen -m PEM

-----BEGIN RSA PRIVATE KEY-----
....
-----END RSA PRIVATE KEY-----

https://stackoverflow.com/questions/64276909/jenkins-gerrit-trigger-var-lib-jenkins-ssh-id-rsa-is-not-a-valid-key-file

 

 

기존에 생성된 OPENSSH RSA키를 RSA키로 변환하는 방법

# [1] OpenSSH
sudo ssh-keygen -p -m PEM -f openssh.pem

# [2] OpenSSL
openssl rsa -in openssh.pem -outform pem > openssh-rsa.pem

# [3] Putty
puttygen openssh.pem -O private-openssh -o openssh-rsa.pem

참고  https://kdevkr.github.io/convert-openssh-private-to-rsa/

 

 

728x90