<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.itcollege.ee/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kkurval</id>
	<title>ICO wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.itcollege.ee/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kkurval"/>
	<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php/Special:Contributions/Kkurval"/>
	<updated>2026-05-11T11:25:23Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115861</id>
		<title>Logging - Monitoring C21</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115861"/>
		<updated>2016-12-15T08:09:15Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Nagios Monitoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Logging and Monitoring with Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Course: Logging and Monitoring - Lecturer: Margus Ernits&lt;br /&gt;
&lt;br /&gt;
Group: Cyber Security Engineering (C21)&lt;br /&gt;
&lt;br /&gt;
Team members: Ender Phan, Kustas Kurval, Sheela Gowry Sumathi Raju, Artur Vincent Kerge&lt;br /&gt;
&lt;br /&gt;
Page created on: October 05, 2016&lt;br /&gt;
&lt;br /&gt;
= Abstract =&lt;br /&gt;
&lt;br /&gt;
In order to understand how to set up the Graylog service as well as understand its crucial roles. We decided to choose Graylog as our application for logging and monitoring. Below are our objectives which would be expected to achieve later on:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Graylog on Ubuntu 14.04.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to use Graylog to protect servers.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Upgrading and configuring Graylog at first, and know how to secure Graylog.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Threats and security during logging.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Netdata and Monitoring with Netdata.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Nagios and Monitoring with Nagios.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Trouble shooting and experiences.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Installation Guide =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ubuntu 14.04&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Graylog_simple_setup_v2.png]]&lt;br /&gt;
&lt;br /&gt;
== Logging Solutions ==&lt;br /&gt;
&lt;br /&gt;
Since the Elasticsearch is based on java, we would require to install either openJDK or Oracle JDK. It is recommended to install Oracle JDK, verify the java version by using the following command.&lt;br /&gt;
&lt;br /&gt;
Remove the OpenJDK from the system, if you have it already installed. From now on it is presumed that user has root privileges.&lt;br /&gt;
&lt;br /&gt;
 apt-get remove --purge openjdk*&lt;br /&gt;
Add repository.&lt;br /&gt;
&lt;br /&gt;
 add-apt-repository -y ppa:webupd8team/java&lt;br /&gt;
Run the following command to pull the packages information from the newly added repository.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Issue the following command to install Java jdk 1.8.&lt;br /&gt;
&lt;br /&gt;
 apt-get -y install oracle-java8-installer&lt;br /&gt;
&lt;br /&gt;
 java -version&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
 Java version &amp;quot;1.8.0_60&amp;quot;&lt;br /&gt;
 Java(TM) SE Runtime Environment (build 1.8.0_60-b27)&lt;br /&gt;
 Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)&lt;br /&gt;
&lt;br /&gt;
=== Installing extras ===&lt;br /&gt;
&lt;br /&gt;
=== Elasticsearch ===&lt;br /&gt;
&lt;br /&gt;
Let’s install Elasticsearch, it can be downloaded from the official website.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download and install GPG signing key&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -&lt;br /&gt;
&lt;br /&gt;
Note that the -qO argument is lowercase Quebec followed by capital Oscar.&lt;br /&gt;
&lt;br /&gt;
Save the repository definition to /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
Update repository cache and install Elasticsearch&lt;br /&gt;
&lt;br /&gt;
 apt-get update &amp;amp;&amp;amp; apt-get install elasticsearch&lt;br /&gt;
&lt;br /&gt;
Configure Elasticsearch to start during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d elasticsearch defaults&lt;br /&gt;
The only important thing is to set a cluster name as “graylog2“, that is being used by graylog. Now edit the configuration file of Elasticsearch.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/elasticsearch/elasticsearch.yml&lt;br /&gt;
&lt;br /&gt;
 cluster.name: graylog2&lt;br /&gt;
&lt;br /&gt;
In the same file disable dynamic scripts to avoid remote execution. That can be done by adding the following line:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOLLOWING LINE GOES INTO GRAYLOG CONF!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 script.disable_dynamic: true&lt;br /&gt;
&lt;br /&gt;
Once it is done, we are good to go. Before that, restart the Elasticsearch services to load the modified configuration.&lt;br /&gt;
&lt;br /&gt;
 service elasticsearch restart&lt;br /&gt;
