{"id":491,"date":"2016-05-13T21:55:31","date_gmt":"2016-05-14T01:55:31","guid":{"rendered":"http:\/\/easy-admin.ca\/?p=491"},"modified":"2016-07-12T15:04:08","modified_gmt":"2016-07-12T19:04:08","slug":"lynis-is-a-powerful-auditing-tool-for-linux","status":"publish","type":"post","link":"https:\/\/easy-admin.ca\/index.php\/2016\/05\/13\/lynis-is-a-powerful-auditing-tool-for-linux\/","title":{"rendered":"Lynis is a powerful auditing tool for Linux"},"content":{"rendered":"<p><strong>Lynis<\/strong> is an open source and much powerful <strong>auditing tool<\/strong> for Unix\/Linux like operating systems. It scans system for security information, general system information, installed and available software information, configuration mistakes, security issues, user accounts without password, wrong file permissions, firewall auditing, etc.<\/p>\n<p><strong>Lynis<\/strong> is one of the most trusted automated auditing tool for software patch management, malware scanning and vulnerability detecting in Unix\/Linux based systems. This tool is useful for <strong>auditors<\/strong>, <strong>network<\/strong> and <strong>system administrators<\/strong>, <strong>security specialists<\/strong> and <strong>penetration testers<\/strong>.<\/p>\n<p><strong>Installation of Lynis<br \/>\n<\/strong>Lynis doesn\u2019t required any installation, it can be used directly from any directory. So, its good idea to create a custom directory for Lynis under <code>\/usr\/local\/lynis<\/code>.<strong><br \/>\n<\/strong><\/p>\n<pre># mkdir \/usr\/local\/lynis<\/pre>\n<p>Download stable version of <strong>Lynis<\/strong> source files from the trusted website using wget command and unpack it using tar command as shown below.<\/p>\n<pre># cd \/usr\/local\/lynis\r\n# wget https:\/\/cisofy.com\/files\/lynis-2.2.0.tar.gz<\/pre>\n<p>Unpack the tarball<\/p>\n<pre># tar -xvf lynis-2.2.0.tar.gz<\/pre>\n<p><strong>Running and using Lynis Basics<\/strong><br \/>\nYou must be <strong>root<\/strong> user to run <strong>Lynis<\/strong>, because it creates and writes output to <code>\/var\/log\/lynis.log<\/code> file. To run <strong>Lynis<\/strong> execute the following command.<\/p>\n<pre># cd lynis\r\n# .\/lynis<\/pre>\n<p>By running <code>.\/lynis<\/code> without any option, it will provide you a complete list of available parameters and goes back to the shell prompt.<\/p>\n<p>To start <strong>Lynis<\/strong> process, you must define a <code>--check-all<\/code> parameter to begin scanning of your entire <strong>Linux<\/strong> system. Use the following command to start scan with parameters as shown below.<\/p>\n<pre># .\/lynis --check-all<\/pre>\n<p>Once, you execute above command it will start scanning your system and ask you to <strong>Press [Enter] to continue, or [CTRL]+C to stop)<\/strong> every process it scans and completes.<\/p>\n<p>To prevent such acknowledgment (i.e. \u201c<strong>press enter to continue<\/strong>\u201d) from user while scanning, you need use <code>-c<\/code> and <code>-Q<\/code> parameters as shown below.<\/p>\n<pre># .\/lynis -c -Q<\/pre>\n<p>It will do complete scan without waiting for any user acknowledgment. See the following screencast.<\/p>\n<p><strong>Creating Lynis CronJobs<br \/>\n<\/strong>If you would like to create a daily scan report of your system, then you need to set a cron job for it. Run the following command at the shell.<\/p>\n<pre># crontab -e<\/pre>\n<p>Add the following cron job with option <code>--cronjob<\/code> all the special characters will be ignored from the output and the scan will run completely automated.<\/p>\n<pre>30\t22\t*\t*\t*\troot    \/path\/to\/lynis -c -Q --auditor \"automated\" --cronjob<\/pre>\n<p>The above example cron job will run daily at <strong>10:30pm<\/strong> in the night and creates a daily report under <code>\/var\/log\/lynis.log<\/code> file.<\/p>\n<p><strong>Lynis Scanning Results<\/strong><br \/>\nWhile scanning you will see output as [<strong>OK<\/strong>] or [<span style=\"color: #ff0000;\"><strong>WARNING<\/strong><\/span>]. Where [<strong>OK<\/strong>] considered as good result and [<span style=\"color: #ff0000;\"><strong>WARNING<\/strong><\/span>] as bad. But it doesn\u2019t mean that [<strong>OK<\/strong>] result is correctly configured and [<span style=\"color: #ff0000;\"><strong>WARNING<\/strong><\/span>] doesn\u2019t have to be bad. You should take corrective steps to fix those issues after reading logs at <code>\/var\/log\/lynis.log<\/code>.<\/p>\n<p>In most cases, the scan provides <span style=\"color: #ff0000;\"><strong>suggestion to fix<\/strong><\/span> problems at the end of the scan. See the attached figure that provides a list of suggestion to fix problems.<\/p>\n<p><strong>Updating Lynis<\/strong><br \/>\nIf you want to <strong>update<\/strong> or <strong>upgrade<\/strong> current lynis version, simple type the following command it will download and install latest version of lynis.<\/p>\n<pre># .\/lynis update info         [Show update details]\r\n# .\/lynis update release      [Update Lynis release]<\/pre>\n<p><strong>Lynis Parameters<\/strong><br \/>\nSome of the Lynis parameters for your reference.<\/p>\n<ol>\n<li><code>--checkall or -c<\/code> : Start the scan.<\/li>\n<li><code>--check-update<\/code> : Checks for Lynis update.<\/li>\n<li><code>--cronjob<\/code> : Runs Lynis as cronjob (includes -c -Q).<\/li>\n<li><code>--help or -h<\/code> : Shows valid parameters<\/li>\n<li><code>--quick or -Q<\/code> : Don\u2019t wait for user input, except on errors<\/li>\n<li><code>--version or -V<\/code> : Shows Lynis version.<\/li>\n<\/ol>\n<p>That\u2019s it, we hope this article will be much helpful you all to figure out security issues in running systems. For more information visit the official Lynis page at<\/p>\n<p><a href=\"https:\/\/cisofy.com\/download\/lynis\/\" target=\"_blank\">https:\/\/cisofy.com\/download\/lynis\/<\/a>.<\/p>\n<p><a href=\"https:\/\/cisofy.com\/files\/lynis-2.2.0.tar.gz\">Direct Download Lynis 2.2.0 Tar File <\/a><\/p>\n<p><em><strong>Enjoy!<\/strong><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lynis is an open source and much powerful auditing tool for Unix\/Linux like operating systems. It scans system for security information, general system information, installed and available software information, configuration mistakes, security issues, user accounts without password, wrong file permissions, firewall auditing, etc. Lynis is one of the most trusted automated auditing tool for software &hellip; <a href=\"https:\/\/easy-admin.ca\/index.php\/2016\/05\/13\/lynis-is-a-powerful-auditing-tool-for-linux\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Lynis is a powerful auditing tool for Linux<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-491","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts\/491","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/comments?post=491"}],"version-history":[{"count":0,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/posts\/491\/revisions"}],"wp:attachment":[{"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/media?parent=491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/categories?post=491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/easy-admin.ca\/index.php\/wp-json\/wp\/v2\/tags?post=491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}