Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Snort-Users
[Top] [All Lists]

Re: [Snort-users] Snort Box IP assigned by DHCP

Subject: Re: [Snort-users] Snort Box IP assigned by DHCP
Date: Wed, 19 Apr 2006 12:27:25 -0500
Paul Schmehl wrote:
Palula Brasil wrote:
Hi there!
Here is the problem. Every time I turn on the box, I have to look at the IP assigned by the ISP, edit snort.conf and, in the HOME_NET variable, I put the DHCP assigned address manually and after that, I start Snort and it works fine.
What I'd like to know is: Is there a way for me to automatically have snort to know what IP has been assigned and work with that IP. I've used both of these variables and it didn't work:
var HOME_NET $eth0_ADDRESS
and
var HOME_NET $eth0
But still... None worked.
Does Linux need some kind of program to make global variables work?

Try this and see if it works: var HOME_NET `ifconfig eth0 | grep inet | awk '{print $2}'`

If that doesn't work, create a small script that assigns that value to an environmental variable and then assign that variable to snort's HOME_NET.

Like this:

#!/bin/bash
MYIP=`ifconfig eth0 | grep inet | awk '{print $2}'`
export MYIP

Then, in snort.conf
var HOME_NET $MYIP

Don't know if either of those will work, but it's worth a try. If the script works, you'd need to run it on startup, so put it in init.d.

This is probably a better idea (thanks to Jason).

in snort.conf replace var HOME_NET with #include home_net.var

then in the snort startup do

echo "var HOME_NET `ifconfig eth0 | grep inet | awk '{print $2}'`/32" >
home_net.var

If you're unfamiliar with unix comands. please note that I'm using backticks before ifconfig and after the awk statement (`). Those are absolutely necessary. You also need to add the /32, which I forgot and Jason pointed out to me.

--
Paul Schmehl (pauls@utdallas.edu)
Adjunct Information Security Officer
The University of Texas at Dallas
http://www.utdallas.edu/ir/security/

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

<Prev in Thread] Current Thread [Next in Thread>