You need to create a dedicated proxy user on a server where you've full control over the ssh service.
In following scenario we used the username git
.
ssh-keygen -f ~/id_azure -t rsa
sudo useradd -m git
sudo mkdir /home/git/.ssh/
sudo mv ~/id_azure* /home/git/.ssh
sudo echo "Host ssh.dev.azure.com" >> /home/git/.ssh/config
sudo echo "HostkeyAlgorithms +ssh-rsa" >> /home/git/.ssh/config
sudo echo "#PubkeyAcceptedAlgorithms +ssh-rsa" >> /home/git/.ssh/config
sudo echo "#HostkeyAlgorithms +ssh-rsa" >> /home/git/.ssh/config
sudo echo "User git" >> /home/git/.ssh/config
sudo echo "IdentityFile /home/git/.ssh/id_azure" >> /home/git/.ssh/config
sudo touch /home/git/.ssh/known_hosts
sudo touch /home/git/.ssh/authorized_keys
sudo echo "LAGOON_ED25519_DEPLOY_KEY Lagoon-Key" >> /home/git/.ssh/authorized_keys
sudo chown -R git:git /home/git
sudo chmod 644 /home/git/.ssh/*
sudo chmod 400 /home/git/.ssh/id_azure
cat /home/git/.ssh/id_azure.pub
!! Enable PubkeyAcceptedAlgorithms / HostkeyAlgorithms if you run OpenSSH >=8.8 (use ssh -V
to check version) \
Get the contents from /home/git/.ssh/id_azure.pub And add them in Azure DevOps > User settings > SSH public keys
sudo runuser -u git -- ssh -v ssh.dev.azure.com
Check for "debug1: Authentication succeeded (publickey).
"
Followup error like "shell request failed on channel 0
" is fine.
sudo echo "" >> /etc/ssh/sshd_config
sudo echo "" >> /etc/ssh/sshd_config
sudo echo "Match User git" >> /etc/ssh/sshd_config
sudo echo " ForceCommand ssh -T ssh.dev.azure.com \$SSH_ORIGINAL_COMMAND" >> /etc/ssh/sshd_config
sudo systemctl restart ssh.service
sudo echo "YOUR_ED25519_KEY" >> /home/git/.ssh/authorized_keys
Now you should be able to execute following command locally - given your local public key was also added to /home/azure/.ssh/authorized_keys
:
git clone git@CUSTOM_SERVER_IP_OR_HOSTNAME:v3/OrganizationName/ProjectName/REPOSITORY
lagoon update p -p YOUR_LAGOON_PROJECT -g git@CUSTOM_SERVER_IP_OR_HOSTNAME:v3/OrganizationName/ProjectName/REPOSITORY.git
Requirements:
LAGOON_ED25519_DEPLOY_KEY
content from Amazee.iossh-keygen -t rsa
and without passphraseAzure deploy key