<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
    <title>Tournesol - FIDO2</title>
    <link rel="self" type="application/atom+xml" href="https://tournesol.me/tags/fido2/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://tournesol.me"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-05-03T00:00:00+00:00</updated>
    <id>https://tournesol.me/tags/fido2/atom.xml</id>
    <entry xml:lang="fr">
        <title>Remplacer son mot de passe utilisateur par une tape</title>
        <published>2026-05-02T00:00:00+00:00</published>
        <updated>2026-05-02T00:00:00+00:00</updated>
        
        <author>
          <name>
            Tournesol
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://tournesol.me/blog/fido2-pam-u2f/"/>
        <id>https://tournesol.me/blog/fido2-pam-u2f/</id>
        
        <content type="html" xml:base="https://tournesol.me/blog/fido2-pam-u2f/">&lt;h1 id=&quot;introduction&quot;&gt;Introduction&lt;&#x2F;h1&gt;
&lt;p&gt;J’ai récemment fait joujou avec les clés physique FIDO2 pour &lt;a href=&quot;https:&#x2F;&#x2F;tournesol.me&#x2F;blog&#x2F;fido2-resident-ssh-key&#x2F;&quot;&gt;héberger mes clés SSH&lt;&#x2F;a&gt; et je dévérouille mes disques chiffrés par LUKS avec.&lt;&#x2F;p&gt;
&lt;p&gt;Aujourd’hui, on va utiliser ces clés pour s’éviter à rentrer son mot de passe utilisateur et permettre de ne faire qu’une tappe sur la clé pour dévérouiller nos sésames.
Pourquoi ? Car j’avais pris l’habitude d’avoir un mot de passe cours et peu complexe pour ne pas passer 20 ans à chaque utilisation de sudo. Normalement c’est pas un soucis mais ça me semblait étrange de chiffrer mon disque dur alors que la majorité du temps, je n’éteins même pas mon ordinateur. Donc si j’ai un vol, ils peuvent “brute-force” ma session utilisateur tant que le pc reste allumé.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;authentification-pour-les-sessions-utilisateurs&quot;&gt;Authentification pour les sessions utilisateurs&lt;&#x2F;h1&gt;
&lt;p&gt;Pour ça on remercie Yubico qui fournissent le package &lt;strong&gt;requit&lt;&#x2F;strong&gt; &lt;code&gt;pam-u2f&lt;&#x2F;code&gt; (ou &lt;code&gt;libpam-u2f&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;ajoutez-les-cles&quot;&gt;Ajoutez les clés&lt;&#x2F;h2&gt;
&lt;p&gt;Dans un terminal en tant que l’utilisateur qui utilisera ces clés :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #EBDBB2); background-color: light-dark(#F9F5D7, #1D2021);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #FABD2F);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #B8BB26);&quot;&gt; ~&#x2F;.config&#x2F;Yubico&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #928374);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #928374);font-style: italic;&quot;&gt; Première clé&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #FABD2F);&quot;&gt;pamu2fcfg&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #B8BB26);&quot;&gt; pam:&#x2F;&#x2F;tournesol&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #8EC07C);&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #B8BB26);&quot;&gt; ~&#x2F;.config&#x2F;Token2&#x2F;u2f_keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #928374);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #928374);font-style: italic;&quot;&gt; Les suivantes (notez l&amp;#39;option -n qui sont nécessaires)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #FABD2F);&quot;&gt;pamu2fcfg&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #B8BB26);&quot;&gt; pam:&#x2F;&#x2F;tournesol&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt;n&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#427B58, #8EC07C);&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #B8BB26);&quot;&gt; ~&#x2F;.config&#x2F;Token2&#x2F;u2f_keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;Il est recommandé de rajouter &lt;code&gt;-i pam:&#x2F;&#x2F;tournesol&lt;&#x2F;code&gt; (remplacer mon nom par tout ce vous voulez) mais ce n’est pas nécessaire. Seulement, par défaut, le nom donné est la variable &lt;code&gt;$HOSTNAME&lt;&#x2F;code&gt; qui risque donc de changer si vous changez de hostname.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;verifiez-alwaysuv&quot;&gt;Vérifiez &lt;em&gt;alwaysUv&lt;&#x2F;em&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;De plus en plus de clés viennent avec &lt;em&gt;alwaysUv&lt;&#x2F;em&gt; d’activé par défaut.
Si cette option est activée, vous ne pourrez pas utiliser les clés pour vous authentifier de la manière décrite sur cette page.&lt;&#x2F;p&gt;
&lt;p&gt;Concrétement, cette option requiert de rentrer le code PIN de la clé à chaque utilisation, même si on vous le demande pas.
De ce que je comprends, désactiver &lt;em&gt;alwaysUv&lt;&#x2F;em&gt;, permets uniquement à toutes personnes qui mets la main sur une de vos clés FIDO2 de les utiliser pour toute application qui ne demande pas le code PIN.&lt;&#x2F;p&gt;
&lt;p&gt;Vérifiez et modifiez son état en utilisant une app géstion de clés FIDO2.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;utiliser-ces-cles-pour-l-authentification&quot;&gt;Utiliser ces clés pour l’authentification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;attention&quot;&gt;ATTENTION&lt;&#x2F;h3&gt;
&lt;blockquote class=&quot;markdown-alert-warning&quot;&gt;
&lt;p&gt;Éditer les fichiers dans &lt;code&gt;&#x2F;etc&#x2F;pam.d&#x2F;&lt;&#x2F;code&gt; peut vous verrouiller en dehors de votre système&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;À chaque édition des fichiers dans &lt;code&gt;&#x2F;etc&#x2F;pam.d&#x2F;&lt;&#x2F;code&gt;, sauvegardez mais NE FERMEZ PAS LE FICHIER. Confirmez dans un nouveau terminal que vous avez toujours vos accès.
Vous pouvez utiliser le package &lt;code&gt;pamtester&lt;&#x2F;code&gt; pour faire vos vérifications.
Vous pouvez aussi ouvrir une session root avant de faire une modification de sorte à toujours pouvoir retourner en arrière si vous avez une erreur.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sudo&quot;&gt;sudo&lt;&#x2F;h3&gt;
&lt;p&gt;Ajoutez en première ligne :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #EBDBB2); background-color: light-dark(#F9F5D7, #1D2021);&quot;&gt;&lt;code data-lang=&quot;plain&quot; data-name=&quot;&#x2F;etc&#x2F;pam.d&#x2F;sudo&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auth            sufficient      pam_u2f.so cue [cue_prompt=Tap key…] authfile=.config&#x2F;Yubico&#x2F;u2f_keys origin=pam:&#x2F;&#x2F;tournesol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Faites attention à remplacer &lt;em&gt;tournesol&lt;&#x2F;em&gt; par le bon nom.&lt;&#x2F;p&gt;
&lt;p&gt;Si vous voulez que vos clés soient vos seules méthodes pour utiliser sudo, vous pouvez commenter les lignes qui suivent ainsi que remplacer &lt;em&gt;sufficient&lt;&#x2F;em&gt; par &lt;em&gt;required&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;login-gdm&quot;&gt;login GDM&lt;&#x2F;h3&gt;
&lt;p&gt;À la suite des lignes &lt;em&gt;auth&lt;&#x2F;em&gt;, rajouter :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #EBDBB2); background-color: light-dark(#F9F5D7, #1D2021);&quot;&gt;&lt;code data-lang=&quot;plain&quot; data-name=&quot;&#x2F;etc&#x2F;pam.d&#x2F;gdm-password&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auth            required      pam_u2f.so nouserok authfile=.config&#x2F;Yubico&#x2F;u2f_keys origin=pam:&#x2F;&#x2F;tournesol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notez l’utilisation de &lt;em&gt;nouserok&lt;&#x2F;em&gt; qui permets à la régle d’échouer si l’utilisateur n’a pas de clés configurées. Cela permets un setup à plusieurs utilisateurs sans rendre l’utilisation de ces clés obligatoires.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ma-methode-bourin-system-auth&quot;&gt;Ma méthode bourin : system-auth&lt;&#x2F;h3&gt;
&lt;p&gt;Les solutions précédentes sont utiles pour sélectionner quels services permettront l’utilisation des clés. Je n’ai pas trouvé pas trouvé de source qui parlent d’utiliser &lt;code&gt;&#x2F;etc&#x2F;pam.d&#x2F;system-auth&lt;&#x2F;code&gt;, j’imagine car c’est une solution trop bourrine mais j’ai testé avec gdm, sudo, le dialogue de 1password.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #EBDBB2); background-color: light-dark(#F9F5D7, #1D2021);&quot;&gt;&lt;code data-lang=&quot;plain&quot; data-name=&quot;&#x2F;etc&#x2F;pam.d&#x2F;system-auth&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-auth      [success=3 default=ignore]  pam_systemd_home.so&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auth       [success=2 default=ignore]  pam_u2f.so cue [cue_prompt=Tap key…] nouserok authfile=.config&#x2F;Yubico&#x2F;u2f_keys origin=pam:&#x2F;&#x2F;tournesol&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auth       [success=1 default=bad]     pam_unix.so          try_first_pass nullok&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;auth       [default=die]               pam_faillock.so      authfail&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;markdown-alert-note&quot;&gt;
&lt;p&gt;le numéro de &lt;em&gt;success&lt;&#x2F;em&gt; est important. Vérifiez qu’il est décroissant à partier de la ligne de &lt;em&gt;pam_systemd_home.so&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h1 id=&quot;references&quot;&gt;Références&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;Page du wiki Arch Linux : &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;wiki.archlinux.org&#x2F;title&#x2F;Universal_2nd_Factor#Authentication_for_user_sessions&quot;&gt;Universal 2nd Factor&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Documentation officielle de pam-u2f : &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;developers.yubico.com&#x2F;pam-u2f&#x2F;#examples&quot;&gt;pam-u2f&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Guide de Token2 : &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.token2.com&#x2F;site&#x2F;page&#x2F;using-token2-fido2-security-keys-for-linux-local-authentication&quot;&gt;Using Token2 FIDO2 Security keys for Linux local authentication&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
    <entry xml:lang="fr">
        <title>Guide pour SSH avec une clé FIDO2</title>
        <published>2026-02-26T00:00:00+00:00</published>
        <updated>2026-05-03T00:00:00+00:00</updated>
        
        <author>
          <name>
            Tournesol
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://tournesol.me/blog/fido2-resident-ssh-key/"/>
        <id>https://tournesol.me/blog/fido2-resident-ssh-key/</id>
        
        <content type="html" xml:base="https://tournesol.me/blog/fido2-resident-ssh-key/">&lt;p&gt;J’ai récemment acheté des clés USB FIDO2 pour stocker et sécuriser mes mots de passes. C’est vraiment cool de pouvoir se connecter partout tant que j’ai mes clés USB.&lt;&#x2F;p&gt;
