Bonjour,
J’ai récemment découvert qu’on pouvait déclarer des blocs ré-utilisables de directives de configuration du client SSH : via des tags.
J’essaie de m’en servir mais ils semblent totalement ignorés :
Voici un exemple avec le contenu de mon fichier ~/.ssh/config
:
# Les forges git utilisent généralement l'utilisateur SSH `git`
Match tagged git-forge
User git
PreferredAuthentications publickey
IdentitiesOnly yes
# Pour GitLab.com, utiliser tel hôte et telle clé
Match tagged git-forge-gitlab_com
Hostname gitlab.com
IdentityFile ~/.ssh/cduv-gitlab
# Hôte SSH nommé pour GitLab.com
Host gitlab_com
Tag git-forge
Tag git-forge-gitlab_com
# Hôte SSH nommé pour GitHub (exemple)
Host git-hub
Tag git-forge
Tag git-forge-github
La commande ssh -vv gitlab_com
échoue et retourne des messages indiquant qu’aucun tag ne correspond :
OpenSSH_9.6p1 Ubuntu-3ubuntu13.9, OpenSSL 3.0.13 30 Jan 2024
debug1: Reading configuration data /home/cduv/.ssh/config
debug2: checking match for 'tagged git-forge' host gitlab_com originally gitlab_com
debug2: match not found
debug2: checking match for 'tagged git-forge-gitlab_com' host gitlab_com originally gitlab_com
debug2: match not found
debug1: /home/cduv/.ssh/config line 14: Applying options for gitlab_com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolving "gitlab_com" port 22
Pour comparaison, la version sans tags fonctionne bien:
Host gitlab_com-notag
User git
PreferredAuthentications publickey
IdentitiesOnly yes
Hostname gitlab.com
IdentityFile ~/.ssh/cduv-gitlab
Un ssh gitlab_com-notag
en arrive au point de me demander ma passphrase de clé SSH:
Enter passphrase for key '/home/cduv/.ssh/cduv-gitlab':
Qu’ais-je mal compris dans les tags de ssh_config
?
Ma version de openssh-client est la v9.6p1-3ubuntu13.9