Howto install and use Lynis on Centos 6.3 / Redhat RHEL / Fedora

Howto install and use Lynis on Centos 6.3 / Redhat RHEL / Fedora

1. Go to this website to download Lynis – security and system auditing tool

http://www.rootkit.nl/projects/lynis.html

2. Download Lynis package and untar

[root@localhost ~]# wget http://www.rootkit.nl/files/lynis-1.3.0.tar.gz
–2013-01-05 09:16:52– http://www.rootkit.nl/files/lynis-1.3.0.tar.gz
Resolving www.rootkit.nl… 31.7.1.110
Connecting to www.rootkit.nl|31.7.1.110|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 119797 (117K) [application/x-gzip]
Saving to: âlynis-1.3.0.tar.gzâ100%[======================================>] 119,797 33.7K/s in 3.5s2013-01-05 09:16:56 (33.7 KB/s) – âlynis-1.3.0.tar.gzâ[root@localhost ~]#
[root@localhost ~]# tar -xzvf lynis-1.3.0.tar.gz
lynis-1.3.0/CHANGELOG
lynis-1.3.0/FAQ
lynis-1.3.0/INSTALL
lynis-1.3.0/LICENSE
lynis-1.3.0/README
lynis-1.3.0/db/
lynis-1.3.0/db/integrity.db
lynis-1.3.0/db/sbl.db
lynis-1.3.0/db/fileperms.db
lynis-1.3.0/db/malware-susp.db
lynis-1.3.0/db/malware.db
lynis-1.3.0/db/hints.db
lynis-1.3.0/default.prf
lynis-1.3.0/dev/
lynis-1.3.0/dev/README
lynis-1.3.0/dev/files.dat
lynis-1.3.0/dev/TODO
lynis-1.3.0/dev/openbsd/
lynis-1.3.0/dev/openbsd/+CONTENTS
lynis-1.3.0/dev/check-lynis.sh
lynis-1.3.0/dev/build-lynis.sh
lynis-1.3.0/include/
lynis-1.3.0/include/profiles
lynis-1.3.0/include/tests_malware
lynis-1.3.0/include/tests_accounting
lynis-1.3.0/include/parameters
lynis-1.3.0/include/tests_ssh
lynis-1.3.0/include/tests_time
lynis-1.3.0/include/tests_firewalls
lynis-1.3.0/include/tests_nameservices
lynis-1.3.0/include/binaries
lynis-1.3.0/include/tests_webservers
lynis-1.3.0/include/tests_squid
lynis-1.3.0/include/tests_storage_nfs
lynis-1.3.0/include/tests_insecure_services
lynis-1.3.0/include/tests_scheduling
lynis-1.3.0/include/tests_tooling
lynis-1.3.0/include/tests_hardening
lynis-1.3.0/include/tests_networking
lynis-1.3.0/include/report
lynis-1.3.0/include/tests_boot_services
lynis-1.3.0/include/functions
lynis-1.3.0/include/tests_memory_processes
lynis-1.3.0/include/tests_file_permissions
lynis-1.3.0/include/tests_file_integrity
lynis-1.3.0/include/tests_shells
lynis-1.3.0/include/tests_databases
lynis-1.3.0/include/tests_homedirs
lynis-1.3.0/include/osdetection
lynis-1.3.0/include/tests_ldap
lynis-1.3.0/include/tests_ports_packages
lynis-1.3.0/include/tests_hardening_tools
lynis-1.3.0/include/tests_logging
lynis-1.3.0/include/tests_mail_messaging
lynis-1.3.0/include/tests_banners
lynis-1.3.0/include/tests_crypto
lynis-1.3.0/include/tests_kernel
lynis-1.3.0/include/tests_mac_frameworks
lynis-1.3.0/include/tests_solaris
lynis-1.3.0/include/tests_virtualization
lynis-1.3.0/include/tests_kernel_hardening
lynis-1.3.0/include/tests_snmp
lynis-1.3.0/include/tests_authentication
lynis-1.3.0/include/tests_filesystems
lynis-1.3.0/include/tests_storage
lynis-1.3.0/include/tests_printers_spools
lynis-1.3.0/include/tests_php
lynis-1.3.0/include/consts
lynis-1.3.0/include/tests_tcpwrappers
lynis-1.3.0/lynis
lynis-1.3.0/lynis.8
lynis-1.3.0/plugins/
lynis-1.3.0/plugins/README
lynis-1.3.0/plugins/custom_plugin.template
[root@localhost ~]# cd lynis-1.3.0
[root@localhost lynis-1.3.0]#

