Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the acf domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php on line 6131

Deprecated: Creation of dynamic property ACF::$fields is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields.php on line 138

Deprecated: Creation of dynamic property acf_loop::$loops is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/loop.php on line 28

Deprecated: Creation of dynamic property ACF::$loop is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/loop.php on line 269

Deprecated: Creation of dynamic property ACF::$revisions is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/revisions.php on line 397

Deprecated: Creation of dynamic property acf_validation::$errors is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/validation.php on line 28

Deprecated: Creation of dynamic property ACF::$validation is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/validation.php on line 214

Deprecated: Creation of dynamic property acf_form_customizer::$preview_values is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php on line 28

Deprecated: Creation of dynamic property acf_form_customizer::$preview_fields is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php on line 29

Deprecated: Creation of dynamic property acf_form_customizer::$preview_errors is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-customizer.php on line 30

Deprecated: Creation of dynamic property ACF::$form_front is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-front.php on line 598

Deprecated: Creation of dynamic property acf_form_widget::$preview_values is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-widget.php on line 34

Deprecated: Creation of dynamic property acf_form_widget::$preview_reference is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-widget.php on line 35

Deprecated: Creation of dynamic property acf_form_widget::$preview_errors is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-widget.php on line 36

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the all-in-one-wp-migration domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php on line 6131

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/wp_plugin/wp_plugin.php on line 23

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 54

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 1539

Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 828

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the rocket domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php on line 6131

Deprecated: Creation of dynamic property acf_field_oembed::$width is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-oembed.php on line 31

Deprecated: Creation of dynamic property acf_field_oembed::$height is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-oembed.php on line 32

Deprecated: Creation of dynamic property acf_field_google_map::$default_values is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-google-map.php on line 33

Deprecated: Creation of dynamic property acf_field__group::$have_rows is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-group.php on line 31

Deprecated: Creation of dynamic property acf_field_clone::$cloning is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-clone.php on line 34

Deprecated: Creation of dynamic property acf_field_clone::$have_rows is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-pro/pro/fields/class-acf-field-clone.php on line 35

