{"id":12953,"date":"2021-12-20T12:57:09","date_gmt":"2021-12-20T12:57:09","guid":{"rendered":"https:\/\/linuxways.net\/?p=12953"},"modified":"2021-12-20T12:57:09","modified_gmt":"2021-12-20T12:57:09","slug":"how-to-install-suricata-ids-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-suricata-ids-on-ubuntu-20-04\/","title":{"rendered":"How to Install Suricata IDS on Ubuntu 20.04"},"content":{"rendered":"<p><a href=\"https:\/\/suricata.io\/\">Suricata<\/a> is an open-source network threat detection tool with features such as intrusion detection, intrusion prevention, as well as network security monitoring. It excels at deep packet inspection and pattern matching, making it an invaluable tool for detecting threats and attacks.<\/p>\n<p>Suricata can generate logs, drop traffic, and trigger alerts in case suspicious packets are in your network. This guide will take you through the installation of Suricata IDS on ubuntu 20.04<\/p>\n<h2><strong>Step 1: Update your system<\/strong><\/h2>\n<p>First, ensure your system packages are updated. Run the command:<\/p>\n<pre><strong>$ sudo apt update<\/strong><\/pre>\n<p>Once the package index is updated, proceed to the next step.<\/p>\n<h2><strong>Step 2: Add Suricata Repository<\/strong><\/h2>\n<p>The latest stable version of Suricata is available on the PPA repository maintained by OISF. Therefore, we are going to add the Suricata repository on your Ubuntu system as shown;<\/p>\n<pre><strong>$ sudo add-apt-repository ppa:oisf\/suricata-stable<\/strong><\/pre>\n<p>Thereafter, update your system\u2019s package index.<\/p>\n<pre><strong>$ sudo apt update<\/strong><\/pre>\n<p>With the PPA in place, head over to the next step and install the Suricat IDS.<\/p>\n<h2><strong>Step 3: Install Suricata<\/strong><\/h2>\n<p>To install Suricata run the command:<\/p>\n<pre><strong>$ sudo apt install suricata<\/strong><\/pre>\n<p>With the installation of Suricata, let\u2019s go a step further and enable it to start on boot time.<\/p>\n<pre><strong>$ sudo systemctl enable suricata.service<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"914\" height=\"147\" class=\"wp-image-12954\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-233.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-233.png 914w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-233-300x48.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-233-768x124.png 768w\" sizes=\"auto, (max-width: 914px) 100vw, 914px\" \/><\/strong><\/p>\n<p>Next, ensure that the installation was successful by running the following command:<\/p>\n<pre><strong>$ sudo suricata \u2013build-info<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1162\" height=\"656\" class=\"wp-image-12955\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-234.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-234.png 1162w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-234-300x169.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-234-1024x578.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-234-768x434.png 768w\" sizes=\"auto, (max-width: 1162px) 100vw, 1162px\" \/><\/strong><\/p>\n<p>Confirm that Suricata\u2019s systemd service is running as follows:<\/p>\n<pre><strong>$ sudo systemctl status suricata<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1193\" height=\"277\" class=\"wp-image-12956\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-235.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-235.png 1193w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-235-300x70.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-235-1024x238.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-235-768x178.png 768w\" sizes=\"auto, (max-width: 1193px) 100vw, 1193px\" \/><\/strong><\/p>\n<p>The output confirms that Suricata is up and running on Ubuntu 20.04<\/p>\n<h2><strong>Step 4: Basic setup<\/strong><\/h2>\n<p>Suricata\u2019s configuration file is located in the <strong> \/etc\/suricata\/suricata.yaml <\/strong>path. For basic setup, we need to configure Suricata for your internal and external network. Open the configuration file as shown:<\/p>\n<pre><strong>$ sudo vim \/etc\/suricata\/suricata.yaml<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"802\" height=\"399\" class=\"wp-image-12957\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-236.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-236.png 802w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-236-300x149.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-236-768x382.png 768w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" \/><\/strong><\/p>\n<p>Then, specify the ip address for the HOME_NET variable. In this case, my IP address is 192.168.100.7. The HOME_ NET variable is the IP address of your local network or interface you want to monitor. Next, define the value for <strong>EXTERNA_ NET<\/strong> as being any network that is not your local ip address.<\/p>\n<p>Next, go to the af-packet section in the configuration file and change the interface name to reflect the network interface chosen above.<\/p>\n<h2><strong>Step 5: Suricata Rules<\/strong><\/h2>\n<p>Suricata allows you to create network rules or signatures according to your requirements. The most common rules include Emerging Threats and Emerging Threats Pro.<\/p>\n<p>The rules file is located in the <strong>\/etc\/suricata\/rules\/<\/strong> directory. To view the contents run:<\/p>\n<pre><strong>$ ls \/etc\/suricata\/rules\/<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1129\" height=\"101\" class=\"wp-image-12958\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-237.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-237.png 1129w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-237-300x27.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-237-1024x92.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-237-768x69.png 768w\" sizes=\"auto, (max-width: 1129px) 100vw, 1129px\" \/><\/strong><\/p>\n<p>To install the Emerging Threats Open ruleset, run:<\/p>\n<pre><strong>$ sudo suricata-update<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"1190\" height=\"694\" class=\"wp-image-12959\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-238.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-238.png 1190w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-238-300x175.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-238-1024x597.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-238-768x448.png 768w\" sizes=\"auto, (max-width: 1190px) 100vw, 1190px\" \/><\/strong><\/p>\n<p>This will install the rules to the <strong>\/var\/lib\/suricata\/rules\/ <\/strong>directory.<\/p>\n<h2><strong>Step 6: Running Suricata<\/strong><\/h2>\n<p>After installing all the rules, you can restart the Suricata IDS service as shown:<\/p>\n<pre><strong>$ sudo systemctl restart suricata<\/strong><\/pre>\n<p>You can also check the Suricata logs as shown:<\/p>\n<pre><strong>$ sudo tail \/var\/log\/suricata\/suricata.log<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1328\" height=\"253\" class=\"wp-image-12960\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-239.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-239.png 1328w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-239-300x57.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-239-1024x195.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/12\/word-image-239-768x146.png 768w\" sizes=\"auto, (max-width: 1328px) 100vw, 1328px\" \/><\/p>\n<p>That\u2019s it with installing Suricata IDS on Ubuntu 20.04. For more information head over to the <a href=\"https:\/\/suricata.readthedocs.io\/en\/suricata-4.1.0\/\">documentation page<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Suricata is an open-source network threat detection tool with features such as intrusion detection, intrusion prevention, as well as network security monitoring. It excels at deep packet inspection&hellip;<\/p>","protected":false},"author":1,"featured_media":13236,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[765,100],"class_list":["post-12953","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-suricata-ids","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12953","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=12953"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/12953\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/13236"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=12953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=12953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=12953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}