Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: InstallSSHKey task error handlimng when trying to generate public key #20846

Open
4 of 7 tasks
jss-devops01 opened this issue Feb 10, 2025 · 0 comments
Open
4 of 7 tasks
Labels
Area: ABTT Akvelon Build Tasks Team area of work bug triage

Comments

@jss-devops01
Copy link

New issue checklist

Task name

InstallSSHKey

Task version

0.231.0

Issue Description

There is an issue with the function generatePublicKey in installsshkey-util.ts when something wrong happens with system command ssh-keygen the return string contains the string error.

/usr/bin/ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-XXXXXXv8SODi/agent.2410918; export SSH_AUTH_SOCK;
SSH_AGENT_PID=2410919; export SSH_AGENT_PID;
echo Agent pid 2410919;
/usr/bin/ssh-add -L
The agent has no identities.
Error loading key "/app/azure/P-Comp/_work/_temp/id_ed25519_my_ssh_key": error in libcrypto
Finishing: InstallSSHKey

The string _"/app/azure/P-Comp/_work/temp/id_ed25519_my_ssh_key": error in libcrypto comes from the return of the function generatePublicKey
The error handling should be improved so a proper error can be display.

When I try on the machine directly from the system to repeat the steps :

eval `ssh-agent`
ssh-add id_ed25519_my_ssh_key

There is no problem with the key

I also try

ssh-keygen -y -P mypassphrasse -f id_ed25519_my_ssh_key

I can generate the public key without an issue

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

Azure DevOps Server (Please specify exact version in the textbox below)

Azure DevOps Server Version (if applicable)

Azure DevOps Server 2022.2 (AzureDevopsServer_20240806.7)

Operation system

RHEL 9

Relevant log output

/usr/bin/ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-XXXXXXv8SODi/agent.2410918; export SSH_AUTH_SOCK;
SSH_AGENT_PID=2410919; export SSH_AGENT_PID;
echo Agent pid 2410919;
/usr/bin/ssh-add -L
The agent has no identities.
Error loading key "/app/azure/P-Comp/_work/_temp/id_ed25519_my_ssh_key": error in libcrypto
Finishing: InstallSSHKey

Full task logs with system.debug enabled

 2025-02-10T16:31:35.4652840Z ##[debug]Evaluating condition for step: 'InstallSSHKey'