Deprecated: Creation of dynamic property jh_acf_field_table::$settings is deprecated in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-content/plugins/advanced-custom-fields-table-field/class-jh-acf-field-table.php on line 23

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/functions.php:6131) in /var/www/vhosts/studiogo.tech/httpdocs/upcloudold/wp-includes/rest-api/class-wp-rest-server.php on line 1902
{"id":24610,"date":"2015-12-08T10:14:25","date_gmt":"2015-12-08T08:14:25","guid":{"rendered":"https:\/\/upcloud.com\/community\/tutorials\/installing-snort-on-debian"},"modified":"2023-09-08T11:30:18","modified_gmt":"2023-09-08T11:30:18","slug":"installing-snort-on-debian","status":"publish","type":"tutorial","link":"https:\/\/studiogo.tech\/upcloudold\/tutorial\/installing-snort-on-debian\/","title":{"rendered":"How to install Snort on Debian"},"content":{"rendered":"\r\n

Snort is a popular choice for running a network intrusion detection system or NIDS for short. It monitors the package data sent and received through a specific network interface. NIDS can catch threats targeting your system vulnerabilities using signature-based detection and protocol analysis technologies. NIDS software, when installed and configured appropriately, can identify the latest attacks, malware infections, compromised systems, and network policy violations. In this guide, you will find instructions on how to install Snort on Debian 9.\u00a0The install guide is also available for cloud servers running\u00a0CentOS 7<\/a>\u00a0and\u00a0Ubuntu 16<\/a>.<\/p>\r\n\r\n\r\n\r\n

\"Snort<\/figure>\r\n\r\n\r\n\r\n

Snort is one of the most commonly used\u00a0network-based IDS<\/a>. It is lightweight, open source, available on a multitude of platforms, and can be comfortably installed even on the smallest of cloud server instances. Although Snort is capable of much more than just network monitoring, this guide shows how to configure and run Snort in NIDS mode with a basic setup that you can later expand as needed.<\/p>\r\n\r\n\r\n\r\n

\r\n
Test hosting on UpCloud!<\/a><\/div>\r\n<\/div>\r\n\r\n\r\n\r\n

Preparing your server<\/h2>\r\n\r\n\r\n\r\n

Setting up a basic configuration of Snort on Debian is fairly simple but takes a few steps to complete. You will first need to install all the prerequisite software to ready your cloud server for installing Snort itself. Install the required libraries with the following command.<\/p>\r\n\r\n\r\n\r\n

sudo apt install -y gcc libpcre3-dev zlib1g-dev libluajit-5.1-dev \r\nlibpcap-dev openssl libssl-dev libnghttp2-dev libdumbnet-dev \r\nbison flex libdnet autoconf libtool<\/pre>\r\n\r\n\r\n\r\n

With the prerequisites fulfilled, next up is how to install Snort on Debian 9. Snort can be downloaded and installed manually from the source. Below you will find instructions on how to get this done.<\/p>\r\n\r\n\r\n\r\n

Installing from the source<\/h2>\r\n\r\n\r\n\r\n

Setting up Snort on Debian from the source code consists of a couple of steps: downloading the code, configuring it, compiling the code, installing it to an appropriate directory, and lastly configuring the detection rules.<\/p>\r\n\r\n\r\n\r\n

Start by making a temporary download folder to your home directory and then changing into it with the command below.<\/p>\r\n\r\n\r\n\r\n

mkdir ~\/snort_src && cd ~\/snort_src<\/pre>\r\n\r\n\r\n\r\n

Snort itself uses something called a Data Acquisition library (DAQ) to make abstract calls to packet capture libraries. Download the latest DAQ source package from the Snort website with the wget command underneath. Replace the version number in the command if a newer source is available.<\/p>\r\n\r\n\r\n\r\n

wget https:\/\/www.snort.org\/downloads\/snort\/daq-2.0.7.tar.gz<\/pre>\r\n\r\n\r\n\r\n

The download will only take a few seconds. When complete, extract the source code and jump into the new directory with the following commands.<\/p>\r\n\r\n\r\n\r\n

tar -xvzf daq-2.0.7.tar.gz\r\ncd daq-2.0.7<\/pre>\r\n\r\n\r\n\r\n

The latest version requires an additional step to auto-reconfigure DAQ before running the config. Use the command below which requires you need to have autoconf<\/tt> and libtool<\/tt> installed.<\/p>\r\n\r\n\r\n\r\n

autoreconf -f -i<\/pre>\r\n\r\n\r\n\r\n

Afterwards, run the configuration script using its default values, then compile the program with make and finally install DAQ.<\/p>\r\n\r\n\r\n\r\n

.\/configure && make && sudo make install<\/pre>\r\n\r\n\r\n\r\n

With the DAQ installed, you can get started with Snort, and change back to the download folder.<\/p>\r\n\r\n\r\n\r\n

cd ~\/snort_src<\/pre>\r\n\r\n\r\n\r\n

Next, download the Snort source code with wget<\/tt>.\u00a0You can find the latest version number on the Snort downloads page<\/a>. Replace it in the following command if necessary.<\/p>\r\n\r\n\r\n\r\n

wget https:\/\/www.snort.org\/downloads\/snort\/snort-2.9.16.tar.gz<\/pre>\r\n\r\n\r\n\r\n

Once the download is complete, extract the source and change into the new directory with these commands.<\/p>\r\n\r\n\r\n\r\n

tar -xvzf snort-2.9.16.tar.gz\r\ncd snort-2.9.16<\/pre>\r\n\r\n\r\n\r\n

Then configure the installation with sourcefire<\/tt>\u00a0enabled, run make and make install.<\/p>\r\n\r\n\r\n\r\n

.\/configure --enable-sourcefire && make && sudo make install<\/pre>\r\n\r\n\r\n\r\n

With that done, continue below on how to set up the configuration files.<\/p>\r\n\r\n\r\n\r\n

Configuring Snort to run in NIDS mode<\/h2>\r\n\r\n\r\n\r\n

Next, you will need to configure Snort for your system. This includes editing some configuration files, downloading the rules that Snort will follow, and taking Snort for a test run.<\/p>\r\n\r\n\r\n\r\n

Start with updating the shared libraries using the command underneath.<\/p>\r\n\r\n\r\n\r\n

sudo ldconfig<\/pre>\r\n\r\n\r\n\r\n

Snort on Debian gets installed to \/usr\/local\/bin\/snort<\/tt> directory, it is good practice to create a symbolic link to \/usr\/sbin\/snort<\/tt>.<\/p>\r\n\r\n\r\n\r\n

sudo ln -s \/usr\/local\/bin\/snort \/usr\/sbin\/snort<\/pre>\r\n\r\n\r\n\r\n

Setting up username and folder structure<\/h2>\r\n\r\n\r\n\r\n

To run Snort on Debian safely without root access, you should create a new unprivileged user and a new user group for the daemon to run under.<\/p>\r\n\r\n\r\n\r\n

sudo groupadd snort\r\nsudo useradd snort -r -s \/sbin\/nologin -c SNORT_IDS -g snort<\/pre>\r\n\r\n\r\n\r\n

Then create the folder structure to house the Snort configuration, just copy over the commands below.<\/p>\r\n\r\n\r\n\r\n

sudo mkdir -p \/etc\/snort\/rules\r\nsudo mkdir \/var\/log\/snort\r\nsudo mkdir \/usr\/local\/lib\/snort_dynamicrules<\/pre>\r\n\r\n\r\n\r\n

Set the permissions for the new directories accordingly.<\/p>\r\n\r\n\r\n\r\n

sudo chmod -R 5775 \/etc\/snort\r\nsudo chmod -R 5775 \/var\/log\/snort\r\nsudo chmod -R 5775 \/usr\/local\/lib\/snort_dynamicrules\r\nsudo chown -R snort:snort \/etc\/snort\r\nsudo chown -R snort:snort \/var\/log\/snort\r\nsudo chown -R snort:snort \/usr\/local\/lib\/snort_dynamicrules<\/pre>\r\n\r\n\r\n\r\n

Create new files for the white and blacklists as well as the local rules.<\/p>\r\n\r\n\r\n\r\n

sudo touch \/etc\/snort\/rules\/white_list.rules\r\nsudo touch \/etc\/snort\/rules\/black_list.rules\r\nsudo touch \/etc\/snort\/rules\/local.rules<\/pre>\r\n\r\n\r\n\r\n

Then copy the configuration files from the download folder.<\/p>\r\n\r\n\r\n\r\n

sudo cp ~\/snort_src\/snort-2.9.16\/etc\/*.conf* \/etc\/snort\r\nsudo cp ~\/snort_src\/snort-2.9.16\/etc\/*.map \/etc\/snort<\/pre>\r\n\r\n\r\n\r\n

Next up, you will need to download the detection rules Snort will follow to identify potential threats. Snort provides three tiers of rule sets, community, registered and subscriber rules.<\/p>\r\n\r\n\r\n\r\n