&lt;p&gt;Mais on peut aussi les utiliser pour stocker des clés SSH. On peut les stocker directement sur la clé FIDO2 et donc les utiliser sur n’importe quel appareil. Vous pouvez même oublier de retirer la clé privées d’un appareil puisqu’elle ne pourra être utilisé que si la clé FIDO2 est insérée et que vous la touchiez.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;small&gt;Cet article est grandement inspiré de celui écrit par Jonas Markström &lt;a class=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;swjm.blog&#x2F;the-complete-guide-to-ssh-with-fido2-security-keys-841063a04252&quot;&gt;The complete guide to SSH with FIDO2 security keys&lt;&#x2F;a&gt;&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;h1 id=&quot;prerequis&quot;&gt;Prérequis&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;OpenSSH version &lt;code&gt;8.3&lt;&#x2F;code&gt; minimum d’installé&lt;&#x2F;li&gt;
&lt;li&gt;Avoir une clé de sécurité FIDO2 avec PIN (Token2, Yubikey,…)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;creer-la-cle-ssh-residente&quot;&gt;Créer la clé SSH résidente&lt;&#x2F;h1&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #EBDBB2); background-color: light-dark(#F9F5D7, #1D2021);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #FABD2F);&quot;&gt;ssh-keygen&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt;t&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #B8BB26);&quot;&gt; ed25519-sk&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt;O&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #B8BB26);&quot;&gt; resident&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt;O&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #B8BB26);&quot;&gt; verify-required&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt;O&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#79740E, #B8BB26);&quot;&gt; application=ssh:main&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;On peut rajouter &lt;code&gt;-C “Commentaire”&lt;&#x2F;code&gt; pour rajouter un commentaire dans les fichiers.&lt;&#x2F;p&gt;
&lt;p&gt;Je préfère &lt;code&gt;-O application=ssh:main&lt;&#x2F;code&gt; où “main” est la description de la clé. À chaque recréation avec &lt;code&gt;ssh-keygen -K&lt;&#x2F;code&gt;, “main” sera utiliser comme suffixe des fichiers ainsi que commentaire de la clé publique.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ssh:&lt;&#x2F;code&gt; est nécessaire pour être détecté par OpenSSH.&lt;&#x2F;p&gt;
&lt;p&gt;Pas besoin de mot de passe comme le pin est demandé.&lt;&#x2F;p&gt;
&lt;p&gt;Cela va écrire 2 fichiers : une clé privée et une publique.&lt;&#x2F;p&gt;
&lt;p&gt;En réalité, la clé privée écrite sur l’ordi est la moitié de la clé et dirige vers l’autre moitié qui est stockées sur la clé USB&lt;&#x2F;p&gt;
&lt;h1 id=&quot;configurer-un-nouveau-client-ssh&quot;&gt;Configurer un nouveau client SSH&lt;&#x2F;h1&gt;
&lt;p&gt;Changer de dossiers vers &lt;code&gt;~&#x2F;.ssh&lt;&#x2F;code&gt; et faites &lt;code&gt;ssh-keygen -K&lt;&#x2F;code&gt; va écrire toutes les clés publiques et secrètes.&lt;&#x2F;p&gt;
&lt;p&gt;On peut maintenant les utiliser comme des clés publiques et secrètes mais qui nécessitent d’avoir une la clé USB sur l’ordi et pouvoir la toucher.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;configurer-le-serveur-ssh&quot;&gt;Configurer le serveur SSH&lt;&#x2F;h1&gt;
&lt;p&gt;Dans &lt;code&gt;&#x2F;etc&#x2F;ssh&#x2F;sshd_config&lt;&#x2F;code&gt;, il est possible de rajouter &lt;code&gt;PubkeyAuthOptions verify-required&lt;&#x2F;code&gt; pour forcer la vérification utilisateur FIDO2 (PIN ou biométrique).&lt;&#x2F;p&gt;
&lt;p&gt;Cet exemple de &lt;code&gt;sshd_config&lt;&#x2F;code&gt; montre les changements que je fais habituellement outre le changement de port SSH.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #EBDBB2); background-color: light-dark(#F9F5D7, #1D2021);&quot;&gt;&lt;code data-lang=&quot;ssh-config&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #928374);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #928374);font-style: italic;&quot;&gt; Support public key cryptography (includes FIDO2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #FB4934);&quot;&gt;PubkeyAuthentication&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt; yes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #928374);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #928374);font-style: italic;&quot;&gt; Make sure User Verification is performed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PubkeyAuthOptions verify-required&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #928374);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #928374);font-style: italic;&quot;&gt; Disable root login via SSH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #FB4934);&quot;&gt;PermitRootLogin&lt;&#x2F;span&gt;&lt;span&gt; without-password&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#928374, #928374);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#928374, #928374);font-style: italic;&quot;&gt; Disable passwords&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #FB4934);&quot;&gt;PasswordAuthentication&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt; no&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #FB4934);&quot;&gt;PermitEmptyPasswords&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt; no&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h1 id=&quot;partager-la-cle-publique-de-l-utilisateur&quot;&gt;Partager la clé publique de l’utilisateur&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;en-utilisant-ssh-copy-id&quot;&gt;En utilisant ssh-copy-id&lt;&#x2F;h2&gt;
&lt;p&gt;Si vous avez déjà un accès SSH, c’est rapide, c’est propre &lt;code&gt;ssh-copy-id -i ~&#x2F;.ssh&#x2F;id_ed25519_sk.pub user@host&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;en-editant-authorized-keys-directement&quot;&gt;En éditant authorized_keys directement&lt;&#x2F;h2&gt;
&lt;p&gt;Ouvrez le fichier, souvent &lt;code&gt;~&#x2F;.ssh&#x2F;authorized_keys&lt;&#x2F;code&gt;, et ajouter la clé publique à la dernière ligne.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;ssh-agent-temporaire&quot;&gt;SSH agent temporaire&lt;&#x2F;h2&gt;
&lt;p&gt;Jusqu’au prochain redémarrage, les clés SSH seront toujours disponible dans l’agent SSH.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #EBDBB2); background-color: light-dark(#F9F5D7, #1D2021);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #FE8019);&quot;&gt;eval&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #A89984);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #A89984);&quot;&gt;$(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #FABD2F);&quot;&gt;ssh-agent&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt;s&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #A89984);&quot;&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #A89984);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#B57614, #FABD2F);&quot;&gt;ssh-add&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt;K&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #EBDBB2); background-color: light-dark(#F9F5D7, #1D2021);&quot;&gt;&lt;code data-lang=&quot;fish&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eval&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #A89984);&quot;&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ssh-agent&lt;&#x2F;span&gt;&lt;span&gt; -c&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#7C6F64, #A89984);&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ssh-add&lt;&#x2F;span&gt;&lt;span&gt; -K&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Si besoin de tuer un ssh agent existant, il suffit de faire un &lt;code&gt;eval (ssh-agent -k)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;sssd&quot;&gt;SSSD&lt;&#x2F;h2&gt;
&lt;p&gt;Ché pas ce que c’est mais ça a l’air cool pour rassembler les clés publiques à un seul et unique endroit.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;tips-en-vrac&quot;&gt;Tips en vrac&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;ssh-via-jump-host-avec-fido2&quot;&gt;SSH via “jump host” avec FIDO2&lt;&#x2F;h2&gt;
&lt;p&gt;“ProxyJump” permets d’accéder à une machine distante via une machine intermédiaire. Ça peut être pratique pour réduire les surfaces d’attaques, mettre en commun des instructions SSH ou pour avoir un unique point d’entrèe dans un réseau interne.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ssh -J &amp;lt;jump host&amp;gt; &amp;lt;remote server&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Il suffit d’avoir la clé publique partagée sur le jump host et la destination.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;exemple-de-ssh-config&quot;&gt;Exemple de &lt;code&gt;~&#x2F;.ssh&#x2F;config&lt;&#x2F;code&gt;&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#3C3836, #EBDBB2); background-color: light-dark(#F9F5D7, #1D2021);&quot;&gt;&lt;code data-lang=&quot;ssh-config&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #FE8019);&quot;&gt;Host&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #FABD2F);&quot;&gt; *&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #FB4934);&quot;&gt;  IdentityFile&lt;&#x2F;span&gt;&lt;span&gt; ~&#x2F;.ssh&#x2F;id_ed25519_sk_xyz1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #FB4934);&quot;&gt;  IdentityFile&lt;&#x2F;span&gt;&lt;span&gt; ~&#x2F;.ssh&#x2F;id_ed25519_sk_xyz2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #FB4934);&quot;&gt;  IdentityAgent&lt;&#x2F;span&gt;&lt;span&gt; none&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #FB4934);&quot;&gt;  IdentitiesOnly&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt; yes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #FB4934);&quot;&gt;  ControlPath&lt;&#x2F;span&gt;&lt;span&gt; ~&#x2F;.ssh&#x2F;controlmasters&#x2F;%r@%h:%p&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #FB4934);&quot;&gt;  ControlMaster&lt;&#x2F;span&gt;&lt;span&gt; auto&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #FB4934);&quot;&gt;  ControlPersist&lt;&#x2F;span&gt;&lt;span&gt; 30m&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#AF3A03, #FE8019);&quot;&gt;Host&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B57614, #FABD2F);&quot;&gt; hostName&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #FB4934);&quot;&gt;  User&lt;&#x2F;span&gt;&lt;span&gt; userName&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#9D0006, #FB4934);&quot;&gt;  Port&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#8F3F71, #D3869B);&quot;&gt; 22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;Host *&lt;&#x2F;code&gt; permets d’éviter de se répéter en entrant une configuration par défaut.&lt;&#x2F;p&gt;
&lt;p&gt;Le premier bloc gère les identités avec 2 clés et &lt;code&gt;IdentitiesOnly yes&lt;&#x2F;code&gt; permets de forcer à utiliser que ces identités là. Ça évite les erreurs si on a trop de clés SSH.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;IdentityAgent none&lt;&#x2F;code&gt; est imporaten car les FIDO2 avec &lt;code&gt;verify-required&lt;&#x2F;code&gt; ne semblent pas être supportés par les agents SSH.&lt;&#x2F;p&gt;
&lt;p&gt;Le second permet de partager la connexion entre de multiples sessions sur la même machine mais surtout, garder la connexion ouverte plus longtemps et évite de redemander le pin et la vérification utilisateur toutes les 3 secondes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;permissions-d-acces&quot;&gt;Permissions d’accès&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;private key (id_ed25519_sk): 600&lt;&#x2F;li&gt;
&lt;li&gt;public key (id_ed25519_sk.pub): 644&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
        
    </entry>
</feed>
