Is the "distributed sensor" running Security Onion? Is it running the
latest version? If so, its barnyard2 configuration should have been
updated to send its alerts to the snorby database on the server.
Check /etc/nsm/HOSTNAME-INTERFACE/barnyard2.conf on the sensor and
verify the last line looks like this:
output database: alert, mysql, user=root dbname=snorby host=127.0.0.1
The sensor should also have an ssh tunnel to the server to encrypt
that MySQL traffic. Check to see if the autossh is running:
ps aux |grep autoss[h]
Hope that helps!
Thanks,
Doug Burks
--
Doug Burks
SANS GSE and Community Instructor
Security Onion | http://securityonion.blogspot.com
President, Greater Augusta ISSA | http://augusta.issa.org
Please vote for Security Onion for 2011 Toolsmith Tool of the Year! |
http://goo.gl/PwTDi
Responses inline.
On Fri, Jan 20, 2012 at 8:43 AM, Emilio <ecas...@gmail.com> wrote:
> Hi Dourks response inline
>
>
> On 20 ene, 14:08, Doug Burks <doug.bu...@gmail.com> wrote:
>> Hi Emilio,
>>
>> Is the "distributed sensor" running Security Onion? Is it running the
>> latest version? If so, its barnyard2 configuration should have been
>> updated to send its alerts to the snorby database on the server.
>> Check /etc/nsm/HOSTNAME-INTERFACE/barnyard2.conf on the sensor and
>> verify the last line looks like this:
>> output database: alert, mysql, user=root dbname=snorby host=127.0.0.1
>>
>
> Yes, "the distributed sensor" is running the same version of SO than
> the server.
> The last line looks like you posted. I assume that it has to be:
> output database: alert, mysql, user=root dbname=snorby host=IpOfServer
It should be EXACTLY like this:
output database: alert, mysql, user=root dbname=snorby host=127.0.0.1
The host should be 127.0.0.1 because autossh is going to forward any
traffic received on the local port 3306 to port 3306 on the server
where MySQL is running.
>
>
>> The sensor should also have an ssh tunnel to the server to encrypt
>> that MySQL traffic. Check to see if the autossh is running:
>> ps aux |grep autoss[h]
>
> autossh Is not running.
That's a problem. Here's the code in /etc/init/securityonion.conf
that starts autossh:
SSH_DIR="/root/.ssh"
SSH_CONF="$SSH_DIR/securityonion_ssh.conf"
if [ -f $SSH_CONF ]
then
# We are a SLAVE
# Stop MySQL
service mysql stop
# Establish persistent SSH tunnel to MASTER.
KEY="$SSH_DIR/securityonion"
# Upstart uses sh instead of bash so we can't use "source"
SSH_USERNAME=`grep SSH_USERNAME $SSH_CONF | cut -d\= -f2`
SERVERNAME=`grep SERVERNAME $SSH_CONF | cut -d\= -f2`
/usr/bin/autossh -f -M 61234 -i "$KEY" -N -L
3306:127.0.0.1:3306 $SSH_USERNAME@$SERVERNAME
fi
Please run this code manually and see if it works. If not, please
copy/paste the output so we can help you further.
Thanks,
Doug
You're right, I wasn't in sudo mode, so I fixed that. However, when I run the command now, it reports nothing. Just a blank line that I can Ctrl-C out of to get back to the prompt.
Here's the command I'm sending. Maybe I've got a stray space in there somewhere?
SSH_USERNAME=`grep SSH_USERNAME $SSH_CONF | cut -d\= -f2` SERVERNAME=`grep SERVERNAME $SSH_CONF | cut -d\= -f2` /usr/bin/autossh -f -M 61234 -i "$KEY" -N -L 3306:127.0.0.1:3306 $SSH_USERNAME@$SERVERNAME
Sean
What you copy/pasted below does not exactly match the entire code snippet:
SSH_DIR="/root/.ssh"
SSH_CONF="$SSH_DIR/securityonion_ssh.conf"
if [ -f $SSH_CONF ]
then
# We are a SLAVE
# Stop MySQL
service mysql stop
# Establish persistent SSH tunnel to MASTER.
KEY="$SSH_DIR/securityonion"
# Upstart uses sh instead of bash so we can't use "source"
SSH_USERNAME=`grep SSH_USERNAME $SSH_CONF | cut -d\= -f2`
SERVERNAME=`grep SERVERNAME $SSH_CONF | cut -d\= -f2`
/usr/bin/autossh -f -M 61234 -i "$KEY" -N -L
3306:127.0.0.1:3306 $SSH_USERNAME@$SERVERNAME
fi
Watch out for line-wrapping on the line starting with "/usr/bin/autossh".
Hope that helps!
Thanks,
Doug
--
SSH_DIR="/root/.ssh"
SSH_CONF="$SSH_DIR/securityonion_ssh.conf"
service mysql stop
KEY="$SSH_DIR/securityonion"
SSH_USERNAME=`grep SSH_USERNAME $SSH_CONF | cut -d\= -f2` SERVERNAME=`grep SERVERNAME $SSH_CONF | cut -d\= -f2` /usr/bin/autossh -f -M 61234 -i "$KEY" -N -L 3306:127.0.0.1:3306 $SSH_USERNAME@$SERVERNAME
When doing this, other than the mysql error I mentioned above, I get no errors. And now, anyway, I go back to a command prompt, as if the box thinks it executed a command and is waiting for more input (as in, I don't have the blank line like I did before.)
But - still nothing showing up in Snorby.
Going from information in another post, running "ps aux | grep autossh" returns the following:
root 5888 0.0 0.0 3324 808 pts/0 S+ 19:16 0:00 grep --color=auto autossh
Sean
It looks like you're putting multiple commands on one line:
SSH_USERNAME=`grep SSH_USERNAME $SSH_CONF | cut -d\= -f2`
SERVERNAME=`grep SERVERNAME $SSH_CONF | cut -d\= -f2` /usr/bin/autossh
-f -M 61234 -i "$KEY" -N -L 3306:127.0.0.1:3306
$SSH_USERNAME@$SERVERNAME
This should actually be three individual lines as shown below (I've
inserted comment lines prefixed with #):
# First, set the SSH_USERNAME variable
SSH_USERNAME=`grep SSH_USERNAME $SSH_CONF | cut -d\= -f2`
# Next, set the SERVERNAME variable
SERVERNAME=`grep SERVERNAME $SSH_CONF | cut -d\= -f2`
# Finally, execute autossh using the previously defined SSH_USERNAME
and SERVERNAME variables
/usr/bin/autossh -f -M 61234 -i "$KEY" -N -L 3306:127.0.0.1:3306
$SSH_USERNAME@$SERVERNAME
Try these three lines and then try "ps aux | grep autoss[h]" to see if
autossh is running.
Thanks,
Doug
--
Sean
Also verify the SSH_USERNAME and SERVERNAME variables are correct in
/root/.ssh/securityonion_ssh.conf.
Thanks,
Doug
--
total 24K
drwx------ 2 root root 4.0K 2012-02-13 16:46 .
drwx------ 20 root root 4.0K 2012-02-13 21:00 ..
-rw-r--r-- 1 root root 442 2012-02-13 16:46 known_hosts
-rw------- 1 root root 1.7K 2012-02-13 16:46 securityonion
-rw------- 1 root root 400 2012-02-13 16:46 securityonion.pub
-rw-r--r-- 1 root root 39 2012-02-13 16:50 securityonion_ssh.conf
> Also verify the SSH_USERNAME and SERVERNAME variables are correct in
> /root/.ssh/securityonion_ssh.conf.
Yes, those two variables are correct.
Sean
Doug
--
Sean
Please look on the SERVER in /home/YOUR_SSH_USERNAME/.ssh/ and see if
there is an authorized_keys file and if it contains the key from your
sensor.
Doug
--
Sean
Then check to see if the .ssh directory got populated correctly in the
user's directory on the server.
Doug
--
root@adcseconion02:~/.ssh# ps aux | grep autossh
root 10323 0.0 0.0 1860 440 ? Ss 20:38 0:00 /usr/lib/autossh/autossh -M 61234 -i /root/.ssh/securityonion -N -L 3306:127.0.0.1:3306 se...@10.6.4.17
root 10327 0.0 0.0 3324 808 pts/0 S+ 20:38 0:00 grep --color=auto autossh
Nothing in Snorby just yet, perhaps just have to wait for data to populate now.
Sean
Did you restart barnyard2 on the sensor?
sudo nsm_sensor_ps-restart --only-barnyard2
Then verify that all services are running on sensor:
sudo service nsm status
Then create some test traffic:
curl http://testmyids.com
Thanks,
Doug
--
Thank you, Doug, for all of your assistance. I'm going to start getting boxes set up to roll out across the network over the next few weeks now.
Sean
Thanks,
Doug
--
Since you started a new thread, I'll answer you over there.
Thanks,
Doug
--
Doug Burks | http://securityonion.blogspot.com
Don't miss SANS SEC503 Intrusion Detection In-Depth in
Augusta GA 6/11 - 6/16 | 10% discount for ISSA Members!
http://augusta.issa.org/drupal/SANS-Augusta-2012