ntop / ntopng

Web-based Traffic and Security Network Traffic Monitoring
http://www.ntop.org
GNU General Public License v3.0
6.24k stars 654 forks source link

Login page changes format and then can't login #6333

Closed mhawkins-consultant closed 2 years ago

mhawkins-consultant commented 2 years ago

Environment:

Why am I presented with a "texty" (perhaps CSS-less) version of the login screen and I can't login either? Only way I could get away from the "texty" page was to recompile nDPI and ntopng.

History I installed and configured the prerequisites. I created an ntopng user and home directory and gave ownership and file write permissions to /home/ntopng/ntopng-data. I followed https://github.com/ntop/ntopng/blob/dev/doc/README.compilation Which included downloading and compiling nDPI and ntopng successfully. Was able to start it with: ntopng -d /home/ntopng/ntopng-data -r 127.0.0.1:6379@1 -w 3000 Was able to reach the login page and was able to login too. Note that the login page looks like a nice CSS based creation. See good-login-page.jpg good-login-page

I then went to use the systemd script for starting/stopping enabling/disabling ntopng. First, the path to ntopng is wrong in: /etc/systemd/system/ntopng.service. That had to be fixed: ExecStart=/usr/bin/ntopng /run/ntopng.conf was changed to: ExecStart=/usr/local/bin/ntopng /run/ntopng.conf For testing, I also commented out: Restart=on-failure was changed to: #Restart=on-failure And then I refreshed systemd with: systemctl daemon-reload Clearly, there are no arguments provided on the ExecStart line. So all configuration items need to be in /etc/ntopng/ntopng.conf which does not exist. So I found an example at: /opt/ntopng/packages/etc/ntopng/ntopng.conf

I set the following options in: /etc/ntopng/ntopng.conf: -w=3000 -d=/home/ntopng/ntopng-data -r=127.0.0.1:6379@1

I then tried to start ntopng with systemctl start ntopng.service ntopng did start as seen below using: ps -ef | grep ntopng ntopng 25902 1 25 11:56 ? 00:01:09 /usr/local/bin/ntopng -d /home/ntopng/ntopng-data -r 127.0.0.1:6379@1 -w 3000

And now I can reach port 3000 but I am presented with a "texty" (probably CSS-less) version of the login page. And I cannot login either. See picture bad-login-page.jpg bad-login-page I have followed the above compilation and configuration steps several times. And always, I can login and continue to login after multiple restarts of ntopng at the CLI. But as soon as I try to use systemd, the login page changes and I can't login anymore. The only way I have found to recover is to recompile nDPI and ntopng. Then it works as expected except if I try to use systemd and then I am back to the 'texty' looking page and can't login either.

Debug information below:

Feb 18 12:26:32 SATURN.home ntopng[27976]: 18/Feb/2022 12:26:32 [NetworkInterface.cpp:3023] Started flow user script hooks loop on interface enp0s3 [i> Feb 18 12:26:32 SATURN.home ntopng[27976]: 18/Feb/2022 12:26:32 [PeriodicActivities.cpp:109] Started periodic activities loop... Feb 18 12:26:32 SATURN.home ntopng[27976]: 18/Feb/2022 12:26:32 [startup.lua:35] Processing startup.lua: please hold on... Feb 18 12:26:32 SATURN.home ntopng[27976]: 18/Feb/2022 12:26:32 [startup.lua:120] [lists_utils.lua:785] Refreshing category lists... Feb 18 12:26:32 SATURN.home ntopng[27976]: 18/Feb/2022 12:26:32 [startup.lua:120] [lists_utils.lua:421] Updating list 'SSLBL Botnet C2 IP Blacklist' [> Feb 18 12:26:32 SATURN.home ntopng[27976]: 18/Feb/2022 12:26:32 [startup.lua:120] [lists_utils.lua:718] Category Lists (1742 hosts, 2254 IPs, 0 JA3) l> Feb 18 12:26:32 SATURN.home ntopng[27976]: 18/Feb/2022 12:26:32 [startup.lua:210] Completed startup.lua Feb 18 12:26:32 SATURN.home ntopng[27976]: 18/Feb/2022 12:26:32 [PeriodicActivities.cpp:167] Found 10 activities Feb 18 12:26:32 SATURN.home ntopng[27976]: 18/Feb/2022 12:26:32 [NetworkInterface.cpp:3195] Started packet polling on interface enp0s3 [id: 1]... Feb 18 12:26:32 SATURN.home ntopng[27976]: 18/Feb/2022 12:26:32 [NetworkInterface.cpp:3195] Started packet polling on interface lo [id: 2]...

Any help is much appreciated.

/Mike

MatteoBiscosi commented 2 years ago

Hi @mhawkins-consultant , I already have a suspect, could you please right click ntopng page and click inspect? then go to the console tab and send me the errors/warnings there? Screenshot from 2022-02-21 13-09-25

mhawkins-consultant commented 2 years ago

Hi Matteo,

I will most certainly try to provide to you what you have asked for but I have actually run into another issue. If you want me to open a new issue for it, I will certainly do that.

After recompiling ntopng many times (I estimate about 10-20 times), I ran 'make' in /opt/ntopng, and I am now seeing the following:

/usr/bin/ld: cannot find -lm collect2: error: ld returned 1 exit status make: *** [Makefile:138: ntopng] Error 1

Keep in mind, that the reason I was recompiling so many times was because I was trying use a process of elimination to figure out why I was getting the 'texty' login screen.

I have checked for the existence and correct symbolic links for libm:

[root@SATURN ~]# locate libm.so /usr/lib/libm.so /usr/lib64/libm.so /usr/lib64/libm.so.6

libm is provided by glibc, and if that was not installed then the compiler would not be getting to the linking stage anyway.

[root@SATURN ntopng]# dnf install glibc Last metadata expiration check: 0:19:20 ago on Mon 21 Feb 2022 11:06:11 AM EST. Package glibc-2.30-13.fc31.x86_64 is already installed. Dependencies resolved. Nothing to do.

I followed the instructions in README.compilation. And I successfully executed make many times to get a working ntopng each time. Now that it won't link, nothing had changed on the machine, no changes were made at all. The compilation/linking simply stopped working after 10-20 autogen, configure, make cycles.

I did read a comment in an online forum that said it was possible for the compiler/linker to run out of temp space. The suggestion referred to /usr/tmp. However, on my machine /usr/tmp does not seem to use much space at all.

As I said before, if you want me to repost the above to a new issue, I will happily do that.

Thanks for your help, /Mike

MatteoBiscosi commented 2 years ago

Hi @mhawkins-consultant unfortunately we do not support the Fedora OS, if you are able to reproduce this behavior with the distro we support, reopen the issue and we'll take a look at it