Pasé lynis audit system por una máquina mía y salieron 65 sobre 100, un
aviso y cuarenta y cuatro sugerencias. Lo normal a partir de ahí es mirar
la lista, no entender la mitad de los identificadores, aplicar a ciegas los
tres que suenan y cerrar la terminal.
Así que en vez de una captura de pantalla, aquí está el informe entero con una ficha de cada hallazgo: qué es, por qué importa, cómo se arregla y —esto es lo que casi nunca se cuenta— cuándo conviene no arreglarlo.
Y como el informe de cada máquina es distinto, el visor acepta el tuyo: pegas la salida de tu terminal y sale tu plan de trabajo, con la tabla de controles, el registro de excepciones y el esqueleto del script de remedio. Todo ocurre en tu navegador; esta página no hace ni una petición. Un informe de Lynis es la lista de lo que le falta a tu máquina, y eso no se sube a ningún sitio.
Qué es Lynis y qué no es
Lynis es un guion de shell que recorre el sistema y hace unas doscientas sesenta comprobaciones. No explota nada, no toca nada y no necesita instalar un agente: lee configuración y responde. Por eso se puede pasar en producción sin miedo — lo único que puede pasar es que tarde.
Lo que devuelve son tres cosas distintas, y confundirlas es el error de lectura más común:
| qué es | |
|---|---|
| Avisos | Algo que Lynis considera un problema. Van aparte y son lo primero. |
| Sugerencias | Margen de mejora. Cada una con su identificador, tipo AUTH-9262. |
| Índice de endurecimiento | Un número de 0 a 100. No es una nota. |
El índice sale de los puntos que se apunta cada prueba superada sobre los que había en juego. Sirve para comparar la misma máquina antes y después, que es exactamente lo que se pide en una práctica de bastionado. No sirve para comparar dos máquinas distintas: un servidor sin entorno gráfico y sin impresora parte con ventaja sobre un portátil, y eso no dice nada de quién lo administra mejor.
Y hay una cuarta categoría que no aparece en ningún resumen: las pruebas que no se ejecutan. En este informe, Lynis encontró Apache pero no supo cuál era su configuración real, avisó con una excepción y se saltó parte de las pruebas del servidor web. Eso no es un aprobado: es un hueco. En el informe que entregues, los huecos van escritos.
Un benchmark no es tu política, y ninguno de los dos es la norma
Tres cosas que se parecen y no son lo mismo:
- Tu política dice lo que tu organización ha decidido. Es corta, es tuya y la aprueba la dirección. Auditarla con éxito no garantiza nada: una política pobre auditada con éxito sigue siendo una política pobre.
- El CIS Benchmark es el contraste externo: cientos de controles concretos, con su comprobación y su remedio, escritos y revisados por gente de fuera de tu casa. Es lo que te dice si lo que has escrito se parece a lo que hace el resto del mundo.
- La ISO/IEC 27001 no te dice qué valor poner en
login.defs. Te dice cómo se gestiona la seguridad: quién decide, qué se documenta, cómo se revisa. El benchmark es el «qué»; la norma, el «cómo se gobierna».
Dentro del benchmark hay dos niveles y dos perfiles, y esa separación es una decisión de diseño, no burocracia. El nivel 1 son medidas que casi nunca rompen nada; el nivel 2 aprieta más y cuesta servicio. El perfil de servidor y el de estación de trabajo difieren justo donde tienen que diferir: desactivar el almacenamiento USB es evidente en un servidor dentro de un armario y un fastidio diario en un portátil.
Por eso cada control del benchmark trae una sección de impacto. Un documento que solo dijera «haz esto» estaría escrito por alguien que nunca ha roto un servidor aplicando una lista a ciegas.
El informe, explicado
Abajo está el informe completo, tal cual salió de la terminal. Cada sección se despliega, cada hallazgo se abre y el botón Ampliar lo pone a pantalla completa. Lo único que he cambiado es el nombre de la máquina.
Si vas a mirar una sola pestaña, que sea Núcleo: son diecisiete parámetros
marcados como DIFFERENT que la gente copia y pega en bloque, y dos de ellos
dejan sin red a los contenedores o impiden cargar el módulo de la tarjeta de
red que te falte.
El visor necesita JavaScript. Debajo tienes el informe completo tal cual salió de la terminal.
root@fmesasc:~# lynis audit system
[ Lynis 3.0.8 ]
2007-2021, CISOfy - https://cisofy.com/lynis/
[+] Initializing program
------------------------------------
- Detecting OS... [ DONE ]
- Checking profiles... [ DONE ]
---------------------------------------------------
Program version: 3.0.8
Operating system: Linux
Operating system name: Debian
Operating system version: 12
Kernel version: 6.12.95
Hardware platform: x86_64
Hostname: fmesasc
---------------------------------------------------
Profiles: /etc/lynis/default.prf
Log file: /var/log/lynis.log
Report file: /var/log/lynis-report.dat
Report version: 1.0
Plugin directory: /etc/lynis/plugins
---------------------------------------------------
Auditor: [Not Specified]
Language: en
Test category: all
Test group: all
---------------------------------------------------
- Program update status... [ NO UPDATE ]
[+] System tools
------------------------------------
- Scanning available tools...
- Checking system binaries...
[+] Plugins (phase 1)
------------------------------------
- Plugin: debian
[+] Debian Tests
------------------------------------
- Checking for system binaries that are required by Debian Tests...
- Checking /bin... [ FOUND ]
- Checking /sbin... [ FOUND ]
- Checking /usr/bin... [ FOUND ]
- Checking /usr/sbin... [ FOUND ]
- Checking /usr/local/bin... [ FOUND ]
- Checking /usr/local/sbin... [ FOUND ]
- Authentication:
- PAM (Pluggable Authentication Modules):
- libpam-tmpdir [ Not Installed ]
- File System Checks:
- DM-Crypt, Cryptsetup & Cryptmount:
- Software:
- apt-listbugs [ Not Installed ]
- apt-listchanges [ Installed and enabled for apt ]
- needrestart [ Not Installed ]
- fail2ban [ Not Installed ]
[+] Boot and services
------------------------------------
- Service Manager [ systemd ]
- Checking UEFI boot [ ENABLED ]
- Checking Secure Boot [ DISABLED ]
- Checking presence GRUB2 [ FOUND ]
- Checking for password protection [ NONE ]
- Check running services (systemctl) [ DONE ]
Result: found 32 running services
- Check enabled services at boot (systemctl) [ DONE ]
Result: found 35 enabled services
- Check startup files (permissions) [ OK ]
- Running 'systemd-analyze security'
- ModemManager.service: [ MEDIUM ]
- NetworkManager.service: [ EXPOSED ]
- accounts-daemon.service: [ MEDIUM ]
- alsa-state.service: [ UNSAFE ]
- anacron.service: [ UNSAFE ]
- avahi-daemon.service: [ UNSAFE ]
- blueman-mechanism.service: [ UNSAFE ]
- bluetooth.service: [ MEDIUM ]
- bolt.service: [ MEDIUM ]
- colord.service: [ EXPOSED ]
- containerd.service: [ UNSAFE ]
- cron.service: [ UNSAFE ]
- cups-browsed.service: [ UNSAFE ]
- cups.service: [ UNSAFE ]
- dbus.service: [ UNSAFE ]
- docker.service: [ UNSAFE ]
- emergency.service: [ UNSAFE ]
- [email protected]: [ UNSAFE ]
- lightdm.service: [ UNSAFE ]
- low-memory-monitor.service: [ MEDIUM ]
- lynis.service: [ UNSAFE ]
- ollama.service: [ UNSAFE ]
- packagekit.service: [ UNSAFE ]
- plymouth-start.service: [ UNSAFE ]
- polkit.service: [ UNSAFE ]
- rc-local.service: [ UNSAFE ]
- rescue.service: [ UNSAFE ]
- rtkit-daemon.service: [ MEDIUM ]
- smartmontools.service: [ UNSAFE ]
- switcheroo-control.service: [ EXPOSED ]
- systemd-ask-password-console.service: [ UNSAFE ]
- systemd-ask-password-plymouth.service: [ UNSAFE ]
- systemd-ask-password-wall.service: [ UNSAFE ]
- systemd-fsckd.service: [ UNSAFE ]
- systemd-initctl.service: [ UNSAFE ]
- systemd-journald.service: [ PROTECTED ]
- systemd-logind.service: [ PROTECTED ]
- systemd-networkd.service: [ PROTECTED ]
- systemd-timesyncd.service: [ PROTECTED ]
- systemd-udevd.service: [ MEDIUM ]
- udisks2.service: [ UNSAFE ]
- unattended-upgrades.service: [ UNSAFE ]
- upower.service: [ PROTECTED ]
- [email protected]: [ UNSAFE ]
- uuidd.service: [ MEDIUM ]
- wpa_supplicant.service: [ UNSAFE ]
- zerotier-one.service: [ UNSAFE ]
[+] Kernel
------------------------------------
- Checking default run level [ RUNLEVEL 5 ]
- Checking CPU support (NX/PAE)
CPU support: PAE and/or NoeXecute supported [ FOUND ]
- Checking kernel version and release [ DONE ]
- Checking kernel type [ DONE ]
- Checking loaded kernel modules [ DONE ]
Found 255 active modules
- Checking Linux kernel configuration file [ FOUND ]
- Checking default I/O kernel scheduler [ NOT FOUND ]
- Checking for available kernel update [ OK ]
- Checking core dumps configuration
- configuration in systemd conf files [ DEFAULT ]
- configuration in /etc/profile [ DEFAULT ]
- 'hard' configuration in /etc/security/limits.conf [ DEFAULT ]
- 'soft' configuration in /etc/security/limits.conf [ DEFAULT ]
- Checking setuid core dumps configuration [ DISABLED ]
- Check if reboot is needed [ NO ]
[+] Memory and Processes
------------------------------------
- Checking /proc/meminfo [ FOUND ]
- Searching for dead/zombie processes [ NOT FOUND ]
- Searching for IO waiting processes [ NOT FOUND ]
- Search prelink tooling [ NOT FOUND ]
[+] Users, Groups and Authentication
------------------------------------
- Administrator accounts [ OK ]
- Unique UIDs [ OK ]
- Consistency of group files (grpck) [ OK ]
- Unique group IDs [ OK ]
- Unique group names [ OK ]
- Password file consistency [ OK ]
- Password hashing methods [ OK ]
- Checking password hashing rounds [ DISABLED ]
- Query system users (non daemons) [ DONE ]
- NIS+ authentication support [ NOT ENABLED ]
- NIS authentication support [ NOT ENABLED ]
- Sudoers file(s) [ FOUND ]
- Permissions for directory: /etc/sudoers.d [ WARNING ]
- Permissions for: /etc/sudoers [ OK ]
- Permissions for: /etc/sudoers.d/panel [ OK ]
- Permissions for: /etc/sudoers.d/README [ OK ]
- PAM password strength tools [ SUGGESTION ]
- PAM configuration files (pam.conf) [ FOUND ]
- PAM configuration files (pam.d) [ FOUND ]
- PAM modules [ FOUND ]
- LDAP module in PAM [ NOT FOUND ]
- Accounts without expire date [ SUGGESTION ]
- Accounts without password [ OK ]
- Locked accounts [ OK ]
- Checking user password aging (minimum) [ DISABLED ]
- User password aging (maximum) [ DISABLED ]
- Checking expired passwords [ OK ]
- Checking Linux single user mode authentication [ OK ]
- Determining default umask
- umask (/etc/profile) [ NOT FOUND ]
- umask (/etc/login.defs) [ SUGGESTION ]
- LDAP authentication support [ NOT ENABLED ]
- Logging failed login attempts [ ENABLED ]
[+] Shells
------------------------------------
- Checking shells from /etc/shells
Result: found 8 shells (valid shells: 8).
- Session timeout settings/tools [ NONE ]
- Checking default umask values
- Checking default umask in /etc/bash.bashrc [ NONE ]
- Checking default umask in /etc/profile [ NONE ]
[+] File systems
------------------------------------
- Checking mount points
- Checking /home mount point [ SUGGESTION ]
- Checking /tmp mount point [ SUGGESTION ]
- Checking /var mount point [ SUGGESTION ]
- Query swap partitions (fstab) [ NONE ]
- Testing swap partitions [ OK ]
- Testing /proc mount (hidepid) [ SUGGESTION ]
- Checking for old files in /tmp [ OK ]
- Checking /tmp sticky bit [ OK ]
- Checking /var/tmp sticky bit [ OK ]
- ACL support root file system [ ENABLED ]
- Mount options of / [ NON DEFAULT ]
- Mount options of /dev [ PARTIALLY HARDENED ]
- Mount options of /dev/shm [ PARTIALLY HARDENED ]
- Mount options of /run [ HARDENED ]
- Total without nodev:12 noexec:15 nosuid:10 ro or noexec (W^X): 15 of total 35
- Disable kernel support of some filesystems
[+] USB Devices
------------------------------------
- Checking usb-storage driver (modprobe config) [ NOT DISABLED ]
- Checking USB devices authorization [ ENABLED ]
- Checking USBGuard [ NOT FOUND ]
[+] Storage
------------------------------------
- Checking firewire ohci driver (modprobe config) [ NOT DISABLED ]
[+] NFS
------------------------------------
- Check running NFS daemon [ NOT FOUND ]
[+] Name services
------------------------------------
- Checking search domains [ FOUND ]
- Searching DNS domain name [ UNKNOWN ]
- Checking /etc/hosts
- Duplicate entries in hosts file [ NONE ]
- Presence of configured hostname in /etc/hosts [ FOUND ]
- Hostname mapped to localhost [ NOT FOUND ]
- Localhost mapping to IP address [ OK ]
[+] Ports and packages
------------------------------------
- Searching package managers
- Searching dpkg package manager [ FOUND ]
- Querying package manager
- Query unpurged packages [ NONE ]
- Checking security repository in sources.list file [ OK ]
- Checking APT package database [ OK ]
- Checking vulnerable packages [ WARNING ]
- Checking upgradeable packages [ SKIPPED ]
- Checking package audit tool [ INSTALLED ]
Found: apt-get
- Toolkit for automatic upgrades (unattended-upgrade) [ FOUND ]
[+] Networking
------------------------------------
- Checking IPv6 configuration [ ENABLED ]
Configuration method [ AUTO ]
IPv6 only [ NO ]
- Checking configured nameservers
- Testing nameservers
Nameserver: 1.1.1.1 [ OK ]
Nameserver: 192.168.1.1 [ OK ]
- Minimal of 2 responsive nameservers [ OK ]
- Getting listening ports (TCP/UDP) [ DONE ]
- Checking promiscuous interfaces [ OK ]
- Checking status DHCP client
- Checking for ARP monitoring software [ NOT FOUND ]
- Uncommon network protocols [ 0 ]
[+] Printers and Spools
------------------------------------
- Checking cups daemon [ RUNNING ]
- Checking CUPS configuration file [ OK ]
- File permissions [ WARNING ]
- Checking CUPS addresses/sockets [ FOUND ]
- Checking lp daemon [ NOT RUNNING ]
[+] Software: e-mail and messaging
------------------------------------
[+] Software: firewalls
------------------------------------
- Checking iptables kernel module [ FOUND ]
- Checking iptables policies of chains [ FOUND ]
- Checking for empty ruleset [ OK ]
- Checking for unused rules [ FOUND ]
- Checking host based firewall [ ACTIVE ]
[+] Software: webserver
------------------------------------
- Checking Apache (binary /usr/sbin/apache2) [ FOUND ]
[Notice] possible directory/file parts found, but still unsure what the real configuration file is. Skipping some Apache related tests
=================================================================
Exception found!
Function/test: [HTTP-6624:1]
Message: Found some unknown directory or file references in Apache configuration
=================================================================
Info: No virtual hosts found
* Loadable modules [ FOUND (119) ]
- Found 119 loadable modules
mod_evasive: anti-DoS/brute force [ NOT FOUND ]
mod_reqtimeout/mod_qos [ FOUND ]
ModSecurity: web application firewall [ NOT FOUND ]
- Checking nginx [ NOT FOUND ]
[+] SSH Support
------------------------------------
- Checking running SSH daemon [ NOT FOUND ]
[+] SNMP Support
------------------------------------
- Checking running SNMP daemon [ NOT FOUND ]
[+] Databases
------------------------------------
- PostgreSQL processes status [ FOUND ]
[+] LDAP Services
------------------------------------
- Checking OpenLDAP instance [ NOT FOUND ]
[+] PHP
------------------------------------
- Checking PHP [ NOT FOUND ]
[+] Squid Support
------------------------------------
- Checking running Squid daemon [ NOT FOUND ]
[+] Logging and files
------------------------------------
- Checking for a running log daemon [ OK ]
- Checking Syslog-NG status [ NOT FOUND ]
- Checking systemd journal status [ FOUND ]
- Checking Metalog status [ NOT FOUND ]
- Checking RSyslog status [ NOT FOUND ]
- Checking RFC 3195 daemon status [ NOT FOUND ]
- Checking minilogd instances [ NOT FOUND ]
- Checking logrotate presence [ OK ]
- Checking remote logging [ NOT ENABLED ]
- Checking log directories (static list) [ DONE ]
- Checking open log files [ DONE ]
- Checking deleted files in use [ FILES FOUND ]
[+] Insecure services
------------------------------------
- Installed inetd package [ NOT FOUND ]
- Installed xinetd package [ OK ]
- xinetd status
- Installed rsh client package [ OK ]
- Installed rsh server package [ OK ]
- Installed telnet client package [ OK ]
- Installed telnet server package [ NOT FOUND ]
- Checking NIS client installation [ OK ]
- Checking NIS server installation [ OK ]
- Checking TFTP client installation [ OK ]
- Checking TFTP server installation [ OK ]
[+] Banners and identification
------------------------------------
- /etc/issue [ FOUND ]
- /etc/issue contents [ WEAK ]
- /etc/issue.net [ FOUND ]
- /etc/issue.net contents [ WEAK ]
[+] Scheduled tasks
------------------------------------
- Checking crontab and cronjob files [ DONE ]
[+] Accounting
------------------------------------
- Checking accounting information [ NOT FOUND ]
- Checking sysstat accounting data [ NOT FOUND ]
- Checking auditd [ NOT FOUND ]
[+] Time and Synchronization
------------------------------------
- NTP daemon found: systemd (timesyncd) [ FOUND ]
- Checking for a running NTP daemon or client [ OK ]
- Last time synchronization [ 1809s ]
[+] Cryptography
------------------------------------
- Checking for expired SSL certificates [0/157] [ NONE ]
[WARNING]: Test CRYP-7902 had a long execution: 24.395284 seconds
- Kernel entropy is sufficient [ YES ]
- HW RNG & rngd [ NO ]
- SW prng [ NO ]
MOR-bit set [ NO ]
[+] Virtualization
------------------------------------
[+] Containers
------------------------------------
- Docker
- Docker daemon [ RUNNING ]
- Docker info output (warnings) [ NONE ]
- Containers
- Total containers [ 11 ]
- Running containers [ 3 ]
- Unused containers [ 8 ]
- File permissions [ OK ]
[+] Security frameworks
------------------------------------
- Checking presence AppArmor [ FOUND ]
- Checking AppArmor status [ ENABLED ]
Found 171 unconfined processes
- Checking presence SELinux [ NOT FOUND ]
- Checking presence TOMOYO Linux [ NOT FOUND ]
- Checking presence grsecurity [ NOT FOUND ]
- Checking for implemented MAC framework [ OK ]
[+] Software: file integrity
------------------------------------
- Checking file integrity tools
- Checking presence integrity tool [ NOT FOUND ]
[+] Software: System tooling
------------------------------------
- Checking automation tooling
- Automation tooling [ NOT FOUND ]
- Checking for IDS/IPS tooling [ NONE ]
[+] Software: Malware
------------------------------------
- Malware software components [ NOT FOUND ]
[+] File Permissions
------------------------------------
- Starting file permissions check
File: /boot/grub/grub.cfg [ OK ]
File: /etc/crontab [ SUGGESTION ]
File: /etc/group [ OK ]
File: /etc/group- [ OK ]
File: /etc/hosts.allow [ OK ]
File: /etc/hosts.deny [ OK ]
File: /etc/issue [ OK ]
File: /etc/issue.net [ OK ]
File: /etc/motd [ OK ]
File: /etc/passwd [ OK ]
File: /etc/passwd- [ OK ]
Directory: /root/.ssh [ OK ]
Directory: /etc/cron.d [ SUGGESTION ]
Directory: /etc/cron.daily [ SUGGESTION ]
Directory: /etc/cron.hourly [ SUGGESTION ]
Directory: /etc/cron.weekly [ SUGGESTION ]
Directory: /etc/cron.monthly [ SUGGESTION ]
[+] Home directories
------------------------------------
- Permissions of home directories [ OK ]
- Ownership of home directories [ OK ]
- Checking shell history files [ OK ]
[+] Kernel Hardening
------------------------------------
- Comparing sysctl key pairs with scan profile
- dev.tty.ldisc_autoload (exp: 0) [ DIFFERENT ]
- fs.protected_fifos (exp: 2) [ DIFFERENT ]
- fs.protected_hardlinks (exp: 1) [ OK ]
- fs.protected_regular (exp: 2) [ OK ]
- fs.protected_symlinks (exp: 1) [ OK ]
- fs.suid_dumpable (exp: 0) [ OK ]
- kernel.core_uses_pid (exp: 1) [ DIFFERENT ]
- kernel.ctrl-alt-del (exp: 0) [ OK ]
- kernel.dmesg_restrict (exp: 1) [ OK ]
- kernel.kptr_restrict (exp: 2) [ DIFFERENT ]
- kernel.modules_disabled (exp: 1) [ DIFFERENT ]
- kernel.perf_event_paranoid (exp: 3) [ OK ]
- kernel.randomize_va_space (exp: 2) [ OK ]
- kernel.sysrq (exp: 0) [ DIFFERENT ]
- kernel.unprivileged_bpf_disabled (exp: 1) [ DIFFERENT ]
- kernel.yama.ptrace_scope (exp: 1 2 3) [ DIFFERENT ]
- net.core.bpf_jit_harden (exp: 2) [ DIFFERENT ]
- net.ipv4.conf.all.accept_redirects (exp: 0) [ OK ]
- net.ipv4.conf.all.accept_source_route (exp: 0) [ OK ]
- net.ipv4.conf.all.bootp_relay (exp: 0) [ OK ]
- net.ipv4.conf.all.forwarding (exp: 0) [ DIFFERENT ]
- net.ipv4.conf.all.log_martians (exp: 1) [ DIFFERENT ]
- net.ipv4.conf.all.mc_forwarding (exp: 0) [ OK ]
- net.ipv4.conf.all.proxy_arp (exp: 0) [ OK ]
- net.ipv4.conf.all.rp_filter (exp: 1) [ DIFFERENT ]
- net.ipv4.conf.all.send_redirects (exp: 0) [ OK ]
- net.ipv4.conf.default.accept_redirects (exp: 0) [ DIFFERENT ]
- net.ipv4.conf.default.accept_source_route (exp: 0) [ DIFFERENT ]
- net.ipv4.conf.default.log_martians (exp: 1) [ DIFFERENT ]
- net.ipv4.icmp_echo_ignore_broadcasts (exp: 1) [ OK ]
- net.ipv4.icmp_ignore_bogus_error_responses (exp: 1) [ OK ]
- net.ipv4.tcp_syncookies (exp: 1) [ OK ]
- net.ipv4.tcp_timestamps (exp: 0 1) [ OK ]
- net.ipv6.conf.all.accept_redirects (exp: 0) [ DIFFERENT ]
- net.ipv6.conf.all.accept_source_route (exp: 0) [ OK ]
- net.ipv6.conf.default.accept_redirects (exp: 0) [ DIFFERENT ]
- net.ipv6.conf.default.accept_source_route (exp: 0) [ OK ]
[+] Hardening
------------------------------------
- Installed compiler(s) [ FOUND ]
- Installed malware scanner [ NOT FOUND ]
- Non-native binary formats [ FOUND ]
[+] Custom tests
------------------------------------
- Running custom tests... [ NONE ]
[+] Plugins (phase 2)
------------------------------------
================================================================================
-[ Lynis 3.0.8 Results ]-
Warnings (1):
----------------------------
! Found one or more vulnerable packages. [PKGS-7392]
https://cisofy.com/lynis/controls/PKGS-7392/
Suggestions (44):
----------------------------
* This release is more than 4 months old. Check the website or GitHub to see if there is an update available. [LYNIS]
https://cisofy.com/lynis/controls/LYNIS/
* Install libpam-tmpdir to set $TMP and $TMPDIR for PAM sessions [DEB-0280]
https://cisofy.com/lynis/controls/DEB-0280/
* Install apt-listbugs to display a list of critical bugs prior to each APT installation. [DEB-0810]
https://cisofy.com/lynis/controls/DEB-0810/
* Install needrestart, alternatively to debian-goodies, so that you can run needrestart after upgrades to determine which daemons are using old versions of libraries and need restarting. [DEB-0831]
https://cisofy.com/lynis/controls/DEB-0831/
* Install fail2ban to automatically ban hosts that commit multiple authentication errors. [DEB-0880]
https://cisofy.com/lynis/controls/DEB-0880/
* Set a password on GRUB boot loader to prevent altering boot configuration (e.g. boot in single user mode without password) [BOOT-5122]
https://cisofy.com/lynis/controls/BOOT-5122/
* Consider hardening system services [BOOT-5264]
- Details : Run '/usr/bin/systemd-analyze security SERVICE' for each service
https://cisofy.com/lynis/controls/BOOT-5264/
* If not required, consider explicit disabling of core dump in /etc/security/limits.conf file [KRNL-5820]
https://cisofy.com/lynis/controls/KRNL-5820/
* Configure password hashing rounds in /etc/login.defs [AUTH-9230]
https://cisofy.com/lynis/controls/AUTH-9230/
* Install a PAM module for password strength testing like pam_cracklib or pam_passwdqc [AUTH-9262]
https://cisofy.com/lynis/controls/AUTH-9262/
* When possible set expire dates for all password protected accounts [AUTH-9282]
https://cisofy.com/lynis/controls/AUTH-9282/
* Configure minimum password age in /etc/login.defs [AUTH-9286]
https://cisofy.com/lynis/controls/AUTH-9286/
* Configure maximum password age in /etc/login.defs [AUTH-9286]
https://cisofy.com/lynis/controls/AUTH-9286/
* Default umask in /etc/login.defs could be more strict like 027 [AUTH-9328]
https://cisofy.com/lynis/controls/AUTH-9328/
* To decrease the impact of a full /home file system, place /home on a separate partition [FILE-6310]
https://cisofy.com/lynis/controls/FILE-6310/
* To decrease the impact of a full /tmp file system, place /tmp on a separate partition [FILE-6310]
https://cisofy.com/lynis/controls/FILE-6310/
* To decrease the impact of a full /var file system, place /var on a separate partition [FILE-6310]
https://cisofy.com/lynis/controls/FILE-6310/
* Disable drivers like USB storage when not used, to prevent unauthorized storage or data theft [USB-1000]
https://cisofy.com/lynis/controls/USB-1000/
* Disable drivers like firewire storage when not used, to prevent unauthorized storage or data theft [STRG-1846]
https://cisofy.com/lynis/controls/STRG-1846/
* Check DNS configuration for the dns domain name [NAME-4028]
https://cisofy.com/lynis/controls/NAME-4028/
* Install debsums utility for the verification of packages with known good database. [PKGS-7370]
https://cisofy.com/lynis/controls/PKGS-7370/
* Update your system with apt-get update, apt-get upgrade, apt-get dist-upgrade and/or unattended-upgrades [PKGS-7392]
https://cisofy.com/lynis/controls/PKGS-7392/
* Install package apt-show-versions for patch management purposes [PKGS-7394]
https://cisofy.com/lynis/controls/PKGS-7394/
* Determine if protocol 'dccp' is really needed on this system [NETW-3200]
https://cisofy.com/lynis/controls/NETW-3200/
* Determine if protocol 'sctp' is really needed on this system [NETW-3200]
https://cisofy.com/lynis/controls/NETW-3200/
* Determine if protocol 'rds' is really needed on this system [NETW-3200]
https://cisofy.com/lynis/controls/NETW-3200/
* Determine if protocol 'tipc' is really needed on this system [NETW-3200]
https://cisofy.com/lynis/controls/NETW-3200/
* Access to CUPS configuration could be more strict. [PRNT-2307]
https://cisofy.com/lynis/controls/PRNT-2307/
* Check iptables rules to see which rules are currently not used [FIRE-4513]
https://cisofy.com/lynis/controls/FIRE-4513/
* Install Apache mod_evasive to guard webserver against DoS/brute force attempts [HTTP-6640]
https://cisofy.com/lynis/controls/HTTP-6640/
* Install Apache modsecurity to guard webserver against web application attacks [HTTP-6643]
https://cisofy.com/lynis/controls/HTTP-6643/
* Enable logging to an external logging host for archiving purposes and additional protection [LOGG-2154]
https://cisofy.com/lynis/controls/LOGG-2154/
* Check what deleted files are still in use and why. [LOGG-2190]
https://cisofy.com/lynis/controls/LOGG-2190/
* Add a legal banner to /etc/issue, to warn unauthorized users [BANN-7126]
https://cisofy.com/lynis/controls/BANN-7126/
* Add legal banner to /etc/issue.net, to warn unauthorized users [BANN-7130]
https://cisofy.com/lynis/controls/BANN-7130/
* Enable process accounting [ACCT-9622]
https://cisofy.com/lynis/controls/ACCT-9622/
* Enable sysstat to collect accounting (no results) [ACCT-9626]
https://cisofy.com/lynis/controls/ACCT-9626/
* Enable auditd to collect audit information [ACCT-9628]
https://cisofy.com/lynis/controls/ACCT-9628/
* Install a file integrity tool to monitor changes to critical and sensitive files [FINT-4350]
https://cisofy.com/lynis/controls/FINT-4350/
* Determine if automation tools are present for system management [TOOL-5002]
https://cisofy.com/lynis/controls/TOOL-5002/
* Consider restricting file permissions [FILE-7524]
- Details : See screen output or log file
- Solution : Use chmod to change file permissions
https://cisofy.com/lynis/controls/FILE-7524/
* One or more sysctl values differ from the scan profile and could be tweaked [KRNL-6000]
https://cisofy.com/lynis/controls/KRNL-6000/
* Harden compilers like restricting access to root user only [HRDN-7222]
https://cisofy.com/lynis/controls/HRDN-7222/
* Harden the system by installing at least one malware scanner, to perform periodic file system scans [HRDN-7230]
- Solution : Install a tool like rkhunter, chkrootkit, OSSEC
https://cisofy.com/lynis/controls/HRDN-7230/
Follow-up:
----------------------------
- Show details of a test (lynis show details TEST-ID)
- Check the logfile for all details (less /var/log/lynis.log)
- Read security controls texts (https://cisofy.com)
- Use --upload to upload data to central system (Lynis Enterprise users)
================================================================================
Lynis security scan details:
Hardening index : 65 [############# ]
Tests performed : 260
Plugins enabled : 1
Components:
- Firewall [V]
- Malware scanner [X]
Scan mode:
Normal [V] Forensics [ ] Integration [ ] Pentest [ ]
Lynis modules:
- Compliance status [?]
- Security audit [V]
- Vulnerability scan [V]
Files:
- Test and debug information : /var/log/lynis.log
- Report data : /var/log/lynis-report.dat
================================================================================
Lo que el número no dice
Tres cosas que se ven leyendo ese informe y que no caben en el índice:
Cuarenta y cuatro sugerencias no son cuarenta y cuatro problemas. Cuatro
de ellas son el mismo control (NETW-3200) repetido por cada protocolo, y
tres son la misma partición que no está separada. Agrupadas por control son
treinta y ocho, y de esas, unas cuantas son comodidad para quien administra
—apt-show-versions, apt-listbugs— que puntúan igual que instalar
auditd. El índice no distingue lo importante de lo cómodo; tú sí.
El único aviso es el más aburrido y el más urgente. «Hay paquetes con vulnerabilidades conocidas» no habla de una mejora posible: habla de software instalado con un fallo publicado y su parche disponible. Es la vía de entrada más usada que existe, por delante de cualquier contraseña floja.
Cuarenta y siete servicios en UNSAFE no son una emergencia. Es el valor
por defecto de casi todo lo que systemd no ha apretado: cron, dbus y
getty llevan décadas corriendo así. Lo que merece una tarde es lo que
aparece como EXPOSED —lo que da la cara a la red sin restricciones— y, sobre
todo, lo que no necesitabas tener encendido. Quitar es más barato que
endurecer: si el servidor no imprime, desinstalar CUPS resuelve un control y
otros tres de golpe.
Tu turno
Esto es la práctica M5021 RA1 A02. El visor de arriba, con tu informe pegado, monta la mitad del trabajo en la pestaña «Tu plan»: los diez controles repartidos por secciones, el registro de excepciones con lo que marques y el esqueleto del script. Lo que no monta —y es lo que se evalúa— es el criterio.
- Qué es un benchmark. Sitúalo frente a tu política y frente a la norma. Elige un control cualquiera y desglosa sus secciones: descripción, justificación, impacto, comprobación y remedio. Y responde: ¿por qué incluye siempre una sección de impacto?
- La línea base. Instala Lynis, pásalo y anota el índice con captura y fecha. Localiza
/var/log/lynis.logy/var/log/lynis-report.dat, y amplía un hallazgo conlynis show details <TEST-ID>. - Diez controles, tres secciones. Por cada uno: número y nombre, nivel, comprobación ejecutada, resultado y veredicto. Marca cuáles ya cumplías gracias al bastionado de la fase anterior — esa columna es la que dice si lo que hiciste por intuición coincide con el estándar. Y cruza tu tabla con Lynis: documenta al menos un caso que detecte Lynis y el benchmark no, y uno al revés.
- Remedia y documenta lo que no. De uno en uno, verificando después de cada uno. Nunca una tanda entera a ciegas. Lo que decidas no aplicar va al registro de excepciones con motivo técnico, riesgo aceptado, medida compensatoria y quién lo aprobaría. Una excepción justificada es una decisión profesional; una sin justificar es una negligencia documentada.
- Segunda pasada. Índice, avisos y sugerencias, antes y después. Y comprueba que el servicio sigue en pie: un servidor endurecido que no da servicio no está endurecido, está averiado. Si has roto algo y lo explicas, ese apartado puntúa más que si dices que todo salió a la primera.
- Automatiza el remedio. Un
hardening_cis.shidempotente: pasarlo dos veces seguidas tiene que dejar el sistema igual y no fallar. Destruye la máquina, recréala, aplícalo y vuelve a pasar Lynis. Si sale el mismo índice, tu bastionado ya no depende de tu memoria.
Entrega: un PDF, M5021_RA1_A02_Cognom1_Cognom2_Nom.pdf, con las
respuestas, las dos tablas completas, las capturas de los dos índices con la
fecha visible y la evidencia de las dos ejecuciones del script.
| Apartado | Evidencia | Puntos |
|---|---|---|
| 1 | El benchmark situado frente a la política y la norma, niveles y perfiles diferenciados y un control desglosado | 1,5 |
| 2 | Índice inicial capturado, avisos y sugerencias distinguidos y un hallazgo ampliado con su detalle | 1,5 |
| 3 | Diez controles de tres secciones con comprobación, resultado y veredicto, cruzados con el bastionado y con Lynis | 2,5 |
| 4 | Remedio verificado uno a uno y registro de excepciones con riesgo y medida compensatoria | 2 |
| 5 | Comparación antes y después, y comprobación de que el servicio sigue operativo | 1,5 |
| 6 | Script idempotente demostrado con dos ejecuciones y reconstrucción desde cero | 1 |
Dos reglas que no se negocian
Instantánea antes de tocar nada. El apartado 5 existe porque algo se rompe: es lo normal, y saber volver atrás es parte del oficio.
Solo tu máquina. Lynis no explota nada, pero pasarlo sobre un sistema ajeno sin autorización escrita es una auditoría no autorizada, y eso tiene nombre legal. Ni la máquina de un compañero, ni la red del centro, ni ese servidor que «total, solo miro». El permiso va por escrito y antes.