azure-pipelines-tasks: Error: All configured authentication methods failed after Ubuntu server upgrade.

Question, Bug, or Feature?: Question

Enter Task Name: ssh@0

Environment

  • Server - Azure Pipelines

  • Agent - Hosted or Private: Hosted

    • If using Hosted agent, provide agent queue name:

Agent name: ‘Hosted Agent’

2022-07-14T20:00:27.7601005Z Agent machine name: ‘fv-az525-731’

Issue Description

I’m using an SSH task to connect to a Ubuntu server and run a simple bash script. It was working fine. I upgraded the server from the 20.10 to the 22.04 release of Ubuntu and the task started failing with the following error:

Failed to connect to remote machine. Verify the SSH service connection details. Error: Error: All configured authentication methods failed.

I checked the server and the server log has this in it:

userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]

I am able to connect to the machine using OpenSSH from Windows 11 using PowerShell 7 with the following command.

ssh -i [redacted] [redacted]@[redacted].uksouth.cloudapp.azure.com

I tried re-uploading the key and setting the password to the same key and password I use from Windows but it still fails.

Apparently according to the release notes for Ubuntu 22.04 they have updated to Open SSL 8.8 and disabled ssh-rsa. The release notes for Open SSL 8.8 note that rsa1 is no longer supported for security reasons but suggest that no change to keys should be needed because clients should use RFC8332 RSA/SHA-256/512 instead.

Is there a way to force it to use a supported encryption scheme?

Task logs