2025-02-10T16:31:35.4705313Z ##[debug]Evaluating: SucceededNode()
2025-02-10T16:31:35.4717737Z ##[debug]Evaluating SucceededNode:
2025-02-10T16:31:35.4752022Z ##[debug]=> True
2025-02-10T16:31:35.4762120Z ##[debug]Result: True
2025-02-10T16:31:35.4835353Z ##[section]Starting: InstallSSHKey
2025-02-10T16:31:35.5051809Z ==============================================================================
2025-02-10T16:31:35.5052336Z Task         : Install SSH key
2025-02-10T16:31:35.5052607Z Description  : Install an SSH key prior to a build or deployment
2025-02-10T16:31:35.5052727Z Version      : 0.231.0
2025-02-10T16:31:35.5053018Z Author       : Microsoft Corporation
2025-02-10T16:31:35.5053276Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/install-ssh-key
2025-02-10T16:31:35.5054015Z ==============================================================================
2025-02-10T16:31:36.3930147Z ##[debug]Resource Utilization warnings is disabled, switch "DISABLE_RESOURCE_UTILIZATION_WARNINGS" variable to "false" if you want to enable it
2025-02-10T16:31:37.5940169Z ##[debug]Using node path: /app/azure/Dev/externals/node16/bin/node
2025-02-10T16:31:37.6908179Z ##[debug]agent.TempDirectory=/app/azure/Dev/_work/_temp
2025-02-10T16:31:37.6909666Z ##[debug]loading inputs and endpoints
2025-02-10T16:31:37.6910011Z ##[debug]loading INPUT_HOSTNAME
2025-02-10T16:31:37.6910270Z ##[debug]loading INPUT_SSHPUBLICKEY
2025-02-10T16:31:37.6910530Z ##[debug]loading INPUT_SSHPASSPHRASE
2025-02-10T16:31:37.6910788Z ##[debug]loading INPUT_SSHKEYSECUREFILE
2025-02-10T16:31:37.6911048Z ##[debug]loading INPUT_ADDENTRYTOCONFIG
2025-02-10T16:31:37.6911362Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2025-02-10T16:31:37.6911631Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2025-02-10T16:31:37.6911934Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2025-02-10T16:31:37.6912248Z ##[debug]loading SECUREFILE_TICKET_c7d1c010-9b4d-439e-93f2-d69c318b8e32
2025-02-10T16:31:37.6915725Z ##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
2025-02-10T16:31:37.6917776Z ##[debug]loading SECRET_SSHPASS
2025-02-10T16:31:37.6920347Z ##[debug]loaded 11
2025-02-10T16:31:37.6926055Z ##[debug]Agent.ProxyUrl=undefined
2025-02-10T16:31:37.6927613Z ##[debug]Agent.CAInfo=undefined
2025-02-10T16:31:37.6929176Z ##[debug]Agent.ClientCert=undefined
2025-02-10T16:31:37.6930526Z ##[debug]Agent.SkipCertValidation=undefined
2025-02-10T16:31:37.7821921Z ##[debug]addEntryToConfig=false
2025-02-10T16:31:37.7823951Z ##[debug]sshPublicKey=ssh-ed25519 AAAAC3NzaC1lZDI1NbG3wP3YUzcN5IbOP1bLZX3sv16PQ7dBG root@myserver
2025-02-10T16:31:37.7825146Z ##[debug]hostName=vmp-ansible-11
2025-02-10T16:31:37.7825742Z ##[debug]sshPassphrase=***
2025-02-10T16:31:37.7826584Z ##[debug]check path : /app/azure/Dev/_work/_tasks/InstallSSHKey_5c9af2eb-5fc5-42dc-9b91-dc234a8c4400/0.231.0/task.json
2025-02-10T16:31:37.7831696Z ##[debug]adding resource file: /app/azure/Dev/_work/_tasks/InstallSSHKey_5c9af2eb-5fc5-42dc-9b91-dc234a8c4400/0.231.0/task.json
2025-02-10T16:31:37.7832359Z ##[debug]system.culture=en-US
2025-02-10T16:31:37.7844643Z ##[debug]sshKeySecureFile=c7d1c010-9b4d-439e-93f2-d69c318b8e32
2025-02-10T16:31:37.7845508Z ##[debug]System.TeamFoundationCollectionUri=https://hosted/tfs/Compliance-DevOps/
2025-02-10T16:31:37.7850215Z ##[debug]SYSTEMVSSCONNECTION auth param ACCESSTOKEN = ***
2025-02-10T16:31:37.7851544Z ##[debug]Secure file retry count set to: 5
2025-02-10T16:31:37.7852577Z ##[debug]Agent.ProxyUrl=undefined
2025-02-10T16:31:37.7873329Z ##[debug]secure file name for id c7d1c010-9b4d-439e-93f2-d69c318b8e32 = id_ed25519_my_ssh_key
2025-02-10T16:31:37.7873917Z ##[debug]Agent.TempDirectory=/app/azure/Dev/_work/_temp
2025-02-10T16:31:37.7874504Z ##[debug]Absolute path for pathSegments: /app/azure/Dev/_work/_temp,id_ed25519_my_ssh_key = /app/azure/Dev/_work/_temp/id_ed25519_my_ssh_key
2025-02-10T16:31:37.7875634Z ##[debug]Downloading secure file contents to: /app/azure/Dev/_work/_temp/id_ed25519_my_ssh_key
2025-02-10T16:31:37.9200543Z ##[debug]secure file ticket for id c7d1c010-9b4d-439e-93f2-d69c318b8e32 = ***
2025-02-10T16:31:37.9200974Z ##[debug]SYSTEM.TEAMPROJECT=Compliance_NonFinancial_Risk
2025-02-10T16:31:38.0166852Z ##[debug]Downloaded secure file contents to: /app/azure/Dev/_work/_temp/id_ed25519_my_ssh_key
2025-02-10T16:31:38.0171082Z ##[debug]Agent.HomeDirectory=/app/azure/Dev
2025-02-10T16:31:38.0175281Z ##[debug]SSH_AGENT_PID=undefined
2025-02-10T16:31:38.0177422Z ##[debug]SSH_AUTH_SOCK=undefined
2025-02-10T16:31:38.0179263Z ##[debug]PID=undefined SOCK=undefined
2025-02-10T16:31:38.0185790Z ##[debug]which 'ssh-agent'
2025-02-10T16:31:38.0196039Z ##[debug]found: '/usr/bin/ssh-agent'
2025-02-10T16:31:38.0199645Z ##[debug]exec tool: /usr/bin/ssh-agent
2025-02-10T16:31:38.0202191Z ##[debug]exec tool: /usr/bin/ssh-agent
2025-02-10T16:31:38.0204584Z ##[debug]arguments:
2025-02-10T16:31:38.0206509Z ##[debug]arguments:
2025-02-10T16:31:38.0211320Z [command]/usr/bin/ssh-agent
2025-02-10T16:31:38.0307727Z SSH_AUTH_SOCK=/tmp/ssh-XXXXXX3gbBCj/agent.3841978; export SSH_AUTH_SOCK;
2025-02-10T16:31:38.0308289Z SSH_AGENT_PID=3841979; export SSH_AGENT_PID;
2025-02-10T16:31:38.0308855Z echo Agent pid 3841979;
2025-02-10T16:31:38.0312486Z ##[debug]Key=SSH_AUTH_SOCK value=/tmp/ssh-XXXXXX3gbBCj/agent.3841978
2025-02-10T16:31:38.0316323Z ##[debug]set SSH_AUTH_SOCK=/tmp/ssh-XXXXXX3gbBCj/agent.3841978
2025-02-10T16:31:38.0500733Z ##[debug]Processed: ##vso[task.setvariable variable=SSH_AUTH_SOCK;isOutput=false;issecret=false;]/tmp/ssh-XXXXXX3gbBCj/agent.3841978
2025-02-10T16:31:38.0502177Z ##[debug]Skipping  export SSH_AUTH_SOCK
2025-02-10T16:31:38.0502689Z ##[debug]Key=SSH_AGENT_PID value=3841979
2025-02-10T16:31:38.0503129Z ##[debug]set SSH_AGENT_PID=3841979
2025-02-10T16:31:38.0504717Z ##[debug]Processed: ##vso[task.setvariable variable=SSH_AGENT_PID;isOutput=false;issecret=false;]3841979
2025-02-10T16:31:38.0505334Z ##[debug]Agent.Version=3.245.0
2025-02-10T16:31:38.0506245Z ##[debug]set task variable: INSTALL_SSH_KEY_KILL_SSH_AGENT_PID=3841979
2025-02-10T16:31:38.0512764Z ##[debug]Processed: ##vso[task.settaskvariable variable=INSTALL_SSH_KEY_KILL_SSH_AGENT_PID;issecret=false;]3841979
2025-02-10T16:31:38.0513708Z ##[debug]Skipping  export SSH_AGENT_PID
2025-02-10T16:31:38.0514430Z ##[debug]Skipping 
echo Agent pid 3841979
2025-02-10T16:31:38.0514937Z ##[debug]Skipping 

