tech:notes_securite_os_gnu_linux_hardening
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:notes_securite_os_gnu_linux_hardening [2026/02/25 15:44] – Jean-Baptiste | tech:notes_securite_os_gnu_linux_hardening [2026/06/29 14:23] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Notes sécurité OS GNU/Linux hardening | ||
| + | |||
| + | Voir : | ||
| + | * [[Notes sécurité OS GNU_Linux hardening - partitions - noexec]] | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * https:// | ||
| + | * [Guide to the Secure Configuration of Red Hat Enterprise Linux 8 - ANSSI-BP-028](https:// | ||
| + | |||
| + | |||
| + | Voir aussi : | ||
| + | * CIS (Center for Internet Security) | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | |||
| + | ## Vulnérabilités connues | ||
| + | |||
| + | ~~~bash | ||
| + | apt-get install debsecan | ||
| + | debsecan | ||
| + | ~~~ | ||
| + | |||
| + | ## Mise à jour automatique | ||
| + | |||
| + | ~~~bash | ||
| + | apt-get install unattended-upgrades | ||
| + | ~~~ | ||
| + | |||
| + | ## Scan intégrité fichiers | ||
| + | |||
| + | |||
| + | |||
| + | ### Find | ||
| + | |||
| + | Recherche de fichier SUID (4000) et SGID (2000) | ||
| + | ~~~bash | ||
| + | find / -type f \( -perm -4000 -o -perm -2000 \) \ | ||
| + | -not \( \ | ||
| + | -wholename "/ | ||
| + | -o -wholename "/ | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | -o -wholename / | ||
| + | \) | ||
| + | |||
| + | #-o -wholename / | ||
| + | #-o -wholename / | ||
| + | #-o -wholename / | ||
| + | #-o -wholename / | ||
| + | #-o -wholename / | ||
| + | #-o -wholename / | ||
| + | #-o -wholename / | ||
| + | #-o -wholename / | ||
| + | #-o -wholename / | ||
| + | #-o -wholename / | ||
| + | ~~~ | ||
| + | |||
| + | Supression du bit SUID | ||
| + | ~~~bash | ||
| + | chmod u-s / | ||
| + | chmod u-s / | ||
| + | chmod u-s / | ||
| + | chmod u-s / | ||
| + | ~~~ | ||
| + | |||
| + | Supression du bit SGID | ||
| + | ~~~bash | ||
| + | chmod g-s / | ||
| + | chmod g-s / | ||
| + | chmod g-s / | ||
| + | ~~~ | ||
| + | |||
| + | Worldreadable | ||
| + | ~~~bash | ||
| + | find / \( -type d -o -type f \) -not \( -wholename "/ | ||
| + | ~~~ | ||
| + | |||
| + | ## Comptes | ||
| + | |||
| + | ~~~bash | ||
| + | perl -a -F':' | ||
| + | ~~~ | ||
| + | |||
| + | ## sysctl | ||
| + | |||
| + | Voir https:// | ||
| + | |||
| + | Interdire strace | ||
| + | ~~~bash | ||
| + | echo 3 > / | ||
| + | ~~~ | ||
| + | |||
| + | ## Mot de passe | ||
| + | |||
| + | Lenteur à la connexion | ||
| + | |||
| + | man 3 crypt | ||
| + | |||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | plop1: | ||
| + | |||
| + | plop1: | ||
| + | ~~~ | ||
| + | |||
| + | https:// | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | # | ||
| + | password | ||
| + | ~~~ | ||
| + | |||
| + | Voir `SHA_CRYPT_MIN_ROUNDS` | ||
| + | |||
| + | ~~~bash | ||
| + | man pam_unix | ||
| + | |||
| + | sudo chpasswd -s 10000 000 -c SHA512 <<< | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | password | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | auth required pam_tally2.so onerr=fail deny=3 unlock_time=900 root_unlock_time=900 file=/ | ||
| + | |||
| + | pam_tally2 --file / | ||
| + | |||
| + | pam_faildelay.so | ||
| + | faillock --user aaronkilik --reset | ||
| + | faillock --user aaronkilik | ||
| + | fail --reset # | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | chown root:root / | ||
| + | chmod og-rwx / | ||
| + | ~~~ | ||
| + | |||
| + | Set the following restrict parameters in / | ||
| + | `/ | ||
| + | ~~~ | ||
| + | restrict default kod nomodify notrap nopeer noquery | ||
| + | restrict -6 default kod nomodify notrap nopeer noquery | ||
| + | ~~~ | ||
| + | |||
| + | Set the following restrict parameters in / | ||
| + | `/ | ||
| + | ~~~ | ||
| + | restrict default kod nomodify notrap nopeer noquery | ||
| + | restrict -6 default kod nomodify notrap nopeer noquery | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | Also, make sure / | ||
| + | server < | ||
| + | ~~~ | ||
| + | |||
| + | Set the `net.ipv4.ip_forward` parameter to 0 in / | ||
| + | Modify active kernel parameters to match: | ||
| + | ~~~bash | ||
| + | / | ||
| + | / | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | chown root:root /etc/cron.d | ||
| + | chmod og-rwx /etc/cron.d | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | rm / | ||
| + | touch / | ||
| + | chown root:root / | ||
| + | chmod og-rwx / | ||
| + | ~~~ | ||
| + | |||
| + | Edit the /etc/bashrc and / | ||
| + | following the UMASK parameter as shown | ||
| + | ~~~ | ||
| + | umask 027 | ||
| + | ~~~ | ||
| + | |||
| + | Pas de version dans les fichiers suivants | ||
| + | * /etc/motd | ||
| + | * / | ||
| + | * / | ||
| + | |||
| + | |||
| + | ## Service SystemD | ||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | [Unit] | ||
| + | Description=Bridge to Ubuntu Pro agent on Windows | ||
| + | ConditionVirtualization=wsl | ||
| + | |||
| + | [Service] | ||
| + | Type=notify | ||
| + | ExecStart=/ | ||
| + | Restart=always | ||
| + | RestartSec=2s | ||
| + | |||
| + | # Some daemon restrictions | ||
| + | LockPersonality=yes | ||
| + | MemoryDenyWriteExecute=yes | ||
| + | NoNewPrivileges=true | ||
| + | PrivateDevices=yes | ||
| + | PrivateMounts=yes | ||
| + | PrivateTmp=yes | ||
| + | ProtectClock=yes | ||
| + | ProtectControlGroups=yes | ||
| + | ProtectHostname=yes | ||
| + | ProtectKernelLogs=yes | ||
| + | ProtectKernelModules=yes | ||
| + | ProtectKernelTunables=yes | ||
| + | RestrictNamespaces=yes | ||
| + | RestrictRealtime=yes | ||
| + | RestrictSUIDSGID=yes | ||
| + | SystemCallArchitectures=native | ||
| + | |||
| + | # Only permit system calls used by common system services, excluding any special purpose calls | ||
| + | SystemCallFilter=@system-service | ||
| + | |||
| + | [Install] | ||
| + | WantedBy=multi-user.target | ||
| + | ~~~ | ||
| + | |||
| + | ## Autre | ||
| + | |||
| + | ~~~bash | ||
| + | apt-get install auditd | ||
| + | ~~~ | ||
| + | |||
| + | Partition dédiée pour | ||
| + | * /var/log | ||
| + | * / | ||
| + | |||
| + | |||
