Welcome, Guest. Please login or register.
Did you miss your activation email?
Friday 15 November 2024, 05:51:38 pm

Login with username, password and session length

Visit the official Endian Community Mailinglist  HERE
14255 Posts in 4377 Topics by 6515 Members
Latest Member: hulteends
Search:     Advanced search
+  EFW Support
|-+  Support
| |-+  General Support
| | |-+  Ntop Interface available
0 Members and 6 Guests are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Ntop Interface available  (Read 16123 times)
mauroreggio
Jr. Member
*
Offline Offline

Posts: 6


« on: Friday 15 January 2016, 10:14:18 pm »

Hi all.
I have EFW Community 3.0 installed. I play many time with NTop and i need to make a little change: add in the interface list my red zone interface (eth1 and eth2).
Now, i search a little and i find some usefull info:
- on the EFW, the Ntop service starts from /etc/init.d/ntopng
- in this start script i find that "NTOPNG_CONFIG="/etc/ntopng/ntopng.conf"" so /etc/ntopng/ntopng.conf is the Ntop configuration file
- in /etc/ntopng/ntopng.conf i find, at the start, all the --interface entry:

Code:
root@XXXX:/etc/ntopng # [b]cat /etc/ntopng/ntopng.conf[/b]
# --dns-mode
--interface=br0
--interface=br1
--data-dir=/var/lib/ntopng/
...

Now, is simple, i add 2 new line and all works ... no! Is NOT that!!

All the time that i restart Ntop (service ntopng restart or restartntop) or reboot the system a new /etc/ntopng/ntopng.conf was "rebuilded".
In /etc/ntopng/ folder there is another file: /etc/ntopng/ntopng.conf.tmpl and, IN MY OPINION, this is used for create a new configuration file every time the system is rebooted or the service is restarted.

Now, the question:
- is MY OPINION CORRECT?
- in /etc/ntopng/ntopng.conf.tmpl i can find:

Code:
root@XXXX:/etc/ntopng # [b]cat ntopng.conf.tmpl[/b]
# --dns-mode
#for $interface in $NTOP_INTERFACES
--interface=${interface}
#end for
...

$NTOP_INTERFACES ... Bingo!!!

But ... where is declared and populated the $NTOP_INTERFACES variable? I can't be able to find it.

Thanks all.
Mauro.

Logged
mrkroket
Hero Member
*****
Offline Offline

Posts: 495


« Reply #1 on: Saturday 16 January 2016, 02:48:51 am »

Your opinion is correct, all .conf.tmpl files rebuild .conf files. Once you know that it's easier to add tweaks to .conf files, and you don't break anything.

On linux, if you need to find a file with some contents on it you can use grep SEARCH_TERM * -R , and it's better used on one of these folders: /var/efw , /usr/lib, /usr/sbin, /etc.
It also works on root folder (/), but gives you more warnings.

The variable you look for is in: /usr/lib/python/site-packages/endian/restartscripts/ntop.py . In this script you'll see the "magic" for creating .conf files from .tmpl, and all templates used by ntop.
Logged
mauroreggio
Jr. Member
*
Offline Offline

Posts: 6


« Reply #2 on: Monday 18 January 2016, 07:22:41 pm »

Your opinion is correct, all .conf.tmpl files rebuild .conf files. Once you know that it's easier to add tweaks to .conf files, and you don't break anything.

On linux, if you need to find a file with some contents on it you can use grep SEARCH_TERM * -R , and it's better used on one of these folders: /var/efw , /usr/lib, /usr/sbin, /etc.
It also works on root folder (/), but gives you more warnings.

The variable you look for is in: /usr/lib/python/site-packages/endian/restartscripts/ntop.py . In this script you'll see the "magic" for creating .conf files from .tmpl, and all templates used by ntop.

Thank you very much @mrkroket.
It Seems that the $NTOP_INTERFACES variable is maked authomatically from the efw settings

Code:
        for name, zone in getZones().iteritems():
134             local_nets.extend(zone.get('SETTINGS', {}).get('IPS_CIDR', []))
135             interfaces.append(zone.get('SETTINGS', {}).get('DEV', ""))
136         self.config_values['NTOP_INTERFACES'] = sorted(interfaces)
137         self.config_values['NTOP_LOCAL_NETS'] = ",".join(["%s" % local_net for local_net in local_nets])

In this case i'm not able to change it and insert other network interces ... or i don't know how.
Any idea to point me in the right way?
Mauro.
Logged
mrkroket
Hero Member
*****
Offline Offline

Posts: 495


« Reply #3 on: Tuesday 19 January 2016, 03:01:39 am »

This is a Python script, if you know some programming you could add other interfaces (like uplinks) to the script.

But if you only need to add new interfaces and you want to make it fast and easy, just hardcode it on the template.
It's far easier and you'll get the same. Obviously it will work only on your configuration and can't be shared.
Logged
mauroreggio
Jr. Member
*
Offline Offline

Posts: 6


« Reply #4 on: Tuesday 19 January 2016, 03:21:50 am »

This is a Python script, if you know some programming you could add other interfaces (like uplinks) to the script.

But if you only need to add new interfaces and you want to make it fast and easy, just hardcode it on the template.
It's far easier and you'll get the same. Obviously it will work only on your configuration and can't be shared.

Thankyou again @mrkroket
I work on the /etc/ntopng/ntopng.conf.tmpl (before i make a copy of the original)

This is my new

Code:
root@XXXX:/etc/ntopng # cat ntopng.conf.tmpl

# --dns-mode
#for $interface in $NTOP_INTERFACES
--interface=${interface}
#end for
--interface=eth1
--interface=eth2
--data-dir=${DS.NTOP.SETTINGS.NTOP_DATA_DIRECTORY}
...

and this is the new /etc/ntopng/ntopng.conf after a restartntop

Code:
root@XXXX:/etc/ntopng # cat ntopng.conf

# --dns-mode
--interface=br0
--interface=br1
--interface=eth1
--interface=eth2
--data-dir=/var/lib/ntopng/
...

And now i can switch from all my interface in the web frontend.

Bye,
Mauro.
Logged
mrkroket
Hero Member
*****
Offline Offline

Posts: 495


« Reply #5 on: Tuesday 19 January 2016, 03:28:54 am »

Exactly that.
 As you hardcoded eth1 and eth2 it won't work on other setups, but on yours it works fine.
And it's way easier that changing the Python script.
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  

Page created in 0.063 seconds with 19 queries.
Powered by SMF 1.1 RC2 | SMF © 2001-2005, Lewis Media Design by 7dana.com