<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Bits on Humberto Rocha</title><link>https://humberto.io/fr/bits/</link><description>Recent content in Bits on Humberto Rocha</description><generator>Hugo</generator><language>fr</language><atom:link href="https://humberto.io/fr/bits/index.xml" rel="self" type="application/rss+xml"/><item><title>Extraire le certificat d'un domaine</title><link>https://humberto.io/fr/bits/extraire-le-certificat-d-un-domaine/</link><pubDate>Sun, 06 Jul 2025 00:00:00 +0000</pubDate><guid>https://humberto.io/fr/bits/extraire-le-certificat-d-un-domaine/</guid><description>&lt;p>Pour extraire le certificat utilisez:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>openssl s_client -showcerts -servername humberto.io -connect humberto.io:443 &amp;lt;/dev/null 2&amp;gt;/dev/null
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Si votre cible n&amp;rsquo;utilise pas &lt;a href="https://fr.wikipedia.org/wiki/Server_Name_Indication">SNI&lt;/a> vous pouvez enlever l&amp;rsquo;option &lt;code>-servername &amp;lt;fqdn&amp;gt;&lt;/code>.&lt;/p>
&lt;p>Après vous pouvez l&amp;rsquo;enchainer avec d&amp;rsquo;autres commandes OpenSSL pour extraire de l&amp;rsquo;information dans le format dont vous avez besoin.&lt;/p>
&lt;p>Pour extraire le certificat dans le format PEM:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>| openssl x509 -outform PEM
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Pour extraire la clé publique:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>| openssl x509 -pubkey -noout
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Pour extraire son empreinte:&lt;/p></description></item><item><title>Extraire le certificat et la clé d'un fichier .pfx</title><link>https://humberto.io/fr/bits/extraire-le-certificat-et-la-cle-d-un-fichier-pfx/</link><pubDate>Mon, 10 Jul 2023 00:00:00 +0000</pubDate><guid>https://humberto.io/fr/bits/extraire-le-certificat-et-la-cle-d-un-fichier-pfx/</guid><description>&lt;p>Extrayez le certificat du fichier &lt;code>.pfx&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>openssl pkcs12 -in &amp;lt;FICHIER_POINT_PFX&amp;gt; -clcerts -nokeys -chain -out certificate.crt
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Extrayez la clé privée au format &lt;code>.pem&lt;/code> sans cryptage du fichier &lt;code>.pfx&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>openssl pkcs12 -in &amp;lt;FICHIER_POINT_PFX&amp;gt; -nocerts -nodes -out private_key.pem
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Convertissez le &lt;code>.pem&lt;/code> au format de clé &lt;code>RSA&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-shell" data-lang="shell">&lt;span style="display:flex;">&lt;span>openssl rsa -in private_key.pem -out id_rsa
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Si vous utilisez OpenSSL 3, le format de sortie par défaut sera &amp;ldquo;PKCS8&amp;rdquo;, avec des limites d&amp;rsquo;encapsulation au format suivant:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-text" data-lang="text">&lt;span style="display:flex;">&lt;span>-----BEGIN PRIVATE KEY-----
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-----END PRIVATE KEY-----
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Si vous avez besoin de la clé au format &lt;code>PKCS1&lt;/code>, c&amp;rsquo;est-à-dire traditionnel, utilisez la flag &lt;code>-traditional&lt;/code> comme ceci:&lt;/p></description></item><item><title>Connecter dans un Pod Kubernetes</title><link>https://humberto.io/fr/bits/connecter-dans-un-pod-kubernetes/</link><pubDate>Wed, 07 Dec 2022 00:00:00 +0000</pubDate><guid>https://humberto.io/fr/bits/connecter-dans-un-pod-kubernetes/</guid><description>&lt;p>Pour ouvrir une session il faut d&amp;rsquo;abord connaître le nom du Pod.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>kubectl get pod -n &amp;lt;namespace&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Ensuite, ouvrez une session bash:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>kubectl exec --stdin --tty &amp;lt;nom du pod&amp;gt; -n &amp;lt;namespace&amp;gt; -- /bin/bash
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Il est aussi possible d&amp;rsquo;ouvrir une session shell:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>kubectl exec --stdin --tty &amp;lt;nom du pod&amp;gt; -n &amp;lt;namespace&amp;gt; -- /bin/sh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Quelques fois, il est nécessaire de démarrer un nouveau Pod à partir d&amp;rsquo;une image ayant les outils nécessaires pour faire des inspections.&lt;/p></description></item><item><title>Session interactive dans un conteneur Docker</title><link>https://humberto.io/fr/bits/session-interactive-dans-un-conteneur-docker/</link><pubDate>Tue, 22 Nov 2022 00:00:00 +0000</pubDate><guid>https://humberto.io/fr/bits/session-interactive-dans-un-conteneur-docker/</guid><description>&lt;p>Pour ouvrir une session bash dans un conteneur executez:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>docker exec -it &amp;lt;nom-du-conteneur&amp;gt; /bin/bash
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Dans le cas où l&amp;rsquo;image est minimaliste il est toujours possible d&amp;rsquo;ouvrir une session shell:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>docker exec -it &amp;lt;nom-du-conteneur&amp;gt; /bin/sh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;aside class="tip warning">
 Il est seulement possible d&amp;rsquo;ouvrir une session dans un conteneur qui est en cours d&amp;rsquo;exécution, donc vérifiez son statut avec &lt;code>docker ps&lt;/code> avant de essayer ouvrir une session.
