Add API capability to provide host_key fingerprint when creating a remote mirror with ssh_public_key

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Release notes

GitLab now provides an API endpoint for providing the remote host's SSH host_key fingerprint when creating a remote mirror which uses auth_method of ssh_public_key.

Problem to solve

Currently, GitLab's API allows retrieving the public key used for a push mirror using auth_method of ssh_public_key, but there's no programmatic way to provide the remote hosts's SSH host_key fingerprint. Users must manually access the web to create the remote mirror and enter or detect the remote host's fingerprints. This renders the API endpoint for creating a remote mirror using auth_method of ssh_public_key as unusable, as there is no way to add the fingerprints after mirror creation.

Proposal

Add parameters to the Project remote mirrors API to allow inclusion of the remote hosts's SSH host key fingerprints, or detection thereof. If detection is selected, return the detected fingerprints in the API response.

POST /projects/:id/remote_mirrors
Attribute Type Required Description
detect_ssh_keys Boolean no Request automatic detection of remote host SSH keys.
remote_ssh_keys String no Provide the SSH keys for the remote host. The format should match the output of the ssh-keyscan utility.

One of the two attributes must be required when creating a remote mirror using auth_method of ssh_public_key.

We would also need to update the documentation https://docs.gitlab.com/ee/api/remote_mirrors.html

Intended users

Project maintainers creating remote mirrors

Edited by 🤖 GitLab Bot 🤖