tech:generer_un_mot_de_passe
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| tech:generer_un_mot_de_passe [2025/03/24 15:06] – créée - modification externe 127.0.0.1 | tech:generer_un_mot_de_passe [2025/07/21 14:32] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| {{tag> | {{tag> | ||
| - | = Générer un mot de passe | + | # Générer un mot de passe |
| Un bon mot de passe contient : majuscule, minuscule, trait d' | Un bon mot de passe contient : majuscule, minuscule, trait d' | ||
| Ligne 7: | Ligne 8: | ||
| Keepassx / Keepass propose un générateur de mot de passe. | Keepassx / Keepass propose un générateur de mot de passe. | ||
| - | Générer un mot de passe vous-même : [[https:// | + | Générer un mot de passe vous-même : [Gérer ses mots de passe](https:// |
| Sinon : | Sinon : | ||
| - | < | + | ~~~bash |
| dd if=/ | dd if=/ | ||
| - | </ | + | ~~~ |
| ou | ou | ||
| - | < | + | ~~~bash |
| cat / | cat / | ||
| - | </ | + | ~~~ |
| Pour un code décimal | Pour un code décimal | ||
| - | < | + | ~~~bash |
| echo $RANDOM$RANDOM | echo $RANDOM$RANDOM | ||
| - | </ | + | ~~~ |
| Aléatoirement A ou B | Aléatoirement A ou B | ||
| - | < | + | ~~~bash |
| r=(A B) | r=(A B) | ||
| echo ${r[RANDOM%2]} | echo ${r[RANDOM%2]} | ||
| - | </ | + | ~~~ |
| Avec pwgen | Avec pwgen | ||
| - | < | + | ~~~bash |
| pwgen -Bs1 16 | pwgen -Bs1 16 | ||
| pwgen -y1 16 | pwgen -y1 16 | ||
| - | </ | + | ~~~ |
| Avec OpenSSL | Avec OpenSSL | ||
| - | < | + | ~~~bash |
| openssl rand -hex 10 | openssl rand -hex 10 | ||
| openssl rand -base64 16 | sed -e " | openssl rand -base64 16 | sed -e " | ||
| openssl rand 300 |perl -pe ' | openssl rand 300 |perl -pe ' | ||
| - | </ | + | ~~~ |
| Avec apg | Avec apg | ||
| - | < | + | ~~~bash |
| apg -q -a 0 -n 1 -m 12 -M NCL | apg -q -a 0 -n 1 -m 12 -M NCL | ||
| apg -a 1 -m 32 -n 1 -M NCL | apg -a 1 -m 32 -n 1 -M NCL | ||
| - | </ | + | ~~~ |
| Avec GPG | Avec GPG | ||
| - | < | + | ~~~bash |
| gpg --gen-random --armor 0 24 | gpg --gen-random --armor 0 24 | ||
| - | </ | + | ~~~ |
| Avec Ansible \\ | Avec Ansible \\ | ||
| Ligne 63: | Ligne 64: | ||
| Hash md5 | Hash md5 | ||
| - | < | + | ~~~bash |
| mkpasswd --hash=md5 $PASS | mkpasswd --hash=md5 $PASS | ||
| - | </ | + | ~~~ |
| Hash SHA-512 ('' | Hash SHA-512 ('' | ||
| - | < | + | ~~~bash |
| mkpasswd --method=sha-512 | mkpasswd --method=sha-512 | ||
| - | </ | + | ~~~ |
| - | < | + | ~~~bash |
| openssl passwd -6 -salt MySaltPlop | openssl passwd -6 -salt MySaltPlop | ||
| openssl passwd -6 <(echo ' | openssl passwd -6 <(echo ' | ||
| - | </ | + | ~~~ |
| - | <code -> | + | ~~~ |
| $ man crypt | $ man crypt | ||
| ID | Method | ID | Method | ||
| Ligne 86: | Ligne 87: | ||
| 5 | SHA-256 (since glibc 2.7) | 5 | SHA-256 (since glibc 2.7) | ||
| 6 | SHA-512 (since glibc 2.7) | 6 | SHA-512 (since glibc 2.7) | ||
| - | </ | + | ~~~ |
| - | == Autres | ||
| + | ## Autres | ||
| - | + | ~~~bash | |
| - | + | ||
| - | == Autres | + | |
| - | + | ||
| - | < | + | |
| / | / | ||
| - | </ | + | ~~~ |
| - | == Entropie / | + | ## Entropie / |
| Ligne 112: | Ligne 109: | ||
| Voir : | Voir : | ||
| - | * [[https:// | + | * [BoottimeEntropyStarvation](https:// |
| + | * https:// | ||
| * https:// | * https:// | ||
| * https:// | * https:// | ||
| Ligne 123: | Ligne 121: | ||
| Voir one-rng | Voir one-rng | ||
| - | * [[https:// | + | * [one-rng](https:// |
| * https:// | * https:// | ||
| Ligne 132: | Ligne 130: | ||
| Check the available entropy | Check the available entropy | ||
| - | < | + | ~~~bash |
| cat / | cat / | ||
| - | </ | + | ~~~ |
| - | ==== rngd - rng-tools | + | |
| + | #### rngd - rng-tools | ||
| Sur RedHat | Sur RedHat | ||
| - | < | + | ~~~bash |
| yum install rng-tools | yum install rng-tools | ||
| systemctl enable --now rngd | systemctl enable --now rngd | ||
| - | </ | + | ~~~ |
| - | <code -> | + | ~~~ |
| # systemctl status rngd | # systemctl status rngd | ||
| ● rngd.service - Hardware RNG Entropy Gatherer Daemon | ● rngd.service - Hardware RNG Entropy Gatherer Daemon | ||
| Ligne 154: | Ligne 153: | ||
| | | ||
| | | ||
| - | </ | + | ~~~ |
| - | === Non-preferred method: seed randomness source from non-blocking source | + | ### Non-preferred method: seed randomness source from non-blocking source |
| source : https:// | source : https:// | ||
| Ligne 165: | Ligne 165: | ||
| You can see the entropy value using the following command: | You can see the entropy value using the following command: | ||
| Raw | Raw | ||
| - | < | + | ~~~bash |
| cat / | cat / | ||
| - | </ | + | ~~~ |
| Now, start the rngd daemon using following command and monitor the entropy on the system: | Now, start the rngd daemon using following command and monitor the entropy on the system: | ||
| Raw | Raw | ||
| - | < | + | ~~~bash |
| rngd -r / | rngd -r / | ||
| watch -n 1 cat / | watch -n 1 cat / | ||
| - | </ | + | ~~~ |
| NOTE: Seeding /dev/random with data derived from / | NOTE: Seeding /dev/random with data derived from / | ||
| - | === Autres | + | ### Autres |
| Voir | Voir | ||
| Ligne 189: | Ligne 189: | ||
| If you run the following, you will may see that available entropy is very low (< 128) and thus reading from /dev/random is likely to block. | If you run the following, you will may see that available entropy is very low (< 128) and thus reading from /dev/random is likely to block. | ||
| Raw | Raw | ||
| - | < | + | ~~~bash |
| while sleep 1; do cat / | while sleep 1; do cat / | ||
| - | </ | + | ~~~ |
| You can set this temporarily to 1024 (default is 64) | You can set this temporarily to 1024 (default is 64) | ||
| Raw | Raw | ||
| - | < | + | ~~~bash |
| echo 1024 > / | echo 1024 > / | ||
| - | </ | + | ~~~ |
| - | === Test | + | ### Test |
| An entropy source can be tested for (FIPS-compliant) randomness using the rng-tools or rng-utils. | An entropy source can be tested for (FIPS-compliant) randomness using the rng-tools or rng-utils. | ||
| - | < | + | ~~~bash |
| rngtest -c 1000 </ | rngtest -c 1000 </ | ||
| - | </ | + | ~~~ |
| Voir https:// | Voir https:// | ||
| - | === TRNG | + | ### TRNG |
| scdrand | scdrand | ||
| Ligne 218: | Ligne 218: | ||
| - | === Pb boot | + | ### Pb boot |
| - | <code -> | + | ~~~ |
| [ 1.616819] random: fast init done | [ 1.616819] random: fast init done | ||
| [ 2.299314] random: crng init done | [ 2.299314] random: crng init done | ||
| - | </ | + | ~~~ |
| Kernel boot parameter | Kernel boot parameter | ||
| - | < | + | ~~~ini |
| random.trust_cpu=on | random.trust_cpu=on | ||
| - | </ | + | ~~~ |
| Voir https:// | Voir https:// | ||
| - | == Infinite Noise TRNG | + | ## Infinite Noise TRNG |
| Voir : | Voir : | ||
| * http:// | * http:// | ||
| - | < | + | ~~~bash |
| apt-get install infnoise | apt-get install infnoise | ||
| - | </ | + | ~~~ |
| - | <code -> | + | ~~~ |
| # #infnoise --raw --debug > / | # #infnoise --raw --debug > / | ||
| # infnoise --debug --no-output | # infnoise --debug --no-output | ||
| Ligne 250: | Ligne 250: | ||
| Generated 3145728 bits. OK to use data. Estimated entropy per bit: 0.872259, estimated K: 1.830528 | Generated 3145728 bits. OK to use data. Estimated entropy per bit: 0.872259, estimated K: 1.830528 | ||
| num1s: | num1s: | ||
| - | </ | + | ~~~ |
| - | <code -> | + | ~~~ |
| # systemctl status infnoise | # systemctl status infnoise | ||
| ● infnoise.service - Wayward Geek InfNoise TRNG driver | ● infnoise.service - Wayward Geek InfNoise TRNG driver | ||
| Ligne 269: | Ligne 269: | ||
| Jul 24 20:23:18 vivobela systemd[1]: Starting infnoise.service - Wayward Geek InfNoise TRNG driver... | Jul 24 20:23:18 vivobela systemd[1]: Starting infnoise.service - Wayward Geek InfNoise TRNG driver... | ||
| Jul 24 20:23:18 vivobela systemd[1]: Started infnoise.service - Wayward Geek InfNoise TRNG driver. | Jul 24 20:23:18 vivobela systemd[1]: Started infnoise.service - Wayward Geek InfNoise TRNG driver. | ||
| - | </ | + | ~~~ |
| - | < | + | ~~~bash |
| systemctl status dev-infnoise.device | systemctl status dev-infnoise.device | ||
| - | </ | + | ~~~ |
tech/generer_un_mot_de_passe.1742825205.txt.gz · Dernière modification : de 127.0.0.1
