Security/Audit/Lynis/Brief
Aller à la navigation
Aller à la recherche
introduction
Lynis est un petit soft qui s’utilise en ligne de commande. Lynis n’est pas à proprement parler un outil de pentest (ce à quoi l’on pourrait s’attendre quand on parle d’audit).
Il a pour but de vérifier via un scan, quasiment tous les paramètres du système avant de faire une synthèse complète et d'afficher des suggestions qui vont permettre d’agir sur les points faibles de celui-ci.
Il va analyser tout un tas de paramètres concernant entre-autres :
- Les chargeurs et services de démarrage
- La configuration du noyau, les modules chargés, ceux en cours d’exécution
- La mémoire et les processus
- Les utilisateurs et les groupes
- Les points de montage et le système de fichiers racine
- Les services NFS et BIND
- Les mises à jour et les référentiels de vos logiciels
- Les règles Iptables et la configurations SELinux
- Les serveurs Web Apache et nginx
- La configurations SSH
- Le mot de passe root, MySQL et les services LDAP
- Les options PHP
- Les options crontab / cron et ATD
- Le démon NTP
- L’expiration du certificat SSL
- La présence de malwares
- Les répertoires personnels
Exemple d'exécution
lynis -Q -c
[ Lynis 1.4.6 ]
################################################################################
Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
welcome to redistribute it under the terms of the GNU General Public License.
See the LICENSE file for details about using this software.
Copyright 2007-2014 - Michael Boelen, http://cisofy.com
Enterprise support and plugins available via CISOfy - http://cisofy.com
################################################################################
[+] Initializing program
------------------------------------
- Detecting OS... [ DONE ]
- Clearing log file (/var/log/lynis.log)... [ DONE ]
---------------------------------------------------
Program version: 1.4.6
Operating system: Linux
Operating system name: CentOS
Operating system version: CentOS release 6.5 (Final)
Kernel version: 2.6.32-431.el6.x86_64
Hardware platform: x86_64
Hostname: scapmaster
Auditor: [Unknown]
Profile: /etc/lynis/default.prf
Log file: /var/log/lynis.log
Report file: /var/log/lynis-report.dat
Report version: 1.0
Plugin directory: /usr/share/lynis/plugins
---------------------------------------------------
- Checking profile file (/etc/lynis/default.prf)...
- Program update status... [ NO UPDATE ]
[+] System Tools
------------------------------------
- Scanning available tools...
- Checking system binaries...
- Checking /bin... [ FOUND ]
- Checking /sbin... [ FOUND ]
- Checking /usr/bin... [ FOUND ]
- Checking /usr/sbin... [ FOUND ]
- Checking /usr/local/bin... [ FOUND ]
- Checking /usr/local/sbin... [ FOUND ]
- Checking /usr/local/libexec... [ FOUND ]
- Checking /usr/libexec... [ FOUND ]
- Checking /usr/sfw/bin... [ NOT FOUND ]
- Checking /usr/sfw/sbin... [ NOT FOUND ]
- Checking /usr/sfw/libexec... [ NOT FOUND ]
- Checking /opt/sfw/bin... [ NOT FOUND ]
- Checking /opt/sfw/sbin... [ NOT FOUND ]
- Checking /opt/sfw/libexec... [ NOT FOUND ]
- Checking /usr/xpg4/bin... [ NOT FOUND ]
- Checking /usr/css/bin... [ NOT FOUND ]
- Checking /usr/ucb... [ NOT FOUND ]
- Checking /usr/X11R6/bin... [ NOT FOUND ]
[+] Plugins (phase 1)
------------------------------------
- Plugins enabled [ NONE ]
[+] Boot and services
------------------------------------
- Checking boot loaders
- Checking presence GRUB... [ OK ]
- Checking for password protection... [ OK ]
- Checking presence LILO... [ NOT FOUND ]
- Checking boot loader SILO [ NOT FOUND ]
- Checking boot loader YABOOT [ NOT FOUND ]
- Check services at startup (chkconfig)... [ DONE ]
Result: found 19 services
- Check startup files (permissions)... [ OK ]
[+] Kernel
------------------------------------
- Checking default run level... [ 3 ]
- 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 35 active modules
- Checking Linux kernel configuration file... [ FOUND ]
- Checking core dumps configuration... [ ENABLED ]
- Checking setuid core dumps configuration... [ DEFAULT ]
[+] Memory and processes
------------------------------------
- Checking /proc/meminfo... [ FOUND ]
- Searching for dead/zombie processes... [ OK ]
- Searching for IO waiting processes... [ OK ]
[+] Users, Groups and Authentication
------------------------------------
- Search administrator accounts... [ OK ]
- Checking consistency of group files (grpck)... [ OK ]
- Checking non unique group ID's... [ OK ]
- Checking non unique group names... [ OK ]
- Checking password file consistency... [ OK ]
- Query system users (non daemons)... [ DONE ]
- Checking NIS+ authentication support [ NOT ENABLED ]
- Checking NIS authentication support [ NOT ENABLED ]
- Checking sudoers file [ FOUND ]
- Check sudoers file permissions [ OK ]
- Checking PAM password strength tools [ OK ]
- Checking PAM configuration file (pam.conf) [ NOT FOUND ]
- Checking PAM configuration files (pam.d) [ FOUND ]
- Checking PAM modules [ FOUND ]
- Checking user password aging [ OK ]
- Checking Linux single user mode authentication [ OK ]
- Determining default umask
- Checking umask (/etc/profile) [ UNKNOWN ]
- Checking umask (/etc/login.defs) [ OK ]
- Checking umask (/etc/init.d/functions) [ OK ]
- Checking LDAP authentication support [ NOT ENABLED ]
[+] Shells
------------------------------------
- Checking shells from /etc/shells...
Result: found 6 shells (valid shells: 6).
[+] File systems
------------------------------------
- Checking mount points
- Checking /home mount point... [ OK ]
- Checking /tmp mount point... [ OK ]
- Checking LVM volume groups... [ FOUND ]
- Checking LVM volumes... [ FOUND ]
- Checking for old files in /tmp... [ OK ]
- Checking /tmp sticky bit... [ OK ]
- ACL support root file system... [ ENABLED ]
- Checking Locate database... [ FOUND ]
[+] Storage
------------------------------------
- Checking usb-storage driver (modprobe config)... [ NOT DISABLED ]
- Checking firewire ohci driver (modprobe config)... [ NOT DISABLED ]
[+] NFS
------------------------------------
- Check running NFS daemon... [ NOT FOUND ]
[+] Software: name services
------------------------------------
- Checking default DNS search domain... [ NONE ]
- Checking /etc/resolv.conf options... [ NONE ]
- Searching DNS domain name... [ FOUND ]
Domain name: didier.b2pweb.com
- Checking nscd status... [ NOT FOUND ]
- Checking BIND status... [ NOT FOUND ]
- Checking PowerDNS status... [ NOT FOUND ]
- Checking ypbind status... [ NOT FOUND ]
- Checking /etc/hosts
- Checking /etc/hosts (duplicates) [ OK ]
- Checking /etc/hosts (hostname) [ OK ]
- Checking /etc/hosts (localhost) [ OK ]
[+] Ports and packages
------------------------------------
- Searching package managers...
- Searching RPM package manager... [ FOUND ]
- Querying RPM package manager...
- Checking YUM package management consistency [ OK ]
- Checking package database duplicates... [ OK ]
- Checking package database for problems... [ OK ]
- Checking missing security packages... [ OK ]
- Checking GPG checks (yum.conf) [ OK ]
- Checking package audit tool... [ INSTALLED ]
Found: yum-security
[+] Networking
------------------------------------
- Checking configured nameservers...
- Testing nameservers...
Nameserver: 192.168.122.1... [ OK ]
- Minimal of 2 responsive nameservers... [ WARNING ]
- Checking default gateway... [ DONE ]
- Getting listening ports (TCP/TCP)... [ DONE ]
* Found 4 ports
- Checking promiscuous interfaces... [ OK ]
- Checking waiting connections... [ OK ]
- Checking status DHCP client... [ RUNNING ]
[+] Printers and Spools
------------------------------------
- Checking cups daemon... [ NOT FOUND ]
[+] Software: e-mail and messaging
------------------------------------
- Checking Exim status... [ NOT FOUND ]
- Checking Postfix status... [ RUNNING ]
- Checking Postfix configuration... [ FOUND ]
- Checking Postfix banner... [ OK ]
- Checking Dovecot status... [ NOT FOUND ]
- Checking Qmail smtpd status... [ NOT FOUND ]
[+] Software: firewalls
------------------------------------
- Checking iptables kernel module [ FOUND ]
- Checking for empty ruleset [ OK ]
- Checking for unused rules [ WARNING ]
Status pf [ NOT FOUND ]
- Checking host based firewall [ ACTIVE ]
[+] Software: webserver
------------------------------------
- Checking Apache (binary /usr/sbin/httpd)... [ FOUND ]
Info: Configuration file found (/etc/httpd/conf/httpd.conf)4C
Info: No virtual hosts found
* Loadable modules [ FOUND ]
- Found 65 loadable modules
mod_evasive: anti-DoS/brute force [ NOT FOUND ]
mod_qos: anti-Slowloris [ NOT FOUND ]
mod_spamhaus: anti-spam (spamhaus) [ NOT FOUND ]
ModSecurity: web application firewall [ NOT FOUND ]
- Checking nginx... [ NOT FOUND ]
[+] SSH Support
------------------------------------
- Checking running SSH daemon... [ FOUND ]
- Searching SSH configuration... [ FOUND ]
- Checking defined SSH options... [ DONE ]
- SSH option: PermitRootLogin... [ DISABLED ]
- SSH option: Protocol... [ OK ]
- SSH option: StrictModes... [ OK ]
- SSH option: AllowUsers... [ FOUND ]
- SSH option: AllowGroups... [ NOT FOUND ]
[+] SNMP Support
------------------------------------
- Checking running SNMP daemon... [ NOT FOUND ]
[+] Databases
------------------------------------
- MySQL process status... [ NOT FOUND ]
- PostgreSQL processes status... [ NOT FOUND ]
- Oracle processes status... [ NOT FOUND ]
[+] LDAP Services
------------------------------------
- Checking OpenLDAP instance... [ NOT FOUND ]
[+] Software: 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 Metalog status [ NOT FOUND ]
- Checking RSyslog status [ FOUND ]
- Checking RFC 3195 daemon status [ NOT FOUND ]
- Checking minilogd instances [ NOT FOUND ]
- Checking logrotate presence [ OK ]
- Checking log directories (static list) [ DONE ]
- Checking open log files [ DONE ]
- Checking deleted files in use [ DONE ]
[+] Insecure services
------------------------------------
- Checking inetd status... [ NOT ACTIVE ]
[+] Banners and identification
------------------------------------
- /etc/motd... [ FOUND ]
- /etc/motd permissions... [ OK ]
- /etc/motd contents... [ OK ]
- /etc/issue... [ FOUND ]
- /etc/issue contents... [ OK ]
- /etc/issue.net... [ FOUND ]
- /etc/issue.net contents... [ WEAK ]
[+] Scheduled tasks
------------------------------------
- Checking crontab/cronjob [ DONE ]
- Checking atd status [ NOT RUNNING ]
[+] Accounting
------------------------------------
- Checking accounting information... [ OK ]
- Checking sysstat accounting data [ ENABLED ]
- Checking auditd [ ENABLED ]
- Checking audit rules [ OK ]
- Checking audit configuration file [ OK ]
- Checking auditd log file [ FOUND ]
[+] Time and Synchronization
------------------------------------
- Checking running NTP daemon (ntpd)... [ FOUND ]
- Checking running NTP daemon (timed)... [ NOT FOUND ]
- Checking running NTP daemon (dntpd)... [ NOT FOUND ]
- Checking NTP client in crontab file (/etc/anacrontab)... [ NOT FOUND ]
- Checking NTP client in crontab file (/etc/crontab)... [ NOT FOUND ]
- Checking NTP client in cron.d files... [ NOT FOUND ]
- Checking for a running NTP daemon or client... [ OK ]
- Checking valid association ID's... [ FOUND ]
- Checking high stratum ntp peers... [ OK ]
- Checking unreliable ntp peers... [ NOTICE ]
- Checking selected time source... [ OK ]
- Checking time source candidates... [ OK ]
- Checking falsetickers... [ OK ]
- Checking NTP version... [ FOUND ]
[+] Cryptography
------------------------------------
- Checking SSL certificate expiration... [ OK ]
[+] Virtualization
------------------------------------
[+] Security frameworks
------------------------------------
- Checking presence AppArmor [ NOT FOUND ]
- Checking presence SELinux [ FOUND ]
- Checking SELinux status [ ENABLED ]
- Checking current mode and config file [ OK ]
Current SELinux mode: enforcing
- Checking presence grsecurity [ NOT FOUND ]
- Checking for implemented MAC framework [ OK ]
[+] Software: file integrity
------------------------------------
- Checking file integrity tools...
- AFICK... [ NOT FOUND ]
- AIDE... [ FOUND ]
- Osiris... [ NOT FOUND ]
- Samhain... [ NOT FOUND ]
- Tripwire... [ NOT FOUND ]
- OSSEC (syscheck)... [ NOT FOUND ]
- Checking presence integrity tool... [ FOUND ]
[+] Software: Malware scanners
------------------------------------
- Checking chkrootkit... [ FOUND ]
- Checking Rootkit Hunter... [ FOUND ]
- Checking ClamAV scanner... [ NOT FOUND ]
- Checking ClamAV daemon... [ NOT FOUND ]
[+] System Tools
------------------------------------
- Starting file permissions check...
/etc/lilo.conf [ NOT FOUND ]
/root/.ssh [ OK ]
[+] Home directories
------------------------------------
- Checking shell history files... [ OK ]
[+] Kernel Hardening
------------------------------------
- Comparing sysctl key pairs with scan profile...
- kernel.core_uses_pid (exp: 1) [ OK ]
- kernel.ctrl-alt-del (exp: 0) [ OK ]
- kernel.exec-shield (exp: 1) [ OK ]
- kernel.sysrq (exp: 0) [ OK ]
- 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) [ OK ]
- net.ipv4.conf.all.log_martians (exp: 1) [ OK ]
- 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) [ OK ]
- net.ipv4.conf.all.send_redirects (exp: 0) [ OK ]
- net.ipv4.conf.default.accept_redirects (exp: 0) [ OK ]
- net.ipv4.conf.default.accept_source_route (exp: 0) [ OK ]
- net.ipv4.conf.default.log_martians (exp: 1) [ OK ]
- 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) [ DIFFERENT ]
[+] Hardening
------------------------------------
- Installed compiler(s)... [ FOUND ]
- Installed malware scanner... [ FOUND ]
[+] Custom Tests
------------------------------------
- Running custom tests... [ NONE ]
================================================================================
-[ Lynis 1.4.6 Results ]-
Tests performed: 174 Plugins enabled: 0
Warnings:
----------------------------
- Couldn't find 2 responsive nameservers [NETW-2705]
Suggestions:
----------------------------
- Run chkconfig --list to see all services and disable unneeded services
- Disable drivers like USB storage when not used, to prevent unauthorized storage or data theft [STRG-1840]
- Disable drivers like firewire storage when not used, to prevent unauthorized storage or data theft [STRG-1846]
- Check your resolv.conf file and fill in a backup nameserver if possible [NETW-2705]
- Check iptables rules to see which rules are currently not used [FIRE-4513]
- Install Apache mod_evasive to guard webserver against DoS/brute force attempts [HTTP-6640]
- Install Apache mod_qos to guard webserver against Slowloris attacks [HTTP-6641]
- Install Apache mod_spamhaus to guard webserver against spammers [HTTP-6642]
- Install Apache modsecurity to guard webserver against web application attacks [HTTP-6643]
- Add legal banner to /etc/issue.net, to warn unauthorized users [BANN-7130]
- Check ntpq peers output for unreliable ntp peers and correct/replace them [TIME-3120]
- One or more sysctl values differ from the scan profile and could be tweaked [KRNL-6000]
- Harden the system by removing unneeded compilers. This can decrease the chance of customized trojans, backdoors and rootkits to be compiled and installed [HRDN-7220]
- Harden compilers and restrict access to world [HRDN-7222]
Follow-up:
----------------------------
- Fix findings, see security controls overview and documentation
- Upload data to Lynis Enterprise for further analysis
- Create a report and implementation plan
Enterprise support and plugins available via CISOfy - http://cisofy.com
================================================================================
Hardening index : [89] [################# ]
================================================================================
Files:
- Test and debug information : /var/log/lynis.log
- Report data : /var/log/lynis-report.dat
================================================================================
Tip: Disable all tests which are not relevant or are too strict for the
purpose of this particular machine. This will remove unwanted suggestions
and also boost the hardening index. Each test should be properly analyzed
to see if the related risks can be accepted, before disabling the test.
================================================================================
Lynis 1.4.6
Copyright 2007-2014 - Michael Boelen, http://cisofy.com
================================================================================