2022-07-15T10:26:31.4177677Z ##[debug]Evaluating condition for step: ‘Poll cloud-init log for finish’ 2022-07-15T10:26:31.4180583Z ##[debug]Evaluating: succeeded() 2022-07-15T10:26:31.4181398Z ##[debug]Evaluating succeeded: 2022-07-15T10:26:31.4183315Z ##[debug]=> True 2022-07-15T10:26:31.4184153Z ##[debug]Result: True 2022-07-15T10:26:31.4184961Z ##[section]Starting: Poll cloud-init log for finish 2022-07-15T10:26:31.4311622Z ============================================================================== 2022-07-15T10:26:31.4311988Z Task : SSH 2022-07-15T10:26:31.4312307Z Description : Run shell commands or a script on a remote machine using SSH 2022-07-15T10:26:31.4312628Z Version : 0.200.0 2022-07-15T10:26:31.4312887Z Author : Microsoft Corporation 2022-07-15T10:26:31.4313263Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/ssh 2022-07-15T10:26:31.4313689Z ============================================================================== 2022-07-15T10:26:31.4451320Z ##[debug]Invoking Method: System.Threading.Tasks.Task <RunAsync>b__9(). Attempt count: 0 2022-07-15T10:26:31.4706451Z ##[debug]Using node path: C:\agents\2.204.0\externals\node10\bin\node.exe 2022-07-15T10:26:31.6445833Z ##[debug]agent.TempDirectory=D:\a_temp 2022-07-15T10:26:31.6472716Z ##[debug]loading inputs and endpoints 2022-07-15T10:26:31.6485431Z ##[debug]loading ENDPOINT_AUTH_674e347f-dd83-4363-b9ee-31d5e51fb6f0 2022-07-15T10:26:31.6548742Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_674e347f-dd83-4363-b9ee-31d5e51fb6f0_PASSWORD 2022-07-15T10:26:31.6550423Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_674e347f-dd83-4363-b9ee-31d5e51fb6f0_USERNAME 2022-07-15T10:26:31.6551585Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN 2022-07-15T10:26:31.6552652Z ##[debug]loading ENDPOINT_AUTH_SCHEME_674e347f-dd83-4363-b9ee-31d5e51fb6f0 2022-07-15T10:26:31.6553687Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION 2022-07-15T10:26:31.6554686Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION 2022-07-15T10:26:31.6555621Z ##[debug]loading INPUT_FAILONSTDERR 2022-07-15T10:26:31.6556583Z ##[debug]loading INPUT_INLINE 2022-07-15T10:26:31.6557495Z ##[debug]loading INPUT_INTERACTIVESESSION 2022-07-15T10:26:31.6558409Z ##[debug]loading INPUT_INTERPRETERCOMMAND 2022-07-15T10:26:31.6559306Z ##[debug]loading INPUT_READYTIMEOUT 2022-07-15T10:26:31.6560185Z ##[debug]loading INPUT_RUNOPTIONS 2022-07-15T10:26:31.6561061Z ##[debug]loading INPUT_SCRIPTPATH 2022-07-15T10:26:31.6561937Z ##[debug]loading INPUT_SSHENDPOINT 2022-07-15T10:26:31.6562812Z ##[debug]loaded 15 2022-07-15T10:26:31.6567195Z ##[debug]Agent.ProxyUrl=undefined 2022-07-15T10:26:31.6568160Z ##[debug]Agent.CAInfo=undefined 2022-07-15T10:26:31.6569075Z ##[debug]Agent.ClientCert=undefined 2022-07-15T10:26:31.6569982Z ##[debug]Agent.SkipCertValidation=undefined 2022-07-15T10:26:31.7807463Z ##[debug]check path : D:\a_tasks\SSH_91443475-df55-4874-944b-39253b558790\0.200.0\task.json 2022-07-15T10:26:31.7893642Z ##[debug]adding resource file: D:\a_tasks\SSH_91443475-df55-4874-944b-39253b558790\0.200.0\task.json 2022-07-15T10:26:31.7897819Z ##[debug]system.culture=en-US 2022-07-15T10:26:31.7899214Z ##[debug]sshEndpoint=674e347f-dd83-4363-b9ee-31d5e51fb6f0 2022-07-15T10:26:31.7902073Z ##[debug]674e347f-dd83-4363-b9ee-31d5e51fb6f0 auth param username = *** 2022-07-15T10:26:31.7905374Z ##[debug]674e347f-dd83-4363-b9ee-31d5e51fb6f0 auth param password = *** 2022-07-15T10:26:31.7961420Z ##[debug]674e347f-dd83-4363-b9ee-31d5e51fb6f0 data host = [redacted].uksouth.cloudapp.azure.com 2022-07-15T10:26:31.7964559Z ##[debug]674e347f-dd83-4363-b9ee-31d5e51fb6f0 data port = 2022-07-15T10:26:31.7966259Z Using port 22 which is the default for SSH since no port was specified. 2022-07-15T10:26:31.7989455Z ##[debug]interactiveSession=true 2022-07-15T10:26:31.7991950Z ##[debug]readyTimeout=20000 2022-07-15T10:26:31.7994174Z ##[debug]Using private key for ssh connection. 2022-07-15T10:26:31.7995263Z ##[debug]runOptions=inline 2022-07-15T10:26:31.8005323Z ##[debug]inline=while ! grep “Cloud-init .* finished” /var/log/cloud-init.log >> /dev/null; do echo “Waiting for cloud-init to finish…” sleep 5s > /dev/null done echo “cloud-init finished” 2022-07-15T10:26:31.8006620Z ##[debug]interpreterCommand=/bin/bash 2022-07-15T10:26:31.8007477Z ##[debug]No script header detected. Adding: #!/bin/bash 2022-07-15T10:26:31.8008297Z ##[debug]Agent.TempDirectory=D:\a_temp 2022-07-15T10:26:31.8009061Z ##[debug]failOnStdErr=true 2022-07-15T10:26:31.8010135Z Trying to establish an SSH connection to [redacted]@[redacted].uksouth.cloudapp.azure.com:22 2022-07-15T10:26:31.9552101Z ##[debug]task result: Failed 2022-07-15T10:26:31.9584945Z ##[error]Failed to connect to remote machine. Verify the SSH service connection details. Error: Error: All configured authentication methods failed.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 15 (1 by maintainers)

Commits related to this issue

Most upvoted comments

not stale still a problem that could use a fix.

For anyone that comes to this issue in the mean time. It can be fixed by creating a file called /etc/ssh/sshd_config.d/60-enable-rsa.conf on the server and adding the following two lines to it.

HostbasedAcceptedAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa

This isn’t really a suitable long term fix though as the whole reason the Ubuntu team removed ssh-rsa is because it is widely seen as broken and a security vulnerability.

Hi @martingbrown thanks for reporting! We are working on more prioritized issues at the moment, let us get back to this one soon.

@KonstantinTyukalov Is there any update on this? Since the current implementation uses a vulnerable algorithm, I would expect this issue to receive a higher priority.

I second this. The issue was reported back in 2022 already and its 2024 now and its still not resolved…

For the record, this got fixed in https://github.com/microsoft/azure-pipelines-tasks/commit/8af713ecdc00c21523de5e88f82cc2eeb57a61c6, six months ago, but nobody bothered to close this. Is there literally anyone reading these issues lol

Fun fact is Microsoft actually updated the SSH library in 16dcae9e225ee061350911576b2a3e70e7eaab9f, but to another version that does not support SHA2 either.