3. Check updates to update database for Lynis

[root@localhost lynis-1.3.0]# ls
CHANGELOG db default.prf dev FAQ include INSTALL LICENSE lynis lynis.8 plugins README
[root@localhost lynis-1.3.0]# ./lynis –check-update

== Lynis ==Version : 1.3.0
Release date : 28 April 2011
Update location : http://www.rootkit.nl/== Databases ==
Current Latest Status
—————————————————————————–
Malware : 2008062700 2008062700 Up-to-date
File perms : 2008053000 2008053000 Up-to-date
Copyright 2007-2012 – Michael Boelen, http://www.rootkit.nl/[root@localhost lynis-1.3.0]#

4.  Scan and audit security and system

[root@localhost lynis-1.3.0]# ./lynis –check-all
[ Lynis 1.3.0 ]################################################################################
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 LICENSE file for details about using this software.Copyright 2007-2012 – Michael Boelen, http://www.rootkit.nl/
################################################################################[+] Initializing program
————————————
– Detecting OS… [ DONE ]
– Clearing log file (/var/log/lynis.log)… [ DONE ]—————————————————
Program version: 1.3.0
Operating system: Linux
Operating system name: CentOS
Operating system version: CentOS release 6.3 (Final)
Kernel version: 2.6.32-279.el6.x86_64
Hardware platform: x86_64
Hostname: localhost
Auditor: [Unknown]
Profile: ./default.prf
Log file: /var/log/lynis.log
Report file: /var/log/lynis-report.dat
Report version: 1.0
—————————————————[ Press [ENTER] to continue, or [CTRL]+C to stop ]- Checking profile file (./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 ][+] Boot and services
————————————
– Checking boot loaders
– Checking presence GRUB… [ OK ]
– Checking for password protection… [ WARNING ]
– Checking presence LILO… [ NOT FOUND ]
– Checking presence YABOOT… [ NOT FOUND ]
– Check services at startup (chkconfig)… [ DONE ]
Result: found 33 services
– Check startup files (permissions)… [ OK ]————————————
– Checking default run level… [ 5 ]
– Checking CPU support (NX/PAE)
CPU supports PAE and NoeXecute [ YES ]
– Checking kernel version [ DONE ]
– Checking kernel type [ DONE ]
– Checking loaded kernel modules [ DONE ]
Found 59 active modules
– Checking Linux kernel configuration file… [ FOUND ]
– Checking core dumps configuration… [ ENABLED ]
– Checking setuid core dumps configuration… [ DISABLED ][+] 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 [ DISABLED ]
– Checking Linux single user mode authentication [ WARNING ]
– Determining default umask
– Checking umask (/etc/profile) [ SUGGESTION ]
– Checking umask (/etc/login.defs) [ OK ]
– Checking umask (/etc/init.d/functions) [ SUGGESTION ]
– Checking LDAP authentication support [ NOT ENABLED ][+] Shells
————————————
– Checking shells from /etc/shells…
Result: found 5 shells (valid shells: 5).[+] File systems
————————————
– Checking mount points
– Checking /home mount point… [ SUGGESTION ]
– Checking /tmp mount point… [ SUGGESTION ]
No volume groups found
– Checking LVM volume groups… [ NONE ]
– Checking for old files in /tmp… [ OK ]
– Checking /tmp sticky bit… [ OK ]
– ACL support root file system… [ ENABLED ]
– Checking Locate database… [ NOT 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… [ FOUND ]
– Checking search domains… [ FOUND ]
– Checking /etc/resolv.conf options… [ NONE ]
– Searching DNS domain name… [ UNKNOWN ]
– Checking nscd status… [ NOT FOUND ]
– Checking BIND status… [ NOT FOUND ]
– Checking PowerDNS status… [ NOT FOUND ]
– Checking ypbind status… [ NOT FOUND ]

[+] Ports and packages
————————————
– Searching package managers…
– Searching RPM package manager… [ FOUND ]
– Querying RPM package manager…
– Checking package database duplicates… [ OK ]
– Checking package database for problems… [ OK ]
Result: no vulnerable packages found [ OK ]

[+] Networking
————————————
– Checking configured nameservers…
– Testing nameservers…
Nameserver: 192.168.129.2… [ OK ]
– Minimal of 2 responsive nameservers… [ WARNING ]
– Checking default gateway… [ DONE ]
– Checking promiscuous interfaces… [ OK ]
– Checking waiting connections… [ OK ]

 

[+] Printers and Spools
————————————
– Checking cups daemon… [ RUNNING ]
– Checking cups configuration file… [ OK ]
– Checking cups addresses/sockets… [ FOUND ]

[+] Software: e-mail and messaging
————————————
– Checking Exim status… [ NOT FOUND ]
– Checking Postfix status… [ RUNNING ]
– Checking Postfix configuration… [ FOUND ]
– Checking Postfix banner… [ WARNING ]
– 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 ]
– Checking pf configuration… [ 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)
– Searching Apache virtual hosts…
– Searching nginx process… [ NOT FOUND ]