&lt;/aside>

&lt;p>Si vous ne rappelez pas le nom du conteneur, listez-les avec:&lt;/p></description></item><item><title>Docker sans root</title><link>https://humberto.io/fr/bits/docker-sans-root/</link><pubDate>Sat, 30 Jul 2022 00:00:00 +0000</pubDate><guid>https://humberto.io/fr/bits/docker-sans-root/</guid><description>&lt;p>Créez le groupe &lt;code>docker&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>sudo groupadd docker
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Ajoutez l&amp;rsquo;utilisateur au groupe &lt;code>docker&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>sudo usermod -aG docker $USER
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Appliquez les changements au groupe.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>newgrp docker
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Vérifiez s&amp;rsquo;il est possible d&amp;rsquo;exécuter &lt;code>docker&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>docker version
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;aside class="tip warning">
 Il n&amp;rsquo;est pas recommandé de le faire avec des serveurs qui sont branchés a l&amp;rsquo;Internet, gardez les privilèges d&amp;rsquo;exécuter &lt;code>docker&lt;/code> au &lt;code>root&lt;/code>.
&lt;/aside></description></item><item><title>Utiliser le portable avec le capot fermé</title><link>https://humberto.io/fr/bits/utiliser-le-portable-avec-le-capot-ferme/</link><pubDate>Sat, 30 Jul 2022 00:00:00 +0000</pubDate><guid>https://humberto.io/fr/bits/utiliser-le-portable-avec-le-capot-ferme/</guid><description>&lt;p>Modifiez le fichier &lt;code>/etc/systemd/logind.conf&lt;/code> et changez les lignes suivantes:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-ini" data-lang="ini">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#89b4fa">HandleLidSwitch&lt;/span>&lt;span style="color:#89dceb;font-weight:bold">=&lt;/span>&lt;span style="color:#a6e3a1">ignore&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#89b4fa">HandleLidSwitchExternalPower&lt;/span>&lt;span style="color:#89dceb;font-weight:bold">=&lt;/span>&lt;span style="color:#a6e3a1">ignore&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#89b4fa">HandleLidSwitchDocked&lt;/span>&lt;span style="color:#89dceb;font-weight:bold">=&lt;/span>&lt;span style="color:#a6e3a1">ignore&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Après redémarrez le service:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>sudo systemctl restart systemd-logind.service
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Éteindre automatiquement l'écran du portable</title><link>https://humberto.io/fr/bits/eteindre-automatiquement-l-ecran-du-portable/</link><pubDate>Fri, 29 Jul 2022 00:00:00 +0000</pubDate><guid>https://humberto.io/fr/bits/eteindre-automatiquement-l-ecran-du-portable/</guid><description>&lt;p>Modifiez le fichier &lt;code>/etc/default/grub&lt;/code> et ajoutez le contenu suivant à la variable &lt;code>GRUB_CMDLINE_LINUX&lt;/code>:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-ini" data-lang="ini">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#89b4fa">GRUB_CMDLINE_LINUX&lt;/span>&lt;span style="color:#89dceb;font-weight:bold">=&lt;/span>&lt;span style="color:#a6e3a1">&amp;#34;consoleblank=300&amp;#34; # éteindre l&amp;#39;écran après 5 minutes&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Puis mettez a jour grub:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>sudo update-grub
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item><item><title>Mise a jour de plusieurs dépôts</title><link>https://humberto.io/fr/bits/mise-a-jour-de-plusieurs-depots/</link><pubDate>Mon, 23 May 2022 00:00:00 +0000</pubDate><guid>https://humberto.io/fr/bits/mise-a-jour-de-plusieurs-depots/</guid><description>&lt;p>Une astuce pour quand on a une liste de dépôts git à mettre a jour:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c &amp;#34;cd &amp;#39;{}&amp;#39; &amp;amp;&amp;amp; git pull &amp;amp;&amp;amp; cd ..&amp;#34; \;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>La partie &lt;code>\( ! -name . \)&lt;/code> de la commande est utilisée pour n&amp;rsquo;est pas exécuter la commande avec le fichier &lt;code>.&lt;/code>.&lt;/p></description></item><item><title>Recherche et remplacement de sauts de ligne dans vim</title><link>https://humberto.io/fr/bits/recherche-et-remplacement-de-sauts-de-ligne-dans-vim/</link><pubDate>Sun, 20 Feb 2022 00:00:00 +0000</pubDate><guid>https://humberto.io/fr/bits/recherche-et-remplacement-de-sauts-de-ligne-dans-vim/</guid><description>&lt;p>Il y a deux caractères spéciaux différents qui sont utilisés pour les sauts de ligne:&lt;/p>
&lt;ul>
&lt;li>&lt;code>\n&lt;/code> représente le caractère de nouvelle ligne &lt;code>0x0a&lt;/code>&lt;/li>
&lt;li>&lt;code>\r&lt;/code> représente le caractère de retour chariot &lt;code>0x0d&lt;/code>&lt;/li>
&lt;/ul>
&lt;p>Mais, dans le coté remplacement du modèle de recherche de vim les choses changent un peut:&lt;/p>
&lt;ul>
&lt;li>&lt;code>\n&lt;/code> deviens le caractère nul &lt;code>0x00&lt;/code>&lt;/li>
&lt;li>&lt;code>\r&lt;/code> deviens le caractère de retour chariot &lt;code>0x0a&lt;/code>&lt;/li>
&lt;/ul>
&lt;p>Alors, pour rechercher le saut de ligne on utilise le &lt;code>\n&lt;/code> et pour le remplacer on utilise le &lt;code>\r&lt;/code>.&lt;/p></description></item><item><title>Commit vide</title><link>https://humberto.io/fr/bits/commit-vide/</link><pubDate>Fri, 18 Feb 2022 00:00:00 +0000</pubDate><guid>https://humberto.io/fr/bits/commit-vide/</guid><description>&lt;p>Parfois on veut juste faire un commit vide pour démarrer le CI, ou pour démarrer un webhook.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-console" data-lang="console">&lt;span style="display:flex;">&lt;span>git commit --allow-empty -m &amp;#34;Trigger CI&amp;#34;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item></channel></rss>