&lt;br /&gt;
Wait at least a minute to let the Elasticsearch get fully restarted, otherwise testing will fail. Elastisearch should be now listen on 9200 for processing HTTP request, we can use CURL to get the response. Ensure that it returns with cluster name as “graylog2”&lt;br /&gt;
&lt;br /&gt;
 curl -X GET http://localhost:9200&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
   &amp;quot;status&amp;quot; : 200,&lt;br /&gt;
   &amp;quot;name&amp;quot; : &amp;quot;Pistol&amp;quot;,&lt;br /&gt;
   &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
   &amp;quot;version&amp;quot; : {&lt;br /&gt;
    &amp;quot;number&amp;quot; : &amp;quot;1.7.1&amp;quot;,&lt;br /&gt;
    &amp;quot;build_hash&amp;quot; : &amp;quot;b88f43fc40b0bcd7f173a1f9ee2e97816de80b19&amp;quot;,&lt;br /&gt;
    &amp;quot;build_timestamp&amp;quot; : &amp;quot;2015-07-29T09:54:16Z&amp;quot;,&lt;br /&gt;
    &amp;quot;build_snapshot&amp;quot; : false,&lt;br /&gt;
    &amp;quot;lucene_version&amp;quot; : &amp;quot;4.10.4&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  &amp;quot;tagline&amp;quot; : &amp;quot;You Know, for Search&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Optional: Use the following command to check the Elasticsearch cluster health, you must get a cluster status as “green” for graylog to work.&lt;br /&gt;
&lt;br /&gt;
 curl -XGET &#039;http://localhost:9200/_cluster/health?pretty=true&#039;&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
  &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;status&amp;quot; : &amp;quot;&#039;&#039;&#039;green&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;timed_out&amp;quot; : false,&lt;br /&gt;
  &amp;quot;number_of_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;number_of_data_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;active_primary_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;active_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;relocating_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;initializing_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;delayed_unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_pending_tasks&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_in_flight_fetch&amp;quot; : 0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== MongoDB ===&lt;br /&gt;
&lt;br /&gt;
MongoDB is available in deb format and same can be downloaded from the official website. Add the following repository information on the system to install MongoDB. Before that we must import public key.&lt;br /&gt;
&lt;br /&gt;
 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10&lt;br /&gt;
Add repository by creating the /etc/apt/sources.list.d/mongodb-org-3.0.list list file using the command.&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse&amp;quot; | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list&lt;br /&gt;
Update repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install MongoDB using the following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install mongodb-org&lt;br /&gt;
Start the MongoDB service and enable it to start automatically during the system start-up.&lt;br /&gt;
&lt;br /&gt;
 service mongod start&lt;br /&gt;
&lt;br /&gt;
 ln -s /usr/bin/mongod /etc/init.d/mongod&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link&lt;br /&gt;
&lt;br /&gt;
 update-rc.d mongod defaults&lt;br /&gt;
&lt;br /&gt;
=== Graylog2 ===&lt;br /&gt;
&lt;br /&gt;
Graylog-server accepts and process the log messages, also spawns the RESTAPI for the requests that comes from graylog-web-interface. Download the latest version of graylog from graylog.org,&lt;br /&gt;
&lt;br /&gt;
Use the following command to install graylog2 repository.&lt;br /&gt;
&lt;br /&gt;
 wget https://packages.graylog2.org/repo/packages/graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
&lt;br /&gt;
 dpkg -i graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
Install https suppport and update the repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get install apt-transport-https&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install Graylog server using following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-server &lt;br /&gt;
Edit the server.conf file.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/server/server.conf&lt;br /&gt;
Configure the following variables in the above file.&lt;br /&gt;
&lt;br /&gt;
Set a secret to secure the user passwords, use the following command to generate a secret, use at least 64 character’s.&lt;br /&gt;
&lt;br /&gt;
 pwgen -N 1 -s 96&lt;br /&gt;
&lt;br /&gt;
 OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
If you get a “pwgen: command not found“, use the following command to install pwgen.&lt;br /&gt;
&lt;br /&gt;
 apt-get install pwgen&lt;br /&gt;
&lt;br /&gt;
Place the secret.&lt;br /&gt;
&lt;br /&gt;
 password_secret = OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
Next is to set a hash password for the root user (not to be confused with system user, root user of graylog is admin). You will use this password for login into the web interface, admin’s password can not be changed using web interface, must edit this variable to set.&lt;br /&gt;
&lt;br /&gt;
Replace “yourpassword” with the choice of your’s.&lt;br /&gt;
&lt;br /&gt;
 echo -n yourpassword | sha256sum&lt;br /&gt;
&lt;br /&gt;
 e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
Place the hash password.&lt;br /&gt;
&lt;br /&gt;
 root_password_sha2 = e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
You can setup email address root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_email = &amp;quot;cyber.web@gmail.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set timezone of root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_timezone = UTC&lt;br /&gt;
&lt;br /&gt;
Graylog will try to find the Elasticsearch nodes automatically, it uses multicast mode for the same. But when it comes to larger network, it is recommended to use unicast mode which is best suited one for production setups. So add the following two entries to graylog server.conf file, replace ipaddress with live hostname or ipaddress. Multiple hosts can be added with comma separated.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_http_enabled = false&lt;br /&gt;
 elasticsearch_discovery_zen_ping_unicast_hosts = ipaddress:9300&lt;br /&gt;
&lt;br /&gt;
Set only one master node by defining the below variable, default setting is true, you must set it as a false to make the particular node as a slave. Master node performs some periodic tasks that slave won’t perform.&lt;br /&gt;
&lt;br /&gt;
 is_master = true&lt;br /&gt;
&lt;br /&gt;
The following variable sets the number of log messages to keep per index, it is recommended to have several smaller indices instead of larger ones.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_docs_per_index = 20000000&lt;br /&gt;
&lt;br /&gt;
The following parameter defines to have total number of indices, if the this number is reached old index will be deleted.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_number_of_indices = 20&lt;br /&gt;
&lt;br /&gt;
Shards setting is really depends on the number of nodes in the Elasticsearch cluster, if you have only one node, set it as 1.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_shards = 1&lt;br /&gt;
&lt;br /&gt;
The number of replicas for your indices, if you have only one node in Elasticsearch cluster; set it as 0.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_replicas = 0&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Restart Graylog service.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 service graylog-server restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of graylog server service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-server defaults&lt;br /&gt;
&lt;br /&gt;
You can check out the server startup logs, it will be useful for you to troubleshoot graylog in case of any issue.&lt;br /&gt;
&lt;br /&gt;
 tailf /var/log/graylog-server/server.log&lt;br /&gt;
&lt;br /&gt;
On successful start of graylog-server, you should get the following message in the log file.&lt;br /&gt;
&lt;br /&gt;
 2015-09-17T09:35:22.895+02:00 INFO  [ServerBootstrap] Graylog server up and running.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Graylog web interface:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To configure graylog-web-interface, you must have at least one graylog-server node. Install Graylog web interface using “apt-get”.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-web&lt;br /&gt;
&lt;br /&gt;
Edit the configuration file and set the following parameters.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/web/web.conf&lt;br /&gt;
&lt;br /&gt;
This is the list of graylog-server nodes, you can add multiple nodes, separate by commas.&lt;br /&gt;
&lt;br /&gt;
 graylog2-server.uris=&amp;quot;http://127.0.0.1:12900/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set the application scret and can be generated using pwgen -N 1 -s 96.&lt;br /&gt;
&lt;br /&gt;
application.secret=&amp;quot;sNXyFf6B4Au3GqSlZwq7En86xp10JimdxxYiLtpptOejX6tIUpUE4DGRJOrcMj07wcK0wugPaapvzEzCYinEWj7BOtHXVl5Z&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set Web interface timezone.&lt;br /&gt;
&lt;br /&gt;
 Timezone=&amp;quot;Europe/Tallinn&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Restart the gralog-web-interface using following command,&lt;br /&gt;
&lt;br /&gt;
 service graylog-web restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of web interface service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-web defaults&lt;br /&gt;
&lt;br /&gt;
Add log forwarding to ryslog.&lt;br /&gt;
 nano /etc/rsyslog.d/50-default.conf&lt;br /&gt;
 *.*@192.168.56.200:5555&lt;br /&gt;
&lt;br /&gt;
== Monitoring Solutions ==&lt;br /&gt;
* Netdata&lt;br /&gt;
&lt;br /&gt;
* Nagios&lt;br /&gt;
=== Netdata Monitoring ===&lt;br /&gt;
[[File:Netdata.gif]]&lt;br /&gt;
&lt;br /&gt;
Linus Distribution: Debian Linux and its derivatives (including Ubuntu, Mint)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install nessesary packages:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install the packages for having a basic netdata installation (system monitoring and many applications, without mysql / mariadb, postgres, named, hardware sensors and SNMP):&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata&lt;br /&gt;
&lt;br /&gt;
Install all the required packages for monitoring everything netdata can monitor:&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata-all&lt;br /&gt;
&lt;br /&gt;
  apt-get install zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Netdata&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Download it - the directory &#039;netdata&#039; will be created&lt;br /&gt;
  git clone https://github.com/firehol/netdata.git --depth=1&lt;br /&gt;
  cd netdata&lt;br /&gt;
&lt;br /&gt;
Build it, install it, start it&lt;br /&gt;
  ./netdata-installer.sh&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;starting netdata at boot&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Copy the netdata startup file to /etc/init.d&lt;br /&gt;
  cp system/netdata-lsb /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Make sure it is executable&lt;br /&gt;
  chmod +x /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Enable it&lt;br /&gt;
  update-rc.d netdata defaults&lt;br /&gt;
&lt;br /&gt;
Access to web interface&lt;br /&gt;
 &lt;br /&gt;
 http://&amp;lt;ipaddress&amp;gt;:19999&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced : https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Nagios Monitoring ===&lt;br /&gt;
&lt;br /&gt;
[[File:Nagios.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Choosing Nagios implementation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Nagios core and Nagios XI. Depending on what version of Linux you are running you might only be able to support Nagios core. On Ubuntu 15 and ahead PHP5 is unavailable which means that Installing Nagios XI is not possible since it depends on PHP5. In this case you have to install Nagios core using PHP7.:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For Nagios XI&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps are for Nagios XI. For Nagios Core install please go below.&lt;br /&gt;
Install PHP (version 5): &lt;br /&gt;
&lt;br /&gt;
  apt-get install php5-common libapache2-mod-php5 php5-cli&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloading the Latest Release&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Make sure to download the Nagios XI installation package to the /tmp directory of the server on which you wish to install it, as shown in&lt;br /&gt;
the following commands:&lt;br /&gt;
&lt;br /&gt;
  cd /tmp&lt;br /&gt;
&lt;br /&gt;
To download the latest stable release, use the following command:&lt;br /&gt;
&lt;br /&gt;
  wget http://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  tar xzf xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  cd /tmp/nagiosxi&lt;br /&gt;
&lt;br /&gt;
  ./fullinstall&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: It will take around 5 minutes to finish the installation.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You are access the Nagios XI interface by pointing your web browser to:&lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;/nagiosxi OR http://&amp;lt;ipaddress&amp;gt;/nagiosql/install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: An empty file named ENABLE_INSTALLER is necessary to create in install/ directory to continue with installation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Troubleshooting&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I got the problem with the given IP after finishing installation, it gave me wrong IP to access. But just ignore it and go to your correct IP of your web server: &lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  without &amp;quot;/nagiosxi&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It will show the installation GUI and you just need to follow and login after all.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Install Plugins ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Locate Your Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Visit this website to download plugins: http://exchange.nagios.org. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 Click the Admin menu --&amp;gt; Manage Plugins &lt;br /&gt;
&lt;br /&gt;
 Click the Browse button --&amp;gt; click the Upload Plugin button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test Your Plugin From The Command Line&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  cd /usr/local/nagios/libexec&lt;br /&gt;
  &lt;br /&gt;
  ./plugin_name arg1 arg2 ...&lt;br /&gt;
&lt;br /&gt;
*See the document of plugin to get more detail of its arguments&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Define A Command&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 browse to Configure → Core&lt;br /&gt;
&lt;br /&gt;
 Configuration Manager → Commands and click Add New.&lt;br /&gt;
&lt;br /&gt;
Enter a Command Name, usually the same as the plugin&lt;br /&gt;
filename. Next in the Command Line field, enter&lt;br /&gt;
$USER1$/plugin_name $ARG1$. The $USER1$ macro is&lt;br /&gt;
replaced with the path to the plugin directory, while the&lt;br /&gt;
$ARG1$ macro is a placeholder for an argument you want to&lt;br /&gt;
specify later on a per-service basis. If you want, you can omit&lt;br /&gt;
$ARG1$ or add more ($ARG2$, $ARG3$, etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Click Save --&amp;gt; Apply Configuration.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Add A Service&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In the left-hand menu&lt;br /&gt;
&lt;br /&gt;
 Click Services --&amp;gt; click Add New.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Config Name&#039;&#039;&#039; field, enter the file name where the&lt;br /&gt;
configuration will be stored. Next enter a description of the&lt;br /&gt;
service in the Description field. Associate the service with a&lt;br /&gt;
host by clicking the Manage Host button.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Check command&#039;&#039;&#039; field, select the command you defined&lt;br /&gt;
above from the dropdown list. If you had any argument&lt;br /&gt;
placeholders when you defined the command earlier, enter&lt;br /&gt;
replacement text in the appropriate argument fields.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Manage Templates&#039;&#039;&#039; button allows you to apply a template&lt;br /&gt;
to this service which will save you from having to fill in all the&lt;br /&gt;
other configuration options, or you can enter the required&lt;br /&gt;
Check and Alert settings manually.&lt;br /&gt;
&lt;br /&gt;
 Save --&amp;gt; Apply Configuration again&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Verify Your Service Is Working&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Navigate to&lt;br /&gt;
&lt;br /&gt;
  Home → Service Detail  &lt;br /&gt;
&lt;br /&gt;
Look for your new service in the list. It will probably take a few minutes before it runs its first check.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For Nagios Core&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install Nagios on Ubuntu 16.04&lt;br /&gt;
&lt;br /&gt;
Step 1. First make sure that all your system packages are up-to-date by running these following apt-get commands in the terminal.&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get update&lt;br /&gt;
 sudo apt-get upgrade&lt;br /&gt;
&lt;br /&gt;
Step 2. Install LAMP (Linux, Apache, MariaDB, PHP) server.&lt;br /&gt;
&lt;br /&gt;
A Ubuntu 16.04 LAMP server is required. If you do not have LAMP installed, you can follow our guide here. Also install all required PHP modules:&lt;br /&gt;
&lt;br /&gt;
 apt-get install php7.0 openssl perl make php7.0-gd libgd2-xpm-dev libapache2-mod-php7.0 libperl-dev libssl-dev daemon wget apache2-utils unzip&lt;br /&gt;
&lt;br /&gt;
Step 3. Create users and groups for Nagios.&lt;br /&gt;
&lt;br /&gt;
Now create a new nagios user account and setup a password to this account:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 useradd nagios&lt;br /&gt;
 groupadd nagcmd&lt;br /&gt;
 usermod -a -G nagcmd nagios&lt;br /&gt;
 usermod -a -G nagcmd www-data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 4. Installing Nagios and plugins.&lt;br /&gt;
&lt;br /&gt;
First thing to do is to go to Nagios’s download page and download the latest stable version of Nagios, At the moment of writing this article it is version 4.1.1:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 wget  https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz&lt;br /&gt;
 tar -zxvf /tmp/nagios-4.1.1.tar.gz&lt;br /&gt;
 cd /tmp/nagios-4.1.1/&lt;br /&gt;
&lt;br /&gt;
Perform below steps to compile the Nagios from the source code:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ./configure --with-nagios-group=nagios --with-command-group=nagcmd --with-   httpd_conf=/etc/apache2/sites-enabled/&lt;br /&gt;
 make all&lt;br /&gt;
 make install&lt;br /&gt;
 make install-init&lt;br /&gt;
 make install-config&lt;br /&gt;
 make install-commandmode&lt;br /&gt;
 make install-webconf&lt;br /&gt;
&lt;br /&gt;
Next steps, Download latest nagios-plugins source and install using following commands:&lt;br /&gt;
&lt;br /&gt;
 wget http://www.nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
 tar xzf nagios-plugins-2.1.1.tar.gz&lt;br /&gt;
 cd nagios-plugins-2.1.1&lt;br /&gt;
 ./configure --with-nagios-user=nagios --with-nagios-group=nagios&lt;br /&gt;
 make&lt;br /&gt;
 make install&lt;br /&gt;
&lt;br /&gt;
Step 5. Configure Nagios.&lt;br /&gt;
&lt;br /&gt;
Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you’d like to use for receiving alerts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 nano /usr/local/nagios/etc/objects/contacts.cfg&lt;br /&gt;
&lt;br /&gt;
Change the email address field to receive the notification:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
define contact{&lt;br /&gt;
contact_name nagiosadmin ; Short name of userus&lt;br /&gt;
generic-contact ; Inherit default values from generic-contact template (defined above)&lt;br /&gt;
alias Nagios Admin ; Full name of useremail&lt;br /&gt;
admin@idroot.net ; &amp;lt;&amp;lt;***** CHANGE THIS TO YOUR EMAIL ADDRESS ******&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Step 6. Configure Apache web server for Nagios.&lt;br /&gt;
&lt;br /&gt;
Now create nagios apache2 configuration file:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 nano /etc/apache2/sites-enabled/nagios.conf&lt;br /&gt;
&lt;br /&gt;
Edit the following lines if you want to access nagios administrative console from a particular IP series, Here, I want to allow nagios administrative access from 192.168.1.0/24 series only:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
## Comment the following lines ##&lt;br /&gt;
#   Order allow,deny&lt;br /&gt;
#   Allow from all&lt;br /&gt;
&lt;br /&gt;
## Uncomment and Change lines as shown below ##&lt;br /&gt;
Order deny,allow&lt;br /&gt;
Deny from all&lt;br /&gt;
Allow from 127.0.0.1 192.168.1.0/24&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
Enable Apache’s rewrite and cgi modules:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 sudo a2enmod rewrite&lt;br /&gt;
 sudo a2enmod cgi&lt;br /&gt;
&lt;br /&gt;
Configure Apache authentication:&lt;br /&gt;
&lt;br /&gt;
We need to setup the password for the user nagiosadmin. This username will be used to access the web interface so it is important to remember the password that you will input here. Set the password running the following command and enter the password twice:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # sudo htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin&lt;br /&gt;
 New password:&lt;br /&gt;
 Re-type new password:&lt;br /&gt;
 Adding password for user nagiosadmin&lt;br /&gt;
&lt;br /&gt;
Restart Apache for the changes to take effect:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 systemctl restart apache2&lt;br /&gt;
&lt;br /&gt;
Step 7. Verify and Start Nagios service.&lt;br /&gt;
&lt;br /&gt;
Next we have to make Nagios start at boot time, so first verify that the configuration file has no errors running the following command:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg&lt;br /&gt;
&lt;br /&gt;
And you should get the output:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [...]&lt;br /&gt;
 Checking objects...&lt;br /&gt;
    Checked 8 services.&lt;br /&gt;
    Checked 1 hosts.&lt;br /&gt;
    Checked 1 host groups.&lt;br /&gt;
    Checked 0 service groups.&lt;br /&gt;
    Checked 1 contacts.&lt;br /&gt;
    Checked 1 contact groups.&lt;br /&gt;
    Checked 24 commands.&lt;br /&gt;
    Checked 5 time periods.&lt;br /&gt;
    Checked 0 host escalations.&lt;br /&gt;
    Checked 0 service escalations.&lt;br /&gt;
 Checking for circular paths...&lt;br /&gt;
    Checked 1 hosts&lt;br /&gt;
    Checked 0 service dependencies&lt;br /&gt;
    Checked 0 host dependencies&lt;br /&gt;
    Checked 5 timeperiods&lt;br /&gt;
 Checking global event handlers...&lt;br /&gt;
 Checking obsessive compulsive processor commands...&lt;br /&gt;
 Checking misc settings...&lt;br /&gt;
&lt;br /&gt;
 Total Warnings: 0&lt;br /&gt;
 Total Errors:   0&lt;br /&gt;
&lt;br /&gt;
 Things look okay - No serious problems were detected during the pre-flight check&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
Ubuntu 16.04 uses systemd for starting / stopping all the services, so, we need to create nagios.service file:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 nano /etc/systemd/system/nagios.service&lt;br /&gt;
&lt;br /&gt;
Add the following lines:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 [Unit]&lt;br /&gt;
 Description=Nagios&lt;br /&gt;
 BindTo=network.target&lt;br /&gt;
&lt;br /&gt;
 [Install]&lt;br /&gt;
 WantedBy=multi-user.target&lt;br /&gt;
&lt;br /&gt;
 [Service]&lt;br /&gt;
 User=nagios&lt;br /&gt;
 Group=nagios&lt;br /&gt;
 Type=simple&lt;br /&gt;
 ExecStart=/usr/local/nagios/bin/nagios /usr/local/nagios/etc/nagios.cfg&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enable Nagios to start automatically at system startup:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 systemctl enable /etc/systemd/system/nagios.service&lt;br /&gt;
&lt;br /&gt;
Now, start Nagios service:&lt;br /&gt;
&lt;br /&gt;
 systemctl start nagios&lt;br /&gt;
&lt;br /&gt;
Step 8. Accessing Nagios.&lt;br /&gt;
&lt;br /&gt;
Nagios will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://yourdomain.com/install.php or http://server-ip/install.php and complete the required the steps to finish the installation. When prompted for username and password you will introduce the username “nagiosadmin” and the password that you entered in step 6.&lt;br /&gt;
&lt;br /&gt;
= Experiences =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In during installation time, we have found some problems which will impact on our your installation as well.&lt;br /&gt;
&lt;br /&gt;
- The version of Ubuntu and Graylog might conflict each other as well as Graylog&#039;s packages ( e.g : java )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I have faced some of certain problem with installing Plugin for Nagios. First of all, you need to check if the plugins you want to use is supported for the OS of the server you are running, for example the plugin is written for Windows Server but you are running Linux server, thus it will give you an error about its format or bunch of error which is difficult to determine exactly its trouble.&lt;br /&gt;
&lt;br /&gt;
Furthermore, once you wish to add the plugin as a service. Please pay attention on the &amp;quot;Service Name&amp;quot; and &amp;quot;Manage Host&amp;quot; which might effect to your installation as well.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
During the installation Graylogs in both versions of Ubuntu ( 14.04 and 16.0 ). We realized that it had many differences between these versions. Listed above our objectives what we expect to achieve after installing and using Graylog, along with its useful information and its interaction between Administrator (users) with Graylog.&lt;br /&gt;
&lt;br /&gt;
its advantages:&lt;br /&gt;
 + Free.&lt;br /&gt;
 + Easy to interact with web interface.&lt;br /&gt;
 + Easy to install with the good support from its sources.&lt;br /&gt;
 + Help Administrator (user) to collect information in during logging and monitoring straightforwardly.&lt;br /&gt;
 + Many useful tools ( plugins ) which supports to work on.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The reason I choose Nagios as my monitoring solution is because it is quite fully functions which help people can handle the services on the server for example it points out detail notification of crucial services such as manage users, HTTP, SSH..so forth. I am using a trial version, but it&#039;s seem pretty enough for beginner to &amp;quot;hangout&amp;quot; with Monitoring tool at first.&lt;br /&gt;
&lt;br /&gt;
This is my opinion of its advantages:&lt;br /&gt;
&lt;br /&gt;
 + Easy to install with many ways with official guide from Nagios Supports.&lt;br /&gt;
 + Good trial version to barely use for beginner.&lt;br /&gt;
 + There are some useful extensions, plugins which are free and easy to install.&lt;br /&gt;
 + Easy to handle with web interface.&lt;br /&gt;
 + Does not take many space of hard disk.&lt;br /&gt;
&lt;br /&gt;
Another hand, it also has disadvantages:&lt;br /&gt;
&lt;br /&gt;
 + Too expensive for license version.&lt;br /&gt;
 + Lack of plugins development, some of them is quite old as well.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/how-to-install-graylog2-on-ubuntu-14-04.html&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://docs.graylog.org/en/2.1/&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagioscore/docs/Installing_Nagios_Core_From_Source.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://idroot.net/linux/install-nagios-ubuntu-16-04/&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115860</id>
		<title>Logging - Monitoring C21</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115860"/>
		<updated>2016-12-15T08:00:25Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Nagios Monitoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Logging and Monitoring with Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Course: Logging and Monitoring - Lecturer: Margus Ernits&lt;br /&gt;
&lt;br /&gt;
Group: Cyber Security Engineering (C21)&lt;br /&gt;
&lt;br /&gt;
Team members: Ender Phan, Kustas Kurval, Sheela Gowry Sumathi Raju, Artur Vincent Kerge&lt;br /&gt;
&lt;br /&gt;
Page created on: October 05, 2016&lt;br /&gt;
&lt;br /&gt;
= Abstract =&lt;br /&gt;
&lt;br /&gt;
In order to understand how to set up the Graylog service as well as understand its crucial roles. We decided to choose Graylog as our application for logging and monitoring. Below are our objectives which would be expected to achieve later on:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Graylog on Ubuntu 14.04.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to use Graylog to protect servers.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Upgrading and configuring Graylog at first, and know how to secure Graylog.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Threats and security during logging.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Netdata and Monitoring with Netdata.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Nagios and Monitoring with Nagios.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Trouble shooting and experiences.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Installation Guide =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ubuntu 14.04&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Graylog_simple_setup_v2.png]]&lt;br /&gt;
&lt;br /&gt;
== Logging Solutions ==&lt;br /&gt;
&lt;br /&gt;
Since the Elasticsearch is based on java, we would require to install either openJDK or Oracle JDK. It is recommended to install Oracle JDK, verify the java version by using the following command.&lt;br /&gt;
&lt;br /&gt;
Remove the OpenJDK from the system, if you have it already installed. From now on it is presumed that user has root privileges.&lt;br /&gt;
&lt;br /&gt;
 apt-get remove --purge openjdk*&lt;br /&gt;
Add repository.&lt;br /&gt;
&lt;br /&gt;
 add-apt-repository -y ppa:webupd8team/java&lt;br /&gt;
Run the following command to pull the packages information from the newly added repository.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Issue the following command to install Java jdk 1.8.&lt;br /&gt;
&lt;br /&gt;
 apt-get -y install oracle-java8-installer&lt;br /&gt;
&lt;br /&gt;
 java -version&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
 Java version &amp;quot;1.8.0_60&amp;quot;&lt;br /&gt;
 Java(TM) SE Runtime Environment (build 1.8.0_60-b27)&lt;br /&gt;
 Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)&lt;br /&gt;
&lt;br /&gt;
=== Installing extras ===&lt;br /&gt;
&lt;br /&gt;
=== Elasticsearch ===&lt;br /&gt;
&lt;br /&gt;
Let’s install Elasticsearch, it can be downloaded from the official website.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download and install GPG signing key&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -&lt;br /&gt;
&lt;br /&gt;
Note that the -qO argument is lowercase Quebec followed by capital Oscar.&lt;br /&gt;
&lt;br /&gt;
Save the repository definition to /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
Update repository cache and install Elasticsearch&lt;br /&gt;
&lt;br /&gt;
 apt-get update &amp;amp;&amp;amp; apt-get install elasticsearch&lt;br /&gt;
&lt;br /&gt;
Configure Elasticsearch to start during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d elasticsearch defaults&lt;br /&gt;
The only important thing is to set a cluster name as “graylog2“, that is being used by graylog. Now edit the configuration file of Elasticsearch.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/elasticsearch/elasticsearch.yml&lt;br /&gt;
&lt;br /&gt;
 cluster.name: graylog2&lt;br /&gt;
&lt;br /&gt;
In the same file disable dynamic scripts to avoid remote execution. That can be done by adding the following line:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOLLOWING LINE GOES INTO GRAYLOG CONF!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 script.disable_dynamic: true&lt;br /&gt;
&lt;br /&gt;
Once it is done, we are good to go. Before that, restart the Elasticsearch services to load the modified configuration.&lt;br /&gt;
&lt;br /&gt;
 service elasticsearch restart&lt;br /&gt;
&lt;br /&gt;
Wait at least a minute to let the Elasticsearch get fully restarted, otherwise testing will fail. Elastisearch should be now listen on 9200 for processing HTTP request, we can use CURL to get the response. Ensure that it returns with cluster name as “graylog2”&lt;br /&gt;
&lt;br /&gt;
 curl -X GET http://localhost:9200&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
   &amp;quot;status&amp;quot; : 200,&lt;br /&gt;
   &amp;quot;name&amp;quot; : &amp;quot;Pistol&amp;quot;,&lt;br /&gt;
   &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
   &amp;quot;version&amp;quot; : {&lt;br /&gt;
    &amp;quot;number&amp;quot; : &amp;quot;1.7.1&amp;quot;,&lt;br /&gt;
    &amp;quot;build_hash&amp;quot; : &amp;quot;b88f43fc40b0bcd7f173a1f9ee2e97816de80b19&amp;quot;,&lt;br /&gt;
    &amp;quot;build_timestamp&amp;quot; : &amp;quot;2015-07-29T09:54:16Z&amp;quot;,&lt;br /&gt;
    &amp;quot;build_snapshot&amp;quot; : false,&lt;br /&gt;
    &amp;quot;lucene_version&amp;quot; : &amp;quot;4.10.4&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  &amp;quot;tagline&amp;quot; : &amp;quot;You Know, for Search&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Optional: Use the following command to check the Elasticsearch cluster health, you must get a cluster status as “green” for graylog to work.&lt;br /&gt;
&lt;br /&gt;
 curl -XGET &#039;http://localhost:9200/_cluster/health?pretty=true&#039;&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
  &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;status&amp;quot; : &amp;quot;&#039;&#039;&#039;green&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;timed_out&amp;quot; : false,&lt;br /&gt;
  &amp;quot;number_of_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;number_of_data_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;active_primary_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;active_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;relocating_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;initializing_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;delayed_unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_pending_tasks&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_in_flight_fetch&amp;quot; : 0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== MongoDB ===&lt;br /&gt;
&lt;br /&gt;
MongoDB is available in deb format and same can be downloaded from the official website. Add the following repository information on the system to install MongoDB. Before that we must import public key.&lt;br /&gt;
&lt;br /&gt;
 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10&lt;br /&gt;
Add repository by creating the /etc/apt/sources.list.d/mongodb-org-3.0.list list file using the command.&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse&amp;quot; | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list&lt;br /&gt;
Update repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install MongoDB using the following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install mongodb-org&lt;br /&gt;
Start the MongoDB service and enable it to start automatically during the system start-up.&lt;br /&gt;
&lt;br /&gt;
 service mongod start&lt;br /&gt;
&lt;br /&gt;
 ln -s /usr/bin/mongod /etc/init.d/mongod&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link&lt;br /&gt;
&lt;br /&gt;
 update-rc.d mongod defaults&lt;br /&gt;
&lt;br /&gt;
=== Graylog2 ===&lt;br /&gt;
&lt;br /&gt;
Graylog-server accepts and process the log messages, also spawns the RESTAPI for the requests that comes from graylog-web-interface. Download the latest version of graylog from graylog.org,&lt;br /&gt;
&lt;br /&gt;
Use the following command to install graylog2 repository.&lt;br /&gt;
&lt;br /&gt;
 wget https://packages.graylog2.org/repo/packages/graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
&lt;br /&gt;
 dpkg -i graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
Install https suppport and update the repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get install apt-transport-https&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install Graylog server using following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-server &lt;br /&gt;
Edit the server.conf file.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/server/server.conf&lt;br /&gt;
Configure the following variables in the above file.&lt;br /&gt;
&lt;br /&gt;
Set a secret to secure the user passwords, use the following command to generate a secret, use at least 64 character’s.&lt;br /&gt;
&lt;br /&gt;
 pwgen -N 1 -s 96&lt;br /&gt;
&lt;br /&gt;
 OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
If you get a “pwgen: command not found“, use the following command to install pwgen.&lt;br /&gt;
&lt;br /&gt;
 apt-get install pwgen&lt;br /&gt;
&lt;br /&gt;
Place the secret.&lt;br /&gt;
&lt;br /&gt;
 password_secret = OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
Next is to set a hash password for the root user (not to be confused with system user, root user of graylog is admin). You will use this password for login into the web interface, admin’s password can not be changed using web interface, must edit this variable to set.&lt;br /&gt;
&lt;br /&gt;
Replace “yourpassword” with the choice of your’s.&lt;br /&gt;
&lt;br /&gt;
 echo -n yourpassword | sha256sum&lt;br /&gt;
&lt;br /&gt;
 e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
Place the hash password.&lt;br /&gt;
&lt;br /&gt;
 root_password_sha2 = e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
You can setup email address root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_email = &amp;quot;cyber.web@gmail.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set timezone of root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_timezone = UTC&lt;br /&gt;
&lt;br /&gt;
Graylog will try to find the Elasticsearch nodes automatically, it uses multicast mode for the same. But when it comes to larger network, it is recommended to use unicast mode which is best suited one for production setups. So add the following two entries to graylog server.conf file, replace ipaddress with live hostname or ipaddress. Multiple hosts can be added with comma separated.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_http_enabled = false&lt;br /&gt;
 elasticsearch_discovery_zen_ping_unicast_hosts = ipaddress:9300&lt;br /&gt;
&lt;br /&gt;
Set only one master node by defining the below variable, default setting is true, you must set it as a false to make the particular node as a slave. Master node performs some periodic tasks that slave won’t perform.&lt;br /&gt;
&lt;br /&gt;
 is_master = true&lt;br /&gt;
&lt;br /&gt;
The following variable sets the number of log messages to keep per index, it is recommended to have several smaller indices instead of larger ones.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_docs_per_index = 20000000&lt;br /&gt;
&lt;br /&gt;
The following parameter defines to have total number of indices, if the this number is reached old index will be deleted.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_number_of_indices = 20&lt;br /&gt;
&lt;br /&gt;
Shards setting is really depends on the number of nodes in the Elasticsearch cluster, if you have only one node, set it as 1.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_shards = 1&lt;br /&gt;
&lt;br /&gt;
The number of replicas for your indices, if you have only one node in Elasticsearch cluster; set it as 0.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_replicas = 0&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Restart Graylog service.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 service graylog-server restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of graylog server service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-server defaults&lt;br /&gt;
&lt;br /&gt;
You can check out the server startup logs, it will be useful for you to troubleshoot graylog in case of any issue.&lt;br /&gt;
&lt;br /&gt;
 tailf /var/log/graylog-server/server.log&lt;br /&gt;
&lt;br /&gt;
On successful start of graylog-server, you should get the following message in the log file.&lt;br /&gt;
&lt;br /&gt;
 2015-09-17T09:35:22.895+02:00 INFO  [ServerBootstrap] Graylog server up and running.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Graylog web interface:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To configure graylog-web-interface, you must have at least one graylog-server node. Install Graylog web interface using “apt-get”.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-web&lt;br /&gt;
&lt;br /&gt;
Edit the configuration file and set the following parameters.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/web/web.conf&lt;br /&gt;
&lt;br /&gt;
This is the list of graylog-server nodes, you can add multiple nodes, separate by commas.&lt;br /&gt;
&lt;br /&gt;
 graylog2-server.uris=&amp;quot;http://127.0.0.1:12900/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set the application scret and can be generated using pwgen -N 1 -s 96.&lt;br /&gt;
&lt;br /&gt;
application.secret=&amp;quot;sNXyFf6B4Au3GqSlZwq7En86xp10JimdxxYiLtpptOejX6tIUpUE4DGRJOrcMj07wcK0wugPaapvzEzCYinEWj7BOtHXVl5Z&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set Web interface timezone.&lt;br /&gt;
&lt;br /&gt;
 Timezone=&amp;quot;Europe/Tallinn&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Restart the gralog-web-interface using following command,&lt;br /&gt;
&lt;br /&gt;
 service graylog-web restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of web interface service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-web defaults&lt;br /&gt;
&lt;br /&gt;
Add log forwarding to ryslog.&lt;br /&gt;
 nano /etc/rsyslog.d/50-default.conf&lt;br /&gt;
 *.*@192.168.56.200:5555&lt;br /&gt;
&lt;br /&gt;
== Monitoring Solutions ==&lt;br /&gt;
* Netdata&lt;br /&gt;
&lt;br /&gt;
* Nagios&lt;br /&gt;
=== Netdata Monitoring ===&lt;br /&gt;
[[File:Netdata.gif]]&lt;br /&gt;
&lt;br /&gt;
Linus Distribution: Debian Linux and its derivatives (including Ubuntu, Mint)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install nessesary packages:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install the packages for having a basic netdata installation (system monitoring and many applications, without mysql / mariadb, postgres, named, hardware sensors and SNMP):&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata&lt;br /&gt;
&lt;br /&gt;
Install all the required packages for monitoring everything netdata can monitor:&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata-all&lt;br /&gt;
&lt;br /&gt;
  apt-get install zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Netdata&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Download it - the directory &#039;netdata&#039; will be created&lt;br /&gt;
  git clone https://github.com/firehol/netdata.git --depth=1&lt;br /&gt;
  cd netdata&lt;br /&gt;
&lt;br /&gt;
Build it, install it, start it&lt;br /&gt;
  ./netdata-installer.sh&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;starting netdata at boot&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Copy the netdata startup file to /etc/init.d&lt;br /&gt;
  cp system/netdata-lsb /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Make sure it is executable&lt;br /&gt;
  chmod +x /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Enable it&lt;br /&gt;
  update-rc.d netdata defaults&lt;br /&gt;
&lt;br /&gt;
Access to web interface&lt;br /&gt;
 &lt;br /&gt;
 http://&amp;lt;ipaddress&amp;gt;:19999&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced : https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Nagios Monitoring ===&lt;br /&gt;
&lt;br /&gt;
[[File:Nagios.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Choosing Nagios implementation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Nagios core and Nagios XI. Depending on what version of Linux you are running you might only be able to support Nagios core. On Ubuntu 15 and ahead PHP5 is unavailable which means that Installing Nagios XI is not possible since it depends on PHP5. In this case you have to install Nagios core using PHP7.:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;For Nagios XI&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following steps are for Nagios XI. For Nagios Core install please go below.&lt;br /&gt;
Install PHP (version 5): &lt;br /&gt;
&lt;br /&gt;
  apt-get install php5-common libapache2-mod-php5 php5-cli&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloading the Latest Release&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Make sure to download the Nagios XI installation package to the /tmp directory of the server on which you wish to install it, as shown in&lt;br /&gt;
the following commands:&lt;br /&gt;
&lt;br /&gt;
  cd /tmp&lt;br /&gt;
&lt;br /&gt;
To download the latest stable release, use the following command:&lt;br /&gt;
&lt;br /&gt;
  wget http://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  tar xzf xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  cd /tmp/nagiosxi&lt;br /&gt;
&lt;br /&gt;
  ./fullinstall&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: It will take around 5 minutes to finish the installation.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You are access the Nagios XI interface by pointing your web browser to:&lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;/nagiosxi OR http://&amp;lt;ipaddress&amp;gt;/nagiosql/install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: An empty file named ENABLE_INSTALLER is necessary to create in install/ directory to continue with installation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Troubleshooting&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I got the problem with the given IP after finishing installation, it gave me wrong IP to access. But just ignore it and go to your correct IP of your web server: &lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  without &amp;quot;/nagiosxi&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It will show the installation GUI and you just need to follow and login after all.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Install Plugins ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Locate Your Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Visit this website to download plugins: http://exchange.nagios.org. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 Click the Admin menu --&amp;gt; Manage Plugins &lt;br /&gt;
&lt;br /&gt;
 Click the Browse button --&amp;gt; click the Upload Plugin button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test Your Plugin From The Command Line&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  cd /usr/local/nagios/libexec&lt;br /&gt;
  &lt;br /&gt;
  ./plugin_name arg1 arg2 ...&lt;br /&gt;
&lt;br /&gt;
*See the document of plugin to get more detail of its arguments&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Define A Command&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 browse to Configure → Core&lt;br /&gt;
&lt;br /&gt;
 Configuration Manager → Commands and click Add New.&lt;br /&gt;
&lt;br /&gt;
Enter a Command Name, usually the same as the plugin&lt;br /&gt;
filename. Next in the Command Line field, enter&lt;br /&gt;
$USER1$/plugin_name $ARG1$. The $USER1$ macro is&lt;br /&gt;
replaced with the path to the plugin directory, while the&lt;br /&gt;
$ARG1$ macro is a placeholder for an argument you want to&lt;br /&gt;
specify later on a per-service basis. If you want, you can omit&lt;br /&gt;
$ARG1$ or add more ($ARG2$, $ARG3$, etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Click Save --&amp;gt; Apply Configuration.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Add A Service&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In the left-hand menu&lt;br /&gt;
&lt;br /&gt;
 Click Services --&amp;gt; click Add New.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Config Name&#039;&#039;&#039; field, enter the file name where the&lt;br /&gt;
configuration will be stored. Next enter a description of the&lt;br /&gt;
service in the Description field. Associate the service with a&lt;br /&gt;
host by clicking the Manage Host button.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Check command&#039;&#039;&#039; field, select the command you defined&lt;br /&gt;
above from the dropdown list. If you had any argument&lt;br /&gt;
placeholders when you defined the command earlier, enter&lt;br /&gt;
replacement text in the appropriate argument fields.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Manage Templates&#039;&#039;&#039; button allows you to apply a template&lt;br /&gt;
to this service which will save you from having to fill in all the&lt;br /&gt;
other configuration options, or you can enter the required&lt;br /&gt;
Check and Alert settings manually.&lt;br /&gt;
&lt;br /&gt;
 Save --&amp;gt; Apply Configuration again&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Verify Your Service Is Working&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Navigate to&lt;br /&gt;
&lt;br /&gt;
  Home → Service Detail  &lt;br /&gt;
&lt;br /&gt;
Look for your new service in the list. It will probably take a few minutes before it runs its first check.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Experiences =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In during installation time, we have found some problems which will impact on our your installation as well.&lt;br /&gt;
&lt;br /&gt;
- The version of Ubuntu and Graylog might conflict each other as well as Graylog&#039;s packages ( e.g : java )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I have faced some of certain problem with installing Plugin for Nagios. First of all, you need to check if the plugins you want to use is supported for the OS of the server you are running, for example the plugin is written for Windows Server but you are running Linux server, thus it will give you an error about its format or bunch of error which is difficult to determine exactly its trouble.&lt;br /&gt;
&lt;br /&gt;
Furthermore, once you wish to add the plugin as a service. Please pay attention on the &amp;quot;Service Name&amp;quot; and &amp;quot;Manage Host&amp;quot; which might effect to your installation as well.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
During the installation Graylogs in both versions of Ubuntu ( 14.04 and 16.0 ). We realized that it had many differences between these versions. Listed above our objectives what we expect to achieve after installing and using Graylog, along with its useful information and its interaction between Administrator (users) with Graylog.&lt;br /&gt;
&lt;br /&gt;
its advantages:&lt;br /&gt;
 + Free.&lt;br /&gt;
 + Easy to interact with web interface.&lt;br /&gt;
 + Easy to install with the good support from its sources.&lt;br /&gt;
 + Help Administrator (user) to collect information in during logging and monitoring straightforwardly.&lt;br /&gt;
 + Many useful tools ( plugins ) which supports to work on.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The reason I choose Nagios as my monitoring solution is because it is quite fully functions which help people can handle the services on the server for example it points out detail notification of crucial services such as manage users, HTTP, SSH..so forth. I am using a trial version, but it&#039;s seem pretty enough for beginner to &amp;quot;hangout&amp;quot; with Monitoring tool at first.&lt;br /&gt;
&lt;br /&gt;
This is my opinion of its advantages:&lt;br /&gt;
&lt;br /&gt;
 + Easy to install with many ways with official guide from Nagios Supports.&lt;br /&gt;
 + Good trial version to barely use for beginner.&lt;br /&gt;
 + There are some useful extensions, plugins which are free and easy to install.&lt;br /&gt;
 + Easy to handle with web interface.&lt;br /&gt;
 + Does not take many space of hard disk.&lt;br /&gt;
&lt;br /&gt;
Another hand, it also has disadvantages:&lt;br /&gt;
&lt;br /&gt;
 + Too expensive for license version.&lt;br /&gt;
 + Lack of plugins development, some of them is quite old as well.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/how-to-install-graylog2-on-ubuntu-14-04.html&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://docs.graylog.org/en/2.1/&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagioscore/docs/Installing_Nagios_Core_From_Source.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://idroot.net/linux/install-nagios-ubuntu-16-04/&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115859</id>
		<title>Logging - Monitoring C21</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115859"/>
		<updated>2016-12-15T07:57:27Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Logging and Monitoring with Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Course: Logging and Monitoring - Lecturer: Margus Ernits&lt;br /&gt;
&lt;br /&gt;
Group: Cyber Security Engineering (C21)&lt;br /&gt;
&lt;br /&gt;
Team members: Ender Phan, Kustas Kurval, Sheela Gowry Sumathi Raju, Artur Vincent Kerge&lt;br /&gt;
&lt;br /&gt;
Page created on: October 05, 2016&lt;br /&gt;
&lt;br /&gt;
= Abstract =&lt;br /&gt;
&lt;br /&gt;
In order to understand how to set up the Graylog service as well as understand its crucial roles. We decided to choose Graylog as our application for logging and monitoring. Below are our objectives which would be expected to achieve later on:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Graylog on Ubuntu 14.04.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to use Graylog to protect servers.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Upgrading and configuring Graylog at first, and know how to secure Graylog.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Threats and security during logging.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Netdata and Monitoring with Netdata.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Nagios and Monitoring with Nagios.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Trouble shooting and experiences.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Installation Guide =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ubuntu 14.04&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Graylog_simple_setup_v2.png]]&lt;br /&gt;
&lt;br /&gt;
== Logging Solutions ==&lt;br /&gt;
&lt;br /&gt;
Since the Elasticsearch is based on java, we would require to install either openJDK or Oracle JDK. It is recommended to install Oracle JDK, verify the java version by using the following command.&lt;br /&gt;
&lt;br /&gt;
Remove the OpenJDK from the system, if you have it already installed. From now on it is presumed that user has root privileges.&lt;br /&gt;
&lt;br /&gt;
 apt-get remove --purge openjdk*&lt;br /&gt;
Add repository.&lt;br /&gt;
&lt;br /&gt;
 add-apt-repository -y ppa:webupd8team/java&lt;br /&gt;
Run the following command to pull the packages information from the newly added repository.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Issue the following command to install Java jdk 1.8.&lt;br /&gt;
&lt;br /&gt;
 apt-get -y install oracle-java8-installer&lt;br /&gt;
&lt;br /&gt;
 java -version&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
 Java version &amp;quot;1.8.0_60&amp;quot;&lt;br /&gt;
 Java(TM) SE Runtime Environment (build 1.8.0_60-b27)&lt;br /&gt;
 Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)&lt;br /&gt;
&lt;br /&gt;
=== Installing extras ===&lt;br /&gt;
&lt;br /&gt;
=== Elasticsearch ===&lt;br /&gt;
&lt;br /&gt;
Let’s install Elasticsearch, it can be downloaded from the official website.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download and install GPG signing key&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -&lt;br /&gt;
&lt;br /&gt;
Note that the -qO argument is lowercase Quebec followed by capital Oscar.&lt;br /&gt;
&lt;br /&gt;
Save the repository definition to /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
Update repository cache and install Elasticsearch&lt;br /&gt;
&lt;br /&gt;
 apt-get update &amp;amp;&amp;amp; apt-get install elasticsearch&lt;br /&gt;
&lt;br /&gt;
Configure Elasticsearch to start during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d elasticsearch defaults&lt;br /&gt;
The only important thing is to set a cluster name as “graylog2“, that is being used by graylog. Now edit the configuration file of Elasticsearch.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/elasticsearch/elasticsearch.yml&lt;br /&gt;
&lt;br /&gt;
 cluster.name: graylog2&lt;br /&gt;
&lt;br /&gt;
In the same file disable dynamic scripts to avoid remote execution. That can be done by adding the following line:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOLLOWING LINE GOES INTO GRAYLOG CONF!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 script.disable_dynamic: true&lt;br /&gt;
&lt;br /&gt;
Once it is done, we are good to go. Before that, restart the Elasticsearch services to load the modified configuration.&lt;br /&gt;
&lt;br /&gt;
 service elasticsearch restart&lt;br /&gt;
&lt;br /&gt;
Wait at least a minute to let the Elasticsearch get fully restarted, otherwise testing will fail. Elastisearch should be now listen on 9200 for processing HTTP request, we can use CURL to get the response. Ensure that it returns with cluster name as “graylog2”&lt;br /&gt;
&lt;br /&gt;
 curl -X GET http://localhost:9200&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
   &amp;quot;status&amp;quot; : 200,&lt;br /&gt;
   &amp;quot;name&amp;quot; : &amp;quot;Pistol&amp;quot;,&lt;br /&gt;
   &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
   &amp;quot;version&amp;quot; : {&lt;br /&gt;
    &amp;quot;number&amp;quot; : &amp;quot;1.7.1&amp;quot;,&lt;br /&gt;
    &amp;quot;build_hash&amp;quot; : &amp;quot;b88f43fc40b0bcd7f173a1f9ee2e97816de80b19&amp;quot;,&lt;br /&gt;
    &amp;quot;build_timestamp&amp;quot; : &amp;quot;2015-07-29T09:54:16Z&amp;quot;,&lt;br /&gt;
    &amp;quot;build_snapshot&amp;quot; : false,&lt;br /&gt;
    &amp;quot;lucene_version&amp;quot; : &amp;quot;4.10.4&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  &amp;quot;tagline&amp;quot; : &amp;quot;You Know, for Search&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Optional: Use the following command to check the Elasticsearch cluster health, you must get a cluster status as “green” for graylog to work.&lt;br /&gt;
&lt;br /&gt;
 curl -XGET &#039;http://localhost:9200/_cluster/health?pretty=true&#039;&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
  &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;status&amp;quot; : &amp;quot;&#039;&#039;&#039;green&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;timed_out&amp;quot; : false,&lt;br /&gt;
  &amp;quot;number_of_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;number_of_data_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;active_primary_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;active_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;relocating_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;initializing_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;delayed_unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_pending_tasks&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_in_flight_fetch&amp;quot; : 0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== MongoDB ===&lt;br /&gt;
&lt;br /&gt;
MongoDB is available in deb format and same can be downloaded from the official website. Add the following repository information on the system to install MongoDB. Before that we must import public key.&lt;br /&gt;
&lt;br /&gt;
 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10&lt;br /&gt;
Add repository by creating the /etc/apt/sources.list.d/mongodb-org-3.0.list list file using the command.&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse&amp;quot; | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list&lt;br /&gt;
Update repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install MongoDB using the following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install mongodb-org&lt;br /&gt;
Start the MongoDB service and enable it to start automatically during the system start-up.&lt;br /&gt;
&lt;br /&gt;
 service mongod start&lt;br /&gt;
&lt;br /&gt;
 ln -s /usr/bin/mongod /etc/init.d/mongod&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link&lt;br /&gt;
&lt;br /&gt;
 update-rc.d mongod defaults&lt;br /&gt;
&lt;br /&gt;
=== Graylog2 ===&lt;br /&gt;
&lt;br /&gt;
Graylog-server accepts and process the log messages, also spawns the RESTAPI for the requests that comes from graylog-web-interface. Download the latest version of graylog from graylog.org,&lt;br /&gt;
&lt;br /&gt;
Use the following command to install graylog2 repository.&lt;br /&gt;
&lt;br /&gt;
 wget https://packages.graylog2.org/repo/packages/graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
&lt;br /&gt;
 dpkg -i graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
Install https suppport and update the repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get install apt-transport-https&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install Graylog server using following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-server &lt;br /&gt;
Edit the server.conf file.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/server/server.conf&lt;br /&gt;
Configure the following variables in the above file.&lt;br /&gt;
&lt;br /&gt;
Set a secret to secure the user passwords, use the following command to generate a secret, use at least 64 character’s.&lt;br /&gt;
&lt;br /&gt;
 pwgen -N 1 -s 96&lt;br /&gt;
&lt;br /&gt;
 OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
If you get a “pwgen: command not found“, use the following command to install pwgen.&lt;br /&gt;
&lt;br /&gt;
 apt-get install pwgen&lt;br /&gt;
&lt;br /&gt;
Place the secret.&lt;br /&gt;
&lt;br /&gt;
 password_secret = OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
Next is to set a hash password for the root user (not to be confused with system user, root user of graylog is admin). You will use this password for login into the web interface, admin’s password can not be changed using web interface, must edit this variable to set.&lt;br /&gt;
&lt;br /&gt;
Replace “yourpassword” with the choice of your’s.&lt;br /&gt;
&lt;br /&gt;
 echo -n yourpassword | sha256sum&lt;br /&gt;
&lt;br /&gt;
 e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
Place the hash password.&lt;br /&gt;
&lt;br /&gt;
 root_password_sha2 = e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
You can setup email address root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_email = &amp;quot;cyber.web@gmail.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set timezone of root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_timezone = UTC&lt;br /&gt;
&lt;br /&gt;
Graylog will try to find the Elasticsearch nodes automatically, it uses multicast mode for the same. But when it comes to larger network, it is recommended to use unicast mode which is best suited one for production setups. So add the following two entries to graylog server.conf file, replace ipaddress with live hostname or ipaddress. Multiple hosts can be added with comma separated.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_http_enabled = false&lt;br /&gt;
 elasticsearch_discovery_zen_ping_unicast_hosts = ipaddress:9300&lt;br /&gt;
&lt;br /&gt;
Set only one master node by defining the below variable, default setting is true, you must set it as a false to make the particular node as a slave. Master node performs some periodic tasks that slave won’t perform.&lt;br /&gt;
&lt;br /&gt;
 is_master = true&lt;br /&gt;
&lt;br /&gt;
The following variable sets the number of log messages to keep per index, it is recommended to have several smaller indices instead of larger ones.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_docs_per_index = 20000000&lt;br /&gt;
&lt;br /&gt;
The following parameter defines to have total number of indices, if the this number is reached old index will be deleted.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_number_of_indices = 20&lt;br /&gt;
&lt;br /&gt;
Shards setting is really depends on the number of nodes in the Elasticsearch cluster, if you have only one node, set it as 1.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_shards = 1&lt;br /&gt;
&lt;br /&gt;
The number of replicas for your indices, if you have only one node in Elasticsearch cluster; set it as 0.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_replicas = 0&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Restart Graylog service.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 service graylog-server restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of graylog server service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-server defaults&lt;br /&gt;
&lt;br /&gt;
You can check out the server startup logs, it will be useful for you to troubleshoot graylog in case of any issue.&lt;br /&gt;
&lt;br /&gt;
 tailf /var/log/graylog-server/server.log&lt;br /&gt;
&lt;br /&gt;
On successful start of graylog-server, you should get the following message in the log file.&lt;br /&gt;
&lt;br /&gt;
 2015-09-17T09:35:22.895+02:00 INFO  [ServerBootstrap] Graylog server up and running.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Graylog web interface:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To configure graylog-web-interface, you must have at least one graylog-server node. Install Graylog web interface using “apt-get”.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-web&lt;br /&gt;
&lt;br /&gt;
Edit the configuration file and set the following parameters.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/web/web.conf&lt;br /&gt;
&lt;br /&gt;
This is the list of graylog-server nodes, you can add multiple nodes, separate by commas.&lt;br /&gt;
&lt;br /&gt;
 graylog2-server.uris=&amp;quot;http://127.0.0.1:12900/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set the application scret and can be generated using pwgen -N 1 -s 96.&lt;br /&gt;
&lt;br /&gt;
application.secret=&amp;quot;sNXyFf6B4Au3GqSlZwq7En86xp10JimdxxYiLtpptOejX6tIUpUE4DGRJOrcMj07wcK0wugPaapvzEzCYinEWj7BOtHXVl5Z&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set Web interface timezone.&lt;br /&gt;
&lt;br /&gt;
 Timezone=&amp;quot;Europe/Tallinn&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Restart the gralog-web-interface using following command,&lt;br /&gt;
&lt;br /&gt;
 service graylog-web restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of web interface service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-web defaults&lt;br /&gt;
&lt;br /&gt;
Add log forwarding to ryslog.&lt;br /&gt;
 nano /etc/rsyslog.d/50-default.conf&lt;br /&gt;
 *.*@192.168.56.200:5555&lt;br /&gt;
&lt;br /&gt;
== Monitoring Solutions ==&lt;br /&gt;
* Netdata&lt;br /&gt;
&lt;br /&gt;
* Nagios&lt;br /&gt;
=== Netdata Monitoring ===&lt;br /&gt;
[[File:Netdata.gif]]&lt;br /&gt;
&lt;br /&gt;
Linus Distribution: Debian Linux and its derivatives (including Ubuntu, Mint)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install nessesary packages:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install the packages for having a basic netdata installation (system monitoring and many applications, without mysql / mariadb, postgres, named, hardware sensors and SNMP):&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata&lt;br /&gt;
&lt;br /&gt;
Install all the required packages for monitoring everything netdata can monitor:&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata-all&lt;br /&gt;
&lt;br /&gt;
  apt-get install zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Netdata&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Download it - the directory &#039;netdata&#039; will be created&lt;br /&gt;
  git clone https://github.com/firehol/netdata.git --depth=1&lt;br /&gt;
  cd netdata&lt;br /&gt;
&lt;br /&gt;
Build it, install it, start it&lt;br /&gt;
  ./netdata-installer.sh&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;starting netdata at boot&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Copy the netdata startup file to /etc/init.d&lt;br /&gt;
  cp system/netdata-lsb /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Make sure it is executable&lt;br /&gt;
  chmod +x /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Enable it&lt;br /&gt;
  update-rc.d netdata defaults&lt;br /&gt;
&lt;br /&gt;
Access to web interface&lt;br /&gt;
 &lt;br /&gt;
 http://&amp;lt;ipaddress&amp;gt;:19999&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced : https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Nagios Monitoring ===&lt;br /&gt;
&lt;br /&gt;
[[File:Nagios.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Choosing Nagios implementation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Nagios core and Nagios XI. Depending on what version of Linux you are running you might only be able to support Nagios core. On Ubuntu 15 and ahead PHP5 is unavailable which means that Installing Nagios XI is not possible since it depends on PHP5. In this case you have to install Nagios core using PHP7.:&lt;br /&gt;
&lt;br /&gt;
  which php&lt;br /&gt;
&lt;br /&gt;
Or Install PHP (version 5): &lt;br /&gt;
&lt;br /&gt;
  apt-get install php5-common libapache2-mod-php5 php5-cli&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloading the Latest Release&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Make sure to download the Nagios XI installation package to the /tmp directory of the server on which you wish to install it, as shown in&lt;br /&gt;
the following commands:&lt;br /&gt;
&lt;br /&gt;
  cd /tmp&lt;br /&gt;
&lt;br /&gt;
To download the latest stable release, use the following command:&lt;br /&gt;
&lt;br /&gt;
  wget http://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  tar xzf xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  cd /tmp/nagiosxi&lt;br /&gt;
&lt;br /&gt;
  ./fullinstall&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: It will take around 5 minutes to finish the installation.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You are access the Nagios XI interface by pointing your web browser to:&lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;/nagiosxi OR http://&amp;lt;ipaddress&amp;gt;/nagiosql/install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: An empty file named ENABLE_INSTALLER is necessary to create in install/ directory to continue with installation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Troubleshooting&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I got the problem with the given IP after finishing installation, it gave me wrong IP to access. But just ignore it and go to your correct IP of your web server: &lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  without &amp;quot;/nagiosxi&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It will show the installation GUI and you just need to follow and login after all.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Install Plugins ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Locate Your Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Visit this website to download plugins: http://exchange.nagios.org. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 Click the Admin menu --&amp;gt; Manage Plugins &lt;br /&gt;
&lt;br /&gt;
 Click the Browse button --&amp;gt; click the Upload Plugin button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test Your Plugin From The Command Line&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  cd /usr/local/nagios/libexec&lt;br /&gt;
  &lt;br /&gt;
  ./plugin_name arg1 arg2 ...&lt;br /&gt;
&lt;br /&gt;
*See the document of plugin to get more detail of its arguments&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Define A Command&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 browse to Configure → Core&lt;br /&gt;
&lt;br /&gt;
 Configuration Manager → Commands and click Add New.&lt;br /&gt;
&lt;br /&gt;
Enter a Command Name, usually the same as the plugin&lt;br /&gt;
filename. Next in the Command Line field, enter&lt;br /&gt;
$USER1$/plugin_name $ARG1$. The $USER1$ macro is&lt;br /&gt;
replaced with the path to the plugin directory, while the&lt;br /&gt;
$ARG1$ macro is a placeholder for an argument you want to&lt;br /&gt;
specify later on a per-service basis. If you want, you can omit&lt;br /&gt;
$ARG1$ or add more ($ARG2$, $ARG3$, etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Click Save --&amp;gt; Apply Configuration.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Add A Service&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In the left-hand menu&lt;br /&gt;
&lt;br /&gt;
 Click Services --&amp;gt; click Add New.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Config Name&#039;&#039;&#039; field, enter the file name where the&lt;br /&gt;
configuration will be stored. Next enter a description of the&lt;br /&gt;
service in the Description field. Associate the service with a&lt;br /&gt;
host by clicking the Manage Host button.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Check command&#039;&#039;&#039; field, select the command you defined&lt;br /&gt;
above from the dropdown list. If you had any argument&lt;br /&gt;
placeholders when you defined the command earlier, enter&lt;br /&gt;
replacement text in the appropriate argument fields.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Manage Templates&#039;&#039;&#039; button allows you to apply a template&lt;br /&gt;
to this service which will save you from having to fill in all the&lt;br /&gt;
other configuration options, or you can enter the required&lt;br /&gt;
Check and Alert settings manually.&lt;br /&gt;
&lt;br /&gt;
 Save --&amp;gt; Apply Configuration again&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Verify Your Service Is Working&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Navigate to&lt;br /&gt;
&lt;br /&gt;
  Home → Service Detail  &lt;br /&gt;
&lt;br /&gt;
Look for your new service in the list. It will probably take a few minutes before it runs its first check.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Experiences =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In during installation time, we have found some problems which will impact on our your installation as well.&lt;br /&gt;
&lt;br /&gt;
- The version of Ubuntu and Graylog might conflict each other as well as Graylog&#039;s packages ( e.g : java )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I have faced some of certain problem with installing Plugin for Nagios. First of all, you need to check if the plugins you want to use is supported for the OS of the server you are running, for example the plugin is written for Windows Server but you are running Linux server, thus it will give you an error about its format or bunch of error which is difficult to determine exactly its trouble.&lt;br /&gt;
&lt;br /&gt;
Furthermore, once you wish to add the plugin as a service. Please pay attention on the &amp;quot;Service Name&amp;quot; and &amp;quot;Manage Host&amp;quot; which might effect to your installation as well.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
During the installation Graylogs in both versions of Ubuntu ( 14.04 and 16.0 ). We realized that it had many differences between these versions. Listed above our objectives what we expect to achieve after installing and using Graylog, along with its useful information and its interaction between Administrator (users) with Graylog.&lt;br /&gt;
&lt;br /&gt;
its advantages:&lt;br /&gt;
 + Free.&lt;br /&gt;
 + Easy to interact with web interface.&lt;br /&gt;
 + Easy to install with the good support from its sources.&lt;br /&gt;
 + Help Administrator (user) to collect information in during logging and monitoring straightforwardly.&lt;br /&gt;
 + Many useful tools ( plugins ) which supports to work on.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The reason I choose Nagios as my monitoring solution is because it is quite fully functions which help people can handle the services on the server for example it points out detail notification of crucial services such as manage users, HTTP, SSH..so forth. I am using a trial version, but it&#039;s seem pretty enough for beginner to &amp;quot;hangout&amp;quot; with Monitoring tool at first.&lt;br /&gt;
&lt;br /&gt;
This is my opinion of its advantages:&lt;br /&gt;
&lt;br /&gt;
 + Easy to install with many ways with official guide from Nagios Supports.&lt;br /&gt;
 + Good trial version to barely use for beginner.&lt;br /&gt;
 + There are some useful extensions, plugins which are free and easy to install.&lt;br /&gt;
 + Easy to handle with web interface.&lt;br /&gt;
 + Does not take many space of hard disk.&lt;br /&gt;
&lt;br /&gt;
Another hand, it also has disadvantages:&lt;br /&gt;
&lt;br /&gt;
 + Too expensive for license version.&lt;br /&gt;
 + Lack of plugins development, some of them is quite old as well.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/how-to-install-graylog2-on-ubuntu-14-04.html&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://docs.graylog.org/en/2.1/&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagioscore/docs/Installing_Nagios_Core_From_Source.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://idroot.net/linux/install-nagios-ubuntu-16-04/&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115858</id>
		<title>Logging - Monitoring C21</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115858"/>
		<updated>2016-12-15T07:55:29Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Graylog2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Logging and Monitoring with Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Course: Logging and Monitoring - Lecturer: Margus Ernits&lt;br /&gt;
&lt;br /&gt;
Group: Cyber Security Engineering (C21)&lt;br /&gt;
&lt;br /&gt;
Team members: Ender Phan, Kustas Kurval, Sheela Gowry Sumathi Raju, Artur Vincent Kerge&lt;br /&gt;
&lt;br /&gt;
Page created on: October 05, 2016&lt;br /&gt;
&lt;br /&gt;
= Abstract =&lt;br /&gt;
&lt;br /&gt;
In order to understand how to set up the Graylog service as well as understand its crucial roles. We decided to choose Graylog as our application for logging and monitoring. Below are our objectives which would be expected to achieve later on:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Graylog on Ubuntu 14.04.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to use Graylog to protect servers.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Upgrading and configuring Graylog at first, and know how to secure Graylog.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Threats and security during logging.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Netdata and Monitoring with Netdata.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Nagios and Monitoring with Nagios.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Trouble shooting and experiences.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Installation Guide =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ubuntu 14.04&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Graylog_simple_setup_v2.png]]&lt;br /&gt;
&lt;br /&gt;
== Logging Solutions ==&lt;br /&gt;
&lt;br /&gt;
Since the Elasticsearch is based on java, we would require to install either openJDK or Oracle JDK. It is recommended to install Oracle JDK, verify the java version by using the following command.&lt;br /&gt;
&lt;br /&gt;
Remove the OpenJDK from the system, if you have it already installed. From now on it is presumed that user has root privileges.&lt;br /&gt;
&lt;br /&gt;
 apt-get remove --purge openjdk*&lt;br /&gt;
Add repository.&lt;br /&gt;
&lt;br /&gt;
 add-apt-repository -y ppa:webupd8team/java&lt;br /&gt;
Run the following command to pull the packages information from the newly added repository.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Issue the following command to install Java jdk 1.8.&lt;br /&gt;
&lt;br /&gt;
 apt-get -y install oracle-java8-installer&lt;br /&gt;
&lt;br /&gt;
 java -version&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
 Java version &amp;quot;1.8.0_60&amp;quot;&lt;br /&gt;
 Java(TM) SE Runtime Environment (build 1.8.0_60-b27)&lt;br /&gt;
 Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)&lt;br /&gt;
&lt;br /&gt;
=== Installing extras ===&lt;br /&gt;
&lt;br /&gt;
=== Elasticsearch ===&lt;br /&gt;
&lt;br /&gt;
Let’s install Elasticsearch, it can be downloaded from the official website.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download and install GPG signing key&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -&lt;br /&gt;
&lt;br /&gt;
Note that the -qO argument is lowercase Quebec followed by capital Oscar.&lt;br /&gt;
&lt;br /&gt;
Save the repository definition to /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
Update repository cache and install Elasticsearch&lt;br /&gt;
&lt;br /&gt;
 apt-get update &amp;amp;&amp;amp; apt-get install elasticsearch&lt;br /&gt;
&lt;br /&gt;
Configure Elasticsearch to start during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d elasticsearch defaults&lt;br /&gt;
The only important thing is to set a cluster name as “graylog2“, that is being used by graylog. Now edit the configuration file of Elasticsearch.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/elasticsearch/elasticsearch.yml&lt;br /&gt;
&lt;br /&gt;
 cluster.name: graylog2&lt;br /&gt;
&lt;br /&gt;
In the same file disable dynamic scripts to avoid remote execution. That can be done by adding the following line:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOLLOWING LINE GOES INTO GRAYLOG CONF!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 script.disable_dynamic: true&lt;br /&gt;
&lt;br /&gt;
Once it is done, we are good to go. Before that, restart the Elasticsearch services to load the modified configuration.&lt;br /&gt;
&lt;br /&gt;
 service elasticsearch restart&lt;br /&gt;
&lt;br /&gt;
Wait at least a minute to let the Elasticsearch get fully restarted, otherwise testing will fail. Elastisearch should be now listen on 9200 for processing HTTP request, we can use CURL to get the response. Ensure that it returns with cluster name as “graylog2”&lt;br /&gt;
&lt;br /&gt;
 curl -X GET http://localhost:9200&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
   &amp;quot;status&amp;quot; : 200,&lt;br /&gt;
   &amp;quot;name&amp;quot; : &amp;quot;Pistol&amp;quot;,&lt;br /&gt;
   &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
   &amp;quot;version&amp;quot; : {&lt;br /&gt;
    &amp;quot;number&amp;quot; : &amp;quot;1.7.1&amp;quot;,&lt;br /&gt;
    &amp;quot;build_hash&amp;quot; : &amp;quot;b88f43fc40b0bcd7f173a1f9ee2e97816de80b19&amp;quot;,&lt;br /&gt;
    &amp;quot;build_timestamp&amp;quot; : &amp;quot;2015-07-29T09:54:16Z&amp;quot;,&lt;br /&gt;
    &amp;quot;build_snapshot&amp;quot; : false,&lt;br /&gt;
    &amp;quot;lucene_version&amp;quot; : &amp;quot;4.10.4&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  &amp;quot;tagline&amp;quot; : &amp;quot;You Know, for Search&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Optional: Use the following command to check the Elasticsearch cluster health, you must get a cluster status as “green” for graylog to work.&lt;br /&gt;
&lt;br /&gt;
 curl -XGET &#039;http://localhost:9200/_cluster/health?pretty=true&#039;&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
  &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;status&amp;quot; : &amp;quot;&#039;&#039;&#039;green&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;timed_out&amp;quot; : false,&lt;br /&gt;
  &amp;quot;number_of_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;number_of_data_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;active_primary_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;active_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;relocating_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;initializing_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;delayed_unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_pending_tasks&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_in_flight_fetch&amp;quot; : 0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== MongoDB ===&lt;br /&gt;
&lt;br /&gt;
MongoDB is available in deb format and same can be downloaded from the official website. Add the following repository information on the system to install MongoDB. Before that we must import public key.&lt;br /&gt;
&lt;br /&gt;
 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10&lt;br /&gt;
Add repository by creating the /etc/apt/sources.list.d/mongodb-org-3.0.list list file using the command.&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse&amp;quot; | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list&lt;br /&gt;
Update repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install MongoDB using the following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install mongodb-org&lt;br /&gt;
Start the MongoDB service and enable it to start automatically during the system start-up.&lt;br /&gt;
&lt;br /&gt;
 service mongod start&lt;br /&gt;
&lt;br /&gt;
 ln -s /usr/bin/mongod /etc/init.d/mongod&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link&lt;br /&gt;
&lt;br /&gt;
 update-rc.d mongod defaults&lt;br /&gt;
&lt;br /&gt;
=== Graylog2 ===&lt;br /&gt;
&lt;br /&gt;
Graylog-server accepts and process the log messages, also spawns the RESTAPI for the requests that comes from graylog-web-interface. Download the latest version of graylog from graylog.org,&lt;br /&gt;
&lt;br /&gt;
Use the following command to install graylog2 repository.&lt;br /&gt;
&lt;br /&gt;
 wget https://packages.graylog2.org/repo/packages/graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
&lt;br /&gt;
 dpkg -i graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
Install https suppport and update the repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get install apt-transport-https&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install Graylog server using following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-server &lt;br /&gt;
Edit the server.conf file.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/server/server.conf&lt;br /&gt;
Configure the following variables in the above file.&lt;br /&gt;
&lt;br /&gt;
Set a secret to secure the user passwords, use the following command to generate a secret, use at least 64 character’s.&lt;br /&gt;
&lt;br /&gt;
 pwgen -N 1 -s 96&lt;br /&gt;
&lt;br /&gt;
 OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
If you get a “pwgen: command not found“, use the following command to install pwgen.&lt;br /&gt;
&lt;br /&gt;
 apt-get install pwgen&lt;br /&gt;
&lt;br /&gt;
Place the secret.&lt;br /&gt;
&lt;br /&gt;
 password_secret = OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
Next is to set a hash password for the root user (not to be confused with system user, root user of graylog is admin). You will use this password for login into the web interface, admin’s password can not be changed using web interface, must edit this variable to set.&lt;br /&gt;
&lt;br /&gt;
Replace “yourpassword” with the choice of your’s.&lt;br /&gt;
&lt;br /&gt;
 echo -n yourpassword | sha256sum&lt;br /&gt;
&lt;br /&gt;
 e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
Place the hash password.&lt;br /&gt;
&lt;br /&gt;
 root_password_sha2 = e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
You can setup email address root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_email = &amp;quot;cyber.web@gmail.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set timezone of root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_timezone = UTC&lt;br /&gt;
&lt;br /&gt;
Graylog will try to find the Elasticsearch nodes automatically, it uses multicast mode for the same. But when it comes to larger network, it is recommended to use unicast mode which is best suited one for production setups. So add the following two entries to graylog server.conf file, replace ipaddress with live hostname or ipaddress. Multiple hosts can be added with comma separated.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_http_enabled = false&lt;br /&gt;
 elasticsearch_discovery_zen_ping_unicast_hosts = ipaddress:9300&lt;br /&gt;
&lt;br /&gt;
Set only one master node by defining the below variable, default setting is true, you must set it as a false to make the particular node as a slave. Master node performs some periodic tasks that slave won’t perform.&lt;br /&gt;
&lt;br /&gt;
 is_master = true&lt;br /&gt;
&lt;br /&gt;
The following variable sets the number of log messages to keep per index, it is recommended to have several smaller indices instead of larger ones.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_docs_per_index = 20000000&lt;br /&gt;
&lt;br /&gt;
The following parameter defines to have total number of indices, if the this number is reached old index will be deleted.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_number_of_indices = 20&lt;br /&gt;
&lt;br /&gt;
Shards setting is really depends on the number of nodes in the Elasticsearch cluster, if you have only one node, set it as 1.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_shards = 1&lt;br /&gt;
&lt;br /&gt;
The number of replicas for your indices, if you have only one node in Elasticsearch cluster; set it as 0.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_replicas = 0&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Restart Graylog service.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 service graylog-server restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of graylog server service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-server defaults&lt;br /&gt;
&lt;br /&gt;
You can check out the server startup logs, it will be useful for you to troubleshoot graylog in case of any issue.&lt;br /&gt;
&lt;br /&gt;
 tailf /var/log/graylog-server/server.log&lt;br /&gt;
&lt;br /&gt;
On successful start of graylog-server, you should get the following message in the log file.&lt;br /&gt;
&lt;br /&gt;
 2015-09-17T09:35:22.895+02:00 INFO  [ServerBootstrap] Graylog server up and running.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Graylog web interface:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To configure graylog-web-interface, you must have at least one graylog-server node. Install Graylog web interface using “apt-get”.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-web&lt;br /&gt;
&lt;br /&gt;
Edit the configuration file and set the following parameters.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/web/web.conf&lt;br /&gt;
&lt;br /&gt;
This is the list of graylog-server nodes, you can add multiple nodes, separate by commas.&lt;br /&gt;
&lt;br /&gt;
 graylog2-server.uris=&amp;quot;http://127.0.0.1:12900/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set the application scret and can be generated using pwgen -N 1 -s 96.&lt;br /&gt;
&lt;br /&gt;
application.secret=&amp;quot;sNXyFf6B4Au3GqSlZwq7En86xp10JimdxxYiLtpptOejX6tIUpUE4DGRJOrcMj07wcK0wugPaapvzEzCYinEWj7BOtHXVl5Z&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set Web interface timezone.&lt;br /&gt;
&lt;br /&gt;
 Timezone=&amp;quot;Europe/Tallinn&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Restart the gralog-web-interface using following command,&lt;br /&gt;
&lt;br /&gt;
 service graylog-web restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of web interface service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-web defaults&lt;br /&gt;
&lt;br /&gt;
Add log forwarding to ryslog.&lt;br /&gt;
 nano /etc/rsyslog.d/50-default.conf&lt;br /&gt;
 *.*@192.168.56.200:5555&lt;br /&gt;
&lt;br /&gt;
== Monitoring Solutions ==&lt;br /&gt;
* Netdata&lt;br /&gt;
&lt;br /&gt;
* Nagios&lt;br /&gt;
=== Netdata Monitoring ===&lt;br /&gt;
[[File:Netdata.gif]]&lt;br /&gt;
&lt;br /&gt;
Linus Distribution: Debian Linux and its derivatives (including Ubuntu, Mint)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install nessesary packages:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install the packages for having a basic netdata installation (system monitoring and many applications, without mysql / mariadb, postgres, named, hardware sensors and SNMP):&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata&lt;br /&gt;
&lt;br /&gt;
Install all the required packages for monitoring everything netdata can monitor:&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata-all&lt;br /&gt;
&lt;br /&gt;
  apt-get install zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Netdata&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Download it - the directory &#039;netdata&#039; will be created&lt;br /&gt;
  git clone https://github.com/firehol/netdata.git --depth=1&lt;br /&gt;
  cd netdata&lt;br /&gt;
&lt;br /&gt;
Build it, install it, start it&lt;br /&gt;
  ./netdata-installer.sh&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;starting netdata at boot&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Copy the netdata startup file to /etc/init.d&lt;br /&gt;
  cp system/netdata-lsb /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Make sure it is executable&lt;br /&gt;
  chmod +x /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Enable it&lt;br /&gt;
  update-rc.d netdata defaults&lt;br /&gt;
&lt;br /&gt;
Access to web interface&lt;br /&gt;
 &lt;br /&gt;
 http://&amp;lt;ipaddress&amp;gt;:19999&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced : https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Nagios Monitoring ===&lt;br /&gt;
&lt;br /&gt;
[[File:Nagios.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Choosing Nagios implementation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Nagios core and Nagios XI. Depending on what version of Linux you are running you might only be able to support Nagios core. On Ubuntu 15 and ahead PHP5 is unavailable which means that Installing Nagios XI is not possible since it depends on PHP5. In this case you have to install Nagios core using PHP7.:&lt;br /&gt;
&lt;br /&gt;
  which php&lt;br /&gt;
&lt;br /&gt;
Or Install PHP (version 5): &lt;br /&gt;
&lt;br /&gt;
  apt-get install php5-common libapache2-mod-php5 php5-cli&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloading the Latest Release&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Make sure to download the Nagios XI installation package to the /tmp directory of the server on which you wish to install it, as shown in&lt;br /&gt;
the following commands:&lt;br /&gt;
&lt;br /&gt;
  cd /tmp&lt;br /&gt;
&lt;br /&gt;
To download the latest stable release, use the following command:&lt;br /&gt;
&lt;br /&gt;
  wget http://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  tar xzf xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  cd /tmp/nagiosxi&lt;br /&gt;
&lt;br /&gt;
  ./fullinstall&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: It will take around 5 minutes to finish the installation.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You are access the Nagios XI interface by pointing your web browser to:&lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;/nagiosxi OR http://&amp;lt;ipaddress&amp;gt;/nagiosql/install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: An empty file named ENABLE_INSTALLER is necessary to create in install/ directory to continue with installation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Troubleshooting&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I got the problem with the given IP after finishing installation, it gave me wrong IP to access. But just ignore it and go to your correct IP of your web server: &lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  without &amp;quot;/nagiosxi&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It will show the installation GUI and you just need to follow and login after all.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Install Plugins ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Locate Your Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Visit this website to download plugins: http://exchange.nagios.org. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 Click the Admin menu --&amp;gt; Manage Plugins &lt;br /&gt;
&lt;br /&gt;
 Click the Browse button --&amp;gt; click the Upload Plugin button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test Your Plugin From The Command Line&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  cd /usr/local/nagios/libexec&lt;br /&gt;
  &lt;br /&gt;
  ./plugin_name arg1 arg2 ...&lt;br /&gt;
&lt;br /&gt;
*See the document of plugin to get more detail of its arguments&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Define A Command&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 browse to Configure → Core&lt;br /&gt;
&lt;br /&gt;
 Configuration Manager → Commands and click Add New.&lt;br /&gt;
&lt;br /&gt;
Enter a Command Name, usually the same as the plugin&lt;br /&gt;
filename. Next in the Command Line field, enter&lt;br /&gt;
$USER1$/plugin_name $ARG1$. The $USER1$ macro is&lt;br /&gt;
replaced with the path to the plugin directory, while the&lt;br /&gt;
$ARG1$ macro is a placeholder for an argument you want to&lt;br /&gt;
specify later on a per-service basis. If you want, you can omit&lt;br /&gt;
$ARG1$ or add more ($ARG2$, $ARG3$, etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Click Save --&amp;gt; Apply Configuration.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Add A Service&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In the left-hand menu&lt;br /&gt;
&lt;br /&gt;
 Click Services --&amp;gt; click Add New.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Config Name&#039;&#039;&#039; field, enter the file name where the&lt;br /&gt;
configuration will be stored. Next enter a description of the&lt;br /&gt;
service in the Description field. Associate the service with a&lt;br /&gt;
host by clicking the Manage Host button.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Check command&#039;&#039;&#039; field, select the command you defined&lt;br /&gt;
above from the dropdown list. If you had any argument&lt;br /&gt;
placeholders when you defined the command earlier, enter&lt;br /&gt;
replacement text in the appropriate argument fields.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Manage Templates&#039;&#039;&#039; button allows you to apply a template&lt;br /&gt;
to this service which will save you from having to fill in all the&lt;br /&gt;
other configuration options, or you can enter the required&lt;br /&gt;
Check and Alert settings manually.&lt;br /&gt;
&lt;br /&gt;
 Save --&amp;gt; Apply Configuration again&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Verify Your Service Is Working&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Navigate to&lt;br /&gt;
&lt;br /&gt;
  Home → Service Detail  &lt;br /&gt;
&lt;br /&gt;
Look for your new service in the list. It will probably take a few minutes before it runs its first check.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Experiences =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In during installation time, we have found some problems which will impact on our your installation as well.&lt;br /&gt;
&lt;br /&gt;
- The version of Ubuntu and Graylog might conflict each other as well as Graylog&#039;s packages ( e.g : java )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I have faced some of certain problem with installing Plugin for Nagios. First of all, you need to check if the plugins you want to use is supported for the OS of the server you are running, for example the plugin is written for Windows Server but you are running Linux server, thus it will give you an error about its format or bunch of error which is difficult to determine exactly its trouble.&lt;br /&gt;
&lt;br /&gt;
Furthermore, once you wish to add the plugin as a service. Please pay attention on the &amp;quot;Service Name&amp;quot; and &amp;quot;Manage Host&amp;quot; which might effect to your installation as well.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
During the installation Graylogs in both versions of Ubuntu ( 14.04 and 16.0 ). We realized that it had many differences between these versions. Listed above our objectives what we expect to achieve after installing and using Graylog, along with its useful information and its interaction between Administrator (users) with Graylog.&lt;br /&gt;
&lt;br /&gt;
its advantages:&lt;br /&gt;
 + Free.&lt;br /&gt;
 + Easy to interact with web interface.&lt;br /&gt;
 + Easy to install with the good support from its sources.&lt;br /&gt;
 + Help Administrator (user) to collect information in during logging and monitoring straightforwardly.&lt;br /&gt;
 + Many useful tools ( plugins ) which supports to work on.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The reason I choose Nagios as my monitoring solution is because it is quite fully functions which help people can handle the services on the server for example it points out detail notification of crucial services such as manage users, HTTP, SSH..so forth. I am using a trial version, but it&#039;s seem pretty enough for beginner to &amp;quot;hangout&amp;quot; with Monitoring tool at first.&lt;br /&gt;
&lt;br /&gt;
This is my opinion of its advantages:&lt;br /&gt;
&lt;br /&gt;
 + Easy to install with many ways with official guide from Nagios Supports.&lt;br /&gt;
 + Good trial version to barely use for beginner.&lt;br /&gt;
 + There are some useful extensions, plugins which are free and easy to install.&lt;br /&gt;
 + Easy to handle with web interface.&lt;br /&gt;
 + Does not take many space of hard disk.&lt;br /&gt;
&lt;br /&gt;
Another hand, it also has disadvantages:&lt;br /&gt;
&lt;br /&gt;
 + Too expensive for license version.&lt;br /&gt;
 + Lack of plugins development, some of them is quite old as well.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/how-to-install-graylog2-on-ubuntu-14-04.html&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://docs.graylog.org/en/2.1/&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagioscore/docs/Installing_Nagios_Core_From_Source.pdf&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115857</id>
		<title>Logging - Monitoring C21</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115857"/>
		<updated>2016-12-15T07:43:23Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Logging and Monitoring with Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Course: Logging and Monitoring - Lecturer: Margus Ernits&lt;br /&gt;
&lt;br /&gt;
Group: Cyber Security Engineering (C21)&lt;br /&gt;
&lt;br /&gt;
Team members: Ender Phan, Kustas Kurval, Sheela Gowry Sumathi Raju, Artur Vincent Kerge&lt;br /&gt;
&lt;br /&gt;
Page created on: October 05, 2016&lt;br /&gt;
&lt;br /&gt;
= Abstract =&lt;br /&gt;
&lt;br /&gt;
In order to understand how to set up the Graylog service as well as understand its crucial roles. We decided to choose Graylog as our application for logging and monitoring. Below are our objectives which would be expected to achieve later on:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Graylog on Ubuntu 14.04.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to use Graylog to protect servers.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Upgrading and configuring Graylog at first, and know how to secure Graylog.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Threats and security during logging.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Netdata and Monitoring with Netdata.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Nagios and Monitoring with Nagios.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Trouble shooting and experiences.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Installation Guide =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ubuntu 14.04&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Graylog_simple_setup_v2.png]]&lt;br /&gt;
&lt;br /&gt;
== Logging Solutions ==&lt;br /&gt;
&lt;br /&gt;
Since the Elasticsearch is based on java, we would require to install either openJDK or Oracle JDK. It is recommended to install Oracle JDK, verify the java version by using the following command.&lt;br /&gt;
&lt;br /&gt;
Remove the OpenJDK from the system, if you have it already installed. From now on it is presumed that user has root privileges.&lt;br /&gt;
&lt;br /&gt;
 apt-get remove --purge openjdk*&lt;br /&gt;
Add repository.&lt;br /&gt;
&lt;br /&gt;
 add-apt-repository -y ppa:webupd8team/java&lt;br /&gt;
Run the following command to pull the packages information from the newly added repository.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Issue the following command to install Java jdk 1.8.&lt;br /&gt;
&lt;br /&gt;
 apt-get -y install oracle-java8-installer&lt;br /&gt;
&lt;br /&gt;
 java -version&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
 Java version &amp;quot;1.8.0_60&amp;quot;&lt;br /&gt;
 Java(TM) SE Runtime Environment (build 1.8.0_60-b27)&lt;br /&gt;
 Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)&lt;br /&gt;
&lt;br /&gt;
=== Installing extras ===&lt;br /&gt;
&lt;br /&gt;
=== Elasticsearch ===&lt;br /&gt;
&lt;br /&gt;
Let’s install Elasticsearch, it can be downloaded from the official website.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download and install GPG signing key&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -&lt;br /&gt;
&lt;br /&gt;
Note that the -qO argument is lowercase Quebec followed by capital Oscar.&lt;br /&gt;
&lt;br /&gt;
Save the repository definition to /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
Update repository cache and install Elasticsearch&lt;br /&gt;
&lt;br /&gt;
 apt-get update &amp;amp;&amp;amp; apt-get install elasticsearch&lt;br /&gt;
&lt;br /&gt;
Configure Elasticsearch to start during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d elasticsearch defaults&lt;br /&gt;
The only important thing is to set a cluster name as “graylog2“, that is being used by graylog. Now edit the configuration file of Elasticsearch.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/elasticsearch/elasticsearch.yml&lt;br /&gt;
&lt;br /&gt;
 cluster.name: graylog2&lt;br /&gt;
&lt;br /&gt;
In the same file disable dynamic scripts to avoid remote execution. That can be done by adding the following line:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOLLOWING LINE GOES INTO GRAYLOG CONF!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 script.disable_dynamic: true&lt;br /&gt;
&lt;br /&gt;
Once it is done, we are good to go. Before that, restart the Elasticsearch services to load the modified configuration.&lt;br /&gt;
&lt;br /&gt;
 service elasticsearch restart&lt;br /&gt;
&lt;br /&gt;
Wait at least a minute to let the Elasticsearch get fully restarted, otherwise testing will fail. Elastisearch should be now listen on 9200 for processing HTTP request, we can use CURL to get the response. Ensure that it returns with cluster name as “graylog2”&lt;br /&gt;
&lt;br /&gt;
 curl -X GET http://localhost:9200&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
   &amp;quot;status&amp;quot; : 200,&lt;br /&gt;
   &amp;quot;name&amp;quot; : &amp;quot;Pistol&amp;quot;,&lt;br /&gt;
   &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
   &amp;quot;version&amp;quot; : {&lt;br /&gt;
    &amp;quot;number&amp;quot; : &amp;quot;1.7.1&amp;quot;,&lt;br /&gt;
    &amp;quot;build_hash&amp;quot; : &amp;quot;b88f43fc40b0bcd7f173a1f9ee2e97816de80b19&amp;quot;,&lt;br /&gt;
    &amp;quot;build_timestamp&amp;quot; : &amp;quot;2015-07-29T09:54:16Z&amp;quot;,&lt;br /&gt;
    &amp;quot;build_snapshot&amp;quot; : false,&lt;br /&gt;
    &amp;quot;lucene_version&amp;quot; : &amp;quot;4.10.4&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  &amp;quot;tagline&amp;quot; : &amp;quot;You Know, for Search&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Optional: Use the following command to check the Elasticsearch cluster health, you must get a cluster status as “green” for graylog to work.&lt;br /&gt;
&lt;br /&gt;
 curl -XGET &#039;http://localhost:9200/_cluster/health?pretty=true&#039;&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
  &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;status&amp;quot; : &amp;quot;&#039;&#039;&#039;green&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;timed_out&amp;quot; : false,&lt;br /&gt;
  &amp;quot;number_of_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;number_of_data_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;active_primary_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;active_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;relocating_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;initializing_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;delayed_unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_pending_tasks&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_in_flight_fetch&amp;quot; : 0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== MongoDB ===&lt;br /&gt;
&lt;br /&gt;
MongoDB is available in deb format and same can be downloaded from the official website. Add the following repository information on the system to install MongoDB. Before that we must import public key.&lt;br /&gt;
&lt;br /&gt;
 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10&lt;br /&gt;
Add repository by creating the /etc/apt/sources.list.d/mongodb-org-3.0.list list file using the command.&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse&amp;quot; | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list&lt;br /&gt;
Update repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install MongoDB using the following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install mongodb-org&lt;br /&gt;
Start the MongoDB service and enable it to start automatically during the system start-up.&lt;br /&gt;
&lt;br /&gt;
 service mongod start&lt;br /&gt;
&lt;br /&gt;
 ln -s /usr/bin/mongod /etc/init.d/mongod&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link&lt;br /&gt;
&lt;br /&gt;
 update-rc.d mongod defaults&lt;br /&gt;
&lt;br /&gt;
=== Graylog2 ===&lt;br /&gt;
&lt;br /&gt;
Graylog-server accepts and process the log messages, also spawns the RESTAPI for the requests that comes from graylog-web-interface. Download the latest version of graylog from graylog.org,&lt;br /&gt;
&lt;br /&gt;
Use the following command to install graylog2 repository.&lt;br /&gt;
&lt;br /&gt;
 wget https://packages.graylog2.org/repo/packages/graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
&lt;br /&gt;
 dpkg -i graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
Install https suppport and update the repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get install apt-transport-https&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install Graylog server using following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-server &lt;br /&gt;
Edit the server.conf file.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/server/server.conf&lt;br /&gt;
Configure the following variables in the above file.&lt;br /&gt;
&lt;br /&gt;
Set a secret to secure the user passwords, use the following command to generate a secret, use at least 64 character’s.&lt;br /&gt;
&lt;br /&gt;
 pwgen -N 1 -s 96&lt;br /&gt;
&lt;br /&gt;
 OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
If you get a “pwgen: command not found“, use the following command to install pwgen.&lt;br /&gt;
&lt;br /&gt;
 apt-get install pwgen&lt;br /&gt;
&lt;br /&gt;
Place the secret.&lt;br /&gt;
&lt;br /&gt;
 password_secret = OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
Next is to set a hash password for the root user (not to be confused with system user, root user of graylog is admin). You will use this password for login into the web interface, admin’s password can not be changed using web interface, must edit this variable to set.&lt;br /&gt;
&lt;br /&gt;
Replace “yourpassword” with the choice of your’s.&lt;br /&gt;
&lt;br /&gt;
 echo -n yourpassword | sha256sum&lt;br /&gt;
&lt;br /&gt;
 e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
Place the hash password.&lt;br /&gt;
&lt;br /&gt;
 root_password_sha2 = e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
You can setup email address root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_email = &amp;quot;cyber.web@gmail.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set timezone of root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_timezone = UTC&lt;br /&gt;
&lt;br /&gt;
Graylog will try to find the Elasticsearch nodes automatically, it uses multicast mode for the same. But when it comes to larger network, it is recommended to use unicast mode which is best suited one for production setups. So add the following two entries to graylog server.conf file, replace ipaddress with live hostname or ipaddress. Multiple hosts can be added with comma separated.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_http_enabled = false&lt;br /&gt;
 elasticsearch_discovery_zen_ping_unicast_hosts = ipaddress:9300&lt;br /&gt;
&lt;br /&gt;
Set only one master node by defining the below variable, default setting is true, you must set it as a false to make the particular node as a slave. Master node performs some periodic tasks that slave won’t perform.&lt;br /&gt;
&lt;br /&gt;
 is_master = true&lt;br /&gt;
&lt;br /&gt;
The following variable sets the number of log messages to keep per index, it is recommended to have several smaller indices instead of larger ones.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_docs_per_index = 20000000&lt;br /&gt;
&lt;br /&gt;
The following parameter defines to have total number of indices, if the this number is reached old index will be deleted.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_number_of_indices = 20&lt;br /&gt;
&lt;br /&gt;
Shards setting is really depends on the number of nodes in the Elasticsearch cluster, if you have only one node, set it as 1.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_shards = 1&lt;br /&gt;
&lt;br /&gt;
The number of replicas for your indices, if you have only one node in Elasticsearch cluster; set it as 0.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_replicas = 0&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Restart Graylog service.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 service graylog-server restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of graylog server service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-server defaults&lt;br /&gt;
&lt;br /&gt;
You can check out the server startup logs, it will be useful for you to troubleshoot graylog in case of any issue.&lt;br /&gt;
&lt;br /&gt;
 tailf /var/log/graylog-server/server.log&lt;br /&gt;
&lt;br /&gt;
On successful start of graylog-server, you should get the following message in the log file.&lt;br /&gt;
&lt;br /&gt;
 2015-09-17T09:35:22.895+02:00 INFO  [ServerBootstrap] Graylog server up and running.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Graylog web interface:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To configure graylog-web-interface, you must have at least one graylog-server node. Install Graylog web interface using “apt-get”.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-web&lt;br /&gt;
&lt;br /&gt;
Edit the configuration file and set the following parameters.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/web/web.conf&lt;br /&gt;
&lt;br /&gt;
This is the list of graylog-server nodes, you can add multiple nodes, separate by commas.&lt;br /&gt;
&lt;br /&gt;
 graylog2-server.uris=&amp;quot;http://127.0.0.1:12900/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set the application scret and can be generated using pwgen -N 1 -s 96.&lt;br /&gt;
&lt;br /&gt;
application.secret=&amp;quot;sNXyFf6B4Au3GqSlZwq7En86xp10JimdxxYiLtpptOejX6tIUpUE4DGRJOrcMj07wcK0wugPaapvzEzCYinEWj7BOtHXVl5Z&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set Web interface timezone.&lt;br /&gt;
&lt;br /&gt;
 Timezone=&amp;quot;Europe/Tallinn&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Restart the gralog-web-interface using following command,&lt;br /&gt;
&lt;br /&gt;
 service graylog-web restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of web interface service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-web defaults&lt;br /&gt;
&lt;br /&gt;
== Monitoring Solutions ==&lt;br /&gt;
* Netdata&lt;br /&gt;
&lt;br /&gt;
* Nagios&lt;br /&gt;
=== Netdata Monitoring ===&lt;br /&gt;
[[File:Netdata.gif]]&lt;br /&gt;
&lt;br /&gt;
Linus Distribution: Debian Linux and its derivatives (including Ubuntu, Mint)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install nessesary packages:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install the packages for having a basic netdata installation (system monitoring and many applications, without mysql / mariadb, postgres, named, hardware sensors and SNMP):&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata&lt;br /&gt;
&lt;br /&gt;
Install all the required packages for monitoring everything netdata can monitor:&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata-all&lt;br /&gt;
&lt;br /&gt;
  apt-get install zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Netdata&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Download it - the directory &#039;netdata&#039; will be created&lt;br /&gt;
  git clone https://github.com/firehol/netdata.git --depth=1&lt;br /&gt;
  cd netdata&lt;br /&gt;
&lt;br /&gt;
Build it, install it, start it&lt;br /&gt;
  ./netdata-installer.sh&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;starting netdata at boot&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Copy the netdata startup file to /etc/init.d&lt;br /&gt;
  cp system/netdata-lsb /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Make sure it is executable&lt;br /&gt;
  chmod +x /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Enable it&lt;br /&gt;
  update-rc.d netdata defaults&lt;br /&gt;
&lt;br /&gt;
Access to web interface&lt;br /&gt;
 &lt;br /&gt;
 http://&amp;lt;ipaddress&amp;gt;:19999&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced : https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Nagios Monitoring ===&lt;br /&gt;
&lt;br /&gt;
[[File:Nagios.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Choosing Nagios implementation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Nagios core and Nagios XI. Depending on what version of Linux you are running you might only be able to support Nagios core. On Ubuntu 15 and ahead PHP5 is unavailable which means that Installing Nagios XI is not possible since it depends on PHP5. In this case you have to install Nagios core using PHP7.:&lt;br /&gt;
&lt;br /&gt;
  which php&lt;br /&gt;
&lt;br /&gt;
Or Install PHP (version 5): &lt;br /&gt;
&lt;br /&gt;
  apt-get install php5-common libapache2-mod-php5 php5-cli&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloading the Latest Release&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Make sure to download the Nagios XI installation package to the /tmp directory of the server on which you wish to install it, as shown in&lt;br /&gt;
the following commands:&lt;br /&gt;
&lt;br /&gt;
  cd /tmp&lt;br /&gt;
&lt;br /&gt;
To download the latest stable release, use the following command:&lt;br /&gt;
&lt;br /&gt;
  wget http://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  tar xzf xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  cd /tmp/nagiosxi&lt;br /&gt;
&lt;br /&gt;
  ./fullinstall&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: It will take around 5 minutes to finish the installation.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You are access the Nagios XI interface by pointing your web browser to:&lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;/nagiosxi OR http://&amp;lt;ipaddress&amp;gt;/nagiosql/install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: An empty file named ENABLE_INSTALLER is necessary to create in install/ directory to continue with installation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Troubleshooting&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I got the problem with the given IP after finishing installation, it gave me wrong IP to access. But just ignore it and go to your correct IP of your web server: &lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  without &amp;quot;/nagiosxi&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It will show the installation GUI and you just need to follow and login after all.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Install Plugins ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Locate Your Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Visit this website to download plugins: http://exchange.nagios.org. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 Click the Admin menu --&amp;gt; Manage Plugins &lt;br /&gt;
&lt;br /&gt;
 Click the Browse button --&amp;gt; click the Upload Plugin button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test Your Plugin From The Command Line&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  cd /usr/local/nagios/libexec&lt;br /&gt;
  &lt;br /&gt;
  ./plugin_name arg1 arg2 ...&lt;br /&gt;
&lt;br /&gt;
*See the document of plugin to get more detail of its arguments&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Define A Command&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 browse to Configure → Core&lt;br /&gt;
&lt;br /&gt;
 Configuration Manager → Commands and click Add New.&lt;br /&gt;
&lt;br /&gt;
Enter a Command Name, usually the same as the plugin&lt;br /&gt;
filename. Next in the Command Line field, enter&lt;br /&gt;
$USER1$/plugin_name $ARG1$. The $USER1$ macro is&lt;br /&gt;
replaced with the path to the plugin directory, while the&lt;br /&gt;
$ARG1$ macro is a placeholder for an argument you want to&lt;br /&gt;
specify later on a per-service basis. If you want, you can omit&lt;br /&gt;
$ARG1$ or add more ($ARG2$, $ARG3$, etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Click Save --&amp;gt; Apply Configuration.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Add A Service&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In the left-hand menu&lt;br /&gt;
&lt;br /&gt;
 Click Services --&amp;gt; click Add New.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Config Name&#039;&#039;&#039; field, enter the file name where the&lt;br /&gt;
configuration will be stored. Next enter a description of the&lt;br /&gt;
service in the Description field. Associate the service with a&lt;br /&gt;
host by clicking the Manage Host button.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Check command&#039;&#039;&#039; field, select the command you defined&lt;br /&gt;
above from the dropdown list. If you had any argument&lt;br /&gt;
placeholders when you defined the command earlier, enter&lt;br /&gt;
replacement text in the appropriate argument fields.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Manage Templates&#039;&#039;&#039; button allows you to apply a template&lt;br /&gt;
to this service which will save you from having to fill in all the&lt;br /&gt;
other configuration options, or you can enter the required&lt;br /&gt;
Check and Alert settings manually.&lt;br /&gt;
&lt;br /&gt;
 Save --&amp;gt; Apply Configuration again&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Verify Your Service Is Working&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Navigate to&lt;br /&gt;
&lt;br /&gt;
  Home → Service Detail  &lt;br /&gt;
&lt;br /&gt;
Look for your new service in the list. It will probably take a few minutes before it runs its first check.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Experiences =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In during installation time, we have found some problems which will impact on our your installation as well.&lt;br /&gt;
&lt;br /&gt;
- The version of Ubuntu and Graylog might conflict each other as well as Graylog&#039;s packages ( e.g : java )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I have faced some of certain problem with installing Plugin for Nagios. First of all, you need to check if the plugins you want to use is supported for the OS of the server you are running, for example the plugin is written for Windows Server but you are running Linux server, thus it will give you an error about its format or bunch of error which is difficult to determine exactly its trouble.&lt;br /&gt;
&lt;br /&gt;
Furthermore, once you wish to add the plugin as a service. Please pay attention on the &amp;quot;Service Name&amp;quot; and &amp;quot;Manage Host&amp;quot; which might effect to your installation as well.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
During the installation Graylogs in both versions of Ubuntu ( 14.04 and 16.0 ). We realized that it had many differences between these versions. Listed above our objectives what we expect to achieve after installing and using Graylog, along with its useful information and its interaction between Administrator (users) with Graylog.&lt;br /&gt;
&lt;br /&gt;
its advantages:&lt;br /&gt;
 + Free.&lt;br /&gt;
 + Easy to interact with web interface.&lt;br /&gt;
 + Easy to install with the good support from its sources.&lt;br /&gt;
 + Help Administrator (user) to collect information in during logging and monitoring straightforwardly.&lt;br /&gt;
 + Many useful tools ( plugins ) which supports to work on.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The reason I choose Nagios as my monitoring solution is because it is quite fully functions which help people can handle the services on the server for example it points out detail notification of crucial services such as manage users, HTTP, SSH..so forth. I am using a trial version, but it&#039;s seem pretty enough for beginner to &amp;quot;hangout&amp;quot; with Monitoring tool at first.&lt;br /&gt;
&lt;br /&gt;
This is my opinion of its advantages:&lt;br /&gt;
&lt;br /&gt;
 + Easy to install with many ways with official guide from Nagios Supports.&lt;br /&gt;
 + Good trial version to barely use for beginner.&lt;br /&gt;
 + There are some useful extensions, plugins which are free and easy to install.&lt;br /&gt;
 + Easy to handle with web interface.&lt;br /&gt;
 + Does not take many space of hard disk.&lt;br /&gt;
&lt;br /&gt;
Another hand, it also has disadvantages:&lt;br /&gt;
&lt;br /&gt;
 + Too expensive for license version.&lt;br /&gt;
 + Lack of plugins development, some of them is quite old as well.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/how-to-install-graylog2-on-ubuntu-14-04.html&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://docs.graylog.org/en/2.1/&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagioscore/docs/Installing_Nagios_Core_From_Source.pdf&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115856</id>
		<title>Logging - Monitoring C21</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115856"/>
		<updated>2016-12-15T07:42:41Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Logging and Monitoring with Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Course: Logging and Monitoring - Lecturer: Margus Ernits&lt;br /&gt;
&lt;br /&gt;
Group: Cyber Security Engineering (C21)&lt;br /&gt;
&lt;br /&gt;
Team members: Ender Phan, Kustas Kurval, Sheela Gowry Sumathi Raju, Artur Vincent Kerge&lt;br /&gt;
&lt;br /&gt;
Page created on: October 05, 2016&lt;br /&gt;
&lt;br /&gt;
= Abstract =&lt;br /&gt;
&lt;br /&gt;
In order to understand how to set up the Graylog service as well as understand its crucial roles. We decided to choose Graylog as our application for logging and monitoring. Below are our objectives which would be expected to achieve later on:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Graylog on Ubuntu 14.04.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to use Graylog to protect servers.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Upgrading and configuring Graylog at first, and know how to secure Graylog.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Threats and security during logging.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Netdata and Monitoring with Netdata.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Nagios and Monitoring with Nagios.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Trouble shooting and experiences.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Installation Guide =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ubuntu 14.04&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Graylog_simple_setup_v2.png]]&lt;br /&gt;
&lt;br /&gt;
== Logging Solutions ==&lt;br /&gt;
&lt;br /&gt;
Since the Elasticsearch is based on java, we would require to install either openJDK or Oracle JDK. It is recommended to install Oracle JDK, verify the java version by using the following command.&lt;br /&gt;
&lt;br /&gt;
Remove the OpenJDK from the system, if you have it already installed. From now on it is presumed that user has root privileges.&lt;br /&gt;
&lt;br /&gt;
 apt-get remove --purge openjdk*&lt;br /&gt;
Add repository.&lt;br /&gt;
&lt;br /&gt;
 add-apt-repository -y ppa:webupd8team/java&lt;br /&gt;
Run the following command to pull the packages information from the newly added repository.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Issue the following command to install Java jdk 1.8.&lt;br /&gt;
&lt;br /&gt;
 apt-get -y install oracle-java8-installer&lt;br /&gt;
&lt;br /&gt;
 java -version&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
 Java version &amp;quot;1.8.0_60&amp;quot;&lt;br /&gt;
 Java(TM) SE Runtime Environment (build 1.8.0_60-b27)&lt;br /&gt;
 Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)&lt;br /&gt;
&lt;br /&gt;
=== Installing extras ===&lt;br /&gt;
&lt;br /&gt;
=== Elasticsearch ===&lt;br /&gt;
&lt;br /&gt;
Let’s install Elasticsearch, it can be downloaded from the official website.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download and install GPG signing key&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -&lt;br /&gt;
&lt;br /&gt;
Note that the -qO argument is lowercase Quebec followed by capital Oscar.&lt;br /&gt;
&lt;br /&gt;
Save the repository definition to /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
Update repository cache and install Elasticsearch&lt;br /&gt;
&lt;br /&gt;
 apt-get update &amp;amp;&amp;amp; apt-get install elasticsearch&lt;br /&gt;
&lt;br /&gt;
Configure Elasticsearch to start during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d elasticsearch defaults&lt;br /&gt;
The only important thing is to set a cluster name as “graylog2“, that is being used by graylog. Now edit the configuration file of Elasticsearch.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/elasticsearch/elasticsearch.yml&lt;br /&gt;
&lt;br /&gt;
 cluster.name: graylog2&lt;br /&gt;
&lt;br /&gt;
In the same file disable dynamic scripts to avoid remote execution. That can be done by adding the following line:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOLLOWING LINE GOES INTO GRAYLOG CONF!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 script.disable_dynamic: true&lt;br /&gt;
&lt;br /&gt;
Once it is done, we are good to go. Before that, restart the Elasticsearch services to load the modified configuration.&lt;br /&gt;
&lt;br /&gt;
 service elasticsearch restart&lt;br /&gt;
&lt;br /&gt;
Wait at least a minute to let the Elasticsearch get fully restarted, otherwise testing will fail. Elastisearch should be now listen on 9200 for processing HTTP request, we can use CURL to get the response. Ensure that it returns with cluster name as “graylog2”&lt;br /&gt;
&lt;br /&gt;
 curl -X GET http://localhost:9200&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
   &amp;quot;status&amp;quot; : 200,&lt;br /&gt;
   &amp;quot;name&amp;quot; : &amp;quot;Pistol&amp;quot;,&lt;br /&gt;
   &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
   &amp;quot;version&amp;quot; : {&lt;br /&gt;
    &amp;quot;number&amp;quot; : &amp;quot;1.7.1&amp;quot;,&lt;br /&gt;
    &amp;quot;build_hash&amp;quot; : &amp;quot;b88f43fc40b0bcd7f173a1f9ee2e97816de80b19&amp;quot;,&lt;br /&gt;
    &amp;quot;build_timestamp&amp;quot; : &amp;quot;2015-07-29T09:54:16Z&amp;quot;,&lt;br /&gt;
    &amp;quot;build_snapshot&amp;quot; : false,&lt;br /&gt;
    &amp;quot;lucene_version&amp;quot; : &amp;quot;4.10.4&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  &amp;quot;tagline&amp;quot; : &amp;quot;You Know, for Search&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Optional: Use the following command to check the Elasticsearch cluster health, you must get a cluster status as “green” for graylog to work.&lt;br /&gt;
&lt;br /&gt;
 curl -XGET &#039;http://localhost:9200/_cluster/health?pretty=true&#039;&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
  &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;status&amp;quot; : &amp;quot;&#039;&#039;&#039;green&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;timed_out&amp;quot; : false,&lt;br /&gt;
  &amp;quot;number_of_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;number_of_data_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;active_primary_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;active_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;relocating_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;initializing_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;delayed_unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_pending_tasks&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_in_flight_fetch&amp;quot; : 0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== MongoDB ===&lt;br /&gt;
&lt;br /&gt;
MongoDB is available in deb format and same can be downloaded from the official website. Add the following repository information on the system to install MongoDB. Before that we must import public key.&lt;br /&gt;
&lt;br /&gt;
 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10&lt;br /&gt;
Add repository by creating the /etc/apt/sources.list.d/mongodb-org-3.0.list list file using the command.&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse&amp;quot; | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list&lt;br /&gt;
Update repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install MongoDB using the following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install mongodb-org&lt;br /&gt;
Start the MongoDB service and enable it to start automatically during the system start-up.&lt;br /&gt;
&lt;br /&gt;
 service mongod start&lt;br /&gt;
&lt;br /&gt;
 ln -s /usr/bin/mongod /etc/init.d/mongod&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link&lt;br /&gt;
&lt;br /&gt;
 update-rc.d mongod defaults&lt;br /&gt;
&lt;br /&gt;
=== Graylog2 ===&lt;br /&gt;
&lt;br /&gt;
Graylog-server accepts and process the log messages, also spawns the RESTAPI for the requests that comes from graylog-web-interface. Download the latest version of graylog from graylog.org,&lt;br /&gt;
&lt;br /&gt;
Use the following command to install graylog2 repository.&lt;br /&gt;
&lt;br /&gt;
 wget https://packages.graylog2.org/repo/packages/graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
&lt;br /&gt;
 dpkg -i graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
Install https suppport and update the repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get install apt-transport-https&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install Graylog server using following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-server &lt;br /&gt;
Edit the server.conf file.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/server/server.conf&lt;br /&gt;
Configure the following variables in the above file.&lt;br /&gt;
&lt;br /&gt;
Set a secret to secure the user passwords, use the following command to generate a secret, use at least 64 character’s.&lt;br /&gt;
&lt;br /&gt;
 pwgen -N 1 -s 96&lt;br /&gt;
&lt;br /&gt;
 OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
If you get a “pwgen: command not found“, use the following command to install pwgen.&lt;br /&gt;
&lt;br /&gt;
 apt-get install pwgen&lt;br /&gt;
&lt;br /&gt;
Place the secret.&lt;br /&gt;
&lt;br /&gt;
 password_secret = OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
Next is to set a hash password for the root user (not to be confused with system user, root user of graylog is admin). You will use this password for login into the web interface, admin’s password can not be changed using web interface, must edit this variable to set.&lt;br /&gt;
&lt;br /&gt;
Replace “yourpassword” with the choice of your’s.&lt;br /&gt;
&lt;br /&gt;
 echo -n yourpassword | sha256sum&lt;br /&gt;
&lt;br /&gt;
 e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
Place the hash password.&lt;br /&gt;
&lt;br /&gt;
 root_password_sha2 = e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
You can setup email address root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_email = &amp;quot;cyber.web@gmail.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set timezone of root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_timezone = UTC&lt;br /&gt;
&lt;br /&gt;
Graylog will try to find the Elasticsearch nodes automatically, it uses multicast mode for the same. But when it comes to larger network, it is recommended to use unicast mode which is best suited one for production setups. So add the following two entries to graylog server.conf file, replace ipaddress with live hostname or ipaddress. Multiple hosts can be added with comma separated.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_http_enabled = false&lt;br /&gt;
 elasticsearch_discovery_zen_ping_unicast_hosts = ipaddress:9300&lt;br /&gt;
&lt;br /&gt;
Set only one master node by defining the below variable, default setting is true, you must set it as a false to make the particular node as a slave. Master node performs some periodic tasks that slave won’t perform.&lt;br /&gt;
&lt;br /&gt;
 is_master = true&lt;br /&gt;
&lt;br /&gt;
The following variable sets the number of log messages to keep per index, it is recommended to have several smaller indices instead of larger ones.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_docs_per_index = 20000000&lt;br /&gt;
&lt;br /&gt;
The following parameter defines to have total number of indices, if the this number is reached old index will be deleted.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_number_of_indices = 20&lt;br /&gt;
&lt;br /&gt;
Shards setting is really depends on the number of nodes in the Elasticsearch cluster, if you have only one node, set it as 1.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_shards = 1&lt;br /&gt;
&lt;br /&gt;
The number of replicas for your indices, if you have only one node in Elasticsearch cluster; set it as 0.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_replicas = 0&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Restart Graylog service.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 service graylog-server restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of graylog server service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-server defaults&lt;br /&gt;
&lt;br /&gt;
You can check out the server startup logs, it will be useful for you to troubleshoot graylog in case of any issue.&lt;br /&gt;
&lt;br /&gt;
 tailf /var/log/graylog-server/server.log&lt;br /&gt;
&lt;br /&gt;
On successful start of graylog-server, you should get the following message in the log file.&lt;br /&gt;
&lt;br /&gt;
 2015-09-17T09:35:22.895+02:00 INFO  [ServerBootstrap] Graylog server up and running.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Graylog web interface:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To configure graylog-web-interface, you must have at least one graylog-server node. Install Graylog web interface using “apt-get”.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-web&lt;br /&gt;
&lt;br /&gt;
Edit the configuration file and set the following parameters.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/web/web.conf&lt;br /&gt;
&lt;br /&gt;
This is the list of graylog-server nodes, you can add multiple nodes, separate by commas.&lt;br /&gt;
&lt;br /&gt;
 graylog2-server.uris=&amp;quot;http://127.0.0.1:12900/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set the application scret and can be generated using pwgen -N 1 -s 96.&lt;br /&gt;
&lt;br /&gt;
application.secret=&amp;quot;sNXyFf6B4Au3GqSlZwq7En86xp10JimdxxYiLtpptOejX6tIUpUE4DGRJOrcMj07wcK0wugPaapvzEzCYinEWj7BOtHXVl5Z&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set Web interface timezone.&lt;br /&gt;
&lt;br /&gt;
 Timezone=&amp;quot;Europe/Tallinn&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Restart the gralog-web-interface using following command,&lt;br /&gt;
&lt;br /&gt;
 service graylog-web restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of web interface service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-web defaults&lt;br /&gt;
&lt;br /&gt;
== Monitoring Solutions ==&lt;br /&gt;
* Netdata&lt;br /&gt;
&lt;br /&gt;
* Nagios&lt;br /&gt;
=== Netdata Monitoring ===&lt;br /&gt;
[[File:Netdata.gif]]&lt;br /&gt;
&lt;br /&gt;
Linus Distribution: Debian Linux and its derivatives (including Ubuntu, Mint)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install nessesary packages:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install the packages for having a basic netdata installation (system monitoring and many applications, without mysql / mariadb, postgres, named, hardware sensors and SNMP):&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata&lt;br /&gt;
&lt;br /&gt;
Install all the required packages for monitoring everything netdata can monitor:&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata-all&lt;br /&gt;
&lt;br /&gt;
  apt-get install zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Netdata&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Download it - the directory &#039;netdata&#039; will be created&lt;br /&gt;
  git clone https://github.com/firehol/netdata.git --depth=1&lt;br /&gt;
  cd netdata&lt;br /&gt;
&lt;br /&gt;
Build it, install it, start it&lt;br /&gt;
  ./netdata-installer.sh&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;starting netdata at boot&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Copy the netdata startup file to /etc/init.d&lt;br /&gt;
  cp system/netdata-lsb /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Make sure it is executable&lt;br /&gt;
  chmod +x /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Enable it&lt;br /&gt;
  update-rc.d netdata defaults&lt;br /&gt;
&lt;br /&gt;
Access to web interface&lt;br /&gt;
 &lt;br /&gt;
 http://&amp;lt;ipaddress&amp;gt;:19999&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced : https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Nagios Monitoring ===&lt;br /&gt;
&lt;br /&gt;
[[File:Nagios.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Choosing Nagios implementation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Nagios core and Nagios XI. Depending on what version of Linux you are running you might only be able to support Nagios core. On Ubuntu 15 and ahead PHP5 is unavailable which means that Installing Nagios XI is not possible since it depends on PHP5. In this case you have to install Nagios core using PHP7.:&lt;br /&gt;
&lt;br /&gt;
  which php&lt;br /&gt;
&lt;br /&gt;
Or Install PHP (version 5): &lt;br /&gt;
&lt;br /&gt;
  apt-get install php5-common libapache2-mod-php5 php5-cli&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloading the Latest Release&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Make sure to download the Nagios XI installation package to the /tmp directory of the server on which you wish to install it, as shown in&lt;br /&gt;
the following commands:&lt;br /&gt;
&lt;br /&gt;
  cd /tmp&lt;br /&gt;
&lt;br /&gt;
To download the latest stable release, use the following command:&lt;br /&gt;
&lt;br /&gt;
  wget http://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  tar xzf xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  cd /tmp/nagiosxi&lt;br /&gt;
&lt;br /&gt;
  ./fullinstall&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: It will take around 5 minutes to finish the installation.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You are access the Nagios XI interface by pointing your web browser to:&lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;/nagiosxi OR http://&amp;lt;ipaddress&amp;gt;/nagiosql/install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: An empty file named ENABLE_INSTALLER is necessary to create in install/ directory to continue with installation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Troubleshooting&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I got the problem with the given IP after finishing installation, it gave me wrong IP to access. But just ignore it and go to your correct IP of your web server: &lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  without &amp;quot;/nagiosxi&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It will show the installation GUI and you just need to follow and login after all.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Install Plugins ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Locate Your Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Visit this website to download plugins: http://exchange.nagios.org. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 Click the Admin menu --&amp;gt; Manage Plugins &lt;br /&gt;
&lt;br /&gt;
 Click the Browse button --&amp;gt; click the Upload Plugin button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test Your Plugin From The Command Line&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  cd /usr/local/nagios/libexec&lt;br /&gt;
  &lt;br /&gt;
  ./plugin_name arg1 arg2 ...&lt;br /&gt;
&lt;br /&gt;
*See the document of plugin to get more detail of its arguments&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Define A Command&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 browse to Configure → Core&lt;br /&gt;
&lt;br /&gt;
 Configuration Manager → Commands and click Add New.&lt;br /&gt;
&lt;br /&gt;
Enter a Command Name, usually the same as the plugin&lt;br /&gt;
filename. Next in the Command Line field, enter&lt;br /&gt;
$USER1$/plugin_name $ARG1$. The $USER1$ macro is&lt;br /&gt;
replaced with the path to the plugin directory, while the&lt;br /&gt;
$ARG1$ macro is a placeholder for an argument you want to&lt;br /&gt;
specify later on a per-service basis. If you want, you can omit&lt;br /&gt;
$ARG1$ or add more ($ARG2$, $ARG3$, etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Click Save --&amp;gt; Apply Configuration.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Add A Service&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In the left-hand menu&lt;br /&gt;
&lt;br /&gt;
 Click Services --&amp;gt; click Add New.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Config Name&#039;&#039;&#039; field, enter the file name where the&lt;br /&gt;
configuration will be stored. Next enter a description of the&lt;br /&gt;
service in the Description field. Associate the service with a&lt;br /&gt;
host by clicking the Manage Host button.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Check command&#039;&#039;&#039; field, select the command you defined&lt;br /&gt;
above from the dropdown list. If you had any argument&lt;br /&gt;
placeholders when you defined the command earlier, enter&lt;br /&gt;
replacement text in the appropriate argument fields.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Manage Templates&#039;&#039;&#039; button allows you to apply a template&lt;br /&gt;
to this service which will save you from having to fill in all the&lt;br /&gt;
other configuration options, or you can enter the required&lt;br /&gt;
Check and Alert settings manually.&lt;br /&gt;
&lt;br /&gt;
 Save --&amp;gt; Apply Configuration again&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Verify Your Service Is Working&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Navigate to&lt;br /&gt;
&lt;br /&gt;
  Home → Service Detail  &lt;br /&gt;
&lt;br /&gt;
Look for your new service in the list. It will probably take a few minutes before it runs its first check.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Experiences =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In during installation time, we have found some problems which will impact on our your installation as well.&lt;br /&gt;
&lt;br /&gt;
- The version of Ubuntu and Graylog might conflict each other as well as Graylog&#039;s packages ( e.g : java )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I have faced some of certain problem with installing Plugin for Nagios. First of all, you need to check if the plugins you want to use is supported for the OS of the server you are running, for example the plugin is written for Windows Server but you are running Linux server, thus it will give you an error about its format or bunch of error which is difficult to determine exactly its trouble.&lt;br /&gt;
&lt;br /&gt;
Furthermore, once you wish to add the plugin as a service. Please pay attention on the &amp;quot;Service Name&amp;quot; and &amp;quot;Manage Host&amp;quot; which might effect to your installation as well.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
During the installation Graylogs in both versions of Ubuntu ( 14.04 and 16.0 ). We realized that it had many differences between these versions. Listed above our objectives what we expect to achieve after installing and using Graylog, along with its useful information and its interaction between Administrator (users) with Graylog.&lt;br /&gt;
&lt;br /&gt;
its advantages:&lt;br /&gt;
 + Free.&lt;br /&gt;
 + Easy to interact with web interface.&lt;br /&gt;
 + Easy to install with the good support from its sources.&lt;br /&gt;
 + Help Administrator (user) to collect information in during logging and monitoring straightforwardly.&lt;br /&gt;
 + Many useful tools ( plugins ) which supports to work on.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The reason I choose Nagios as my monitoring solution is because it is quite fully functions which help people can handle the services on the server for example it points out detail notification of crucial services such as manage users, HTTP, SSH..so forth. I am using a trial version, but it&#039;s seem pretty enough for beginner to &amp;quot;hangout&amp;quot; with Monitoring tool at first.&lt;br /&gt;
&lt;br /&gt;
This is my opinion of its advantages:&lt;br /&gt;
&lt;br /&gt;
 + Easy to install with many ways with official guide from Nagios Supports.&lt;br /&gt;
 + Good trial version to barely use for beginner.&lt;br /&gt;
 + There are some useful extensions, plugins which are free and easy to install.&lt;br /&gt;
 + Easy to handle with web interface.&lt;br /&gt;
 + Does not take many space of hard disk.&lt;br /&gt;
&lt;br /&gt;
Another hand, it also has disadvantages:&lt;br /&gt;
&lt;br /&gt;
 + Too expensive for license version.&lt;br /&gt;
 + Lack of plugins development, some of them is quite old as well.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/how-to-install-graylog2-on-ubuntu-14-04.html&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://docs.graylog.org/en/2.1/&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115855</id>
		<title>Logging - Monitoring C21</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115855"/>
		<updated>2016-12-15T07:40:02Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Nagios Monitoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Logging and Monitoring with Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Course: Logging and Monitoring - Lecturer: Margus Ernits&lt;br /&gt;
&lt;br /&gt;
Group: Cyber Security Engineering (C21)&lt;br /&gt;
&lt;br /&gt;
Team members: Ender Phan, Kustas Kurval, Sheela Gowry Sumathi Raju, Artur Vincent Kerge&lt;br /&gt;
&lt;br /&gt;
Page created on: October 05, 2016&lt;br /&gt;
&lt;br /&gt;
= Abstract =&lt;br /&gt;
&lt;br /&gt;
In order to understand how to set up the Graylog service as well as understand its crucial roles. We decided to choose Graylog as our application for logging and monitoring. Below are our objectives which would be expected to achieve later on:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Graylog on Ubuntu 14.04.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to use Graylog to protect servers.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Upgrading and configuring Graylog at first, and know how to secure Graylog.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Threats and security during logging.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Netdata and Monitoring with Netdata.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Nagios and Monitoring with Nagios.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Trouble shooting and experiences.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Installation Guide =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ubuntu 14.04&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Graylog_simple_setup_v2.png]]&lt;br /&gt;
&lt;br /&gt;
== Logging Solutions ==&lt;br /&gt;
&lt;br /&gt;
Since the Elasticsearch is based on java, we would require to install either openJDK or Oracle JDK. It is recommended to install Oracle JDK, verify the java version by using the following command.&lt;br /&gt;
&lt;br /&gt;
Remove the OpenJDK from the system, if you have it already installed. From now on it is presumed that user has root privileges.&lt;br /&gt;
&lt;br /&gt;
 apt-get remove --purge openjdk*&lt;br /&gt;
Add repository.&lt;br /&gt;
&lt;br /&gt;
 add-apt-repository -y ppa:webupd8team/java&lt;br /&gt;
Run the following command to pull the packages information from the newly added repository.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Issue the following command to install Java jdk 1.8.&lt;br /&gt;
&lt;br /&gt;
 apt-get -y install oracle-java8-installer&lt;br /&gt;
&lt;br /&gt;
 java -version&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
 Java version &amp;quot;1.8.0_60&amp;quot;&lt;br /&gt;
 Java(TM) SE Runtime Environment (build 1.8.0_60-b27)&lt;br /&gt;
 Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)&lt;br /&gt;
&lt;br /&gt;
=== Installing extras ===&lt;br /&gt;
&lt;br /&gt;
=== Elasticsearch ===&lt;br /&gt;
&lt;br /&gt;
Let’s install Elasticsearch, it can be downloaded from the official website.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download and install GPG signing key&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -&lt;br /&gt;
&lt;br /&gt;
Note that the -qO argument is lowercase Quebec followed by capital Oscar.&lt;br /&gt;
&lt;br /&gt;
Save the repository definition to /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
Update repository cache and install Elasticsearch&lt;br /&gt;
&lt;br /&gt;
 apt-get update &amp;amp;&amp;amp; apt-get install elasticsearch&lt;br /&gt;
&lt;br /&gt;
Configure Elasticsearch to start during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d elasticsearch defaults&lt;br /&gt;
The only important thing is to set a cluster name as “graylog2“, that is being used by graylog. Now edit the configuration file of Elasticsearch.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/elasticsearch/elasticsearch.yml&lt;br /&gt;
&lt;br /&gt;
 cluster.name: graylog2&lt;br /&gt;
&lt;br /&gt;
In the same file disable dynamic scripts to avoid remote execution. That can be done by adding the following line:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOLLOWING LINE GOES INTO GRAYLOG CONF!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 script.disable_dynamic: true&lt;br /&gt;
&lt;br /&gt;
Once it is done, we are good to go. Before that, restart the Elasticsearch services to load the modified configuration.&lt;br /&gt;
&lt;br /&gt;
 service elasticsearch restart&lt;br /&gt;
&lt;br /&gt;
Wait at least a minute to let the Elasticsearch get fully restarted, otherwise testing will fail. Elastisearch should be now listen on 9200 for processing HTTP request, we can use CURL to get the response. Ensure that it returns with cluster name as “graylog2”&lt;br /&gt;
&lt;br /&gt;
 curl -X GET http://localhost:9200&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
   &amp;quot;status&amp;quot; : 200,&lt;br /&gt;
   &amp;quot;name&amp;quot; : &amp;quot;Pistol&amp;quot;,&lt;br /&gt;
   &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
   &amp;quot;version&amp;quot; : {&lt;br /&gt;
    &amp;quot;number&amp;quot; : &amp;quot;1.7.1&amp;quot;,&lt;br /&gt;
    &amp;quot;build_hash&amp;quot; : &amp;quot;b88f43fc40b0bcd7f173a1f9ee2e97816de80b19&amp;quot;,&lt;br /&gt;
    &amp;quot;build_timestamp&amp;quot; : &amp;quot;2015-07-29T09:54:16Z&amp;quot;,&lt;br /&gt;
    &amp;quot;build_snapshot&amp;quot; : false,&lt;br /&gt;
    &amp;quot;lucene_version&amp;quot; : &amp;quot;4.10.4&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  &amp;quot;tagline&amp;quot; : &amp;quot;You Know, for Search&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Optional: Use the following command to check the Elasticsearch cluster health, you must get a cluster status as “green” for graylog to work.&lt;br /&gt;
&lt;br /&gt;
 curl -XGET &#039;http://localhost:9200/_cluster/health?pretty=true&#039;&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
  &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;status&amp;quot; : &amp;quot;&#039;&#039;&#039;green&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;timed_out&amp;quot; : false,&lt;br /&gt;
  &amp;quot;number_of_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;number_of_data_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;active_primary_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;active_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;relocating_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;initializing_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;delayed_unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_pending_tasks&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_in_flight_fetch&amp;quot; : 0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== MongoDB ===&lt;br /&gt;
&lt;br /&gt;
MongoDB is available in deb format and same can be downloaded from the official website. Add the following repository information on the system to install MongoDB. Before that we must import public key.&lt;br /&gt;
&lt;br /&gt;
 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10&lt;br /&gt;
Add repository by creating the /etc/apt/sources.list.d/mongodb-org-3.0.list list file using the command.&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse&amp;quot; | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list&lt;br /&gt;
Update repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install MongoDB using the following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install mongodb-org&lt;br /&gt;
Start the MongoDB service and enable it to start automatically during the system start-up.&lt;br /&gt;
&lt;br /&gt;
 service mongod start&lt;br /&gt;
&lt;br /&gt;
 ln -s /usr/bin/mongod /etc/init.d/mongod&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link&lt;br /&gt;
&lt;br /&gt;
 update-rc.d mongod defaults&lt;br /&gt;
&lt;br /&gt;
=== Graylog2 ===&lt;br /&gt;
&lt;br /&gt;
Graylog-server accepts and process the log messages, also spawns the RESTAPI for the requests that comes from graylog-web-interface. Download the latest version of graylog from graylog.org,&lt;br /&gt;
&lt;br /&gt;
Use the following command to install graylog2 repository.&lt;br /&gt;
&lt;br /&gt;
 wget https://packages.graylog2.org/repo/packages/graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
&lt;br /&gt;
 dpkg -i graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
Install https suppport and update the repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get install apt-transport-https&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install Graylog server using following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-server &lt;br /&gt;
Edit the server.conf file.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/server/server.conf&lt;br /&gt;
Configure the following variables in the above file.&lt;br /&gt;
&lt;br /&gt;
Set a secret to secure the user passwords, use the following command to generate a secret, use at least 64 character’s.&lt;br /&gt;
&lt;br /&gt;
 pwgen -N 1 -s 96&lt;br /&gt;
&lt;br /&gt;
 OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
If you get a “pwgen: command not found“, use the following command to install pwgen.&lt;br /&gt;
&lt;br /&gt;
 apt-get install pwgen&lt;br /&gt;
&lt;br /&gt;
Place the secret.&lt;br /&gt;
&lt;br /&gt;
 password_secret = OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
Next is to set a hash password for the root user (not to be confused with system user, root user of graylog is admin). You will use this password for login into the web interface, admin’s password can not be changed using web interface, must edit this variable to set.&lt;br /&gt;
&lt;br /&gt;
Replace “yourpassword” with the choice of your’s.&lt;br /&gt;
&lt;br /&gt;
 echo -n yourpassword | sha256sum&lt;br /&gt;
&lt;br /&gt;
 e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
Place the hash password.&lt;br /&gt;
&lt;br /&gt;
 root_password_sha2 = e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
You can setup email address root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_email = &amp;quot;cyber.web@gmail.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set timezone of root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_timezone = UTC&lt;br /&gt;
&lt;br /&gt;
Graylog will try to find the Elasticsearch nodes automatically, it uses multicast mode for the same. But when it comes to larger network, it is recommended to use unicast mode which is best suited one for production setups. So add the following two entries to graylog server.conf file, replace ipaddress with live hostname or ipaddress. Multiple hosts can be added with comma separated.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_http_enabled = false&lt;br /&gt;
 elasticsearch_discovery_zen_ping_unicast_hosts = ipaddress:9300&lt;br /&gt;
&lt;br /&gt;
Set only one master node by defining the below variable, default setting is true, you must set it as a false to make the particular node as a slave. Master node performs some periodic tasks that slave won’t perform.&lt;br /&gt;
&lt;br /&gt;
 is_master = true&lt;br /&gt;
&lt;br /&gt;
The following variable sets the number of log messages to keep per index, it is recommended to have several smaller indices instead of larger ones.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_docs_per_index = 20000000&lt;br /&gt;
&lt;br /&gt;
The following parameter defines to have total number of indices, if the this number is reached old index will be deleted.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_number_of_indices = 20&lt;br /&gt;
&lt;br /&gt;
Shards setting is really depends on the number of nodes in the Elasticsearch cluster, if you have only one node, set it as 1.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_shards = 1&lt;br /&gt;
&lt;br /&gt;
The number of replicas for your indices, if you have only one node in Elasticsearch cluster; set it as 0.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_replicas = 0&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Restart Graylog service.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 service graylog-server restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of graylog server service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-server defaults&lt;br /&gt;
&lt;br /&gt;
You can check out the server startup logs, it will be useful for you to troubleshoot graylog in case of any issue.&lt;br /&gt;
&lt;br /&gt;
 tailf /var/log/graylog-server/server.log&lt;br /&gt;
&lt;br /&gt;
On successful start of graylog-server, you should get the following message in the log file.&lt;br /&gt;
&lt;br /&gt;
 2015-09-17T09:35:22.895+02:00 INFO  [ServerBootstrap] Graylog server up and running.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Graylog web interface:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To configure graylog-web-interface, you must have at least one graylog-server node. Install Graylog web interface using “apt-get”.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-web&lt;br /&gt;
&lt;br /&gt;
Edit the configuration file and set the following parameters.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/web/web.conf&lt;br /&gt;
&lt;br /&gt;
This is the list of graylog-server nodes, you can add multiple nodes, separate by commas.&lt;br /&gt;
&lt;br /&gt;
 graylog2-server.uris=&amp;quot;http://127.0.0.1:12900/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set the application scret and can be generated using pwgen -N 1 -s 96.&lt;br /&gt;
&lt;br /&gt;
application.secret=&amp;quot;sNXyFf6B4Au3GqSlZwq7En86xp10JimdxxYiLtpptOejX6tIUpUE4DGRJOrcMj07wcK0wugPaapvzEzCYinEWj7BOtHXVl5Z&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set Web interface timezone.&lt;br /&gt;
&lt;br /&gt;
 Timezone=&amp;quot;Europe/Tallinn&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Restart the gralog-web-interface using following command,&lt;br /&gt;
&lt;br /&gt;
 service graylog-web restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of web interface service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-web defaults&lt;br /&gt;
&lt;br /&gt;
== Monitoring Solutions ==&lt;br /&gt;
* Netdata&lt;br /&gt;
&lt;br /&gt;
* Nagios&lt;br /&gt;
=== Netdata Monitoring ===&lt;br /&gt;
[[File:Netdata.gif]]&lt;br /&gt;
&lt;br /&gt;
Linus Distribution: Debian Linux and its derivatives (including Ubuntu, Mint)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install nessesary packages:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install the packages for having a basic netdata installation (system monitoring and many applications, without mysql / mariadb, postgres, named, hardware sensors and SNMP):&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata&lt;br /&gt;
&lt;br /&gt;
Install all the required packages for monitoring everything netdata can monitor:&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata-all&lt;br /&gt;
&lt;br /&gt;
  apt-get install zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Netdata&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Download it - the directory &#039;netdata&#039; will be created&lt;br /&gt;
  git clone https://github.com/firehol/netdata.git --depth=1&lt;br /&gt;
  cd netdata&lt;br /&gt;
&lt;br /&gt;
Build it, install it, start it&lt;br /&gt;
  ./netdata-installer.sh&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;starting netdata at boot&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Copy the netdata startup file to /etc/init.d&lt;br /&gt;
  cp system/netdata-lsb /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Make sure it is executable&lt;br /&gt;
  chmod +x /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Enable it&lt;br /&gt;
  update-rc.d netdata defaults&lt;br /&gt;
&lt;br /&gt;
Access to web interface&lt;br /&gt;
 &lt;br /&gt;
 http://&amp;lt;ipaddress&amp;gt;:19999&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced : https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Nagios Monitoring ===&lt;br /&gt;
&lt;br /&gt;
[[File:Nagios.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Choosing Nagios implementation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Nagios core and Nagios XI. Depending on what version of Linux you are running you might only be able to support Nagios core. On Ubuntu 15 and ahead PHP5 is unavailable which means that Installing Nagios XI is not possible since it depends on PHP5. In this case you have to install Nagios core using PHP7.:&lt;br /&gt;
&lt;br /&gt;
  which php&lt;br /&gt;
&lt;br /&gt;
Or Install PHP (version 5): &lt;br /&gt;
&lt;br /&gt;
  apt-get install php5-common libapache2-mod-php5 php5-cli&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloading the Latest Release&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Make sure to download the Nagios XI installation package to the /tmp directory of the server on which you wish to install it, as shown in&lt;br /&gt;
the following commands:&lt;br /&gt;
&lt;br /&gt;
  cd /tmp&lt;br /&gt;
&lt;br /&gt;
To download the latest stable release, use the following command:&lt;br /&gt;
&lt;br /&gt;
  wget http://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  tar xzf xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  cd /tmp/nagiosxi&lt;br /&gt;
&lt;br /&gt;
  ./fullinstall&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: It will take around 5 minutes to finish the installation.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You are access the Nagios XI interface by pointing your web browser to:&lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;/nagiosxi OR http://&amp;lt;ipaddress&amp;gt;/nagiosql/install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: An empty file named ENABLE_INSTALLER is necessary to create in install/ directory to continue with installation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Troubleshooting&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I got the problem with the given IP after finishing installation, it gave me wrong IP to access. But just ignore it and go to your correct IP of your web server: &lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  without &amp;quot;/nagiosxi&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It will show the installation GUI and you just need to follow and login after all.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Install Plugins ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Locate Your Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Visit this website to download plugins: http://exchange.nagios.org. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 Click the Admin menu --&amp;gt; Manage Plugins &lt;br /&gt;
&lt;br /&gt;
 Click the Browse button --&amp;gt; click the Upload Plugin button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test Your Plugin From The Command Line&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  cd /usr/local/nagios/libexec&lt;br /&gt;
  &lt;br /&gt;
  ./plugin_name arg1 arg2 ...&lt;br /&gt;
&lt;br /&gt;
*See the document of plugin to get more detail of its arguments&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Define A Command&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 browse to Configure → Core&lt;br /&gt;
&lt;br /&gt;
 Configuration Manager → Commands and click Add New.&lt;br /&gt;
&lt;br /&gt;
Enter a Command Name, usually the same as the plugin&lt;br /&gt;
filename. Next in the Command Line field, enter&lt;br /&gt;
$USER1$/plugin_name $ARG1$. The $USER1$ macro is&lt;br /&gt;
replaced with the path to the plugin directory, while the&lt;br /&gt;
$ARG1$ macro is a placeholder for an argument you want to&lt;br /&gt;
specify later on a per-service basis. If you want, you can omit&lt;br /&gt;
$ARG1$ or add more ($ARG2$, $ARG3$, etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Click Save --&amp;gt; Apply Configuration.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Add A Service&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In the left-hand menu&lt;br /&gt;
&lt;br /&gt;
 Click Services --&amp;gt; click Add New.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Config Name&#039;&#039;&#039; field, enter the file name where the&lt;br /&gt;
configuration will be stored. Next enter a description of the&lt;br /&gt;
service in the Description field. Associate the service with a&lt;br /&gt;
host by clicking the Manage Host button.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Check command&#039;&#039;&#039; field, select the command you defined&lt;br /&gt;
above from the dropdown list. If you had any argument&lt;br /&gt;
placeholders when you defined the command earlier, enter&lt;br /&gt;
replacement text in the appropriate argument fields.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Manage Templates&#039;&#039;&#039; button allows you to apply a template&lt;br /&gt;
to this service which will save you from having to fill in all the&lt;br /&gt;
other configuration options, or you can enter the required&lt;br /&gt;
Check and Alert settings manually.&lt;br /&gt;
&lt;br /&gt;
 Save --&amp;gt; Apply Configuration again&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Verify Your Service Is Working&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Navigate to&lt;br /&gt;
&lt;br /&gt;
  Home → Service Detail  &lt;br /&gt;
&lt;br /&gt;
Look for your new service in the list. It will probably take a few minutes before it runs its first check.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Experiences =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In during installation time, we have found some problems which will impact on our your installation as well.&lt;br /&gt;
&lt;br /&gt;
- The version of Ubuntu and Graylog might conflict each other as well as Graylog&#039;s packages ( e.g : java )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I have faced some of certain problem with installing Plugin for Nagios. First of all, you need to check if the plugins you want to use is supported for the OS of the server you are running, for example the plugin is written for Windows Server but you are running Linux server, thus it will give you an error about its format or bunch of error which is difficult to determine exactly its trouble.&lt;br /&gt;
&lt;br /&gt;
Furthermore, once you wish to add the plugin as a service. Please pay attention on the &amp;quot;Service Name&amp;quot; and &amp;quot;Manage Host&amp;quot; which might effect to your installation as well.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
During the installation Graylogs in both versions of Ubuntu ( 14.04 and 16.0 ). We realized that it had many differences between these versions. Listed above our objectives what we expect to achieve after installing and using Graylog, along with its useful information and its interaction between Administrator (users) with Graylog.&lt;br /&gt;
&lt;br /&gt;
its advantages:&lt;br /&gt;
 + Free.&lt;br /&gt;
 + Easy to interact with web interface.&lt;br /&gt;
 + Easy to install with the good support from its sources.&lt;br /&gt;
 + Help Administrator (user) to collect information in during logging and monitoring straightforwardly.&lt;br /&gt;
 + Many useful tools ( plugins ) which supports to work on.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The reason I choose Nagios as my monitoring solution is because it is quite fully functions which help people can handle the services on the server for example it points out detail notification of crucial services such as manage users, HTTP, SSH..so forth. I am using a trial version, but it&#039;s seem pretty enough for beginner to &amp;quot;hangout&amp;quot; with Monitoring tool at first.&lt;br /&gt;
&lt;br /&gt;
This is my opinion of its advantages:&lt;br /&gt;
&lt;br /&gt;
 + Easy to install with many ways with official guide from Nagios Supports.&lt;br /&gt;
 + Good trial version to barely use for beginner.&lt;br /&gt;
 + There are some useful extensions, plugins which are free and easy to install.&lt;br /&gt;
 + Easy to handle with web interface.&lt;br /&gt;
 + Does not take many space of hard disk.&lt;br /&gt;
&lt;br /&gt;
Another hand, it also has disadvantages:&lt;br /&gt;
&lt;br /&gt;
 + Too expensive for license version.&lt;br /&gt;
 + Lack of plugins development, some of them is quite old as well.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/how-to-install-graylog2-on-ubuntu-14-04.html&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115854</id>
		<title>Logging - Monitoring C21</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115854"/>
		<updated>2016-12-15T07:39:12Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Nagios Monitoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Logging and Monitoring with Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Course: Logging and Monitoring - Lecturer: Margus Ernits&lt;br /&gt;
&lt;br /&gt;
Group: Cyber Security Engineering (C21)&lt;br /&gt;
&lt;br /&gt;
Team members: Ender Phan, Kustas Kurval, Sheela Gowry Sumathi Raju, Artur Vincent Kerge&lt;br /&gt;
&lt;br /&gt;
Page created on: October 05, 2016&lt;br /&gt;
&lt;br /&gt;
= Abstract =&lt;br /&gt;
&lt;br /&gt;
In order to understand how to set up the Graylog service as well as understand its crucial roles. We decided to choose Graylog as our application for logging and monitoring. Below are our objectives which would be expected to achieve later on:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Graylog on Ubuntu 14.04.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to use Graylog to protect servers.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Upgrading and configuring Graylog at first, and know how to secure Graylog.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Threats and security during logging.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Netdata and Monitoring with Netdata.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Nagios and Monitoring with Nagios.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Trouble shooting and experiences.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Installation Guide =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ubuntu 14.04&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Graylog_simple_setup_v2.png]]&lt;br /&gt;
&lt;br /&gt;
== Logging Solutions ==&lt;br /&gt;
&lt;br /&gt;
Since the Elasticsearch is based on java, we would require to install either openJDK or Oracle JDK. It is recommended to install Oracle JDK, verify the java version by using the following command.&lt;br /&gt;
&lt;br /&gt;
Remove the OpenJDK from the system, if you have it already installed. From now on it is presumed that user has root privileges.&lt;br /&gt;
&lt;br /&gt;
 apt-get remove --purge openjdk*&lt;br /&gt;
Add repository.&lt;br /&gt;
&lt;br /&gt;
 add-apt-repository -y ppa:webupd8team/java&lt;br /&gt;
Run the following command to pull the packages information from the newly added repository.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Issue the following command to install Java jdk 1.8.&lt;br /&gt;
&lt;br /&gt;
 apt-get -y install oracle-java8-installer&lt;br /&gt;
&lt;br /&gt;
 java -version&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
 Java version &amp;quot;1.8.0_60&amp;quot;&lt;br /&gt;
 Java(TM) SE Runtime Environment (build 1.8.0_60-b27)&lt;br /&gt;
 Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)&lt;br /&gt;
&lt;br /&gt;
=== Installing extras ===&lt;br /&gt;
&lt;br /&gt;
=== Elasticsearch ===&lt;br /&gt;
&lt;br /&gt;
Let’s install Elasticsearch, it can be downloaded from the official website.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download and install GPG signing key&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -&lt;br /&gt;
&lt;br /&gt;
Note that the -qO argument is lowercase Quebec followed by capital Oscar.&lt;br /&gt;
&lt;br /&gt;
Save the repository definition to /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
Update repository cache and install Elasticsearch&lt;br /&gt;
&lt;br /&gt;
 apt-get update &amp;amp;&amp;amp; apt-get install elasticsearch&lt;br /&gt;
&lt;br /&gt;
Configure Elasticsearch to start during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d elasticsearch defaults&lt;br /&gt;
The only important thing is to set a cluster name as “graylog2“, that is being used by graylog. Now edit the configuration file of Elasticsearch.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/elasticsearch/elasticsearch.yml&lt;br /&gt;
&lt;br /&gt;
 cluster.name: graylog2&lt;br /&gt;
&lt;br /&gt;
In the same file disable dynamic scripts to avoid remote execution. That can be done by adding the following line:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOLLOWING LINE GOES INTO GRAYLOG CONF!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 script.disable_dynamic: true&lt;br /&gt;
&lt;br /&gt;
Once it is done, we are good to go. Before that, restart the Elasticsearch services to load the modified configuration.&lt;br /&gt;
&lt;br /&gt;
 service elasticsearch restart&lt;br /&gt;
&lt;br /&gt;
Wait at least a minute to let the Elasticsearch get fully restarted, otherwise testing will fail. Elastisearch should be now listen on 9200 for processing HTTP request, we can use CURL to get the response. Ensure that it returns with cluster name as “graylog2”&lt;br /&gt;
&lt;br /&gt;
 curl -X GET http://localhost:9200&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
   &amp;quot;status&amp;quot; : 200,&lt;br /&gt;
   &amp;quot;name&amp;quot; : &amp;quot;Pistol&amp;quot;,&lt;br /&gt;
   &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
   &amp;quot;version&amp;quot; : {&lt;br /&gt;
    &amp;quot;number&amp;quot; : &amp;quot;1.7.1&amp;quot;,&lt;br /&gt;
    &amp;quot;build_hash&amp;quot; : &amp;quot;b88f43fc40b0bcd7f173a1f9ee2e97816de80b19&amp;quot;,&lt;br /&gt;
    &amp;quot;build_timestamp&amp;quot; : &amp;quot;2015-07-29T09:54:16Z&amp;quot;,&lt;br /&gt;
    &amp;quot;build_snapshot&amp;quot; : false,&lt;br /&gt;
    &amp;quot;lucene_version&amp;quot; : &amp;quot;4.10.4&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  &amp;quot;tagline&amp;quot; : &amp;quot;You Know, for Search&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Optional: Use the following command to check the Elasticsearch cluster health, you must get a cluster status as “green” for graylog to work.&lt;br /&gt;
&lt;br /&gt;
 curl -XGET &#039;http://localhost:9200/_cluster/health?pretty=true&#039;&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
  &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;status&amp;quot; : &amp;quot;&#039;&#039;&#039;green&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;timed_out&amp;quot; : false,&lt;br /&gt;
  &amp;quot;number_of_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;number_of_data_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;active_primary_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;active_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;relocating_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;initializing_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;delayed_unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_pending_tasks&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_in_flight_fetch&amp;quot; : 0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== MongoDB ===&lt;br /&gt;
&lt;br /&gt;
MongoDB is available in deb format and same can be downloaded from the official website. Add the following repository information on the system to install MongoDB. Before that we must import public key.&lt;br /&gt;
&lt;br /&gt;
 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10&lt;br /&gt;
Add repository by creating the /etc/apt/sources.list.d/mongodb-org-3.0.list list file using the command.&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse&amp;quot; | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list&lt;br /&gt;
Update repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install MongoDB using the following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install mongodb-org&lt;br /&gt;
Start the MongoDB service and enable it to start automatically during the system start-up.&lt;br /&gt;
&lt;br /&gt;
 service mongod start&lt;br /&gt;
&lt;br /&gt;
 ln -s /usr/bin/mongod /etc/init.d/mongod&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link&lt;br /&gt;
&lt;br /&gt;
 update-rc.d mongod defaults&lt;br /&gt;
&lt;br /&gt;
=== Graylog2 ===&lt;br /&gt;
&lt;br /&gt;
Graylog-server accepts and process the log messages, also spawns the RESTAPI for the requests that comes from graylog-web-interface. Download the latest version of graylog from graylog.org,&lt;br /&gt;
&lt;br /&gt;
Use the following command to install graylog2 repository.&lt;br /&gt;
&lt;br /&gt;
 wget https://packages.graylog2.org/repo/packages/graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
&lt;br /&gt;
 dpkg -i graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
Install https suppport and update the repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get install apt-transport-https&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install Graylog server using following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-server &lt;br /&gt;
Edit the server.conf file.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/server/server.conf&lt;br /&gt;
Configure the following variables in the above file.&lt;br /&gt;
&lt;br /&gt;
Set a secret to secure the user passwords, use the following command to generate a secret, use at least 64 character’s.&lt;br /&gt;
&lt;br /&gt;
 pwgen -N 1 -s 96&lt;br /&gt;
&lt;br /&gt;
 OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
If you get a “pwgen: command not found“, use the following command to install pwgen.&lt;br /&gt;
&lt;br /&gt;
 apt-get install pwgen&lt;br /&gt;
&lt;br /&gt;
Place the secret.&lt;br /&gt;
&lt;br /&gt;
 password_secret = OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
Next is to set a hash password for the root user (not to be confused with system user, root user of graylog is admin). You will use this password for login into the web interface, admin’s password can not be changed using web interface, must edit this variable to set.&lt;br /&gt;
&lt;br /&gt;
Replace “yourpassword” with the choice of your’s.&lt;br /&gt;
&lt;br /&gt;
 echo -n yourpassword | sha256sum&lt;br /&gt;
&lt;br /&gt;
 e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
Place the hash password.&lt;br /&gt;
&lt;br /&gt;
 root_password_sha2 = e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
You can setup email address root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_email = &amp;quot;cyber.web@gmail.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set timezone of root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_timezone = UTC&lt;br /&gt;
&lt;br /&gt;
Graylog will try to find the Elasticsearch nodes automatically, it uses multicast mode for the same. But when it comes to larger network, it is recommended to use unicast mode which is best suited one for production setups. So add the following two entries to graylog server.conf file, replace ipaddress with live hostname or ipaddress. Multiple hosts can be added with comma separated.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_http_enabled = false&lt;br /&gt;
 elasticsearch_discovery_zen_ping_unicast_hosts = ipaddress:9300&lt;br /&gt;
&lt;br /&gt;
Set only one master node by defining the below variable, default setting is true, you must set it as a false to make the particular node as a slave. Master node performs some periodic tasks that slave won’t perform.&lt;br /&gt;
&lt;br /&gt;
 is_master = true&lt;br /&gt;
&lt;br /&gt;
The following variable sets the number of log messages to keep per index, it is recommended to have several smaller indices instead of larger ones.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_docs_per_index = 20000000&lt;br /&gt;
&lt;br /&gt;
The following parameter defines to have total number of indices, if the this number is reached old index will be deleted.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_number_of_indices = 20&lt;br /&gt;
&lt;br /&gt;
Shards setting is really depends on the number of nodes in the Elasticsearch cluster, if you have only one node, set it as 1.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_shards = 1&lt;br /&gt;
&lt;br /&gt;
The number of replicas for your indices, if you have only one node in Elasticsearch cluster; set it as 0.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_replicas = 0&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Restart Graylog service.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 service graylog-server restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of graylog server service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-server defaults&lt;br /&gt;
&lt;br /&gt;
You can check out the server startup logs, it will be useful for you to troubleshoot graylog in case of any issue.&lt;br /&gt;
&lt;br /&gt;
 tailf /var/log/graylog-server/server.log&lt;br /&gt;
&lt;br /&gt;
On successful start of graylog-server, you should get the following message in the log file.&lt;br /&gt;
&lt;br /&gt;
 2015-09-17T09:35:22.895+02:00 INFO  [ServerBootstrap] Graylog server up and running.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Graylog web interface:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To configure graylog-web-interface, you must have at least one graylog-server node. Install Graylog web interface using “apt-get”.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-web&lt;br /&gt;
&lt;br /&gt;
Edit the configuration file and set the following parameters.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/web/web.conf&lt;br /&gt;
&lt;br /&gt;
This is the list of graylog-server nodes, you can add multiple nodes, separate by commas.&lt;br /&gt;
&lt;br /&gt;
 graylog2-server.uris=&amp;quot;http://127.0.0.1:12900/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set the application scret and can be generated using pwgen -N 1 -s 96.&lt;br /&gt;
&lt;br /&gt;
application.secret=&amp;quot;sNXyFf6B4Au3GqSlZwq7En86xp10JimdxxYiLtpptOejX6tIUpUE4DGRJOrcMj07wcK0wugPaapvzEzCYinEWj7BOtHXVl5Z&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set Web interface timezone.&lt;br /&gt;
&lt;br /&gt;
 Timezone=&amp;quot;Europe/Tallinn&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Restart the gralog-web-interface using following command,&lt;br /&gt;
&lt;br /&gt;
 service graylog-web restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of web interface service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-web defaults&lt;br /&gt;
&lt;br /&gt;
== Monitoring Solutions ==&lt;br /&gt;
* Netdata&lt;br /&gt;
&lt;br /&gt;
* Nagios&lt;br /&gt;
=== Netdata Monitoring ===&lt;br /&gt;
[[File:Netdata.gif]]&lt;br /&gt;
&lt;br /&gt;
Linus Distribution: Debian Linux and its derivatives (including Ubuntu, Mint)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install nessesary packages:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install the packages for having a basic netdata installation (system monitoring and many applications, without mysql / mariadb, postgres, named, hardware sensors and SNMP):&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata&lt;br /&gt;
&lt;br /&gt;
Install all the required packages for monitoring everything netdata can monitor:&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata-all&lt;br /&gt;
&lt;br /&gt;
  apt-get install zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Netdata&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Download it - the directory &#039;netdata&#039; will be created&lt;br /&gt;
  git clone https://github.com/firehol/netdata.git --depth=1&lt;br /&gt;
  cd netdata&lt;br /&gt;
&lt;br /&gt;
Build it, install it, start it&lt;br /&gt;
  ./netdata-installer.sh&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;starting netdata at boot&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Copy the netdata startup file to /etc/init.d&lt;br /&gt;
  cp system/netdata-lsb /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Make sure it is executable&lt;br /&gt;
  chmod +x /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Enable it&lt;br /&gt;
  update-rc.d netdata defaults&lt;br /&gt;
&lt;br /&gt;
Access to web interface&lt;br /&gt;
 &lt;br /&gt;
 http://&amp;lt;ipaddress&amp;gt;:19999&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced : https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Nagios Monitoring ===&lt;br /&gt;
&lt;br /&gt;
[[File:Nagios.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Nagios core and Nagios XI. Depending on what version of Linux you are running you might only be able to support Nagios core. On Ubuntu 15 and ahead PHP5 is unavailable which means that Installing Nagios XI is not possible since it depends on PHP5. In this case you have to install Nagios core using PHP7.:&lt;br /&gt;
&lt;br /&gt;
  which php&lt;br /&gt;
&lt;br /&gt;
Or Install PHP (version 5): &lt;br /&gt;
&lt;br /&gt;
  apt-get install php5-common libapache2-mod-php5 php5-cli&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloading the Latest Release&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Make sure to download the Nagios XI installation package to the /tmp directory of the server on which you wish to install it, as shown in&lt;br /&gt;
the following commands:&lt;br /&gt;
&lt;br /&gt;
  cd /tmp&lt;br /&gt;
&lt;br /&gt;
To download the latest stable release, use the following command:&lt;br /&gt;
&lt;br /&gt;
  wget http://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  tar xzf xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  cd /tmp/nagiosxi&lt;br /&gt;
&lt;br /&gt;
  ./fullinstall&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: It will take around 5 minutes to finish the installation.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You are access the Nagios XI interface by pointing your web browser to:&lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;/nagiosxi OR http://&amp;lt;ipaddress&amp;gt;/nagiosql/install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: An empty file named ENABLE_INSTALLER is necessary to create in install/ directory to continue with installation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Troubleshooting&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I got the problem with the given IP after finishing installation, it gave me wrong IP to access. But just ignore it and go to your correct IP of your web server: &lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  without &amp;quot;/nagiosxi&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It will show the installation GUI and you just need to follow and login after all.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Install Plugins ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Locate Your Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Visit this website to download plugins: http://exchange.nagios.org. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 Click the Admin menu --&amp;gt; Manage Plugins &lt;br /&gt;
&lt;br /&gt;
 Click the Browse button --&amp;gt; click the Upload Plugin button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test Your Plugin From The Command Line&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  cd /usr/local/nagios/libexec&lt;br /&gt;
  &lt;br /&gt;
  ./plugin_name arg1 arg2 ...&lt;br /&gt;
&lt;br /&gt;
*See the document of plugin to get more detail of its arguments&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Define A Command&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 browse to Configure → Core&lt;br /&gt;
&lt;br /&gt;
 Configuration Manager → Commands and click Add New.&lt;br /&gt;
&lt;br /&gt;
Enter a Command Name, usually the same as the plugin&lt;br /&gt;
filename. Next in the Command Line field, enter&lt;br /&gt;
$USER1$/plugin_name $ARG1$. The $USER1$ macro is&lt;br /&gt;
replaced with the path to the plugin directory, while the&lt;br /&gt;
$ARG1$ macro is a placeholder for an argument you want to&lt;br /&gt;
specify later on a per-service basis. If you want, you can omit&lt;br /&gt;
$ARG1$ or add more ($ARG2$, $ARG3$, etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Click Save --&amp;gt; Apply Configuration.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Add A Service&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In the left-hand menu&lt;br /&gt;
&lt;br /&gt;
 Click Services --&amp;gt; click Add New.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Config Name&#039;&#039;&#039; field, enter the file name where the&lt;br /&gt;
configuration will be stored. Next enter a description of the&lt;br /&gt;
service in the Description field. Associate the service with a&lt;br /&gt;
host by clicking the Manage Host button.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Check command&#039;&#039;&#039; field, select the command you defined&lt;br /&gt;
above from the dropdown list. If you had any argument&lt;br /&gt;
placeholders when you defined the command earlier, enter&lt;br /&gt;
replacement text in the appropriate argument fields.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Manage Templates&#039;&#039;&#039; button allows you to apply a template&lt;br /&gt;
to this service which will save you from having to fill in all the&lt;br /&gt;
other configuration options, or you can enter the required&lt;br /&gt;
Check and Alert settings manually.&lt;br /&gt;
&lt;br /&gt;
 Save --&amp;gt; Apply Configuration again&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Verify Your Service Is Working&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Navigate to&lt;br /&gt;
&lt;br /&gt;
  Home → Service Detail  &lt;br /&gt;
&lt;br /&gt;
Look for your new service in the list. It will probably take a few minutes before it runs its first check.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Experiences =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In during installation time, we have found some problems which will impact on our your installation as well.&lt;br /&gt;
&lt;br /&gt;
- The version of Ubuntu and Graylog might conflict each other as well as Graylog&#039;s packages ( e.g : java )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I have faced some of certain problem with installing Plugin for Nagios. First of all, you need to check if the plugins you want to use is supported for the OS of the server you are running, for example the plugin is written for Windows Server but you are running Linux server, thus it will give you an error about its format or bunch of error which is difficult to determine exactly its trouble.&lt;br /&gt;
&lt;br /&gt;
Furthermore, once you wish to add the plugin as a service. Please pay attention on the &amp;quot;Service Name&amp;quot; and &amp;quot;Manage Host&amp;quot; which might effect to your installation as well.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
During the installation Graylogs in both versions of Ubuntu ( 14.04 and 16.0 ). We realized that it had many differences between these versions. Listed above our objectives what we expect to achieve after installing and using Graylog, along with its useful information and its interaction between Administrator (users) with Graylog.&lt;br /&gt;
&lt;br /&gt;
its advantages:&lt;br /&gt;
 + Free.&lt;br /&gt;
 + Easy to interact with web interface.&lt;br /&gt;
 + Easy to install with the good support from its sources.&lt;br /&gt;
 + Help Administrator (user) to collect information in during logging and monitoring straightforwardly.&lt;br /&gt;
 + Many useful tools ( plugins ) which supports to work on.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The reason I choose Nagios as my monitoring solution is because it is quite fully functions which help people can handle the services on the server for example it points out detail notification of crucial services such as manage users, HTTP, SSH..so forth. I am using a trial version, but it&#039;s seem pretty enough for beginner to &amp;quot;hangout&amp;quot; with Monitoring tool at first.&lt;br /&gt;
&lt;br /&gt;
This is my opinion of its advantages:&lt;br /&gt;
&lt;br /&gt;
 + Easy to install with many ways with official guide from Nagios Supports.&lt;br /&gt;
 + Good trial version to barely use for beginner.&lt;br /&gt;
 + There are some useful extensions, plugins which are free and easy to install.&lt;br /&gt;
 + Easy to handle with web interface.&lt;br /&gt;
 + Does not take many space of hard disk.&lt;br /&gt;
&lt;br /&gt;
Another hand, it also has disadvantages:&lt;br /&gt;
&lt;br /&gt;
 + Too expensive for license version.&lt;br /&gt;
 + Lack of plugins development, some of them is quite old as well.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/how-to-install-graylog2-on-ubuntu-14-04.html&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115853</id>
		<title>Logging - Monitoring C21</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Logging_-_Monitoring_C21&amp;diff=115853"/>
		<updated>2016-12-15T07:36:21Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Nagios Monitoring */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Logging and Monitoring with Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Course: Logging and Monitoring - Lecturer: Margus Ernits&lt;br /&gt;
&lt;br /&gt;
Group: Cyber Security Engineering (C21)&lt;br /&gt;
&lt;br /&gt;
Team members: Ender Phan, Kustas Kurval, Sheela Gowry Sumathi Raju, Artur Vincent Kerge&lt;br /&gt;
&lt;br /&gt;
Page created on: October 05, 2016&lt;br /&gt;
&lt;br /&gt;
= Abstract =&lt;br /&gt;
&lt;br /&gt;
In order to understand how to set up the Graylog service as well as understand its crucial roles. We decided to choose Graylog as our application for logging and monitoring. Below are our objectives which would be expected to achieve later on:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Graylog on Ubuntu 14.04.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to use Graylog to protect servers.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Upgrading and configuring Graylog at first, and know how to secure Graylog.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Threats and security during logging.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Netdata and Monitoring with Netdata.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;How to install Nagios and Monitoring with Nagios.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Trouble shooting and experiences.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Installation Guide =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ubuntu 14.04&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Graylog_simple_setup_v2.png]]&lt;br /&gt;
&lt;br /&gt;
== Logging Solutions ==&lt;br /&gt;
&lt;br /&gt;
Since the Elasticsearch is based on java, we would require to install either openJDK or Oracle JDK. It is recommended to install Oracle JDK, verify the java version by using the following command.&lt;br /&gt;
&lt;br /&gt;
Remove the OpenJDK from the system, if you have it already installed. From now on it is presumed that user has root privileges.&lt;br /&gt;
&lt;br /&gt;
 apt-get remove --purge openjdk*&lt;br /&gt;
Add repository.&lt;br /&gt;
&lt;br /&gt;
 add-apt-repository -y ppa:webupd8team/java&lt;br /&gt;
Run the following command to pull the packages information from the newly added repository.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Issue the following command to install Java jdk 1.8.&lt;br /&gt;
&lt;br /&gt;
 apt-get -y install oracle-java8-installer&lt;br /&gt;
&lt;br /&gt;
 java -version&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
 Java version &amp;quot;1.8.0_60&amp;quot;&lt;br /&gt;
 Java(TM) SE Runtime Environment (build 1.8.0_60-b27)&lt;br /&gt;
 Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)&lt;br /&gt;
&lt;br /&gt;
=== Installing extras ===&lt;br /&gt;
&lt;br /&gt;
=== Elasticsearch ===&lt;br /&gt;
&lt;br /&gt;
Let’s install Elasticsearch, it can be downloaded from the official website.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Download and install GPG signing key&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
 wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -&lt;br /&gt;
&lt;br /&gt;
Note that the -qO argument is lowercase Quebec followed by capital Oscar.&lt;br /&gt;
&lt;br /&gt;
Save the repository definition to /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://packages.elastic.co/elasticsearch/2.x/debian stable main&amp;quot; | sudo tee -a /etc/apt/sources.list.d/elasticsearch.list&lt;br /&gt;
&lt;br /&gt;
Update repository cache and install Elasticsearch&lt;br /&gt;
&lt;br /&gt;
 apt-get update &amp;amp;&amp;amp; apt-get install elasticsearch&lt;br /&gt;
&lt;br /&gt;
Configure Elasticsearch to start during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d elasticsearch defaults&lt;br /&gt;
The only important thing is to set a cluster name as “graylog2“, that is being used by graylog. Now edit the configuration file of Elasticsearch.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/elasticsearch/elasticsearch.yml&lt;br /&gt;
&lt;br /&gt;
 cluster.name: graylog2&lt;br /&gt;
&lt;br /&gt;
In the same file disable dynamic scripts to avoid remote execution. That can be done by adding the following line:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FOLLOWING LINE GOES INTO GRAYLOG CONF!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 script.disable_dynamic: true&lt;br /&gt;
&lt;br /&gt;
Once it is done, we are good to go. Before that, restart the Elasticsearch services to load the modified configuration.&lt;br /&gt;
&lt;br /&gt;
 service elasticsearch restart&lt;br /&gt;
&lt;br /&gt;
Wait at least a minute to let the Elasticsearch get fully restarted, otherwise testing will fail. Elastisearch should be now listen on 9200 for processing HTTP request, we can use CURL to get the response. Ensure that it returns with cluster name as “graylog2”&lt;br /&gt;
&lt;br /&gt;
 curl -X GET http://localhost:9200&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
   &amp;quot;status&amp;quot; : 200,&lt;br /&gt;
   &amp;quot;name&amp;quot; : &amp;quot;Pistol&amp;quot;,&lt;br /&gt;
   &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
   &amp;quot;version&amp;quot; : {&lt;br /&gt;
    &amp;quot;number&amp;quot; : &amp;quot;1.7.1&amp;quot;,&lt;br /&gt;
    &amp;quot;build_hash&amp;quot; : &amp;quot;b88f43fc40b0bcd7f173a1f9ee2e97816de80b19&amp;quot;,&lt;br /&gt;
    &amp;quot;build_timestamp&amp;quot; : &amp;quot;2015-07-29T09:54:16Z&amp;quot;,&lt;br /&gt;
    &amp;quot;build_snapshot&amp;quot; : false,&lt;br /&gt;
    &amp;quot;lucene_version&amp;quot; : &amp;quot;4.10.4&amp;quot;&lt;br /&gt;
  },&lt;br /&gt;
  &amp;quot;tagline&amp;quot; : &amp;quot;You Know, for Search&amp;quot;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Optional: Use the following command to check the Elasticsearch cluster health, you must get a cluster status as “green” for graylog to work.&lt;br /&gt;
&lt;br /&gt;
 curl -XGET &#039;http://localhost:9200/_cluster/health?pretty=true&#039;&lt;br /&gt;
&lt;br /&gt;
 {&lt;br /&gt;
  &amp;quot;cluster_name&amp;quot; : &amp;quot;&#039;&#039;&#039;graylog2&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;status&amp;quot; : &amp;quot;&#039;&#039;&#039;green&#039;&#039;&#039;&amp;quot;,&lt;br /&gt;
  &amp;quot;timed_out&amp;quot; : false,&lt;br /&gt;
  &amp;quot;number_of_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;number_of_data_nodes&amp;quot; : 1,&lt;br /&gt;
  &amp;quot;active_primary_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;active_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;relocating_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;initializing_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;delayed_unassigned_shards&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_pending_tasks&amp;quot; : 0,&lt;br /&gt;
  &amp;quot;number_of_in_flight_fetch&amp;quot; : 0&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
=== MongoDB ===&lt;br /&gt;
&lt;br /&gt;
MongoDB is available in deb format and same can be downloaded from the official website. Add the following repository information on the system to install MongoDB. Before that we must import public key.&lt;br /&gt;
&lt;br /&gt;
 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10&lt;br /&gt;
Add repository by creating the /etc/apt/sources.list.d/mongodb-org-3.0.list list file using the command.&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse&amp;quot; | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list&lt;br /&gt;
Update repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install MongoDB using the following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install mongodb-org&lt;br /&gt;
Start the MongoDB service and enable it to start automatically during the system start-up.&lt;br /&gt;
&lt;br /&gt;
 service mongod start&lt;br /&gt;
&lt;br /&gt;
 ln -s /usr/bin/mongod /etc/init.d/mongod&lt;br /&gt;
&lt;br /&gt;
Create a symbolic link&lt;br /&gt;
&lt;br /&gt;
 update-rc.d mongod defaults&lt;br /&gt;
&lt;br /&gt;
=== Graylog2 ===&lt;br /&gt;
&lt;br /&gt;
Graylog-server accepts and process the log messages, also spawns the RESTAPI for the requests that comes from graylog-web-interface. Download the latest version of graylog from graylog.org,&lt;br /&gt;
&lt;br /&gt;
Use the following command to install graylog2 repository.&lt;br /&gt;
&lt;br /&gt;
 wget https://packages.graylog2.org/repo/packages/graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
&lt;br /&gt;
 dpkg -i graylog-1.2-repository-ubuntu14.04_latest.deb&lt;br /&gt;
Install https suppport and update the repository cache.&lt;br /&gt;
&lt;br /&gt;
 apt-get install apt-transport-https&lt;br /&gt;
&lt;br /&gt;
 apt-get update&lt;br /&gt;
Install Graylog server using following command.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-server &lt;br /&gt;
Edit the server.conf file.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/server/server.conf&lt;br /&gt;
Configure the following variables in the above file.&lt;br /&gt;
&lt;br /&gt;
Set a secret to secure the user passwords, use the following command to generate a secret, use at least 64 character’s.&lt;br /&gt;
&lt;br /&gt;
 pwgen -N 1 -s 96&lt;br /&gt;
&lt;br /&gt;
 OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
If you get a “pwgen: command not found“, use the following command to install pwgen.&lt;br /&gt;
&lt;br /&gt;
 apt-get install pwgen&lt;br /&gt;
&lt;br /&gt;
Place the secret.&lt;br /&gt;
&lt;br /&gt;
 password_secret = OH9wXpsNZVBA8R5vJQSnkhTB1qDOjCxAh3aE3LvXddtfDlZlKYEyGS24BJAiIxI0sbSTSPovTTnhLkkrUvhSSxodTlzDi5gP&lt;br /&gt;
&lt;br /&gt;
Next is to set a hash password for the root user (not to be confused with system user, root user of graylog is admin). You will use this password for login into the web interface, admin’s password can not be changed using web interface, must edit this variable to set.&lt;br /&gt;
&lt;br /&gt;
Replace “yourpassword” with the choice of your’s.&lt;br /&gt;
&lt;br /&gt;
 echo -n yourpassword | sha256sum&lt;br /&gt;
&lt;br /&gt;
 e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
Place the hash password.&lt;br /&gt;
&lt;br /&gt;
 root_password_sha2 = e3c652f0ba0b4801205814f8b6bc49672c4c74e25b497770bb89b22cdeb4e951&lt;br /&gt;
&lt;br /&gt;
You can setup email address root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_email = &amp;quot;cyber.web@gmail.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set timezone of root (admin) user.&lt;br /&gt;
&lt;br /&gt;
 root_timezone = UTC&lt;br /&gt;
&lt;br /&gt;
Graylog will try to find the Elasticsearch nodes automatically, it uses multicast mode for the same. But when it comes to larger network, it is recommended to use unicast mode which is best suited one for production setups. So add the following two entries to graylog server.conf file, replace ipaddress with live hostname or ipaddress. Multiple hosts can be added with comma separated.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_http_enabled = false&lt;br /&gt;
 elasticsearch_discovery_zen_ping_unicast_hosts = ipaddress:9300&lt;br /&gt;
&lt;br /&gt;
Set only one master node by defining the below variable, default setting is true, you must set it as a false to make the particular node as a slave. Master node performs some periodic tasks that slave won’t perform.&lt;br /&gt;
&lt;br /&gt;
 is_master = true&lt;br /&gt;
&lt;br /&gt;
The following variable sets the number of log messages to keep per index, it is recommended to have several smaller indices instead of larger ones.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_docs_per_index = 20000000&lt;br /&gt;
&lt;br /&gt;
The following parameter defines to have total number of indices, if the this number is reached old index will be deleted.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_max_number_of_indices = 20&lt;br /&gt;
&lt;br /&gt;
Shards setting is really depends on the number of nodes in the Elasticsearch cluster, if you have only one node, set it as 1.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_shards = 1&lt;br /&gt;
&lt;br /&gt;
The number of replicas for your indices, if you have only one node in Elasticsearch cluster; set it as 0.&lt;br /&gt;
&lt;br /&gt;
 elasticsearch_replicas = 0&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Restart Graylog service.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 service graylog-server restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of graylog server service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-server defaults&lt;br /&gt;
&lt;br /&gt;
You can check out the server startup logs, it will be useful for you to troubleshoot graylog in case of any issue.&lt;br /&gt;
&lt;br /&gt;
 tailf /var/log/graylog-server/server.log&lt;br /&gt;
&lt;br /&gt;
On successful start of graylog-server, you should get the following message in the log file.&lt;br /&gt;
&lt;br /&gt;
 2015-09-17T09:35:22.895+02:00 INFO  [ServerBootstrap] Graylog server up and running.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Graylog web interface:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To configure graylog-web-interface, you must have at least one graylog-server node. Install Graylog web interface using “apt-get”.&lt;br /&gt;
&lt;br /&gt;
 apt-get install graylog-web&lt;br /&gt;
&lt;br /&gt;
Edit the configuration file and set the following parameters.&lt;br /&gt;
&lt;br /&gt;
 nano /etc/graylog/web/web.conf&lt;br /&gt;
&lt;br /&gt;
This is the list of graylog-server nodes, you can add multiple nodes, separate by commas.&lt;br /&gt;
&lt;br /&gt;
 graylog2-server.uris=&amp;quot;http://127.0.0.1:12900/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set the application scret and can be generated using pwgen -N 1 -s 96.&lt;br /&gt;
&lt;br /&gt;
application.secret=&amp;quot;sNXyFf6B4Au3GqSlZwq7En86xp10JimdxxYiLtpptOejX6tIUpUE4DGRJOrcMj07wcK0wugPaapvzEzCYinEWj7BOtHXVl5Z&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Set Web interface timezone.&lt;br /&gt;
&lt;br /&gt;
 Timezone=&amp;quot;Europe/Tallinn&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Restart the gralog-web-interface using following command,&lt;br /&gt;
&lt;br /&gt;
 service graylog-web restart&lt;br /&gt;
&lt;br /&gt;
Enable auto start of web interface service during system startup.&lt;br /&gt;
&lt;br /&gt;
 update-rc.d graylog-web defaults&lt;br /&gt;
&lt;br /&gt;
== Monitoring Solutions ==&lt;br /&gt;
* Netdata&lt;br /&gt;
&lt;br /&gt;
* Nagios&lt;br /&gt;
=== Netdata Monitoring ===&lt;br /&gt;
[[File:Netdata.gif]]&lt;br /&gt;
&lt;br /&gt;
Linus Distribution: Debian Linux and its derivatives (including Ubuntu, Mint)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install nessesary packages:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Install the packages for having a basic netdata installation (system monitoring and many applications, without mysql / mariadb, postgres, named, hardware sensors and SNMP):&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata&lt;br /&gt;
&lt;br /&gt;
Install all the required packages for monitoring everything netdata can monitor:&lt;br /&gt;
&lt;br /&gt;
  curl -Ss &#039;https://raw.githubusercontent.com/firehol/netdata-demo-site/master/install-required-packages.sh&#039; &amp;gt;/tmp/kickstart.sh &amp;amp;&amp;amp; bash /tmp/kickstart.sh netdata-all&lt;br /&gt;
&lt;br /&gt;
  apt-get install zlib1g-dev uuid-dev libmnl-dev gcc make git autoconf autoconf-archive autogen automake pkg-config curl&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Netdata&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Download it - the directory &#039;netdata&#039; will be created&lt;br /&gt;
  git clone https://github.com/firehol/netdata.git --depth=1&lt;br /&gt;
  cd netdata&lt;br /&gt;
&lt;br /&gt;
Build it, install it, start it&lt;br /&gt;
  ./netdata-installer.sh&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;starting netdata at boot&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Copy the netdata startup file to /etc/init.d&lt;br /&gt;
  cp system/netdata-lsb /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Make sure it is executable&lt;br /&gt;
  chmod +x /etc/init.d/netdata&lt;br /&gt;
&lt;br /&gt;
Enable it&lt;br /&gt;
  update-rc.d netdata defaults&lt;br /&gt;
&lt;br /&gt;
Access to web interface&lt;br /&gt;
 &lt;br /&gt;
 http://&amp;lt;ipaddress&amp;gt;:19999&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced : https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Nagios Monitoring ===&lt;br /&gt;
[[File:Nagios.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Nagios core and Nagios XI. Depending on what version of Linux you are running you might only be able to support Nagios core. On Ubuntu 15 and ahead PHP5 is unavailable which means that Installing Nagios XI is not possible since it depends on PHP5. In this case you have to install Nagios core using PHP7.:&lt;br /&gt;
&lt;br /&gt;
  which php&lt;br /&gt;
&lt;br /&gt;
Or Install PHP (version 5): &lt;br /&gt;
&lt;br /&gt;
  apt-get install php5-common libapache2-mod-php5 php5-cli&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Downloading the Latest Release&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Make sure to download the Nagios XI installation package to the /tmp directory of the server on which you wish to install it, as shown in&lt;br /&gt;
the following commands:&lt;br /&gt;
&lt;br /&gt;
  cd /tmp&lt;br /&gt;
&lt;br /&gt;
To download the latest stable release, use the following command:&lt;br /&gt;
&lt;br /&gt;
  wget http://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  tar xzf xi-latest.tar.gz&lt;br /&gt;
&lt;br /&gt;
  cd /tmp/nagiosxi&lt;br /&gt;
&lt;br /&gt;
  ./fullinstall&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: It will take around 5 minutes to finish the installation.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You are access the Nagios XI interface by pointing your web browser to:&lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;/nagiosxi OR http://&amp;lt;ipaddress&amp;gt;/nagiosql/install&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: An empty file named ENABLE_INSTALLER is necessary to create in install/ directory to continue with installation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Troubleshooting&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I got the problem with the given IP after finishing installation, it gave me wrong IP to access. But just ignore it and go to your correct IP of your web server: &lt;br /&gt;
&lt;br /&gt;
  http://&amp;lt;ipaddress&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  without &amp;quot;/nagiosxi&amp;quot;&lt;br /&gt;
&lt;br /&gt;
It will show the installation GUI and you just need to follow and login after all.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Install Plugins ====&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Locate Your Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Visit this website to download plugins: http://exchange.nagios.org. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Install Plugin&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 Click the Admin menu --&amp;gt; Manage Plugins &lt;br /&gt;
&lt;br /&gt;
 Click the Browse button --&amp;gt; click the Upload Plugin button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test Your Plugin From The Command Line&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
  cd /usr/local/nagios/libexec&lt;br /&gt;
  &lt;br /&gt;
  ./plugin_name arg1 arg2 ...&lt;br /&gt;
&lt;br /&gt;
*See the document of plugin to get more detail of its arguments&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Define A Command&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 browse to Configure → Core&lt;br /&gt;
&lt;br /&gt;
 Configuration Manager → Commands and click Add New.&lt;br /&gt;
&lt;br /&gt;
Enter a Command Name, usually the same as the plugin&lt;br /&gt;
filename. Next in the Command Line field, enter&lt;br /&gt;
$USER1$/plugin_name $ARG1$. The $USER1$ macro is&lt;br /&gt;
replaced with the path to the plugin directory, while the&lt;br /&gt;
$ARG1$ macro is a placeholder for an argument you want to&lt;br /&gt;
specify later on a per-service basis. If you want, you can omit&lt;br /&gt;
$ARG1$ or add more ($ARG2$, $ARG3$, etc.)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Click Save --&amp;gt; Apply Configuration.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Add A Service&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In the left-hand menu&lt;br /&gt;
&lt;br /&gt;
 Click Services --&amp;gt; click Add New.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Config Name&#039;&#039;&#039; field, enter the file name where the&lt;br /&gt;
configuration will be stored. Next enter a description of the&lt;br /&gt;
service in the Description field. Associate the service with a&lt;br /&gt;
host by clicking the Manage Host button.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Check command&#039;&#039;&#039; field, select the command you defined&lt;br /&gt;
above from the dropdown list. If you had any argument&lt;br /&gt;
placeholders when you defined the command earlier, enter&lt;br /&gt;
replacement text in the appropriate argument fields.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Manage Templates&#039;&#039;&#039; button allows you to apply a template&lt;br /&gt;
to this service which will save you from having to fill in all the&lt;br /&gt;
other configuration options, or you can enter the required&lt;br /&gt;
Check and Alert settings manually.&lt;br /&gt;
&lt;br /&gt;
 Save --&amp;gt; Apply Configuration again&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Verify Your Service Is Working&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Navigate to&lt;br /&gt;
&lt;br /&gt;
  Home → Service Detail  &lt;br /&gt;
&lt;br /&gt;
Look for your new service in the list. It will probably take a few minutes before it runs its first check.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Referenced: https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&lt;br /&gt;
&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Experiences =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In during installation time, we have found some problems which will impact on our your installation as well.&lt;br /&gt;
&lt;br /&gt;
- The version of Ubuntu and Graylog might conflict each other as well as Graylog&#039;s packages ( e.g : java )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I have faced some of certain problem with installing Plugin for Nagios. First of all, you need to check if the plugins you want to use is supported for the OS of the server you are running, for example the plugin is written for Windows Server but you are running Linux server, thus it will give you an error about its format or bunch of error which is difficult to determine exactly its trouble.&lt;br /&gt;
&lt;br /&gt;
Furthermore, once you wish to add the plugin as a service. Please pay attention on the &amp;quot;Service Name&amp;quot; and &amp;quot;Manage Host&amp;quot; which might effect to your installation as well.&lt;br /&gt;
&lt;br /&gt;
= Summary =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Graylog&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
During the installation Graylogs in both versions of Ubuntu ( 14.04 and 16.0 ). We realized that it had many differences between these versions. Listed above our objectives what we expect to achieve after installing and using Graylog, along with its useful information and its interaction between Administrator (users) with Graylog.&lt;br /&gt;
&lt;br /&gt;
its advantages:&lt;br /&gt;
 + Free.&lt;br /&gt;
 + Easy to interact with web interface.&lt;br /&gt;
 + Easy to install with the good support from its sources.&lt;br /&gt;
 + Help Administrator (user) to collect information in during logging and monitoring straightforwardly.&lt;br /&gt;
 + Many useful tools ( plugins ) which supports to work on.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Nagios&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The reason I choose Nagios as my monitoring solution is because it is quite fully functions which help people can handle the services on the server for example it points out detail notification of crucial services such as manage users, HTTP, SSH..so forth. I am using a trial version, but it&#039;s seem pretty enough for beginner to &amp;quot;hangout&amp;quot; with Monitoring tool at first.&lt;br /&gt;
&lt;br /&gt;
This is my opinion of its advantages:&lt;br /&gt;
&lt;br /&gt;
 + Easy to install with many ways with official guide from Nagios Supports.&lt;br /&gt;
 + Good trial version to barely use for beginner.&lt;br /&gt;
 + There are some useful extensions, plugins which are free and easy to install.&lt;br /&gt;
 + Easy to handle with web interface.&lt;br /&gt;
 + Does not take many space of hard disk.&lt;br /&gt;
&lt;br /&gt;
Another hand, it also has disadvantages:&lt;br /&gt;
&lt;br /&gt;
 + Too expensive for license version.&lt;br /&gt;
 + Lack of plugins development, some of them is quite old as well.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;http://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/how-to-install-graylog2-on-ubuntu-14-04.html&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://assets.nagios.com/downloads/nagiosxi/docs/XI_Manual_Installation_Instructions.pdf&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;https://github.com/firehol/netdata/wiki/Installation&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Category:I802_Firewalls_and_VPN_IPSec&amp;diff=105945</id>
		<title>Category:I802 Firewalls and VPN IPSec</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Category:I802_Firewalls_and_VPN_IPSec&amp;diff=105945"/>
		<updated>2016-10-03T10:31:20Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Firewalls and VPN/IPSec=&lt;br /&gt;
&lt;br /&gt;
==General information==&lt;br /&gt;
&lt;br /&gt;
ECTS: 4&lt;br /&gt;
&lt;br /&gt;
Lecturer: Lauri Võsandi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
In this course we will attempt to set up a network similar to a corporate network with multiple offices, eg http://docplayer.it/docs-images/20/596222/images/25-0.png&lt;br /&gt;
&lt;br /&gt;
We will use VPN software to connect subnets to each other and we will use VPN software to connect our personal computers to the intranet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setting up virtual machine hosts==&lt;br /&gt;
&lt;br /&gt;
For this course we have 3 Sun servers, each with 16GB of RAM. In each server we should be able to create 3 or more virtual machines. As host operating system we will install Ubuntu 16.04 server. On disks set up ext4 on mdraid set up in RAID1 configuration.&lt;br /&gt;
&lt;br /&gt;
For virtualization let&#039;s use libvirt and virt-manager on your Ubuntu laptops, for Windows and Mac unfortunately there is no decent UI available instead installing web interface such as [https://github.com/kimchi-project/kimchi Kimchi] is recommended.&lt;br /&gt;
&lt;br /&gt;
To install libvirt on the server:&lt;br /&gt;
&lt;br /&gt;
  apt install libvirt-bin qemu-kvm&lt;br /&gt;
&lt;br /&gt;
Also add the primary user to the libvirt group:&lt;br /&gt;
&lt;br /&gt;
  sudo gpasswd -a $USER libvirt&lt;br /&gt;
&lt;br /&gt;
On your  laptop first set up SSH keys between the laptop and server with ssh-keygen and ssh-copy-id. And then you can install virt-manager with:&lt;br /&gt;
&lt;br /&gt;
  sudo apt install virt-manager&lt;br /&gt;
&lt;br /&gt;
Copy CD ISO files into /var/lib/libvirt/images using scp or FileZilla.&lt;br /&gt;
&lt;br /&gt;
Continue with creating a virtual machine for each service. For Windows 2012 server virtual machines use 2G of RAM and 50G of storage. For Ubuntu 16.04 server installations use 1G of memory and 50G storage. For Ubuntu 16.04 MATE desktop installations use 2G of RAM.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In order to set up virtual switch inside the server use Linux&#039;s built-in bridges, start with installing bridge-utils:&lt;br /&gt;
&lt;br /&gt;
  apt install bridge-utils&lt;br /&gt;
&lt;br /&gt;
Reconfigure your server&#039;s /etc/network/interfaces, replace X with number relevant to your server. Also replace eth0, eth1 and eth2 with the network interfaces available in your machine:&lt;br /&gt;
&lt;br /&gt;
  # The loopback network interface&lt;br /&gt;
  auto lo&lt;br /&gt;
  iface lo inet loopback&lt;br /&gt;
  &lt;br /&gt;
  # Wide area network interface&lt;br /&gt;
  auto br-wan&lt;br /&gt;
  iface br-wan inet dhcp&lt;br /&gt;
    # Until we set up router in a VM we will use DHCP so we can have internet access in 417&lt;br /&gt;
    bridge_ports eth0&lt;br /&gt;
  &lt;br /&gt;
  # Local area network interface&lt;br /&gt;
  auto br-lan&lt;br /&gt;
  iface br-lan inet static&lt;br /&gt;
    address 172.16.X.1&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
    bridge_ports eth1&lt;br /&gt;
  &lt;br /&gt;
  # Management interface&lt;br /&gt;
  auto eth2&lt;br /&gt;
  iface eth2 inet static&lt;br /&gt;
    address 192.168.12.1X&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
When creating virtual machines, configure network as shown in the screenshot below:&lt;br /&gt;
&lt;br /&gt;
[[File:Virt-manager_bridges.png]]&lt;br /&gt;
&lt;br /&gt;
This way your VM-s should be able to access the Internet as the physical machine can&lt;br /&gt;
&lt;br /&gt;
==Setting up router==&lt;br /&gt;
&lt;br /&gt;
On Wednesday 14. September we will configure OpenWrt as a router in a virtual machine.&lt;br /&gt;
Download the OpenWrt image and uncompress it:&lt;br /&gt;
&lt;br /&gt;
  cd /var/lib/libvirt/images/&lt;br /&gt;
  wget https://downloads.openwrt.org/chaos_calmer/15.05-rc3/x86/kvm_guest/openwrt-15.05-rc3-x86-kvm_guest-combined-ext4.img.gz&lt;br /&gt;
  gunzip openwrt-15.05.1-x86-kvm_guest-combined-ext4.img.gz&lt;br /&gt;
&lt;br /&gt;
Add second network interface to your router&#039;s VM.&lt;br /&gt;
Configure first NIC as connected to br-wan and second one connected to br-lan.&lt;br /&gt;
&lt;br /&gt;
After that you should end up with topology similar to this:&lt;br /&gt;
&lt;br /&gt;
[[File:Topology-inside-server.png]]&lt;br /&gt;
&lt;br /&gt;
To clarify: &#039;srv1.office&#039; and &#039;srv2.office&#039; are the Ubuntu 16.04 servers, you should have configured static IP addresses or set a static lease from the router. The &#039;router.office&#039; refers to the OpenWrt router you just set up. The router serves IP addresses using DHCP to &#039;ubuntu-mate.office&#039;  Ubuntu MATE 16.04 workstation and &#039;windows.office&#039; refers to Windows workstation. Your physical server &#039;host.office&#039; can be accessed as well. The &#039;office&#039; throughout the diagram refers to your domain name, use abbrevations such as hq, rnd, devops for that.&lt;br /&gt;
&lt;br /&gt;
==Teams==&lt;br /&gt;
&lt;br /&gt;
===Headquarters===&lt;br /&gt;
&lt;br /&gt;
Gateway: 193.40.194.220&lt;br /&gt;
&lt;br /&gt;
DNS: 193.40.0.12, 193.40.56.245&lt;br /&gt;
&lt;br /&gt;
Public IP address (port no 0 = enp6s4f0): 193.40.194.160/24&lt;br /&gt;
&lt;br /&gt;
Management network IP address (port no 1 = enp6s4f1), accessible from robotics club: 192.168.12.10&lt;br /&gt;
&lt;br /&gt;
Internal IP address of the physical server (port no 2 = enp0s9): 172.16.1.1/24&lt;br /&gt;
&lt;br /&gt;
Team members: Keijo, Anton, Mohanad, Etienne&lt;br /&gt;
&lt;br /&gt;
Services:&lt;br /&gt;
&lt;br /&gt;
* BIND9 as public DNS server, also figure out what domain name we should/can use&lt;br /&gt;
* domain controller, at this point primarily for user accounts (Keijo)&lt;br /&gt;
* nginx web server, for company&#039;s homepage (Anton)&lt;br /&gt;
* SMB/CIFS fileserver, join to domain (Etienne)&lt;br /&gt;
* VPN server for other subnets, presumably OpenVPN (Mohanad Aly)&lt;br /&gt;
&lt;br /&gt;
===Research &amp;amp; development===&lt;br /&gt;
&lt;br /&gt;
Gateway: 193.40.194.220&lt;br /&gt;
&lt;br /&gt;
DNS: 193.40.0.12, 193.40.56.245&lt;br /&gt;
&lt;br /&gt;
Public IP address (port no 0 = enp6s4f0): 193.40.194.161/24&lt;br /&gt;
&lt;br /&gt;
Management network IP address (port no 1 = enp6s4f1), accessible from robotics club: 192.168.12.11&lt;br /&gt;
&lt;br /&gt;
Internal IP address of the physical server (port no 2 = enp0s9): 172.16.2.1/24&lt;br /&gt;
&lt;br /&gt;
Team members: Marvin, Madis, Taavi, Berit, Joosep&lt;br /&gt;
&lt;br /&gt;
Services:&lt;br /&gt;
&lt;br /&gt;
* Hypervisor - Marvin&lt;br /&gt;
* [https://gogs.io/docs Git hosting], for sharing scripts, set up LDAP to authenticate with domain controller (Madis)&lt;br /&gt;
* [https://wiki.itcollege.ee/index.php/Installation_MediaWiki Wiki], for exchanging information,  [https://www.mediawiki.org/wiki/Extension:LDAP_Authentication/Kerberos_Configuration_Examples set up LDAP to authenticate with domain controller and later possibly configure web server to authenticate with Kerberos] (Taavi)&lt;br /&gt;
* Windows XP workstation, join to domain&lt;br /&gt;
* Ubuntu 16.04 MATE workstation, [https://raw.githubusercontent.com/laurivosandi/puppet-butterknife/master/files/etc/butterknife/helpers/join-domain join to domain].&lt;br /&gt;
* [http://lauri.vosandi.com/2016/09/xenial-ltsp-ja-id-kaart.html LTSP server] (Joosep)&lt;br /&gt;
* OpenVPN connection to headquarters, use shared secret at first, later X509 certificates&lt;br /&gt;
* [https://github.com/bpoldoja/pastebin Pastebin], possibly later implement [https://github.com/laurivosandi/certidude/blob/master/certidude/auth.py#L37 Kerberos support] (Berit)&lt;br /&gt;
====Examples====&lt;br /&gt;
Port forwarding example, we have 2 linux virtual machines, one forwarding to host local ip.&lt;br /&gt;
[[File:vpn-portForwarding.png|900px|]]&lt;br /&gt;
&lt;br /&gt;
Network interface example file:&lt;br /&gt;
&lt;br /&gt;
  auto lo&lt;br /&gt;
  iface lo inet loopback&lt;br /&gt;
  &lt;br /&gt;
  # Wide area network interface (port 0)&lt;br /&gt;
  auto br-wan&lt;br /&gt;
  iface br-wan inet manual&lt;br /&gt;
    bridge_ports enp6s4f0&lt;br /&gt;
  &lt;br /&gt;
  # Local area network interface (port 3)&lt;br /&gt;
  auto br-lan&lt;br /&gt;
  iface br-lan inet static&lt;br /&gt;
    address 172.16.2.1&lt;br /&gt;
    gateway 172.16.2.254&lt;br /&gt;
    dns-nameserver 172.16.2.254&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
    bridge_ports enp0s8&lt;br /&gt;
  &lt;br /&gt;
  # Management interface (port 1)&lt;br /&gt;
  auto enp6s4f1&lt;br /&gt;
  iface enp6s4f1 inet static&lt;br /&gt;
    address 192.168.12.11&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
Openwrt interface file working example /etc/config/network:&lt;br /&gt;
&lt;br /&gt;
  config interface &#039;lan&#039;&lt;br /&gt;
        option ifname &#039;eth0&#039;&lt;br /&gt;
        option type &#039;bridge&#039;&lt;br /&gt;
        option proto &#039;static&#039;&lt;br /&gt;
        option netmask &#039;255.255.255.0&#039;&lt;br /&gt;
        option ip6assign &#039;60&#039;&lt;br /&gt;
        option ipaddr &#039;172.16.2.254&#039;&lt;br /&gt;
  &lt;br /&gt;
  config interface &#039;wan&#039;&lt;br /&gt;
        option ifname &#039;eth1&#039;&lt;br /&gt;
        option proto &#039;static&#039;&lt;br /&gt;
        option ipaddr &#039;193.40.194.161&#039;&lt;br /&gt;
        option gateway &#039;193.40.194.220&#039;&lt;br /&gt;
        option netmask &#039;255.255.255.0&#039;&lt;br /&gt;
        option dns &#039;192.40.0.12 193.40.56.245&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To create poor man&#039;s vpn. Install on your computer&lt;br /&gt;
  apt install sshuttle&lt;br /&gt;
&lt;br /&gt;
and connection.&lt;br /&gt;
  sshuttle --dns -HNvr username@server:port&lt;br /&gt;
no you should be able to connect local network computers and services.&lt;br /&gt;
&#039;&#039;&#039;NB! ping is not working with sshuttle&#039;&#039;&#039;&lt;br /&gt;
you can read more here http://teohm.com/blog/using-sshuttle-in-daily-work/&lt;br /&gt;
&lt;br /&gt;
====TODO====&lt;br /&gt;
&lt;br /&gt;
===Devops===&lt;br /&gt;
&lt;br /&gt;
Gateway: 193.40.194.220&lt;br /&gt;
&lt;br /&gt;
DNS: 193.40.0.12, 193.40.56.245&lt;br /&gt;
&lt;br /&gt;
Public IP address (port no 0 = enp6s4f0): 193.40.194.162/24&lt;br /&gt;
&lt;br /&gt;
Management network IP address (port no 1 = enp6s4f1), accessible from robotics club: 192.168.12.12&lt;br /&gt;
&lt;br /&gt;
Internal IP address of the physical server (port no 2 = enp0s9): 172.16.3.1/24&lt;br /&gt;
&lt;br /&gt;
Services:&lt;br /&gt;
&lt;br /&gt;
* Hypervisor - Artur O&lt;br /&gt;
* IRC, for chatting (Meelis Hass)&lt;br /&gt;
* [https://github.com/ether/etherpad-lite Etherpad] for collaborating (Sheela)&lt;br /&gt;
* [https://github.com/laurivosandi/certidude#usecases Certificate management] for roadwarriors, usecase number #1 (Artur O)&lt;br /&gt;
* Monitoring software of your choice to make sure that services are up and running, possibly use LDAP for authentication&lt;br /&gt;
* E-mail for sending notifications from monitoring software at first (Ilja), this needs MX records in DNS&lt;br /&gt;
* Later, in the beginning just monitor public services: OpenVPN connection to headquarters&lt;br /&gt;
&lt;br /&gt;
===Pentest===&lt;br /&gt;
&lt;br /&gt;
Find security issues in the deployed services, attempt to plant backdoors, malware etc.&lt;br /&gt;
&lt;br /&gt;
Team members: Kustas, Ender&lt;br /&gt;
&lt;br /&gt;
==Report template==&lt;br /&gt;
&lt;br /&gt;
Send report as a plaintext e-mail to Lauri, in the title include: Report #number - your name - your team&lt;br /&gt;
&lt;br /&gt;
In the content make sure you specify the timespan you&#039;re talking about (September of 2016, first half of October 2016 etc)&lt;br /&gt;
&lt;br /&gt;
The content, no need for formal speech:&lt;br /&gt;
&lt;br /&gt;
* What have been done so far by the team (eg. server hardware setup, virtual machine setup, service setup)&lt;br /&gt;
* What was your role for this timespan, note that we will shuffle the teams now and then&lt;br /&gt;
* What was your contribution, or in other words what did you do during this timespan&lt;br /&gt;
* What (security) incidents happened - red team found messing around with the servers, passwords changed, backdoor found etc.&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Category:I802_Firewalls_and_VPN_IPSec&amp;diff=105385</id>
		<title>Category:I802 Firewalls and VPN IPSec</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Category:I802_Firewalls_and_VPN_IPSec&amp;diff=105385"/>
		<updated>2016-09-14T07:23:19Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Setting up router */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Firewalls and VPN/IPSec=&lt;br /&gt;
&lt;br /&gt;
==General information==&lt;br /&gt;
&lt;br /&gt;
ECTS: 4&lt;br /&gt;
&lt;br /&gt;
Lecturer: Lauri Võsandi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
In this course we will attempt to set up a network similar to a corporate network with multiple offices, eg http://docplayer.it/docs-images/20/596222/images/25-0.png&lt;br /&gt;
&lt;br /&gt;
We will use VPN software to connect subnets to each other and we will use VPN software to connect our personal computers to the intranet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setting up virtual machine hosts==&lt;br /&gt;
&lt;br /&gt;
For this course we have 3 Sun servers, each with 16GB of RAM. In each server we should be able to create 3 or more virtual machines. As host operating system we will install Ubuntu 16.04 server. On disks set up ext4 on mdraid set up in RAID1 configuration.&lt;br /&gt;
&lt;br /&gt;
For virtualization let&#039;s use libvirt and virt-manager on your Ubuntu laptops, for Windows and Mac unfortunately there is no decent UI available instead installing web interface such as [https://github.com/kimchi-project/kimchi Kimchi] is recommended.&lt;br /&gt;
&lt;br /&gt;
To install libvirt on the server:&lt;br /&gt;
&lt;br /&gt;
  apt install libvirt-bin qemu-kvm&lt;br /&gt;
&lt;br /&gt;
Also add the primary user to the libvirt group:&lt;br /&gt;
&lt;br /&gt;
  sudo gpasswd -a $USER libvirt&lt;br /&gt;
&lt;br /&gt;
On your  laptop first set up SSH keys between the laptop and server with ssh-keygen and ssh-copy-id. And then you can install virt-manager with:&lt;br /&gt;
&lt;br /&gt;
  sudo apt install virt-manager&lt;br /&gt;
&lt;br /&gt;
Copy CD ISO files into /var/lib/libvirt/images using scp or FileZilla.&lt;br /&gt;
&lt;br /&gt;
Continue with creating a virtual machine for each service. For Windows 2012 server virtual machines use 2G of RAM and 50G of storage. For Ubuntu 16.04 server installations use 1G of memory and 50G storage. For Ubuntu 16.04 MATE desktop installations use 2G of RAM.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In order to set up virtual switch inside the server use Linux&#039;s built-in bridges, start with installing bridge-utils:&lt;br /&gt;
&lt;br /&gt;
  apt install bridge-utils&lt;br /&gt;
&lt;br /&gt;
Reconfigure your server&#039;s /etc/network/interfaces, replace X with number relevant to your server. Also replace eth0, eth1 and eth2 with the network interfaces available in your machine:&lt;br /&gt;
&lt;br /&gt;
  # The loopback network interface&lt;br /&gt;
  auto lo&lt;br /&gt;
  iface lo inet loopback&lt;br /&gt;
  &lt;br /&gt;
  # Wide area network interface&lt;br /&gt;
  auto br-wan&lt;br /&gt;
  iface br-wan inet dhcp&lt;br /&gt;
    # Until we set up router in a VM we will use DHCP so we can have internet access in 417&lt;br /&gt;
    bridge_ports eth0&lt;br /&gt;
  &lt;br /&gt;
  # Local area network interface&lt;br /&gt;
  auto br-lan&lt;br /&gt;
  iface br-lan inet static&lt;br /&gt;
    address 172.16.X.1&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
    bridge_ports eth1&lt;br /&gt;
  &lt;br /&gt;
  # Management interface&lt;br /&gt;
  auto eth2&lt;br /&gt;
  iface  eth2 static&lt;br /&gt;
    address 192.168.12.1X&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
When creating virtual machines, configure network as shown in the screenshot below:&lt;br /&gt;
&lt;br /&gt;
[[File:Virt-manager_bridges.png]]&lt;br /&gt;
&lt;br /&gt;
This way your VM-s should be able to access the Internet as the physical machine can&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setting up router==&lt;br /&gt;
&lt;br /&gt;
On Wednesday 14. September we will configure OpenWrt as a router in a virtual machine.&lt;br /&gt;
Download the OpenWrt image and uncompress it:&lt;br /&gt;
&lt;br /&gt;
  cd /var/lib/libvirt/images/&lt;br /&gt;
  wget http://185.94.112.87/openwrt.org/chaos_calmer/15.05.1/x86/kvm_guest/openwrt-15.05.1-x86-kvm_guest-combined-ext4.img.gz&lt;br /&gt;
  gunzip openwrt-15.05.1-x86-kvm_guest-combined-ext4.img.gz&lt;br /&gt;
&lt;br /&gt;
Add second network interface to your router&#039;s VM.&lt;br /&gt;
Configure first NIC as connected to br-wan and second one connected to br-lan.&lt;br /&gt;
&lt;br /&gt;
After that you should end up with topology similar to this:&lt;br /&gt;
&lt;br /&gt;
[[File:Topology-inside-server.png]]&lt;br /&gt;
&lt;br /&gt;
To clarify: &#039;srv1.office&#039; and &#039;srv2.office&#039; are the Ubuntu 16.04 servers, you should have configured static IP addresses or set a static lease from the router. The &#039;router.office&#039; refers to the OpenWrt router you just set up. The router serves IP addresses using DHCP to &#039;ubuntu-mate.office&#039;  Ubuntu MATE 16.04 workstation and &#039;windows.office&#039; refers to Windows workstation. Your physical server &#039;host.office&#039; can be accessed as well. The &#039;office&#039; throughout the diagram refers to your domain name, use abbrevations such as hq, rnd, devops for that.&lt;br /&gt;
&lt;br /&gt;
==Offices==&lt;br /&gt;
&lt;br /&gt;
===Headquarters===&lt;br /&gt;
&lt;br /&gt;
Gateway: 193.40.194.220&lt;br /&gt;
&lt;br /&gt;
DNS: 193.40.0.12, 193.40.56.245&lt;br /&gt;
&lt;br /&gt;
Public IP address (eth0): 193.40.194.160/24&lt;br /&gt;
&lt;br /&gt;
Internal IP address of the physical server (eth1): 172.16.1.1/24&lt;br /&gt;
&lt;br /&gt;
Management network IP address (eth2), accessible from robotics club: 192.168.12.10&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Team members: Keijo, Anton, Mohanad, Etienne&lt;br /&gt;
&lt;br /&gt;
Services:&lt;br /&gt;
&lt;br /&gt;
* BIND9 as public DNS server, also figure out what domain name we should/can use&lt;br /&gt;
* domain controller, at this point primarily for user accounts (Keijo)&lt;br /&gt;
* nginx web server, for company&#039;s homepage (Anton)&lt;br /&gt;
* SMB/CIFS fileserver, join to domain (Etienne)&lt;br /&gt;
* VPN server for other subnets, presumably OpenVPN&lt;br /&gt;
&lt;br /&gt;
===Research &amp;amp; development===&lt;br /&gt;
&lt;br /&gt;
Gateway: 193.40.194.220&lt;br /&gt;
&lt;br /&gt;
DNS: 193.40.0.12, 193.40.56.245&lt;br /&gt;
&lt;br /&gt;
Public IP address (eth0): 193.40.194.161/24&lt;br /&gt;
&lt;br /&gt;
Internal IP address of the physical server (eth1): 172.16.2.1/24&lt;br /&gt;
&lt;br /&gt;
Management network IP address (eth2), accessible from robotics club: 192.168.12.11&lt;br /&gt;
&lt;br /&gt;
Team members: Marvin, Madis, Taavi, Berit, Joosep&lt;br /&gt;
&lt;br /&gt;
Services:&lt;br /&gt;
&lt;br /&gt;
* [https://gogs.io/docs Git hosting], for sharing scripts, set up LDAP to authenticate with domain controller&lt;br /&gt;
* [https://www.mediawiki.org/wiki/MediaWiki Wiki], for exchanging information, [https://www.mediawiki.org/wiki/Extension:LDAP_Authentication/Kerberos_Configuration_Examples set up LDAP to authenticate with domain controller and later possibly configure web server to authenticate with Kerberos]&lt;br /&gt;
* Windows XP workstation, join to domain&lt;br /&gt;
* Ubuntu 16.04 MATE workstation, [https://raw.githubusercontent.com/laurivosandi/puppet-butterknife/master/files/etc/butterknife/helpers/join-domain join to domain].&lt;br /&gt;
* [http://lauri.vosandi.com/2016/09/xenial-ltsp-ja-id-kaart.html LTSP server]&lt;br /&gt;
* OpenVPN connection to headquarters, use shared secret at first, later X509 certificates&lt;br /&gt;
* [https://github.com/bpoldoja/pastebin Pastebin], possibly later implement [https://github.com/laurivosandi/certidude/blob/master/certidude/auth.py#L37 Kerberos support] (Berit)&lt;br /&gt;
&lt;br /&gt;
===Devops===&lt;br /&gt;
&lt;br /&gt;
Gateway: 193.40.194.220&lt;br /&gt;
&lt;br /&gt;
DNS: 193.40.0.12, 193.40.56.245&lt;br /&gt;
&lt;br /&gt;
Public IP address (eth0): 193.40.194.162/24&lt;br /&gt;
&lt;br /&gt;
Internal IP address of the physical server (eth1): 172.16.3.1/24&lt;br /&gt;
&lt;br /&gt;
Management network IP address (eth2), accessible from robotics club: 192.168.12.12&lt;br /&gt;
&lt;br /&gt;
Team members: Arti, Meelis Hass, Artur O, Sheela, Ilja (exchange)&lt;br /&gt;
&lt;br /&gt;
Services:&lt;br /&gt;
&lt;br /&gt;
* IRC, for chatting&lt;br /&gt;
* [https://github.com/laurivosandi/certidude Certificate management] for roadwarriors&lt;br /&gt;
* Monitoring software of your choice to make sure that services are up and running, possibly use LDAP for authentication&lt;br /&gt;
* E-mail for sending notifications from monitoring software at first&lt;br /&gt;
* Later, in the beginning just monitor public services: OpenVPN connection to headquarters&lt;br /&gt;
&lt;br /&gt;
==Pentest==&lt;br /&gt;
&lt;br /&gt;
Find security issues in the deployed services.&lt;br /&gt;
&lt;br /&gt;
Team members: Kustas, Ender, Indrek (?)&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Category:I802_Firewalls_and_VPN_IPSec&amp;diff=105384</id>
		<title>Category:I802 Firewalls and VPN IPSec</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Category:I802_Firewalls_and_VPN_IPSec&amp;diff=105384"/>
		<updated>2016-09-14T02:23:19Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Setting up router */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Firewalls and VPN/IPSec=&lt;br /&gt;
&lt;br /&gt;
==General information==&lt;br /&gt;
&lt;br /&gt;
ECTS: 4&lt;br /&gt;
&lt;br /&gt;
Lecturer: Lauri Võsandi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Scenario==&lt;br /&gt;
&lt;br /&gt;
In this course we will attempt to set up a network similar to a corporate network with multiple offices, eg http://docplayer.it/docs-images/20/596222/images/25-0.png&lt;br /&gt;
&lt;br /&gt;
We will use VPN software to connect subnets to each other and we will use VPN software to connect our personal computers to the intranet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setting up virtual machine hosts==&lt;br /&gt;
&lt;br /&gt;
For this course we have 3 Sun servers, each with 16GB of RAM. In each server we should be able to create 3 or more virtual machines. As host operating system we will install Ubuntu 16.04 server. On disks set up ext4 on mdraid set up in RAID1 configuration.&lt;br /&gt;
&lt;br /&gt;
For virtualization let&#039;s use libvirt and virt-manager on your Ubuntu laptops, for Windows and Mac unfortunately there is no decent UI available instead installing web interface such as [https://github.com/kimchi-project/kimchi Kimchi] is recommended.&lt;br /&gt;
&lt;br /&gt;
To install libvirt on the server:&lt;br /&gt;
&lt;br /&gt;
  apt install libvirt-bin qemu-kvm&lt;br /&gt;
&lt;br /&gt;
Also add the primary user to the libvirt group:&lt;br /&gt;
&lt;br /&gt;
  sudo gpasswd -a $USER libvirt&lt;br /&gt;
&lt;br /&gt;
On your  laptop first set up SSH keys between the laptop and server with ssh-keygen and ssh-copy-id. And then you can install virt-manager with:&lt;br /&gt;
&lt;br /&gt;
  sudo apt install virt-manager&lt;br /&gt;
&lt;br /&gt;
Copy CD ISO files into /var/lib/libvirt/images using scp or FileZilla.&lt;br /&gt;
&lt;br /&gt;
Continue with creating a virtual machine for each service. For Windows 2012 server virtual machines use 2G of RAM and 50G of storage. For Ubuntu 16.04 server installations use 1G of memory and 50G storage. For Ubuntu 16.04 MATE desktop installations use 2G of RAM.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In order to set up virtual switch inside the server use Linux&#039;s built-in bridges, start with installing bridge-utils:&lt;br /&gt;
&lt;br /&gt;
  apt install bridge-utils&lt;br /&gt;
&lt;br /&gt;
Reconfigure your server&#039;s /etc/network/interfaces, replace X with number relevant to your server. Also replace eth0, eth1 and eth2 with the network interfaces available in your machine:&lt;br /&gt;
&lt;br /&gt;
  # The loopback network interface&lt;br /&gt;
  auto lo&lt;br /&gt;
  iface lo inet loopback&lt;br /&gt;
  &lt;br /&gt;
  # Wide area network interface&lt;br /&gt;
  auto br-wan&lt;br /&gt;
  iface br-wan inet dhcp&lt;br /&gt;
    # Until we set up router in a VM we will use DHCP so we can have internet access in 417&lt;br /&gt;
    bridge_ports eth0&lt;br /&gt;
  &lt;br /&gt;
  # Local area network interface&lt;br /&gt;
  auto br-lan&lt;br /&gt;
  iface br-lan inet static&lt;br /&gt;
    address 172.16.X.1&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
    bridge_ports eth1&lt;br /&gt;
  &lt;br /&gt;
  # Management interface&lt;br /&gt;
  auto eth2&lt;br /&gt;
  iface  eth2 static&lt;br /&gt;
    address 192.168.12.1X&lt;br /&gt;
    netmask 255.255.255.0&lt;br /&gt;
&lt;br /&gt;
When creating virtual machines, configure network as shown in the screenshot below:&lt;br /&gt;
&lt;br /&gt;
[[File:Virt-manager_bridges.png]]&lt;br /&gt;
&lt;br /&gt;
This way your VM-s should be able to access the Internet as the physical machine can&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Setting up router==&lt;br /&gt;
&lt;br /&gt;
On Wednesday 14. September we will configure OpenWrt as a router in a virtual machine.&lt;br /&gt;
Download the OpenWrt image and uncompress it:&lt;br /&gt;
&lt;br /&gt;
  cd /var/lib/libvirt/images/&lt;br /&gt;
  wget http://185.94.112.87/openwrt.org/chaos_calmer/15.05.1/x86/kvm_guest/openwrt-15.05.1x86-kvm_guest-combined-ext4.img.gz&lt;br /&gt;
  gunzip openwrt-15.05.1-x86-kvm_guest-combined-ext4.img.gz&lt;br /&gt;
&lt;br /&gt;
Add second network interface to your router&#039;s VM.&lt;br /&gt;
Configure first NIC as connected to br-wan and second one connected to br-lan.&lt;br /&gt;
&lt;br /&gt;
After that you should end up with topology similar to this:&lt;br /&gt;
&lt;br /&gt;
[[File:Topology-inside-server.png]]&lt;br /&gt;
&lt;br /&gt;
To clarify: &#039;srv1.office&#039; and &#039;srv2.office&#039; are the Ubuntu 16.04 servers, you should have configured static IP addresses or set a static lease from the router. The &#039;router.office&#039; refers to the OpenWrt router you just set up. The router serves IP addresses using DHCP to &#039;ubuntu-mate.office&#039;  Ubuntu MATE 16.04 workstation and &#039;windows.office&#039; refers to Windows workstation. Your physical server &#039;host.office&#039; can be accessed as well. The &#039;office&#039; throughout the diagram refers to your domain name, use abbrevations such as hq, rnd, devops for that.&lt;br /&gt;
&lt;br /&gt;
==Offices==&lt;br /&gt;
&lt;br /&gt;
===Headquarters===&lt;br /&gt;
&lt;br /&gt;
Gateway: 193.40.194.220&lt;br /&gt;
&lt;br /&gt;
DNS: 193.40.0.12, 193.40.56.245&lt;br /&gt;
&lt;br /&gt;
Public IP address (eth0): 193.40.194.160/24&lt;br /&gt;
&lt;br /&gt;
Internal IP address of the physical server (eth1): 172.16.1.1/24&lt;br /&gt;
&lt;br /&gt;
Management network IP address (eth2), accessible from robotics club: 192.168.12.10&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Team members: Keijo, Anton, Mohanad, Etienne&lt;br /&gt;
&lt;br /&gt;
Services:&lt;br /&gt;
&lt;br /&gt;
* BIND9 as public DNS server, also figure out what domain name we should/can use&lt;br /&gt;
* domain controller, at this point primarily for user accounts (Keijo)&lt;br /&gt;
* nginx web server, for company&#039;s homepage (Anton)&lt;br /&gt;
* SMB/CIFS fileserver, join to domain (Etienne)&lt;br /&gt;
* VPN server for other subnets, presumably OpenVPN&lt;br /&gt;
&lt;br /&gt;
===Research &amp;amp; development===&lt;br /&gt;
&lt;br /&gt;
Gateway: 193.40.194.220&lt;br /&gt;
&lt;br /&gt;
DNS: 193.40.0.12, 193.40.56.245&lt;br /&gt;
&lt;br /&gt;
Public IP address (eth0): 193.40.194.161/24&lt;br /&gt;
&lt;br /&gt;
Internal IP address of the physical server (eth1): 172.16.2.1/24&lt;br /&gt;
&lt;br /&gt;
Management network IP address (eth2), accessible from robotics club: 192.168.12.11&lt;br /&gt;
&lt;br /&gt;
Team members: Marvin, Madis, Taavi, Berit, Joosep&lt;br /&gt;
&lt;br /&gt;
Services:&lt;br /&gt;
&lt;br /&gt;
* [https://gogs.io/docs Git hosting], for sharing scripts, set up LDAP to authenticate with domain controller&lt;br /&gt;
* [https://www.mediawiki.org/wiki/MediaWiki Wiki], for exchanging information, [https://www.mediawiki.org/wiki/Extension:LDAP_Authentication/Kerberos_Configuration_Examples set up LDAP to authenticate with domain controller and later possibly configure web server to authenticate with Kerberos]&lt;br /&gt;
* Windows XP workstation, join to domain&lt;br /&gt;
* Ubuntu 16.04 MATE workstation, [https://raw.githubusercontent.com/laurivosandi/puppet-butterknife/master/files/etc/butterknife/helpers/join-domain join to domain].&lt;br /&gt;
* [http://lauri.vosandi.com/2016/09/xenial-ltsp-ja-id-kaart.html LTSP server]&lt;br /&gt;
* OpenVPN connection to headquarters, use shared secret at first, later X509 certificates&lt;br /&gt;
* [https://github.com/bpoldoja/pastebin Pastebin], possibly later implement [https://github.com/laurivosandi/certidude/blob/master/certidude/auth.py#L37 Kerberos support] (Berit)&lt;br /&gt;
&lt;br /&gt;
===Devops===&lt;br /&gt;
&lt;br /&gt;
Gateway: 193.40.194.220&lt;br /&gt;
&lt;br /&gt;
DNS: 193.40.0.12, 193.40.56.245&lt;br /&gt;
&lt;br /&gt;
Public IP address (eth0): 193.40.194.162/24&lt;br /&gt;
&lt;br /&gt;
Internal IP address of the physical server (eth1): 172.16.3.1/24&lt;br /&gt;
&lt;br /&gt;
Management network IP address (eth2), accessible from robotics club: 192.168.12.12&lt;br /&gt;
&lt;br /&gt;
Team members: Arti, Meelis Hass, Artur O, Sheela, Ilja (exchange)&lt;br /&gt;
&lt;br /&gt;
Services:&lt;br /&gt;
&lt;br /&gt;
* IRC, for chatting&lt;br /&gt;
* [https://github.com/laurivosandi/certidude Certificate management] for roadwarriors&lt;br /&gt;
* Monitoring software of your choice to make sure that services are up and running, possibly use LDAP for authentication&lt;br /&gt;
* E-mail for sending notifications from monitoring software at first&lt;br /&gt;
* Later, in the beginning just monitor public services: OpenVPN connection to headquarters&lt;br /&gt;
&lt;br /&gt;
==Pentest==&lt;br /&gt;
&lt;br /&gt;
Find security issues in the deployed services.&lt;br /&gt;
&lt;br /&gt;
Team members: Kustas, Ender, Indrek (?)&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Operating_systems&amp;diff=104498</id>
		<title>Operating systems</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Operating_systems&amp;diff=104498"/>
		<updated>2016-06-06T17:59:00Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* List of the topics chosen: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Operating systems subject related info=&lt;br /&gt;
&lt;br /&gt;
Lecturer: &lt;br /&gt;
&lt;br /&gt;
Katrin Loodus (katrin.loodus@itcollege.ee) &lt;br /&gt;
&lt;br /&gt;
Room 516 (5th floor), phone (6285) 834&lt;br /&gt;
&lt;br /&gt;
All subject related infotmation will be put up on Wiki page, due to the possibility to have access to the materials even after the subject has concluded. Materials, such as tests, lectures and links to additional materials, will remain available throughout the subject teaching period. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Aim of this course=&lt;br /&gt;
&lt;br /&gt;
The aim of this course is to introduce the basics of operating systems and IT system life cycle from the viewpoint of the IT system administrator of operating systems. This subject provides hands-on skills needed to complete other field specific subjects in the curriculum.&lt;br /&gt;
&lt;br /&gt;
Lectures give a theoretical background and the labs give hands-on skills on the same topic using Ubuntu Linux Server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This subject is oriented on hands-on practical assignments to compliment the theoretical side of the subject.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Learning outcome 1: &lt;br /&gt;
&lt;br /&gt;
A student who has completed the subject is able to perform the most common administrative tasks (user management, software management, disk usage, process management) in at least one of the most popular operating system on a server.&lt;br /&gt;
&lt;br /&gt;
Learning outcome 2: &lt;br /&gt;
&lt;br /&gt;
A student who has completed the subject understands and is able to explain orally the basic concepts of operating systems and its security aspects.&lt;br /&gt;
&lt;br /&gt;
Learning outcome 3: &lt;br /&gt;
&lt;br /&gt;
The student is able to document an operating system&#039;s service from an IT systems administrator&#039;s viewpoint.&lt;br /&gt;
&lt;br /&gt;
=Deadlines for assignments 2016=&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;03.04.2016&#039;&#039;&#039; - Submission of wiki article&#039;s topic (Sending an e-mail with the chosen topic is mandatory!)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;08.05.2016 23:59&#039;&#039;&#039; - Submission of wiki article and sending an e-mail to the lecturer in order to get it graded&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;10.05.2016&#039;&#039;&#039; - Pre practical test for students, who have done all of their labs&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;23.05.2016&#039;&#039;&#039; - Last option to defend lab work (Lab1 and/or Lab2)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;24.05.2016&#039;&#039;&#039; - Practical test&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;09.06.2016 at 09:00&#039;&#039;&#039; - Both practical and oral exams are in room 319&lt;br /&gt;
&lt;br /&gt;
All dates are inclusive.&lt;br /&gt;
&lt;br /&gt;
=(Occasional) Homework=&lt;br /&gt;
&lt;br /&gt;
==Week 0 &amp;amp; 1==&lt;br /&gt;
&lt;br /&gt;
Get familiar with the Unix command line by trying out this Codeacadamy [https://www.codecademy.com/learn/learn-the-command-line short course].&lt;br /&gt;
&lt;br /&gt;
==Week 11==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;&lt;br /&gt;
This homework is voluntary! &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please test these online courses (especially user management) in https://rangeforce.com environment and send the lecturer feedback you feel you would like to share. It can be about the content, the environment, spelling, storyline etc. &lt;br /&gt;
&lt;br /&gt;
The promo code to get access to the courses is &#039;&#039;&#039;EIK2016&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please send the feedback to my e-mail address: &#039;&#039;&#039;kloodus@itcollege.ee&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
Thank you!&lt;br /&gt;
&lt;br /&gt;
==Reading materials==&lt;br /&gt;
&lt;br /&gt;
[http://www.tecmint.com/10-useful-free-linux-ebooks-for-newbies-and-administrators/ 10 Free Linux Administration e-books]&lt;br /&gt;
&lt;br /&gt;
=Timetable for lectures 2016=&lt;br /&gt;
&lt;br /&gt;
Public chat for any subject related questions that were left unasked during the lecture: https://chatlink.com/#osadmin_ITKolledz&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt;&lt;br /&gt;
Link to lecture and lab captures:&amp;lt;/span&amp;gt; [https://echo360.e-ope.ee/ess/portal/section/d38715c3-2cc6-43ee-bc1c-818df79d0b41 Go to captures]&lt;br /&gt;
&lt;br /&gt;
==Lecture 0==&lt;br /&gt;
February 09th 2016 [http://enos.itcollege.ee/~kloodus/opsys/lecture00%20-%20Introduction%20-%202016.odp Lecture 0 - Introduction to subject (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture00%20-%20Introduction%20-%202016.pdf (PDF) ]&lt;br /&gt;
&lt;br /&gt;
[http://enos.itcollege.ee/~kloodus/opsys/test_answers_spring2016.txt Test answers].&lt;br /&gt;
&lt;br /&gt;
==Lecture 1==&lt;br /&gt;
&lt;br /&gt;
February 12th 2016 [http://enos.itcollege.ee/~kloodus/opsys/lecture01%20-%20OS%20introduction.odp Lecture 1 - Operating systems introduction (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture01%20-%20OS%20introduction.pdf (PDF) ]&lt;br /&gt;
&lt;br /&gt;
* Lecture will be on the February 12th at 8:15 in room 219&lt;br /&gt;
&lt;br /&gt;
* Practice will be on the same day at 10:00 in room 410&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt; Homereading materials:&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/playlist?list=PLmbPuZ0NsyGS8ef6zaHd2qYylzsHxL63x Introduction to operating systems (videos)]&lt;br /&gt;
&lt;br /&gt;
[https://en.wikipedia.org/wiki/Operating_system Operating systems (wikipedia article)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 2==&lt;br /&gt;
&lt;br /&gt;
February 16th 2016 [http://enos.itcollege.ee/~kloodus/opsys/lecture02%20-%20user%20management.odp Lecture 2 - User management (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture02%20-%20user%20management.pdf (PDF) ]&lt;br /&gt;
&lt;br /&gt;
==Lecture 3==&lt;br /&gt;
&lt;br /&gt;
February 23rd 2016 [http://enos.itcollege.ee/~kloodus/opsys/lecture03%20-%20managing%20files%20-%202016.odp Lecture 3 - File permissions (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture03%20-%20managing%20files%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 4==&lt;br /&gt;
March 1st 2016 [http://enos.itcollege.ee/~kloodus/opsys/lecture04%20-%20user%20environment%20and%20processes%20-%202016.odp Lecture 4 - User environment and processes (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture04%20-%20user%20environment%20and%20processes%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 5==&lt;br /&gt;
&lt;br /&gt;
March 8th 2016 Lecture 5 - [http://enos.itcollege.ee/~kloodus/opsys/lecture05%20-%20FHS%20and%20links%20-%202016.odp Filesystem Hierarchy (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture05%20-%20FHS%20and%20links%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 6==&lt;br /&gt;
&lt;br /&gt;
March 15th 2016 [http://enos.itcollege.ee/~kloodus/opsys/lecture06%20-%20Software%20management%20-%202016.odp Lecture 6 - Software management (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture06%20-%20Software%20management%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 7==&lt;br /&gt;
&lt;br /&gt;
March 22nd 2016 - [http://enos.itcollege.ee/~kloodus/opsys/lecture07%20-%20Documentation%20-%202016.odp Lecture 7 - Documentation (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture07%20-%20Documentation%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 8==&lt;br /&gt;
&lt;br /&gt;
April 5th 2016 - [http://enos.itcollege.ee/~kloodus/opsys/lecture08%20-%20Security%20session%20-%202016.odp Lecture 8 - Security session (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture08%20-%20Security%20session%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 9==&lt;br /&gt;
&lt;br /&gt;
April 12th 2016 - No lecture nor labs - Lecturer is away &lt;br /&gt;
&lt;br /&gt;
Substitute lecture and lab time will be announced later&lt;br /&gt;
&lt;br /&gt;
==Lecture 10==&lt;br /&gt;
&lt;br /&gt;
April 19th 2016 - [http://enos.itcollege.ee/~kloodus/opsys/lecture10%20-%20Disks%20and%20Swap%20-%202016.odp Lecture 10 - Disks, partitions and swap area (Open Document)] [http://enos.itcollege.ee/~kloodus/opsys/lecture10%20-%20Disks%20and%20Swap%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 11==&lt;br /&gt;
&lt;br /&gt;
April 26th 2016 - [http://enos.itcollege.ee/~kloodus/opsys/lecture11%20-%20RAID,LVM,SAN,NAS%20-%202016.odp Lecture 11 - RAID; LVM, SAN and NAS technologies (Open Document)] [http://enos.itcollege.ee/~kloodus/opsys/lecture11%20-%20RAID,LVM,SAN,NAS%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 12==&lt;br /&gt;
May 3rd 2016 - [http://enos.itcollege.ee/~kloodus/opsys/lecture12%20-%20DAS,SAN,NAS,CAS-%202016.odp Lecture 12 - DAS, SAN, NAS and CAS (group work) technologies (cont.) (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture12%20-%20DAS,SAN,NAS,CAS-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
[[http://www.slideshare.net/pranayakumar1986/network-storage Additional reading materials]]&lt;br /&gt;
&lt;br /&gt;
==Lecture 13==&lt;br /&gt;
&lt;br /&gt;
May 10th 2016 - [http://enos.itcollege.ee/~kloodus/opsys/lecture13%20-%20Backup%20and%20Recovery%20-%202016.odp Lecture 13 - Backup and recovery (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture13%20-%20Backup%20and%20Recovery%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 14 and Lecture 9==&lt;br /&gt;
&lt;br /&gt;
May &#039;&#039;&#039;17th&#039;&#039;&#039; 2016 - Lecture 14 - Miscellaneous topics (will be held in a computer class 319)&lt;br /&gt;
&lt;br /&gt;
May &#039;&#039;&#039;19th 2016 at 10:00 in room 320&#039;&#039;&#039; - [http://enos.itcollege.ee/~kloodus/opsys/lecture15%20-%20Monitoring%20-%202016.odp Lecture 9 - Monitoring (substitute lecture) (OpenDocument)] [http://enos.itcollege.ee/~kloodus/opsys/lecture15%20-%20Monitoring%20-%202016.pdf (PDF)]&lt;br /&gt;
&lt;br /&gt;
==Lecture 15==&lt;br /&gt;
May 24th 2016 - Lecture 15 - working in IT - merits and demerits &lt;br /&gt;
&lt;br /&gt;
We will not have a lecture in the ordinary sense, instead we&#039;ll have a seminar or discussion on important aspects of working in IT. The ethical, social and personal aspects of it. Terms like &amp;quot;imposter syndrome&amp;quot;, burnout, teamwork and better work environment will be some of the topics covered. Life is not only technical competence, it&#039;s a lot about human interaction as well.&lt;br /&gt;
&lt;br /&gt;
=Lab works=&lt;br /&gt;
&lt;br /&gt;
==Lab 0==&lt;br /&gt;
&lt;br /&gt;
Installing Ubuntu Server 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Introduction to Unix command line&#039;&#039;&#039; (cd, ls, cat, full path, relative path etc)&lt;br /&gt;
&lt;br /&gt;
==Lab 1== &lt;br /&gt;
&lt;br /&gt;
3 points - &#039;&#039;&#039;Managing users&#039;&#039;&#039; (adduser, addgroup, passwd, /etc/passwd, /etc/shadow)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) Create a user noodle&lt;br /&gt;
&lt;br /&gt;
2) Add a new group food and add a the user noodle to a group called food.&lt;br /&gt;
&lt;br /&gt;
3) Divert the user noodle&#039;s password hash via cowsay to a file called cownoodle.txt.&lt;br /&gt;
&lt;br /&gt;
4) Lock the user noodle and be ready to show me the indication of the user being locked. &lt;br /&gt;
&lt;br /&gt;
5) Change the user&#039;s current home directory into /home/unknown so that the files will also be moved to the new location.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5 points - &#039;&#039;&#039;Managing files&#039;&#039;&#039; (mkdir, cp, mv, rm, touch, nano, less, chmod, chown, rwx, 644 etc)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) Create a folder march in root user directory and for every march day a subfolder with a name day1, day2, day3 … day31. (Example: /root/march/day1 or /root/march/day2 etc)&lt;br /&gt;
&lt;br /&gt;
2) Modify the march folder owner so that it will be student and the new group audio.&lt;br /&gt;
&lt;br /&gt;
3) Modify the march folder&#039;s and its subfolders so that the user can do anything, group can do ls in the folder and cd into it and others can&#039;t do anything with it.&lt;br /&gt;
&lt;br /&gt;
4) Create a hard link called network to a file /etc/network/interfaces &lt;br /&gt;
&lt;br /&gt;
5) Copy /var/log directory into march folder so that the timestamp and user info will be preserved.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4 points - &#039;&#039;&#039;Processes and environment variables&#039;&#039;&#039; (kill, using directing input/output/error: |, &amp;lt;, &amp;gt;, &amp;gt;&amp;gt;; env, PATH, HOME etc)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) Divert the list with the student user&#039;s groups via cowsay into a fail studgroup.txt.&lt;br /&gt;
&lt;br /&gt;
2) Create a environment variable called MYHOME that has the value of the system&#039;s HOME environment variable. (Hint: you have tu use variable symbol here!)&lt;br /&gt;
&lt;br /&gt;
3) Send 2 htop&#039;s to the background and be ready to present how you send a kill signal to the first htop by job number and term signal to the second htop by a process number. &lt;br /&gt;
&lt;br /&gt;
4) Create an alias called bye that logs you out of the terminal. Make this alias permanent. &lt;br /&gt;
&lt;br /&gt;
5) Execute a programm called espdiff and diver the standardoutput to a file called okay.txt and the standard error to a file called notokay.txt. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3 points - &#039;&#039;&#039;Managing software&#039;&#039;&#039; (installation, updating, deleting, apt and dpkg utils)&lt;br /&gt;
&lt;br /&gt;
==Lab 2==&lt;br /&gt;
&lt;br /&gt;
7 points - &lt;br /&gt;
&#039;&#039;&#039;Managing disks by creating partitions&#039;&#039;&#039; (fdisk, mkfs, blkid, mount, umount)&lt;br /&gt;
&lt;br /&gt;
5 points - &lt;br /&gt;
&#039;&#039;&#039;Managing swap&#039;&#039;&#039; (mkswap, swapon, swapoff)&lt;br /&gt;
&lt;br /&gt;
=Practical tests=&lt;br /&gt;
&lt;br /&gt;
==2016==&lt;br /&gt;
&lt;br /&gt;
[https://docs.google.com/document/d/1FGZcqmQQDF1l32uPUJ6n8x2Tc4gK8nuxS-C9esgRqaQ/edit?usp=sharing First practical test 10th of May 2016]&lt;br /&gt;
&lt;br /&gt;
=Exams=&lt;br /&gt;
&lt;br /&gt;
==2016==&lt;br /&gt;
[https://docs.google.com/document/d/1gkEDb1g1em9UGhj9n_LIwnhp17gY85U9aPtMfGk56_8/edit# Topics] of the oral exam in Spring 2016&lt;br /&gt;
&lt;br /&gt;
=Wiki article information=&lt;br /&gt;
&lt;br /&gt;
* Choose a topic from personal experience or from topics found on the wiki page&lt;br /&gt;
&lt;br /&gt;
*Send the topic to the lecturer kloodus@itcollege.ee&lt;br /&gt;
&lt;br /&gt;
*Lecturer will confirm the topic&lt;br /&gt;
&lt;br /&gt;
*Write your article in wiki environment &lt;br /&gt;
&lt;br /&gt;
*Inform the lecturer when the article is finished&lt;br /&gt;
&lt;br /&gt;
*Receive feedback with corrections&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt; &lt;br /&gt;
Bare in mind that this is an open environment, so everything you write in your wiki article, will be public :) &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Helpful tips and requirements what is expected of your wiki article: https://docs.google.com/document/d/1TGmcv4CL0csigtzA_1Ti4Ndvvc6AjNchZwJe2Jc7OQc/edit# &lt;br /&gt;
&lt;br /&gt;
===List of the topics chosen:===&lt;br /&gt;
&lt;br /&gt;
[[User:akerge|Artur Kerge]] is doing an article on [[Irssi]].&lt;br /&gt;
&lt;br /&gt;
[[OpenVPN_Access_Server|OpenVPN Access Server]] by  [[User:aovtsinn|Artur Ovtsinnikov]]&lt;br /&gt;
&lt;br /&gt;
[[Securing_database_with_command_line_linux#Aim_of_this_page| Securing database with command line Linux]] by  [[User:malyhass|Mohanad Aly]]&lt;br /&gt;
&lt;br /&gt;
[[SSH_for_beginners|SSH for beginners]] by [[User:ebarrier|Etienne Barrier]]&lt;br /&gt;
&lt;br /&gt;
[https://wiki.itcollege.ee/index.php/Linux_File_Permissions#References| Linux File Permissions] by Sheela Raj&lt;br /&gt;
&lt;br /&gt;
[https://wiki.itcollege.ee/index.php/User_talk:Lphanvan  Attack A Website by Using Local Method ([[Local Attack]])] by Ender Phan&lt;br /&gt;
&lt;br /&gt;
[https://wiki.itcollege.ee/index.php/Cowsay_English Cowsay] by Meelis Hass&lt;br /&gt;
&lt;br /&gt;
[https://wiki.itcollege.ee/index.php/Sguil Sguil] by Kustas Kurval&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104497</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104497"/>
		<updated>2016-06-06T17:56:29Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
                                            |&amp;lt;---------&amp;gt; Sensor #1 &lt;br /&gt;
            Client  ==&amp;gt;  Server &amp;lt;=========&amp;gt; |&amp;lt;---------&amp;gt; Sensor #2&lt;br /&gt;
                                            |&amp;lt;---------&amp;gt; Sensor #3&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
The hardware necessary to run sguil depends entirely upon the amount of network traffic you plan to monitor, how much of it you store and how long you store it.  The public demonstration server at demo.sguil.net gets by with a 133MHz Pentium system, though for production systems you&#039;ll want something beefier.&lt;br /&gt;
&lt;br /&gt;
For the sguil server, try to find something with a lot of memory and a fast disk.   The MySQL database will need a lot of RAM for caching results from its queries, and a fast disk will speed up the access time while doing sequential searches.&lt;br /&gt;
&lt;br /&gt;
You may find it helpful to place the MySQL storage on a separate disk partition, or even a separate disk. It doesn&#039;t matter where you mount this storage area, but for convenience, I&#039;ll assume that that you&#039;re going to mount it on the same directory path you&#039;re using for the sensor data directory (see below), referred to in this document as &#039;&#039;$NSM&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The following table is a useful guideline for a good server hardware configuration.  Feel free to adjust it up or down depending on the size of your installation.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
|+ Recommended Server Hardware&lt;br /&gt;
! CPU !! RAM !! Disk Storage&lt;br /&gt;
|-&lt;br /&gt;
| 3.0GHz || 2GB || 150GB (Consider a RAID5 array for speed &amp;amp; reliability)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software===&lt;br /&gt;
Tools that usually make up Sguil&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Squert_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
=Summary=&lt;br /&gt;
Sguil is a superb software to combine together a very large amount of IDS information while keeping every it sorted and very easily manageable. Additional tools in Security Onion also help to set up custom configuration with all analysis software a few clicks away. This gives a lot of possibility for automation of deep packet analysis. Clean installation and configuration of Sguil with all its dependencies is quite time consuming for a newcomer. But Security Onion can reduce this very to a reasonable time frame.  &lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Sagan_(software) Sagan]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Intrusion_detection_system IDS]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Intrusion_prevention_system IPS]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Metasploit_Project Metasploit Project]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/Nmap NMAP]&lt;br /&gt;
* [https://www.snort.org/ SNORT]&lt;br /&gt;
* [https://www.bro.org/ BRO]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
*[https://security-onion-solutions.github.io/security-onion/ Security Onion homepage]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Sguil Wikipedia Sguil]&lt;br /&gt;
*[https://github.com/Security-Onion-Solutions/security-onion Security Onion Github Wiki]&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104496</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104496"/>
		<updated>2016-06-06T17:52:26Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
                                            |&amp;lt;---------&amp;gt; Sensor #1 &lt;br /&gt;
            Client  ==&amp;gt;  Server &amp;lt;=========&amp;gt; |&amp;lt;---------&amp;gt; Sensor #2&lt;br /&gt;
                                            |&amp;lt;---------&amp;gt; Sensor #3&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
The hardware necessary to run sguil depends entirely upon the amount of network traffic you plan to monitor, how much of it you store and how long you store it.  The public demonstration server at demo.sguil.net gets by with a 133MHz Pentium system, though for production systems you&#039;ll want something beefier.&lt;br /&gt;
&lt;br /&gt;
For the sguil server, try to find something with a lot of memory and a fast disk.   The MySQL database will need a lot of RAM for caching results from its queries, and a fast disk will speed up the access time while doing sequential searches.&lt;br /&gt;
&lt;br /&gt;
You may find it helpful to place the MySQL storage on a separate disk partition, or even a separate disk. It doesn&#039;t matter where you mount this storage area, but for convenience, I&#039;ll assume that that you&#039;re going to mount it on the same directory path you&#039;re using for the sensor data directory (see below), referred to in this document as &#039;&#039;$NSM&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The following table is a useful guideline for a good server hardware configuration.  Feel free to adjust it up or down depending on the size of your installation.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
|+ Recommended Server Hardware&lt;br /&gt;
! CPU !! RAM !! Disk Storage&lt;br /&gt;
|-&lt;br /&gt;
| 3.0GHz || 2GB || 150GB (Consider a RAID5 array for speed &amp;amp; reliability)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software===&lt;br /&gt;
Tools that usually make up Sguil&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Squert_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
=Summary=&lt;br /&gt;
Sguil is a superb software to combine together a very large amount of IDS information while keeping every it sorted and very easily manageable. Additional tools in Security Onion also help to set up custom configuration with all analysis software a few clicks away. This gives a lot of possibility for automation of deep packet analysis. Clean installation and configuration of Sguil with all its dependencies is quite time consuming for a newcomer. But Security Onion can reduce this very to a reasonable time frame.  &lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
*[https://security-onion-solutions.github.io/security-onion/ Security Onion homepage]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Sguil Wikipedia Sguil]&lt;br /&gt;
*[https://github.com/Security-Onion-Solutions/security-onion Security Onion Github Wiki]&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104495</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104495"/>
		<updated>2016-06-06T17:44:20Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
                                            |&amp;lt;---------&amp;gt; Sensor #1 &lt;br /&gt;
            Client  ==&amp;gt;  Server &amp;lt;=========&amp;gt; |&amp;lt;---------&amp;gt; Sensor #2&lt;br /&gt;
                                            |&amp;lt;---------&amp;gt; Sensor #3&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
The hardware necessary to run sguil depends entirely upon the amount of network traffic you plan to monitor, how much of it you store and how long you store it.  The public demonstration server at demo.sguil.net gets by with a 133MHz Pentium system, though for production systems you&#039;ll want something beefier.&lt;br /&gt;
&lt;br /&gt;
For the sguil server, try to find something with a lot of memory and a fast disk.   The MySQL database will need a lot of RAM for caching results from its queries, and a fast disk will speed up the access time while doing sequential searches.&lt;br /&gt;
&lt;br /&gt;
You may find it helpful to place the MySQL storage on a separate disk partition, or even a separate disk. It doesn&#039;t matter where you mount this storage area, but for convenience, I&#039;ll assume that that you&#039;re going to mount it on the same directory path you&#039;re using for the sensor data directory (see below), referred to in this document as &#039;&#039;$NSM&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The following table is a useful guideline for a good server hardware configuration.  Feel free to adjust it up or down depending on the size of your installation.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
|+ Recommended Server Hardware&lt;br /&gt;
! CPU !! RAM !! Disk Storage&lt;br /&gt;
|-&lt;br /&gt;
| 3.0GHz || 2GB || 150GB (Consider a RAID5 array for speed &amp;amp; reliability)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software===&lt;br /&gt;
Tools that usually make up Sguil&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Squert_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
*[https://security-onion-solutions.github.io/security-onion/ Security Onion homepage]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Sguil Wikipedia Sguil]&lt;br /&gt;
*[https://github.com/Security-Onion-Solutions/security-onion Security Onion Github Wiki]&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104494</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104494"/>
		<updated>2016-06-06T17:43:07Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
                                            |&amp;lt;---------&amp;gt; Sensor #1 &lt;br /&gt;
            Client  ==&amp;gt;  Server &amp;lt;=========&amp;gt; |&amp;lt;---------&amp;gt; Sensor #2&lt;br /&gt;
                                            |&amp;lt;---------&amp;gt; Sensor #3&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
The hardware necessary to run sguil depends entirely upon the amount of network traffic you plan to monitor, how much of it you store and how long you store it.  The public demonstration server at demo.sguil.net gets by with a 133MHz Pentium system, though for production systems you&#039;ll want something beefier.&lt;br /&gt;
&lt;br /&gt;
For the sguil server, try to find something with a lot of memory and a fast disk.   The MySQL database will need a lot of RAM for caching results from its queries, and a fast disk will speed up the access time while doing sequential searches.&lt;br /&gt;
&lt;br /&gt;
You may find it helpful to place the MySQL storage on a separate disk partition, or even a separate disk. It doesn&#039;t matter where you mount this storage area, but for convenience, I&#039;ll assume that that you&#039;re going to mount it on the same directory path you&#039;re using for the sensor data directory (see below), referred to in this document as &#039;&#039;$NSM&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The following table is a useful guideline for a good server hardware configuration.  Feel free to adjust it up or down depending on the size of your installation.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
|+ Recommended Server Hardware&lt;br /&gt;
! CPU !! RAM !! Disk Storage&lt;br /&gt;
|-&lt;br /&gt;
| 3.0GHz || 2GB || 150GB (Consider a RAID5 array for speed &amp;amp; reliability)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software===&lt;br /&gt;
Tools that usually make up Sguil&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Squert_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
*[https://security-onion-solutions.github.io/security-onion/ Security Onion homepage]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Sguil Wikipedia Sguil]&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104493</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104493"/>
		<updated>2016-06-06T17:42:08Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
                                            |&amp;lt;---------&amp;gt; Sensor #1 &lt;br /&gt;
            Client  ==&amp;gt;  Server &amp;lt;=========&amp;gt; |&amp;lt;---------&amp;gt; Sensor #2&lt;br /&gt;
                                            |&amp;lt;---------&amp;gt; Sensor #3&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
The hardware necessary to run sguil depends entirely upon the amount of network traffic you plan to monitor, how much of it you store and how long you store it.  The public demonstration server at demo.sguil.net gets by with a 133MHz Pentium system, though for production systems you&#039;ll want something beefier.&lt;br /&gt;
&lt;br /&gt;
For the sguil server, try to find something with a lot of memory and a fast disk.   The MySQL database will need a lot of RAM for caching results from its queries, and a fast disk will speed up the access time while doing sequential searches.&lt;br /&gt;
&lt;br /&gt;
You may find it helpful to place the MySQL storage on a separate disk partition, or even a separate disk. It doesn&#039;t matter where you mount this storage area, but for convenience, I&#039;ll assume that that you&#039;re going to mount it on the same directory path you&#039;re using for the sensor data directory (see below), referred to in this document as &#039;&#039;$NSM&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The following table is a useful guideline for a good server hardware configuration.  Feel free to adjust it up or down depending on the size of your installation.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
|+ Recommended Server Hardware&lt;br /&gt;
! CPU !! RAM !! Disk Storage&lt;br /&gt;
|-&lt;br /&gt;
| 3.0GHz || 2GB || 150GB (Consider a RAID5 array for speed &amp;amp; reliability)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software===&lt;br /&gt;
Tools that usually make up Sguil&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Squert_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
*[https://security-onion-solutions.github.io/security-onion/ Security Onion homepage]&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104492</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104492"/>
		<updated>2016-06-06T17:40:05Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Software architecture */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
                                            |&amp;lt;---------&amp;gt; Sensor #1 &lt;br /&gt;
            Client  ==&amp;gt;  Server &amp;lt;=========&amp;gt; |&amp;lt;---------&amp;gt; Sensor #2&lt;br /&gt;
                                            |&amp;lt;---------&amp;gt; Sensor #3&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
The hardware necessary to run sguil depends entirely upon the amount of network traffic you plan to monitor, how much of it you store and how long you store it.  The public demonstration server at demo.sguil.net gets by with a 133MHz Pentium system, though for production systems you&#039;ll want something beefier.&lt;br /&gt;
&lt;br /&gt;
For the sguil server, try to find something with a lot of memory and a fast disk.   The MySQL database will need a lot of RAM for caching results from its queries, and a fast disk will speed up the access time while doing sequential searches.&lt;br /&gt;
&lt;br /&gt;
You may find it helpful to place the MySQL storage on a separate disk partition, or even a separate disk. It doesn&#039;t matter where you mount this storage area, but for convenience, I&#039;ll assume that that you&#039;re going to mount it on the same directory path you&#039;re using for the sensor data directory (see below), referred to in this document as &#039;&#039;$NSM&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The following table is a useful guideline for a good server hardware configuration.  Feel free to adjust it up or down depending on the size of your installation.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
|+ Recommended Server Hardware&lt;br /&gt;
! CPU !! RAM !! Disk Storage&lt;br /&gt;
|-&lt;br /&gt;
| 3.0GHz || 2GB || 150GB (Consider a RAID5 array for speed &amp;amp; reliability)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software===&lt;br /&gt;
Tools that usually make up Sguil&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Squert_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104491</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104491"/>
		<updated>2016-06-06T17:38:04Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
The hardware necessary to run sguil depends entirely upon the amount of network traffic you plan to monitor, how much of it you store and how long you store it.  The public demonstration server at demo.sguil.net gets by with a 133MHz Pentium system, though for production systems you&#039;ll want something beefier.&lt;br /&gt;
&lt;br /&gt;
For the sguil server, try to find something with a lot of memory and a fast disk.   The MySQL database will need a lot of RAM for caching results from its queries, and a fast disk will speed up the access time while doing sequential searches.&lt;br /&gt;
&lt;br /&gt;
You may find it helpful to place the MySQL storage on a separate disk partition, or even a separate disk. It doesn&#039;t matter where you mount this storage area, but for convenience, I&#039;ll assume that that you&#039;re going to mount it on the same directory path you&#039;re using for the sensor data directory (see below), referred to in this document as &#039;&#039;$NSM&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The following table is a useful guideline for a good server hardware configuration.  Feel free to adjust it up or down depending on the size of your installation.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; align=&amp;quot;center&amp;quot;&lt;br /&gt;
|+ Recommended Server Hardware&lt;br /&gt;
! CPU !! RAM !! Disk Storage&lt;br /&gt;
|-&lt;br /&gt;
| 3.0GHz || 2GB || 150GB (Consider a RAID5 array for speed &amp;amp; reliability)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Software===&lt;br /&gt;
Tools that usually make up Sguil&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Squert_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104490</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104490"/>
		<updated>2016-06-06T17:37:20Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
The hardware necessary to run sguil depends entirely upon the amount of network traffic you plan to monitor, how much of it you store and how long you store it. The public demonstration server at demo.sguil.net gets by with a 133MHz Pentium system, though for production systems you&#039;ll want something beefier.&lt;br /&gt;
&lt;br /&gt;
For the sguil server, try to find something with a lot of memory and a fast disk. The MySQL database will need a lot of RAM for caching results from its queries, and a fast disk will speed up the access time while doing sequential searches.&lt;br /&gt;
&lt;br /&gt;
You may find it helpful to place the MySQL storage on a separate disk partition, or even a separate disk. It doesn&#039;t matter where you mount this storage area, but for convenience, I&#039;ll assume that that you&#039;re going to mount it on the same directory path you&#039;re using for the sensor data directory (see below), referred to in this document as $NSM.&lt;br /&gt;
&lt;br /&gt;
The following table is a useful guideline for a good server hardware configuration. Feel free to adjust it up or down depending on the size of your installation.&lt;br /&gt;
&lt;br /&gt;
===Software===&lt;br /&gt;
Tools that usually make up Sguil&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Squert_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104489</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104489"/>
		<updated>2016-06-06T17:36:35Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
&lt;br /&gt;
===Software===&lt;br /&gt;
Tools that usually make up Sguil&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Squert_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104488</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104488"/>
		<updated>2016-06-06T17:36:23Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Hardware */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
The hardware necessary to run sguil depends entirely upon the amount of network traffic you plan to monitor, how much of it you store and how long you store it. The public demonstration server at demo.sguil.net gets by with a 133MHz Pentium system, though for production systems you&#039;ll want something beefier.&lt;br /&gt;
For the sguil server, try to find something with a lot of memory and a fast disk. The MySQL database will need a lot of RAM for caching results from its queries, and a fast disk will speed up the access time while doing sequential searches.&lt;br /&gt;
You may find it helpful to place the MySQL storage on a separate disk partition, or even a separate disk. It doesn&#039;t matter where you mount this storage area, but for convenience, I&#039;ll assume that that you&#039;re going to mount it on the same directory path you&#039;re using for the sensor data directory (see below), referred to in this document as $NSM.&lt;br /&gt;
The following table is a useful guideline for a good server hardware configuration. Feel free to adjust it up or down depending on the size of your installation.&lt;br /&gt;
Recommended Server Hardware&lt;br /&gt;
CPU	RAM	Disk Storage&lt;br /&gt;
3.0GHz	2GB	150GB (Consider a RAID5 array for speed &amp;amp; reliability)&lt;br /&gt;
Estimating the Size of the Database&lt;br /&gt;
The disk space required to host the database varies depending on how many sensors you have and how busy your network is. Most of the space is taken up by session records. Each session record takes up approximately 170 bytes of disk space, including database overhead like indices. If you have 3 million records per day, that comes to about 486MB/day of space.&lt;br /&gt;
By contrast, an alert consumes around 625 bytes on average, including packet information and other supporting data, but there are usually far fewer alerts than network sessions on a reasonably well-tuned sensor. In fact, the ratio of alerts to sessions is nearly 0, therefore you can safely ignore everything but the session data when sizing your database partition. For a production sensor with a several months of session and alert data, you&#039;ll probably want anywhere from 50GB - 100GB of free disk space devoted to MySQL, depending on your data retention policy.&lt;br /&gt;
Sensor Hardware&lt;br /&gt;
The sensors typically store PCAP files of all network traffic they monitor, so they usually require more disk space than the central database server. A large, fast disk is the most important thing for a sensor; they need to write raw packet data to the disk as fast as it comes off the wire, and there can be quite a lot of it. It would not be out of the question to consider large RAID5 arrays here, at least for the systems at your network perimeter. At the very least, buy a single big disk to use just for the data storage. With 500GB disks available now, storage for the sensors should be no problem. If you&#039;re running multiple sensors on the same machine, you&#039;ll probably want to double the RAM and multiply the storage space by the number of sensors on the system.&lt;br /&gt;
Recommended Sensor Hardware&lt;br /&gt;
CPU	RAM	Disk Storage&lt;br /&gt;
2.0GHz	1GB	300GB or more&lt;br /&gt;
Whatever you choose for storage, you&#039;ll need to mount it somewhere in order for it to be useful. The sguil documentation recommends mounting it as /snort_data, but at least one other well-known installation guide[1]recommends using /nsm instead. You can mount it wherever you like. In this document, we&#039;ll refer to the mountpoint as $NSM.&lt;br /&gt;
If you&#039;re deploying multiple sensors on the same system, be sure to give each of the sensors their own data partition. Each of the sensors has a unique name, and will have a directory named $NSM/$SENSORNAME (e.g., /nsm/sensor1, /nsm/sensor2, etc). Sguil uses this space to store packet capture data (among other things), and when the partition starts to get full, it deletes the oldest packet data for the sensor in order to make room for newer captures. The algorithm it uses assumes that each sensor has it&#039;s own partition, so they each need to be mounted separately, otherwise one sensor will eventually take up all the storage space and others won&#039;t get any.&lt;br /&gt;
Another thing to take into account when preparing the data partitions is how they are mounted. Sguil is constantly writing data to the disk, but it rarely reads it back. Therefore, it makes sense to optimize the filesystem for write performance. This can be accomplished by using the async and noatime mount options, as in the following /etc/fstab entry:&lt;br /&gt;
LABEL=nsm  /nsm  ext3 defaults,async,noatime 1 2&lt;br /&gt;
As for network interfaces, you&#039;ll need one for the system itself to use (the &amp;quot;management interface&amp;quot;) and one or more to sniff network traffic (the &amp;quot;monitoring interfaces&amp;quot;). While the management interface obviously requires an IP address and full network setup, the monitoring interfaces should be configured without addresses or network parameters of any sort. The number and type of monitoring interfaces you need will be dictated by the type of data collection you use and the number of sensors you will install on the system. Switch SPAN ports usually require only a single monitoring NIC, while most taps require two NICs (one for each direction of traffic on the monitored link).&lt;br /&gt;
&lt;br /&gt;
===Software===&lt;br /&gt;
Tools that usually make up Sguil&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Squert_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104487</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104487"/>
		<updated>2016-06-06T17:32:24Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Software */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
Tools that usually make up Sguil&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Squert_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104486</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104486"/>
		<updated>2016-06-06T17:32:05Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Tools that usually make up Sguil */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Squert_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104485</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104485"/>
		<updated>2016-06-06T17:30:17Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Squert_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104484</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104484"/>
		<updated>2016-06-06T17:29:20Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Using Sguil */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Squert_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104483</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104483"/>
		<updated>2016-06-06T17:27:20Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Using Sguil */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:File:Security_Onion_20110116_Squert_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=File:Security_Onion_20110116_Squert_alert_expired.PNG&amp;diff=104482</id>
		<title>File:Security Onion 20110116 Squert alert expired.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=File:Security_Onion_20110116_Squert_alert_expired.PNG&amp;diff=104482"/>
		<updated>2016-06-06T17:26:49Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104481</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104481"/>
		<updated>2016-06-06T17:26:14Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Using Sguil */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_expired.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=File:Security_Onion_20110116_Sguil_alert_expired.PNG&amp;diff=104480</id>
		<title>File:Security Onion 20110116 Sguil alert expired.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=File:Security_Onion_20110116_Sguil_alert_expired.PNG&amp;diff=104480"/>
		<updated>2016-06-06T17:25:34Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104479</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104479"/>
		<updated>2016-06-06T17:25:17Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Using Sguil */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039; Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104478</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104478"/>
		<updated>2016-06-06T17:24:45Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Using Sguil */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;* Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;* Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;* Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;* Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104477</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104477"/>
		<updated>2016-06-06T17:23:44Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Using Sguil */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
* Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104476</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104476"/>
		<updated>2016-06-06T17:23:15Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Using Sguil */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert_(1).PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=File:Security_Onion_20110116_Sguil_alert_(1).PNG&amp;diff=104475</id>
		<title>File:Security Onion 20110116 Sguil alert (1).PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=File:Security_Onion_20110116_Sguil_alert_(1).PNG&amp;diff=104475"/>
		<updated>2016-06-06T17:22:52Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104474</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104474"/>
		<updated>2016-06-06T17:22:15Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Using Sguil */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|frame|none|alt=Alt text|Caption text]]&lt;br /&gt;
&lt;br /&gt;
Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104473</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104473"/>
		<updated>2016-06-06T17:21:08Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Using Sguil */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|900px]]&lt;br /&gt;
&lt;br /&gt;
Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104472</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104472"/>
		<updated>2016-06-06T17:20:57Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Using Sguil */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|1000px]]&lt;br /&gt;
&lt;br /&gt;
Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104471</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104471"/>
		<updated>2016-06-06T17:20:49Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Using Sguil */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|1300px]]&lt;br /&gt;
&lt;br /&gt;
Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104470</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104470"/>
		<updated>2016-06-06T17:20:40Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Using Sguil */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&lt;br /&gt;
&lt;br /&gt;
[[File:Security_Onion_20110116_Sguil_alert.PNG|1600px]]&lt;br /&gt;
&lt;br /&gt;
Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=File:Security_Onion_20110116_Sguil_alert.PNG&amp;diff=104469</id>
		<title>File:Security Onion 20110116 Sguil alert.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=File:Security_Onion_20110116_Sguil_alert.PNG&amp;diff=104469"/>
		<updated>2016-06-06T17:20:26Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104468</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104468"/>
		<updated>2016-06-06T17:18:53Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Using Sguil */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104467</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104467"/>
		<updated>2016-06-06T17:16:52Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
5. Double-click the Sguil desktop icon.  Log into Sguil using the username/password you specified in the previous step.  There may already be some alerts in the Sguil console.  If not, open Firefox and click the testmyids.com bookmark and you should then see an alert appear in Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
6. Double-click the Squert desktop icon.  The Squert main page appears.  Click the &amp;quot;submit&amp;quot; button.  Snort alerts appear at the bottom of the page and they should match what you saw in Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
7. Go back to Sguil, select an alert, and press the F8 key to expire it.  Notice that the alert disappears from Sguil.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8. Go back to Squert and click the &amp;quot;submit&amp;quot; button again.  Notice that the alert remains in Squert.  Sguil&#039;s main console shows events that have not yet been classified, so we need to tell Squert to do the same.  Click the &amp;quot;Status&amp;quot; drop-down box and select &amp;quot;Unclassified&amp;quot;.  Click the &amp;quot;submit&amp;quot; button and notice that the alert is now gone. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this post, we&#039;ve covered the following:&lt;br /&gt;
Logging into Sguil and Squert&lt;br /&gt;
generating an IDS alert&lt;br /&gt;
expiring an IDS alert&lt;br /&gt;
Configuring Squert to show Unclassified events to match the main Sguil window&lt;br /&gt;
Stay tuned for future posts in this series!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104466</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104466"/>
		<updated>2016-06-06T17:16:07Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
==Software architecture==&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
==Tools that usually make up Sguil==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
=Contents=&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
==Dependencies==&lt;br /&gt;
===Hardware===&lt;br /&gt;
===Software===&lt;br /&gt;
==Setup==&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
==Post Installation==&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
====Tuning / Miscellaneous====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Summary=&lt;br /&gt;
=See also=&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
=References=&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104465</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104465"/>
		<updated>2016-06-06T17:11:42Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Can sguil page me when it sees a particular alert? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
===Software architecture===&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
===Tools that usually make up Sguil===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==Contents==&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
===Dependencies===&lt;br /&gt;
====Hardware====&lt;br /&gt;
====Software====&lt;br /&gt;
===Setup===&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
===Post Installation===&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
=====Tuning / Miscellaneous=====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
==See also==&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
==References==&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104464</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104464"/>
		<updated>2016-06-06T17:11:06Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
===Software architecture===&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
===Tools that usually make up Sguil===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==Contents==&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
===Dependencies===&lt;br /&gt;
====Hardware====&lt;br /&gt;
====Software====&lt;br /&gt;
===Setup===&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
===Post Installation===&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
=====Tuning / Miscellaneous=====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
==Using Sguil==&lt;br /&gt;
===How do I set up sguil to automatically categorize incoming alerts?===&lt;br /&gt;
This is called &amp;quot;automatic categorization&amp;quot;, or just &amp;quot;autocat&amp;quot; for short.  Take a look at &#039;&#039;/etc/sguild/autocat.conf&#039;&#039;, which contains full instructions.  Once you edit this file, you&#039;ll need to restart sguild in order for the changes to take effect.&lt;br /&gt;
&lt;br /&gt;
NOTE:  Be sure you are running sguild with the proper &amp;quot;-a&amp;quot; flag!&lt;br /&gt;
&lt;br /&gt;
===Can sguil page me when it sees a particular alert?===&lt;br /&gt;
Thanks to Will Button (wbutton at skyhawks d0t com) for contributing the following:&lt;br /&gt;
 Yes, using the sguild.email file on the sguild server (for version 0.6  &lt;br /&gt;
 and higher).  Note that the file is only read on init, and reread on &lt;br /&gt;
 HUP signals, so if you make changes to it, you&#039;ll need to restart &lt;br /&gt;
 sguild.&lt;br /&gt;
 &lt;br /&gt;
 Set-up is fairly straightforward, as the file is very well documented.&lt;br /&gt;
 &lt;br /&gt;
 To activate:&lt;br /&gt;
 	set EMAIL_EVENTS 1&lt;br /&gt;
 	set SMTP_SERVER {your_mail_server} &lt;br /&gt;
 	set EMAIL_RCPT_TO &amp;quot;recipient1@mydomain.com,recipient2@mydomain.com&amp;quot;&lt;br /&gt;
 	set EMAIL_FROM &amp;quot;sguil@mydomain.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Modify your notification options to meet your needs:&lt;br /&gt;
 &lt;br /&gt;
 	set EMAIL_CLASSES &amp;quot;successful-admin trojan-activity attempted-admin attempted-user&amp;quot;&lt;br /&gt;
 	set EMAIL_PRIORITIES &amp;quot;0&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 Optionally, use the last two parameters, EMAIL_DISABLE_SIDS and &lt;br /&gt;
 EMAIL_ENABLE_SIDS to override any specific sids you&#039;d like.&lt;br /&gt;
 &lt;br /&gt;
 Restart sguild to complete.&lt;br /&gt;
By the way, the procedure for 0.5.3 and previous releases is very similar, except that the email configuration is included directly in the sguild.conf file instead.&lt;br /&gt;
&lt;br /&gt;
===How do I expire (purge) old information from the database?===&lt;br /&gt;
Sguil 0.5.3 comes with a handy script for this, called &#039;&#039;archive_sguildb.tcl&#039;&#039;.  Basic usage looks like this:&lt;br /&gt;
 archive_sguildb.tcl -d 2004-12-27 -p 2004_12_27_ --dbname sguildb \&lt;br /&gt;
        --dbhost localhost --dbuser sguil --dbpass password --event \&lt;br /&gt;
 	--session --sancp &lt;br /&gt;
This command would expire all event, session and SANCP entries older than &amp;quot;2004-12-27&amp;quot;, placing them in new tables called &amp;quot;2004_12_27_event&amp;quot;,  &amp;quot;2004_12_27_session&amp;quot; and &amp;quot;2004_12_27_sancp&amp;quot;.  You can drop these tables if you don&#039;t want the data, or you can keep them around in case you need to make historical queries.  As long as you have the disk space to store them, these older tables do not affect the performance of queries running against the current tables.&lt;br /&gt;
&lt;br /&gt;
After expiring old date, you should also run mysqlcheck to re-optimize the database, reindex and repair tables and to reclaim the space used by the expired data. &lt;br /&gt;
&lt;br /&gt;
Be warned that expiring old data may take hours on a large database (especially the sessions and SANCP tables).  This can temporarily lock tables in the db, which will interfere with queries and with insertions.  The sensors will queue up their data and try again when the table is unlocked, but interactive use might suffer.  It&#039;s probably best to run these overnight when no one is using the GUI.&lt;br /&gt;
&lt;br /&gt;
For sguil 0.5.3, you might also want to try out David Bianco&#039;s [http://www.biancorama.com/sguil/sguil_age_db sguil_age_db script], which is a wrapper for [[archive_sguildb.tcl]].  The script&#039;s advantage is that it doesn&#039;t require you to give an absolute date for the expiration time, and you can specify different thresholds for different tables.  For example:&lt;br /&gt;
    sguil_age_db --event &amp;quot;-27 days&amp;quot; --session &amp;quot;-3 weeks&amp;quot; --sancp &amp;quot;-1 month&amp;quot;&lt;br /&gt;
This makes it a little more suitable for running out of cron.&lt;br /&gt;
&lt;br /&gt;
Sguil 0.6.0 and above changes the database schema extensively, and the archive script is no longer necessary.  This version uses MERGE tables to create &amp;quot;virtual tables&amp;quot; for events, SANCP records and other supporting information.  The virtual tables are comprised of a number of individual tables, one for each day.  The table names look something like &amp;quot;tablename_sensorname_date&amp;quot; (e.g., &amp;quot;sancp_externalnet_20051128&amp;quot;, &amp;quot;event_finance_20051031&amp;quot; or &amp;quot;data_finance_20051031&amp;quot;).  The sguil server creates the merged tables dynamically, so you&#039;ll find &amp;quot;event&amp;quot;, &amp;quot;icmphdr&amp;quot;, &amp;quot;tcphdr&amp;quot;, &amp;quot;udphdr&amp;quot;, &amp;quot;data&amp;quot; and &amp;quot;sancp&amp;quot; tables, along with all the individual daily tables that make up these merged tables.&lt;br /&gt;
&lt;br /&gt;
Given this, if you want to get rid of old data, simply stop the sguil server, drop the daily tables you don&#039;t want, drop the merged tables, then restart the sguil server.  Sguil will recreate the merged tables using the remaining data in the database.&lt;br /&gt;
&lt;br /&gt;
Here is a handy bash shell script that will automate this process and also repairs any remaining tables to keep data corruption to a minumum:&lt;br /&gt;
&lt;br /&gt;
 #! /bin/bash&lt;br /&gt;
 &lt;br /&gt;
 DATABASE=sguildb&lt;br /&gt;
 DB_USER=sguil&lt;br /&gt;
 DB_PASSWORD=password&lt;br /&gt;
 DAYSTOKEEP=45 &lt;br /&gt;
 &lt;br /&gt;
 KEEPDAY=`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SELECT DATE_FORMAT(DATE_SUB(NOW(), INTERVAL $DAYSTOKEEP DAY), &#039;%Y%m%d&#039;);&amp;quot; -D $DATABASE` &lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild stop&lt;br /&gt;
 &lt;br /&gt;
 for TABLEPREFIX in &amp;quot;data&amp;quot; &amp;quot;event&amp;quot; &amp;quot;icmphdr&amp;quot; &amp;quot;sancp&amp;quot; &amp;quot;tcphdr&amp;quot; &amp;quot;udphdr&amp;quot;&lt;br /&gt;
 do&lt;br /&gt;
 	/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLEPREFIX;&amp;quot; -D $DATABASE &lt;br /&gt;
 	TABLES=(`/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;SHOW TABLES LIKE &#039;$TABLEPREFIX%&#039;;&amp;quot; -D $DATABASE`)&lt;br /&gt;
 	for TABLE in &amp;quot;${TABLES[@]}&amp;quot;&lt;br /&gt;
 	do&lt;br /&gt;
 		TABLEDAY=`echo &amp;quot;$TABLE&amp;quot; | awk -F_ &#039;{print($3)}&#039;`&lt;br /&gt;
 		if [ &amp;quot;$TABLEDAY&amp;quot; -lt &amp;quot;$KEEPDAY&amp;quot; ]&lt;br /&gt;
 			then /usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;DROP TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		else&lt;br /&gt;
 			/usr/bin/mysql -u$DB_USER -p$DB_PASSWORD -BN -e &amp;quot;REPAIR TABLE $TABLE;&amp;quot; -D $DATABASE&lt;br /&gt;
 		fi&lt;br /&gt;
 	done&lt;br /&gt;
 done&lt;br /&gt;
 &lt;br /&gt;
 /sbin/service sguild start&lt;br /&gt;
&lt;br /&gt;
===What commands are available in the &amp;quot;User Messages&amp;quot; window?===&lt;br /&gt;
Most people probably don&#039;t realize this, but the client&#039;s User Messages window is good for more than just user-to-user chat.  It also offers a few simple commands you can use to check the status of the sguil sensors and server.  To use one of the commands, simply type it on a line by itself in the User Message tab. &lt;br /&gt;
&lt;br /&gt;
Version 0.5.3 supports the following commands:&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
! Command || Purpose&lt;br /&gt;
|-&lt;br /&gt;
| agents || Lists all the sensor agents connected to sguild.  This is deprecated, but still supported.&lt;br /&gt;
|-&lt;br /&gt;
| healthcheck || Like the &amp;quot;agents&amp;quot; command, but more comprehensive.  It also checks each agent to make sure it is still actively responding to requests.  Unlike the other commands, the output for this is displayed in the &amp;quot;System Messages&amp;quot; tab.  This is also deprecated, since the 0.6.0 client now includes a handy &amp;quot;Sensor Status&amp;quot; panel.&lt;br /&gt;
|-&lt;br /&gt;
| sensors || An alias for the &amp;quot;agents&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
| who || List all users connected to sguild.&lt;br /&gt;
|}&lt;br /&gt;
===I&#039;m not satisfied with the default packet logging subsystem.  Are there any alternatives available?===&lt;br /&gt;
Yes.  Two alternatives have already been developed, based on [[DaemonLogger] and [[SANCP]].  See [[Packet Logging in Sguil]] for more information on this subsystem and the alternatives available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
==See also==&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
==References==&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104463</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104463"/>
		<updated>2016-06-06T17:04:19Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Tuning / Miscellaneous */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
===Software architecture===&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
===Tools that usually make up Sguil===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==Contents==&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
===Dependencies===&lt;br /&gt;
====Hardware====&lt;br /&gt;
====Software====&lt;br /&gt;
===Setup===&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
===Post Installation===&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
=====Tuning / Miscellaneous=====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support [https://github.com/Security-Onion-Solutions/security-onion/wiki/FreeNX FreeNX] or [http://www.xrdp.org xrdp].&lt;br /&gt;
* Read more about the tools contained in Security Onion: [https://github.com/Security-Onion-Solutions/security-onion/wiki/Tools Tools]&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
==See also==&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
==References==&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104462</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104462"/>
		<updated>2016-06-06T17:02:59Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Tuning / Miscellaneous */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
===Software architecture===&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
===Tools that usually make up Sguil===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==Contents==&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
===Dependencies===&lt;br /&gt;
====Hardware====&lt;br /&gt;
====Software====&lt;br /&gt;
===Setup===&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
===Post Installation===&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
=====Tuning / Miscellaneous=====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure [https://github.com/Security-Onion-Solutions/security-onion/wiki/email Email] for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use [https://help.ubuntu.com/12.04/serverguide/bazaar.html bazaar], [https://git-scm.com/ git], [https://help.ubuntu.com/12.04/serverguide/etckeeper.html etckeeper]:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support FreeNX or xrdp.&lt;br /&gt;
* Read more about the tools contained in Security Onion: Tools&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
==See also==&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
==References==&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
	<entry>
		<id>https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104461</id>
		<title>Sguil</title>
		<link rel="alternate" type="text/html" href="https://wiki.itcollege.ee/index.php?title=Sguil&amp;diff=104461"/>
		<updated>2016-06-06T17:01:10Z</updated>

		<summary type="html">&lt;p&gt;Kkurval: /* Tuning / Miscellaneous */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Sguil_logo_h.png‎‎|320px|right|text-top]]&lt;br /&gt;
[[File:Sguil_main.png‎‎|320px|right|text-top]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Author: Kustas Kurval&lt;br /&gt;
&lt;br /&gt;
Cyber Security Engineering C11&lt;br /&gt;
&lt;br /&gt;
Written 06.06.2016&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
This tutorial was made to make an introduction to Sguil. Sguil (pronounced sgweel) is built by network security analysts for network security analysts.&lt;br /&gt;
It is a collection of free software components for Network Security Monitoring (NSM) and event driven analysis of [https://en.wikipedia.org/wiki/Intrusion_prevention_system IDS] alerts. Sguil&#039;s main component is an intuitive GUI that provides access to realtime events, session data, and raw packet captures. Sguil facilitates the practice of Network Security Monitoring and event driven analysis.&lt;br /&gt;
&lt;br /&gt;
The Sguil client is written in [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] and can be run on any operating system that supports [https://en.wikipedia.org/wiki/Tcl tcl] / [https://en.wikipedia.org/wiki/Tk_(software) tk] (including Linux, *BSD, Solaris, MacOS, and Win32).&lt;br /&gt;
&lt;br /&gt;
It is provided by [https://en.wikipedia.org/wiki/Q_Public_License Q Public License]&lt;br /&gt;
&lt;br /&gt;
Sguil integrates alert data from Snort, session data from SANCP, and full content data from a second instance of Snort running in packet logger mode.&lt;br /&gt;
&lt;br /&gt;
In this introduction I will be covering Sguil in [https://en.wikipedia.org/wiki/Xubuntu Xbuntu]. You will need to know basic Linux syntax and terminology also some terminology concerning overall [https://en.wikipedia.org/wiki/Intrusion_prevention_system intrusion detection and prevention systems (IDPS)] and overall basic networking. &lt;br /&gt;
&lt;br /&gt;
===Software architecture===&lt;br /&gt;
A sguil system is composed of a single sguil server and an arbitrary number of sguil network sensors. The sensors perform all the security monitoring tasks and feed information back to the server on a regular basis. The server coordinates this information, stores it in a database and communicates with sguil clients running on administrators&#039; desktop machines. It can also issue requests for specific information from the sensors.&lt;br /&gt;
&lt;br /&gt;
Each sensor monitors a single network link (although you can have multiple sensors on one physical machine). They collect several different types of information:&lt;br /&gt;
&lt;br /&gt;
# Snort monitors the link for security events, and logs them to a file on the local disk. &lt;br /&gt;
# Barnyard takes events from the snort log file and sends them to the sensor agent, which inserts them into database running on the sguil server in near real-time &lt;br /&gt;
# A separate instance of snort logs the full content of all network packets to the local disk (this typically requires a large separate data partition) &lt;br /&gt;
# SANCP records TCP/IP sessions and forwards them to the database on the sguil server &lt;br /&gt;
# The sguil agent also listens for commands from the sguil server. These commands are typically requests for packet data previously logged by Snort.&lt;br /&gt;
&lt;br /&gt;
===Tools that usually make up Sguil===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Tool !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| [[MySQL]] 4.x or 5.x  || Data storage and retrieval&lt;br /&gt;
|-&lt;br /&gt;
| [[Snort (software)|Snort]] 2.x / [[Suricata (software)|Suricata]]  || Intrusion detection alerts, scan detection, packet logging&lt;br /&gt;
|-&lt;br /&gt;
| Barnyard / Barnyard2  || Decodes IDS alerts and sends them to sguil&lt;br /&gt;
|-&lt;br /&gt;
| SANCP  || TCP/IP session records&lt;br /&gt;
|-&lt;br /&gt;
| [[Tcpflow]] || Extract an ASCII dump of a given TCP session&lt;br /&gt;
|-&lt;br /&gt;
| [[p0f]]  || Operating system fingerprinting&lt;br /&gt;
|-&lt;br /&gt;
| [[tcpdump]] || Extracts individual sessions from packet logs  &lt;br /&gt;
|-&lt;br /&gt;
| [[Wireshark]]  || Packet analysis tool (used to be called Ethereal)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==Contents==&lt;br /&gt;
Since Sguil is dependant on many other types of software to gather, facilitate, store ,decode and analyze I will be using [https://en.wikipedia.org/wiki/Xubuntu Xbuntu] based distribution [https://security-onion-solutions.github.io/security-onion/ Security Onion] which saves massive amount of time to set up the entire environment. [https://security-onion-solutions.github.io/security-onion/ Security Onion] has all this and more build in and is able to quickly configure which software to tie to Sguil. &lt;br /&gt;
===Dependencies===&lt;br /&gt;
====Hardware====&lt;br /&gt;
====Software====&lt;br /&gt;
===Setup===&lt;br /&gt;
*  First, review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Hardware Hardware Requirements] page.&lt;br /&gt;
*  Review the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Security-Onion-14.04-Release-Notes Release Notes] page.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/blob/master/Verify_ISO.md Download and verify our Security Onion ISO image].&lt;br /&gt;
*  Boot the ISO image and select the Install option.&lt;br /&gt;
&lt;br /&gt;
I Installed this on Oracle Virutalbox as a 64 bit Ubuntu operating system, with 4GB of memory and a single processor. I set the network adapter as bridged with promiscuous mode allowed. This ensured that I am able to capture network traffic from the host machine&lt;br /&gt;
*  Follow the prompts in the Xubuntu installer. If prompted with an encrypt home folder or encrypt partition option, DO NOT enable this feature. If asked about *  *  *  automatic updates, DO NOT enable automatic updates. Reboot into your new installation. Login using the username/password you specified during installation.&lt;br /&gt;
*  Verify that you have Internet connectivity. If necessary, configure your proxy settings.&lt;br /&gt;
*  [https://github.com/Security-Onion-Solutions/security-onion/wiki/Upgrade Install updates and reboot].&lt;br /&gt;
*  Double-click the Setup icon on the desktop. The Setup wizard will walk you through configuring /etc/network/interfaces and will then reboot.&lt;br /&gt;
*  After rebooting, log back in and start the Setup wizard again. It will detect that you have already configured /etc/network/interfaces and will walk you through the rest of the configuration. When prompted for Evaluation Mode or Production Mode, choose Evaluation Mode.&lt;br /&gt;
&lt;br /&gt;
Security Onion usually expects at least two networking interfaces. One for monitoring the other for management. Since I only had access to a single interface on the virtual machine I set it as management. I used the static IP address 192.168.1.111 with regular /24 [https://en.wikipedia.org/wiki/Subnetwork subnet mask] for ease of use. After this I was prompted for a gateway address and [https://en.wikipedia.org/wiki/Domain_Name_System DNS] server.&lt;br /&gt;
*  Once you&#039;ve completed the Setup wizard, use the Desktop icons to login to Sguil.&lt;br /&gt;
&lt;br /&gt;
===Post Installation===&lt;br /&gt;
Verify services are running:&lt;br /&gt;
 sudo service nsm status&lt;br /&gt;
&lt;br /&gt;
If any services are not running, try starting them:&lt;br /&gt;
 sudo service nsm start&lt;br /&gt;
&lt;br /&gt;
=====Tuning / Miscellaneous=====&lt;br /&gt;
&lt;br /&gt;
*  Are you monitoring network traffic that has VLAN tags? If so, take a look at our [https://github.com/Security-Onion-Solutions/security-onion/wiki/VLAN-Traffic VLAN] page.&lt;br /&gt;
*  If you’re monitoring IP address ranges other than private RFC1918 address space (192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12), you should update your sensor configuration with the correct IP ranges. Sensor configuration files can be found in &amp;lt;code&amp;gt;/etc/nsm/$HOSTNAME-$INTERFACE/&amp;lt;/code&amp;gt;. Modify either &amp;lt;code&amp;gt;snort.conf&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;suricata.yaml&amp;lt;/code&amp;gt; (depending on which IDS engine you chose during &amp;lt;code&amp;gt;sosetup&amp;lt;/code&amp;gt;) and update the &amp;lt;code&amp;gt;HOME_NET&amp;lt;/code&amp;gt; variable. Also update the home_nets variable in &amp;lt;code&amp;gt;prads.conf&amp;lt;/code&amp;gt;. Then update Bro’s network configuration in &amp;lt;code&amp;gt;/opt/bro/etc/networks.cfg&amp;lt;/code&amp;gt;. Restart the sensor processes:&lt;br /&gt;
 sudo nsm_sensor_ps-restart&lt;br /&gt;
* If you have Internet access, create an IDS alert by typing the following at a terminal:&lt;br /&gt;
&amp;lt;code&amp;gt;curl http://testmyids.com&amp;lt;/code&amp;gt;&lt;br /&gt;
* As of securityonion-setup - 20120912-0ubuntu0securityonion201, Setup now defaults to only opening port 22 in the firewall. If you need to connect OSSEC agents, syslog devices, or analyst VMs, you can run the new &amp;lt;code&amp;gt;so-allow&amp;lt;/code&amp;gt; utility which will walk you through creating firewall rules to allow these devices to connect. For more information, please see the [https://github.com/Security-Onion-Solutions/security-onion/wiki/Firewall firewall] page.&lt;br /&gt;
* Full-time analysts should install Security Onion in a VM on their workstation (run through the Ubuntu installer, but do not run our Setup wizard). This gives you a local copy of Wireshark, NetworkMiner, and our customized Sguil client. Launch the Sguil client and connect to the IP/hostname of your production Sguil sensor (you may need to run so-allow as described in the previous step). This allows you to investigate pcaps without fear of impacting your production server/sensors. To change the resolution of your Security Onion VM, install the Virtual Tools for your virtualization solution or use xrandr. For a list of available screen resolutions, simply execute “xrandr”. To set the screen resolution (replace W and H with the actual Width and Height desired):&lt;br /&gt;
&amp;lt;code&amp;gt;xrandr -s WxH&amp;lt;/code&amp;gt;&lt;br /&gt;
* Login to Sguil and review your IDS alerts. Squert and ELSA can be accessed by visiting https://server/ for additional in-depth analysis.&lt;br /&gt;
* Run the following to see how your sensor is coping with the load. You should check this on a daily basis to make sure your sensor is not dropping packets. Consider adding it to a cronjob and having it emailed to you (see the “configure email” link below).&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sostat | less&amp;lt;/code&amp;gt;&lt;br /&gt;
* Please note that any IDS/NSM system needs to be tuned for the network it’s monitoring. Please see [https://github.com/Security-Onion-Solutions/security-onion/wiki/ManagingAlerts ManagingAlerts]. You should only run the signatures you really care about.&lt;br /&gt;
* Also note that you should be looking at and categorizing events every day with the goal being to categorize all events every day. Even if you don’t use the Sguil console for your primary analysis, you need to log into it periodically and F8 old events to keep the real time queue from getting too big. Neglecting to do so will result in database/Sguil issues as the number of uncategorized events continues to increase on a daily basis. Please see the [http://nsmwiki.org/Sguil_Client Sguil client page on NSMwiki].&lt;br /&gt;
* On the server running the Sguil database, set the &amp;lt;code&amp;gt;DAYSTOKEEP&amp;lt;/code&amp;gt; variable in &amp;lt;code&amp;gt;/etc/nsm/securityonion.conf&amp;lt;/code&amp;gt; to however many days you want to keep in your archive. The default is 30, but you may need to adjust it based on your organization’s detection/response policy and your available disk space.&lt;br /&gt;
* If you enabled [https://github.com/Security-Onion-Solutions/security-onion/wiki/http_agent http_agent], you should tune it using http_agent.conf. If you&#039;re running ELSA, you already have all the Bro HTTP logs available there, so you might want to disable http_agent to avoid duplicating those logs in the Sguil database:&lt;br /&gt;
&amp;lt;code&amp;gt;# Terminate the running http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_sensor_ps-stop --only-http-agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;# Disable http_agent&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;sudo sed -i &#039;s|HTTP_AGENT_ENABLED=&amp;quot;yes&amp;quot;|HTTP_AGENT_ENABLED=&amp;quot;no&amp;quot;|g&#039; /etc/nsm//sensor.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
* [https://github.com/Security-Onion-Solutions/security-onion/wiki/DisablingProcesses Disable any unneeded sensor processes]&lt;br /&gt;
* Tune the number of PF_RING instances for Snort/Suricata and Bro: [https://github.com/Security-Onion-Solutions/security-onion/wiki/PF_RING PF_RING]&lt;br /&gt;
* Optional:* exclude unnecessary traffic from your monitoring using [https://github.com/Security-Onion-Solutions/security-onion/wiki/BPF BPF].&lt;br /&gt;
* Optional: add new Sguil user accounts with the following:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo nsm_server_user-add&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional, but highly recommended: configure Email for alerting and reporting.&lt;br /&gt;
* Optional, but highly recommended: place /etc under version control. If your organization doesn&#039;t already have a standard version control tool, you can use bazaar, git, etckeeper:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install etckeeper&amp;lt;/code&amp;gt;&lt;br /&gt;
* Optional: need “remote desktop” access to your Security Onion sensor or server? We recommend SSH X-Forwarding as shown above, but if you want something more rdp-like, you can install FreeNX or xrdp:&lt;br /&gt;
&amp;lt;code&amp;gt;sudo apt-get install xrdp&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that we do not support FreeNX or xrdp.&lt;br /&gt;
* Read more about the tools contained in Security Onion: Tools&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
==Summary==&lt;br /&gt;
==See also==&lt;br /&gt;
{{Portal|Free Software}}&lt;br /&gt;
* [[Sagan (software)|Sagan]]&lt;br /&gt;
* [[Intrusion detection system]] (IDS)&lt;br /&gt;
* [[Intrusion prevention system]] (IPS)&lt;br /&gt;
* [[Network intrusion detection system]] (NIDS)&lt;br /&gt;
* [[Metasploit Project]]&lt;br /&gt;
* [[nmap]]&lt;br /&gt;
==References==&lt;br /&gt;
*[http://sguil.sourceforge.net Sguil Homepage]&lt;br /&gt;
*[http://nsmwiki.org/Sguil_FAQ Sguil FAQ]&lt;br /&gt;
*[http://nsmwiki.org/Main_Page NSMWiki]: The official wiki for the Sguil project.&lt;br /&gt;
&lt;br /&gt;
[[Category:Operatsioonisüsteemide administreerimine ja sidumine]]&lt;br /&gt;
[[Category:Operating systems]]&lt;/div&gt;</summary>
		<author><name>Kkurval</name></author>
	</entry>
</feed>