[+] SSH Support
————————————
– Checking running SSH daemon… [ FOUND ]
– Searching SSH configuration… [ FOUND ]
– Checking defined SSH options… [ DONE ]
– SSH option: PermitRootLogin… [ DEFAULT ]
– SSH option: Protocol… [ OK ]
– SSH option: StrictModes… [ DEFAULT ]
– SSH option: AllowUsers… [ NOT 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 ]

[ Press [ENTER] to continue, or [CTRL]+C to stop ]
[+] LDAP Services
————————————
– Checking OpenLDAP instance… [ NOT FOUND ]

[ Press [ENTER] to continue, or [CTRL]+C to stop ]
[+] Software: PHP
————————————
– Checking PHP… [ NOT FOUND ]

[ Press [ENTER] to continue, or [CTRL]+C to stop ]
[+] Squid Support
————————————
– Checking running Squid daemon… [ NOT FOUND ]

[ Press [ENTER] to continue, or [CTRL]+C to stop ]
[+] Logging and files
————————————
– Checking for a running syslog 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 [ NONE ]
– Checking logrotate presence [ OK ]
– Checking log directories (static list) [ DONE ]

– Checking open log files [ DONE ]
– Checking deleted files in use [ FILES FOUND ]

[ Press [ENTER] to continue, or [CTRL]+C to stop ]

[+] Insecure services
————————————
– Checking inetd status… [ NOT ACTIVE ]

[ Press [ENTER] to continue, or [CTRL]+C to stop ]
[+] Banners and identification
————————————
– /etc/motd… [ FOUND ]
– /etc/motd permissions… [ OK ]
– /etc/motd contents… [ WEAK ]
– /etc/issue… [ FOUND ]
– /etc/issue contents… [ WEAK ]
– /etc/issue.net… [ FOUND ]
– /etc/issue.net contents… [ WEAK ]

 

[+] Virtualization
————————————

[ Press [ENTER] to continue, or [CTRL]+C to stop ]
[+] Security frameworks
————————————
– Checking presence AppArmor [ NOT FOUND ]
– Checking presence SELinux [ FOUND ]
– Checking SELinux status [ ENABLED ]
Current SELinux mode: enforcing
– Checking current mode and config file [ OK ]
– Checking presence grsecurity [ NOT FOUND ]

[ Press [ENTER] to continue, or [CTRL]+C to stop ]
[+] Software: file integrity
————————————
– Checking AFICK… [ NOT FOUND ]
– Checking AIDE… [ NOT FOUND ]
– Checking Osiris… [ NOT FOUND ]
– Checking Samhain… [ NOT FOUND ]
– Checking Tripwire… [ NOT FOUND ]
– Checking presence integrity tool… [ NOT FOUND ]

[ Press [ENTER] to continue, or [CTRL]+C to stop ]
[+] Software: Malware scanners
————————————
– Checking chkrootkit… [ NOT FOUND ]
– Checking Rootkit Hunter… [ NOT FOUND ]
– Checking ClamAV scanner… [ NOT FOUND ]
– Checking ClamAV daemon… [ NOT FOUND ]

[ Press [ENTER] to continue, or [CTRL]+C to stop ]
[+] System Tools
————————————
– Starting file permissions check…
/etc/lilo.conf [ NOT FOUND ]
/root/.ssh [ OK ]

[ Press [ENTER] to continue, or [CTRL]+C to stop ]
[+] Home directories
————————————
– Checking shell history files… [ OK ]

[ Press [ENTER] to continue, or [CTRL]+C to stop ]
[+] 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) [ DIFFERENT ]
– 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) [ 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) [ DIFFERENT ]
– net.ipv4.conf.default.accept_redirects (exp: 0) [ DIFFERENT ]
– net.ipv4.conf.default.accept_source_route (exp: 0) [ OK ]
– 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) [ DIFFERENT ]
– 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 ]