2025-02-10T16:31:38.0515359Z ##[debug]Get a list of the SSH keys in the agent
2025-02-10T16:31:38.0515795Z ##[debug]which 'ssh-add'
2025-02-10T16:31:38.0516163Z ##[debug]found: '/usr/bin/ssh-add'
2025-02-10T16:31:38.0516545Z ##[debug]/usr/bin/ssh-add arg: -L
2025-02-10T16:31:38.0516913Z ##[debug]/usr/bin/ssh-add arg: -L
2025-02-10T16:31:38.0517247Z ##[debug]exec tool: /usr/bin/ssh-add
2025-02-10T16:31:38.0517624Z ##[debug]exec tool: /usr/bin/ssh-add
2025-02-10T16:31:38.0518004Z ##[debug]arguments:
2025-02-10T16:31:38.0518372Z ##[debug]arguments:
2025-02-10T16:31:38.0518718Z ##[debug] -L
2025-02-10T16:31:38.0519067Z ##[debug] -L
2025-02-10T16:31:38.0519626Z [command]/usr/bin/ssh-add -L
2025-02-10T16:31:38.0519786Z The agent has no identities.
2025-02-10T16:31:38.0520232Z ##[debug]Checking for public SSH key: AAAAC3NzaC1lZDI1NTE5AAAAIB0c2gh4xHAXbG3wP3YUzcN5IbOP1bLZX3sv16PQ7dBG
2025-02-10T16:31:38.0520752Z ##[debug]Adding the SSH key to the agent /app/azure/Dev/_work/_temp/id_ed25519_my_ssh_key
2025-02-10T16:31:38.0521200Z ##[debug]execSshAddPassphraseSync
2025-02-10T16:31:38.0521572Z ##[debug]writing passphrase
2025-02-10T16:31:38.0521916Z ##[debug]passphrase complete
2025-02-10T16:31:38.0534211Z Error loading key "/app/azure/Dev/_work/_temp/id_ed25519_my_ssh_key": error in libcrypto
2025-02-10T16:31:38.0536015Z ##[debug]errline:Error loading key "/app/azure/Dev/_work/_temp/id_ed25519_my_ssh_key": error in libcrypto
2025-02-10T16:31:38.0551636Z ##[debug]rc:1
2025-02-10T16:31:38.0551928Z ##[debug]success:true
2025-02-10T16:31:38.0556037Z ##[debug]Agent.Version=3.245.0
2025-02-10T16:31:38.0557078Z ##[debug]set task variable: INSTALL_SSH_KEY_DELETE_KEY=/app/azure/Dev/_work/_temp/id_ed25519_my_ssh_key
2025-02-10T16:31:38.0560752Z ##[debug]Processed: ##vso[task.settaskvariable variable=INSTALL_SSH_KEY_DELETE_KEY;issecret=false;]/app/azure/Dev/_work/_temp/id_ed25519_my_ssh_key
2025-02-10T16:31:38.0561311Z ##[debug]which 'ssh-add'
2025-02-10T16:31:38.0564611Z ##[debug]found: '/usr/bin/ssh-add'
2025-02-10T16:31:38.0564989Z ##[debug]exec tool: /usr/bin/ssh-add
2025-02-10T16:31:38.0565297Z ##[debug]exec tool: /usr/bin/ssh-add
2025-02-10T16:31:38.0565558Z ##[debug]arguments:
2025-02-10T16:31:38.0565930Z ##[debug]arguments:
2025-02-10T16:31:38.0566110Z [command]/usr/bin/ssh-add
2025-02-10T16:31:38.0666646Z ##[debug]Read known_hosts
2025-02-10T16:31:38.0667725Z ##[debug]Inserting entry into known_hosts
2025-02-10T16:31:38.0668633Z ##[debug]INSTALL_SSH_KEY_KNOWN_HOSTS_LOCATION=undefined
2025-02-10T16:31:38.0672872Z ##[debug]Agent.Version=3.245.0
2025-02-10T16:31:38.0675971Z ##[debug]set task variable: INSTALL_SSH_KEY_KNOWN_HOSTS_CONTENTS=vmp-ansible-11
2025-02-10T16:31:38.0680651Z ##[debug]Processed: ##vso[task.settaskvariable variable=INSTALL_SSH_KEY_KNOWN_HOSTS_CONTENTS;issecret=false;]vmp-ansible-11
2025-02-10T16:31:38.0681795Z ##[debug]set INSTALL_SSH_KEY_KNOWN_HOSTS_LOCATION=/home/svc_ansible_comp/.ssh/known_hosts
2025-02-10T16:31:38.0683774Z ##[debug]Processed: ##vso[task.setvariable variable=INSTALL_SSH_KEY_KNOWN_HOSTS_LOCATION;isOutput=false;issecret=false;]/home/svc_ansible_comp/.ssh/known_hosts
2025-02-10T16:31:38.0684190Z ##[debug]Agent.Version=3.245.0
2025-02-10T16:31:38.0684465Z ##[debug]set task variable: INSTALL_SSH_KEY_KNOWN_HOSTS_FILE_DELETE=false
2025-02-10T16:31:38.0687708Z ##[debug]Processed: ##vso[task.settaskvariable variable=INSTALL_SSH_KEY_KNOWN_HOSTS_FILE_DELETE;issecret=false;]false
2025-02-10T16:31:38.0689929Z ##[debug]secure file name for id c7d1c010-9b4d-439e-93f2-d69c318b8e32 = id_ed25519_my_ssh_key
2025-02-10T16:31:38.0691379Z ##[debug]Agent.TempDirectory=/app/azure/Dev/_work/_temp
2025-02-10T16:31:38.0692900Z ##[debug]Absolute path for pathSegments: /app/azure/Dev/_work/_temp,id_ed25519_my_ssh_key = /app/azure/Dev/_work/_temp/id_ed25519_my_ssh_key
2025-02-10T16:31:38.0697393Z ##[debug]Deleting secure file at: /app/azure/Dev/_work/_temp/id_ed25519_my_ssh_key
2025-02-10T16:31:38.0700006Z ##[debug]rm -rf /app/azure/Dev/_work/_temp/id_ed25519_my_ssh_key
2025-02-10T16:31:38.0702802Z ##[debug]removing file
2025-02-10T16:31:38.0705755Z ##[debug]End
2025-02-10T16:31:38.0809780Z ##[section]Finishing: InstallSSHKey

Repro steps

- task: InstallSSHKey@0
    inputs:
      knownHostsEntry: "myserver"
      sshKeySecureFile: id_ed25519_my_ssh_key
      sshPassphrase: $(sshpass)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: ABTT Akvelon Build Tasks Team area of work bug triage
Projects
None yet
Development

No branches or pull requests

2 participants