{"id":11913,"date":"2021-11-15T09:04:32","date_gmt":"2021-11-15T09:04:32","guid":{"rendered":"https:\/\/linuxways.net\/?p=11913"},"modified":"2021-11-16T13:14:43","modified_gmt":"2021-11-16T13:14:43","slug":"how-to-install-lynis-security-auditing-tool-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-lynis-security-auditing-tool-on-ubuntu-20-04\/","title":{"rendered":"How to install Lynis security auditing tool on Ubuntu 20.04"},"content":{"rendered":"<p>Lynis is an open-source security auditing tool used for in-depth system-wide security scans. It provides useful information about vulnerabilities in your system and suggestions on how to improve security. Lynis allows you to easily scan your system features such as application patch management, ports, file system, kernel, databases, and much more. System admins and security professionals can scan systems extensively in a very short time.<\/p>\n<p>Lynis can be used in both enterprise environments and on small and medium enterprises.<\/p>\n<p>In this article, I will explain how to install and use Lynis on Ubuntu 20.04<\/p>\n<h2>Step 1: Check version available in repo<\/h2>\n<p>First, let&#8217;s check the Lynis version available in the Ubuntu 20.04 repo. Run:<\/p>\n<pre>\r\n$ apt-cache policy lynis\r\n<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"887\" height=\"187\" class=\"wp-image-11916\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-142.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-142.png 887w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-142-300x63.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-142-768x162.png 768w\" sizes=\"auto, (max-width: 887px) 100vw, 887px\" \/><\/strong><\/p>\n<p>As you can see, the Lynis v2.6.2 is available in the ubuntu universe repos. By the time of writing this tutorial, Lynis 3.0.6 is the current stable release version.<\/p>\n<p>You can download the latest release from the Lynis community software repository.<\/p>\n<h2>Step 2: Install PGP key &amp; Repo.<\/h2>\n<p>First, download and add the PGP signing key from a central keyserver. Execute the commands:<\/p>\n<pre>\r\n$ wget -O - https:\/\/packages.cisofy.com\/keys\/cisofy-software-public.key | sudo apt-key add -\r\n<\/pre>\n<p>Next, add the Lynis repository to the system package repository list as shown:<\/p>\n<pre>\r\n$ echo \"deb https:\/\/packages.cisofy.com\/community\/lynis\/deb\/ stable main\" | sudo tee \/etc\/apt\/sources.list.d\/cisofy-lynis.list\r\n<\/pre>\n<p>To use Lynis with only English, disable translations from being downloaded as shown:<\/p>\n<pre>\r\n$ echo 'Acquire::Languages \"none\";' | sudo tee \/etc\/apt\/apt.conf.d\/99disable-translations<\/pre>\n<h2>Step 3: Update Packages<\/h2>\n<p>Next, update the system packages before proceeding with the installation. Run the commands:<\/p>\n<pre>\r\n$ sudo apt install apt-transport-https\r\n\r\n$ sudo apt update\r\n<\/pre>\n<h2>Step 4: Install Lynis<\/h2>\n<p>Now we are ready to install Lynis on our system. Execute the command:<\/p>\n<pre>\r\n$ sudo apt install lynis\r\n<\/pre>\n<p>Once the installation is done, confirm the Lynis version installed on your system as shown:<\/p>\n<pre>\r\n$ lynis show version\r\n<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"589\" height=\"97\" class=\"wp-image-11918\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-145.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-145.png 589w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-145-300x49.png 300w\" sizes=\"auto, (max-width: 589px) 100vw, 589px\" \/><\/strong><\/p>\n<h2>Step 5: Lynis Command Line Syntax and Options<\/h2>\n<p>Now that the latest version of Lynis is installed, let\u2019s learn how to use this tool to audit the system. The syntax of the Lynis command is as follows:<\/p>\n<pre>\r\n$ lynis [scan mode] [other options]\r\n<\/pre>\n<p>We can view the Lynis commands as shown:<\/p>\n<pre>\r\n$ lynis show commands\r\n<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"675\" height=\"241\" class=\"wp-image-11920\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-147.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-147.png 675w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-147-300x107.png 300w\" sizes=\"auto, (max-width: 675px) 100vw, 675px\" \/><\/strong><\/p>\n<p>To view settings run:<\/p>\n<pre>\r\n$ lynis show settings\r\n<\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1157\" height=\"849\" class=\"wp-image-11923\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-150.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-150.png 1157w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-150-300x220.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-150-1024x751.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-150-768x564.png 768w\" sizes=\"auto, (max-width: 1157px) 100vw, 1157px\" \/><\/strong><\/p>\n<h2>Step 6: Auditing a Linux System Using Lynis<\/h2>\n<p>Let&#8217;s proceed and perform a system audit on the machine. Run the following command:<\/p>\n<pre>\r\n$ sudo lynis audit system\r\n<\/pre>\n<p>During the auditing process, Lynis executes tests and generates output separated into many areas such as security, suggestions, file system, test result, debug information, and so on. The auditing report is saved to \/var\/log\/lynis-report.dat, and all test and debug information is written to \/var\/log\/lynis.log. The report file contains general information on the system application, server vulnerable packages, and so forth. The prior test results will be overwritten each time you perform a new system audit.<\/p>\n<p>The example below displays several auditing results labeled by keywords such as Enabled, Found, Not Found, Ok, Suggestion, etc. Any output with the Warning keyword needs to be checked and fixed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1190\" height=\"756\" class=\"wp-image-11925\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-152.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-152.png 1190w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-152-300x191.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-152-1024x651.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-152-768x488.png 768w\" sizes=\"auto, (max-width: 1190px) 100vw, 1190px\" \/><\/p>\n<p>System Audit Output<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1168\" height=\"827\" class=\"wp-image-11927\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-154.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-154.png 1168w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-154-300x212.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-154-1024x725.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-154-768x544.png 768w\" sizes=\"auto, (max-width: 1168px) 100vw, 1168px\" \/><\/p>\n<p>Lynis provided suggestions at the end of the auditing on how to harden your system.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1271\" height=\"817\" class=\"wp-image-11929\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-156.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-156.png 1271w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-156-300x193.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-156-1024x658.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-156-768x494.png 768w\" sizes=\"auto, (max-width: 1271px) 100vw, 1271px\" \/><\/p>\n<h2>Display Details of a Specific Test or Suggestion<\/h2>\n<p>Each system check has a unique test ID. If you require additional information about a certain test, use the command below and its ID and display further information.<\/p>\n<pre>\r\n$ lynis show details TEST-ID\r\n<\/pre>\n<p>In this example, we will find out more about a test with a suggestion from Lynis.<\/p>\n<pre>\r\n$ lynis show details HRDN-7222\r\n<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1233\" height=\"535\" class=\"wp-image-11930\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-157.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-157.png 1233w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-157-300x130.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-157-1024x444.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/11\/word-image-157-768x333.png 768w\" sizes=\"auto, (max-width: 1233px) 100vw, 1233px\" \/><\/p>\n<p>We have learned how to install and use the Lynis tool to audit our Ubuntu system. For further information on how to use it, check out the <a href=\"https:\/\/cisofy.com\/lynis\/\">official site.<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>Lynis is an open-source security auditing tool used for in-depth system-wide security scans. It provides useful information about vulnerabilities in your system and suggestions on how to improve&hellip;<\/p>","protected":false},"author":1,"featured_media":11942,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-11913","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/11913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=11913"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/11913\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/11942"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=11913"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=11913"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=11913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}