[ Press [ENTER] to continue, or [CTRL]+C to stop ]
================================================================================

-[ Lynis 1.3.0 Results ]-

Tests performed: 155
Warnings:
—————————-
– [09:22:03] Warning: No password set on GRUB bootloader [test:BOOT-5121] [impact:M]
– [09:22:51] Warning: No password set for single mode [test:AUTH-9308] [impact:L]
– [09:24:50] Warning: Couldn’t find 2 responsive nameservers [test:NETW-2705] [impact:L]
– [09:25:14] Warning: Found mail_name in SMTP banner, and/or mail_name contains ‘Postfix’ [test:MAIL-8818] [impact:L]
– [09:25:25] Warning: Found possible unused iptables rules (1) [test:FIRE-4513] [impact:L]
– [09:26:57] Warning: No running NTP daemon or available client found [test:TIME-3104] [impact:M]

Suggestions:
—————————-
– [09:22:03] Suggestion: Run grub-md5-crypt and create a hashed password. Add a line below the line timeout=<value>, add: password –md5 <password hash> [test:BOOT-5121]
– [09:22:51] Suggestion: Configure password aging limits to enforce password changing on a regular base [test:AUTH-9286]
– [09:22:51] Suggestion: Set password for single user mode to minimize physical access attack surface [test:AUTH-9308]
– [09:22:51] Suggestion: Default umask in /etc/profile could be more strict like 027 [test:AUTH-9328]
– [09:23:17] Suggestion: To decrease the impact of a full /home file system, place /home on a separated partition [test:FILE-6310]
– [09:23:17] Suggestion: To decrease the impact of a full /tmp file system, place /tmp on a separated partition [test:FILE-6310]
– [09:23:18] Suggestion: The database required for ‘locate’ could not be found. Run ‘updatedb’ or ‘locate.updatedb’ to create this file. [test:FILE-6410]
– [09:23:32] Suggestion: Disable drivers like USB storage when not used, to prevent unauthorized storage or data theft [test:STRG-1840]
– [09:23:32] Suggestion: Disable drivers like firewire storage when not used, to prevent unauthorized storage or data theft [test:STRG-1846]
– [09:24:50] Suggestion: Check your resolv.conf file and fill in a backup nameserver if possible [test:NETW-2705]
– [09:25:14] Suggestion: You are adviced to hide the mail_name (option: smtpd_banner) from your postfix configuration. Use postconf -e or change your main.cf file (/etc/postfix/main.cf) [test:MAIL-8818]
– [09:25:25] Suggestion: Check iptables rules to see which rules are currently not used (iptables –list –numeric –verbose) [test:FIRE-4513]
– [09:26:33] Suggestion: Add legal banner to /etc/motd, to warn unauthorized users [test:BANN-7122]
– [09:26:33] Suggestion: Add legal banner to /etc/issue, to warn unauthorized users [test:BANN-7126]
– [09:26:33] Suggestion: Add legal banner to /etc/issue.net, to warn unauthorized users [test:BANN-7130]
– [09:26:55] Suggestion: Audit daemon is enabled with an empty ruleset. Disable the daemon or define rules [test:ACCT-9630]
– [09:26:57] Suggestion: Check if any NTP daemon is running or a NTP client gets executed daily, to prevent big time differences and avoid problems with services like kerberos, authentication or logging differences. [test:TIME-3104]
– [09:27:03] Suggestion: Install a file integrity tool [test:FINT-4350]
– [09:27:17] Suggestion: One or more sysctl values differ from the scan profile and could be tweaked [test:KRNL-6000]
– [09:27:40] Suggestion: Harden the system by removing unneeded compilers. This can decrease the chance of customized trojans, backdoors and rootkits to be compiled and installed [test:HRDN-7220]
– [09:27:40] Suggestion: Harden compilers and restrict access to world [test:HRDN-7222]
– [09:27:40] Suggestion: Harden the system by installing one or malware scanners to perform periodic file system scans [test:HRDN-7230]
================================================================================
Files:
– Test and debug information : /var/log/lynis.log
– Report data : /var/log/lynis-report.dat
================================================================================
Hardening index : [57] [########### ]
================================================================================
Tip: Disable all tests which are not relevant or are too strict for the
purpose of the 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.3.0
Copyright 2007-2012 – Michael Boelen, http://www.rootkit.nl/
================================================================================
[root@localhost lynis-1.3.0]#

That’s all. Thanks for using IThelpblog.com.

 

 

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>