Last login: Tue Mar 2 21:21:48 on ttys000 user@users-MacBook-Pro ~ % sudo lynis audit system --verbose Password: [!] Change ownership of /usr/local/Cellar/lynis/3.0.3/include/functions to 'root' or similar (found: user with UID 501). Command: # chown 0:0 /usr/local/Cellar/lynis/3.0.3/include/functions [X] Security check failed Why do I see this error? ------------------------------- This is a protection mechanism to prevent the root user from executing user created files. The files may be altered, or including malicious pieces of script. What can I do? --------------------- Option 1) Check if a trusted user created the files (e.g. due to using Git, Homebrew or similar). If you trust these files, you can decide to continue this run by pressing ENTER. Option 2) Change ownership of the related files (or full directory). Commands (full directory): # cd .. # chown -R 0:0 lynis # cd lynis # ./lynis audit system [ Press ENTER to continue, or CTRL+C to cancel ] [ Lynis 3.0.3 ] ################################################################################ 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. 2007-2021, CISOfy - https://cisofy.com/lynis/ Enterprise support available (compliance, plugins, interface and tools) ################################################################################ [+] Initializing program ------------------------------------ Unknown macOS version. Do you know what version it is? Create an issue at https://github.com/CISOfy/lynis - Detecting OS... [ DONE ] - Checking profiles... [ DONE ] --------------------------------------------------- Program version: 3.0.3 Operating system: macOS Operating system name: macOS Operating system version: 11.2.2 Kernel version: 20.3.0 Hardware platform: x86_64 Hostname: users-MacBook-Pro --------------------------------------------------- Profiles: /usr/local/Cellar/lynis/3.0.3/default.prf Log file: /var/log/lynis.log Report file: /var/log/lynis-report.dat Report version: 1.0 Plugin directory: /usr/local/Cellar/lynis/3.0.3/plugins --------------------------------------------------- Auditor: [Not Specified] Language: en Test category: all Test group: all --------------------------------------------------- - Program update status... [ UNKNOWN ] [+] System tools ------------------------------------ - Scanning available tools... - Checking system binaries... No log handling enabled - using stderr logging Created directory: /var/db/net-snmp Created directory: /var/db/net-snmp/mib_indexes [+] Program Details ------------------------------------ - Verbose mode [ YES ] - Debug mode [ NO ] [+] Plugins (phase 1) ------------------------------------ Note: plugins have more extensive tests and may take several minutes to complete - Plugin: pam [..] - Plugin: systemd [................] [+] Boot and services ------------------------------------ - Service Manager [ launchd ] [+] Kernel ------------------------------------ [+] Memory and Processes ------------------------------------ - Searching for dead/zombie processes [ NOT FOUND ] - Searching for IO waiting processes [ NOT FOUND ] [+] Users, Groups and Authentication ------------------------------------ - Administrator accounts [ OK ] - Unique UIDs [ OK ] - Unique group IDs [ OK ] - Unique group names [ OK ] - Password hashing methods [ OK ] - Query system users (non daemons) [ DONE ] - Sudoers file(s) [ FOUND ] - Permissions for directory: /etc/sudoers.d [ WARNING ] - Permissions for: /etc/sudoers [ OK ] - PAM password strength tools [ SUGGESTION ] - PAM configuration file (pam.conf) [ NOT FOUND ] - PAM configuration files (pam.d) [ FOUND ] - LDAP module in PAM [ NOT FOUND ] - Determining default umask - umask (/etc/profile and /etc/profile.d) [ OK ] [+] Shells ------------------------------------ - Checking shells from /etc/shells Result: found 7 shells (valid shells: 7). - Session timeout settings/tools [ NONE ] - Checking default umask values - Checking default umask in /etc/bashrc [ NONE ] - Checking default umask in /etc/csh.cshrc [ NONE ] - Checking default umask in /etc/profile [ NONE ] [+] File systems ------------------------------------ - Checking mount points - Checking /home mount point [ SYMLINK ] - Checking /tmp mount point [ SYMLINK ] - Checking /var mount point [ SYMLINK ] - Checking for old files in /tmp [ OK ] - Checking /var/tmp sticky bit [ OK ] [+] USB Devices ------------------------------------ [+] Storage ------------------------------------ [+] NFS ------------------------------------ - Query rpc registered programs [ DONE ] - Query NFS versions [ DONE ] - Query NFS protocols [ DONE ] - Check running NFS daemon [ NOT FOUND ] [+] Name services ------------------------------------ - Checking default DNS search domain [ NONE ] - Checking /etc/resolv.conf options [ NONE ] - Searching DNS domain name [ FOUND ] Domain name: local - Checking nscd status [ NOT FOUND ] - Checking Unbound status [ NOT FOUND ] - Checking BIND status [ NOT FOUND ] - Checking PowerDNS status [ NOT FOUND ] - Checking ypbind status [ NOT FOUND ] - Checking /etc/hosts - Duplicate entries in hosts file [ NONE ] - Presence of configured hostname in /etc/hosts [ NOT FOUND ] - Hostname mapped to localhost [ NOT FOUND ] [+] Ports and packages ------------------------------------ - Searching package managers - Searching brew [ FOUND ] - Querying brew for installed packages Error: Running Homebrew as root is extremely dangerous and no longer supported. As Homebrew does not drop privileges on installation you would be giving all build scripts full access to your system. - Checking package audit tool [ NONE ] [+] Networking ------------------------------------ - Hostname (FQDN length) [ OK ] - Hostname (allowed characters) [ OK ] - Checking configured nameservers - Testing nameservers Nameserver: 1.1.1.1 [ NO RESPONSE ] - Minimal of 2 responsive nameservers [ WARNING ] - Checking default gateway [ DONE ] - Getting listening ports (TCP/UDP) [ DONE ] [WARNING]: Test NETW-3012 had a long execution: 36 seconds - Checking waiting connections [ OK ] - Checking status DHCP client [+] Printers and Spools ------------------------------------ - Checking cups daemon [ NOT FOUND ] - Checking lp daemon [ NOT RUNNING ] [+] Software: e-mail and messaging ------------------------------------ - Exim status [ NOT FOUND ] - Postfix status [ NOT FOUND ] - Dovecot status [ NOT FOUND ] - Qmail status [ NOT FOUND ] - Sendmail status [ NOT FOUND ] [+] Software: firewalls ------------------------------------ - Checking pf status (pfctl) [ ENABLED ] - Checking pf configuration consistency [ OK ] - Checking macOS: Application Firewall [ ENABLED ] - Checking host based firewall [ ACTIVE ] [+] Software: webserver ------------------------------------ - Checking Apache (binary /usr/sbin/httpd) [ FOUND ] Info: Configuration file found (/private/etc/apache2/httpd.conf) Info: Found 8 virtual hosts * Loadable modules [ FOUND (114) ] - Found 114 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 ------------------------------------ No database engines found [+] LDAP Services ------------------------------------ - Checking OpenLDAP instance [ NOT FOUND ] [+] PHP ------------------------------------ - Checking PHP [ FOUND ] - Checking PHP disabled functions [ FOUND ] - Checking expose_php option [ ON ] - Checking enable_dl option [ OFF ] - Checking allow_url_fopen option [ ON ] - Checking allow_url_include option [ OFF ] - Checking listen option [ OK ] [+] 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 [ NOT FOUND ] - Checking Metalog status [ NOT FOUND ] - Checking RSyslog status [ NOT FOUND ] - Checking RFC 3195 daemon status [ NOT FOUND ] - Checking remote logging [ ENABLED ] - Checking /etc/newsyslog.conf [ FOUND ] - Checking log directories (newsyslog.conf) [ DONE ] - Checking log files (newsyslog.conf) [ DONE ] - Checking log directories (static list) [ DONE ] - Checking open log files [ DONE ] - Checking deleted files in use [ FILES FOUND ] [+] Insecure services ------------------------------------ - xinetd status - com.apple.fingerd [ OK ] - com.apple.ftp-proxy [ OK ] [+] Banners and identification ------------------------------------ - /etc/issue [ NOT FOUND ] - /etc/issue.net [ NOT FOUND ] [+] Scheduled tasks ------------------------------------ - Checking crontab and cronjob files [ DONE ] - Checking atd status [ NOT RUNNING ] [+] Accounting ------------------------------------ [+] Time and Synchronization ------------------------------------ - NTP daemon found: timed [ FOUND ] - Checking for a running NTP daemon or client [ OK ] [+] Cryptography ------------------------------------ - Checking for expired SSL certificates [0/1] [ NONE ] [+] Virtualization ------------------------------------ [+] Containers ------------------------------------ [+] Security frameworks ------------------------------------ - Checking presence AppArmor [ NOT FOUND ] - Checking presence SELinux [ NOT FOUND ] - Checking presence TOMOYO Linux [ NOT FOUND ] - Checking presence grsecurity [ NOT FOUND ] - Checking for implemented MAC framework [ NONE ] [+] Software: file integrity ------------------------------------ - Checking file integrity tools - AFICK [ NOT FOUND ] - AIDE [ NOT FOUND ] - Osiris [ NOT FOUND ] - Samhain [ NOT FOUND ] - Tripwire [ NOT FOUND ] - OSSEC [ NOT FOUND ] - mtree [ FOUND ] - osquery daemon (syscheck) [ NOT FOUND ] - Checking presence integrity tool [ FOUND ] [+] Software: System tooling ------------------------------------ - Checking automation tooling - Automation tooling [ NOT FOUND ] - Checking for IDS/IPS tooling [ NONE ] [+] Software: Malware ------------------------------------ - Checking Bitdefender agent [ FOUND ] [+] File Permissions ------------------------------------ - Starting file permissions check /boot/grub/grub.cfg [ NOT FOUND ] /boot/grub2/grub.cfg [ NOT FOUND ] /boot/grub2/user.cfg [ NOT FOUND ] /etc/at.allow [ NOT FOUND ] /etc/at.deny [ NOT FOUND ] /etc/cron.allow [ NOT FOUND ] /etc/cron.deny [ NOT FOUND ] /etc/crontab [ NOT FOUND ] File: /etc/group [ OK ] /etc/group- [ NOT FOUND ] /etc/hosts.allow [ NOT FOUND ] /etc/hosts.deny [ NOT FOUND ] /etc/issue [ NOT FOUND ] /etc/issue.net [ NOT FOUND ] /etc/lilo.conf [ NOT FOUND ] /etc/motd [ NOT FOUND ] File: /etc/passwd [ OK ] /etc/passwd- [ NOT FOUND ] File: /etc/ssh/sshd_config [ SUGGESTION ] File: /etc/hosts.equiv [ OK ] /etc/shosts.equiv [ NOT FOUND ] /root/.rhosts [ NOT FOUND ] /root/.rlogin [ NOT FOUND ] /root/.shosts [ NOT FOUND ] /root/.ssh [ NOT FOUND ] /etc/cron.d [ NOT FOUND ] /etc/cron.daily [ NOT FOUND ] /etc/cron.hourly [ NOT FOUND ] /etc/cron.weekly [ NOT FOUND ] /etc/cron.monthly [ NOT FOUND ] [+] Home directories ------------------------------------ - Permissions of home directories [ WARNING ] - Ownership of home directories [ OK ] - Checking shell history files [ OK ] [+] Kernel Hardening ------------------------------------ [+] Hardening ------------------------------------ - Installed compiler(s) [ FOUND ] - Installed malware scanner [ FOUND ] [+] Custom tests ------------------------------------ - Running custom tests... [ NONE ] [+] Plugins (phase 2) ------------------------------------ - Plugins (phase 2) [ DONE ] ================================================================================ -[ Lynis 3.0.3 Results ]- Warnings (2): ---------------------------- ! Nameserver 1.1.1.1 does not respond [NETW-2704] https://cisofy.com/lynis/controls/NETW-2704/ ! Couldn't find 2 responsive nameservers [NETW-2705] https://cisofy.com/lynis/controls/NETW-2705/ Suggestions (17): ---------------------------- * Install a PAM module for password strength testing like pam_cracklib or pam_passwdqc [AUTH-9262] https://cisofy.com/lynis/controls/AUTH-9262/ * Symlinked mount point needs to be checked manually [FILE-6310] - Details : /home - Solution : https://cisofy.com/lynis/controls/FILE-6310/ * Symlinked mount point needs to be checked manually [FILE-6310] - Details : /tmp - Solution : https://cisofy.com/lynis/controls/FILE-6310/ * Symlinked mount point needs to be checked manually [FILE-6310] - Details : /var - Solution : https://cisofy.com/lynis/controls/FILE-6310/ * Add the IP name and FQDN to /etc/hosts for proper name resolving [NAME-4404] https://cisofy.com/lynis/controls/NAME-4404/ * Install a package audit tool to determine vulnerable packages [PKGS-7398] https://cisofy.com/lynis/controls/PKGS-7398/ * Check connection to this nameserver and make sure no outbound DNS queries are blocked (port 53 UDP and TCP). [NETW-2704] https://cisofy.com/lynis/controls/NETW-2704/ * Check your resolv.conf file and fill in a backup nameserver if possible [NETW-2705] https://cisofy.com/lynis/controls/NETW-2705/ * 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/ * Turn off PHP information exposure [PHP-2372] - Details : expose_php = Off https://cisofy.com/lynis/controls/PHP-2372/ * Change the allow_url_fopen line to: allow_url_fopen = Off, to disable downloads via PHP [PHP-2376] https://cisofy.com/lynis/controls/PHP-2376/ * Check what deleted files are still in use and why. [LOGG-2190] https://cisofy.com/lynis/controls/LOGG-2190/ * 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/ * Double check the permissions of home directories as some might be not strict enough. [HOME-9304] https://cisofy.com/lynis/controls/HOME-9304/ * Harden compilers like restricting access to root user only [HRDN-7222] https://cisofy.com/lynis/controls/HRDN-7222/ 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 : 76 [############### ] Tests performed : 170 Plugins enabled : 2 Components: - Firewall [V] - Malware scanner [V] 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 ================================================================================ Lynis 3.0.3 Auditing, system hardening, and compliance for UNIX-based systems (Linux, macOS, BSD, and others) 2007-2021, CISOfy - https://cisofy.com/lynis/ Enterprise support available (compliance, plugins, interface and tools) ================================================================================ [TIP]: Enhance Lynis audits by adding your settings to custom.prf (see /usr/local/Cellar/lynis/3.0.3/default.prf for all settings) user@users-MacBook-Pro ~ %