ntop / docker-ntop Goto Github PK
View Code? Open in Web Editor NEWA collection of Dockerfile for running ntop applications on Docker
A collection of Dockerfile for running ntop applications on Docker
I've slightly changed the Dockerfile.ntopng as follows
FROM ubuntu:20.04
ENV TZ="Europe/Zurich" # Changed by me
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && \
apt-get -y -q install wget curl lsb-release gnupg libelf1 && \ # Changed by me added curl
wget -q http://apt-stable.ntop.org/20.04/all/apt-ntop-stable.deb && \
dpkg -i apt-ntop-stable.deb && \
apt-get clean all
RUN apt-get update && \
apt-get -y install ntopng ntopng-data
COPY fritzdump.sh /fritzdump.sh # Changed by me
RUN chmod +x /fritzdump.sh # Changed by me
RUN echo '#!/bin/bash\n/etc/init.d/redis-server start\n/./fritzdump.sh "$@"' > /run.sh && \ # Changed by me
chmod +x /run.sh
EXPOSE 3000
ENTRYPOINT ["/run.sh"]
And there is my fritzdump.sh
#!/bin/bash
# This is the address of the router
FRITZIP=http://192.168.178.1
# This is the WAN interface
IFACE="2-0"
# Lan Interface
#IFACE="1-lan"
# If you use password-only authentication use 'dslf-config' as username.
FRITZUSER=dslf-config
FRITZPWD=$1
SIDFILE="/tmp/fritz.sid"
if [ -z "$FRITZPWD" ] || [ -z "$FRITZUSER" ] ; then echo "Username/Password empty. Usage: $0 <username> <password>" ; exit 1; fi
echo "Trying to login into $FRITZIP as user $FRITZUSER"
if [ ! -f $SIDFILE ]; then
touch $SIDFILE
fi
SID=$(cat $SIDFILE)
# Request challenge token from Fritz!Box
CHALLENGE=$(curl -k -s $FRITZIP/login_sid.lua | grep -o "<Challenge>[a-z0-9]\{8\}" | cut -d'>' -f 2)
# Very proprieatry way of AVM: Create a authentication token by hashing challenge token with password
HASH=$(perl -MPOSIX -e '
use Digest::MD5 "md5_hex";
my $ch_Pw = "$ARGV[0]-$ARGV[1]";
$ch_Pw =~ s/(.)/$1 . chr(0)/eg;
my $md5 = lc(md5_hex($ch_Pw));
print $md5;
' -- "$CHALLENGE" "$FRITZPWD")
curl -k -s "$FRITZIP/login_sid.lua" -d "response=$CHALLENGE-$HASH" -d 'username='${FRITZUSER} | grep -o "<SID>[a-z0-9]\{16\}" | cut -d'>' -f 2 > $SIDFILE
SID=$(cat $SIDFILE)
echo "[FRITZ!BOX] Successfully logged in. SID: $SID"
# Check for successfull authentification
if [[ $SID =~ ^0+$ ]] ; then echo "Login failed. Did you create & use explicit Fritz!Box users?" ; exit 1 ; fi
echo "Capturing traffic on Fritz!Box interface $IFACE ..." 1>&2
# In case you want to use tshark instead of ntopng
#wget --no-check-certificate -qO- $FRITZIP/cgi-bin/capture_notimeout?ifaceorminor=$IFACE\&snaplen=\&capture=Start\&sid=$SID | /usr/bin/tshark -r -
wget --no-check-certificate -qO- $FRITZIP/cgi-bin/capture_notimeout?ifaceorminor=$IFACE\&snaplen=\&capture=Start\&sid=$SID | ntopng -i -
Then I start the container using comman
docker run -it --net=host ntopng SomePasswoRd
After that I get following log output
Starting redis-server: redis-server.
Trying to login into http://192.168.178.1 as user dslf-config
[FRITZ!BOX] Successfully logged in. SID: 2cdc35f568d8c370
Capturing traffic on Fritz!Box interface 2-0 ...
19/Nov/2021 18:25:02 [Ntop.cpp:2478] Setting local networks to 127.0.0.0/8,fe80::/10
19/Nov/2021 18:25:02 [Redis.cpp:157] Successfully connected to redis 127.0.0.1:6379@0
19/Nov/2021 18:25:02 [Redis.cpp:157] Successfully connected to redis 127.0.0.1:6379@0
19/Nov/2021 18:25:02 [NtopPro.cpp:320] [LICENSE] No license file found /etc/ntopng.license: reading license from redis
19/Nov/2021 18:25:02 [NtopPro.cpp:469] [LICENSE] Unable to validate license [Empty license file]
19/Nov/2021 18:25:02 [NtopPro.cpp:538] WARNING: [LICENSE] Invalid license [Empty license file]
19/Nov/2021 18:25:02 [NtopPro.cpp:555] WARNING: [LICENSE] ntopng will now run in Enterprise L edition for 10 minutes
19/Nov/2021 18:25:02 [NtopPro.cpp:557] WARNING: [LICENSE] before returning to community mode
19/Nov/2021 18:25:02 [NtopPro.cpp:559] WARNING: [LICENSE] You can buy a permanent license at http://shop.ntop.org
19/Nov/2021 18:25:02 [NtopPro.cpp:561] WARNING: [LICENSE] or run ntopng in community mode starting
19/Nov/2021 18:25:02 [NtopPro.cpp:562] WARNING: [LICENSE] ntopng --community
19/Nov/2021 18:25:03 [NetworkInterface.cpp:3186] Cleanup interface stdin
19/Nov/2021 18:25:03 [main.cpp:234] Unable to open interface stdin [97]: PF_RING not loaded. Falling back to pcap.
19/Nov/2021 18:25:03 [Ntop.cpp:2586] Registered interface stdin [id: 0]
19/Nov/2021 18:25:03 [main.cpp:331] PID stored in file /var/run/ntopng.pid
19/Nov/2021 18:25:03 [Geolocation.cpp:149] Loaded database dbip-asn-lite.mmdb [/usr/share/ntopng/httpdocs/geoip//dbip-asn-lite.mmdb][ip_version: 6]
19/Nov/2021 18:25:03 [Geolocation.cpp:149] Loaded database dbip-city-lite.mmdb [/usr/share/ntopng/httpdocs/geoip//dbip-city-lite.mmdb][ip_version: 6]
19/Nov/2021 18:25:03 [Geolocation.cpp:95] Using geolocation provided by DB-IP (https://db-ip.com)
19/Nov/2021 18:25:03 [HTTPserver.cpp:1691] Web server dirs [/usr/share/ntopng/httpdocs][/usr/share/ntopng/scripts]
19/Nov/2021 18:25:03 [HTTPserver.cpp:1694] HTTP server listening on 3000
19/Nov/2021 18:25:03 [Utils.cpp:737] WARNING: Unable to retain privileges for privileged file writing
19/Nov/2021 18:25:03 [Utils.cpp:781] User changed to ntopng
19/Nov/2021 18:25:03 [NetworkInterface.cpp:2971] Started flow user script hooks loop on interface stdin [id: 0]...
19/Nov/2021 18:25:03 [NetworkInterface.cpp:3002] Started host user script hooks loop on interface stdin [id: 0]...
19/Nov/2021 18:25:03 [main.cpp:401] Working directory: /var/lib/ntopng
19/Nov/2021 18:25:03 [main.cpp:403] Scripts/HTML pages directory: /usr/share/ntopng
19/Nov/2021 18:25:03 [Ntop.cpp:469] Welcome to ntopng x86_64 v.5.0.211117 - (C) 1998-21 ntop.org
19/Nov/2021 18:25:03 [Ntop.cpp:479] Built on Ubuntu 20.04.3 LTS
19/Nov/2021 18:25:03 [NtopPro.cpp:763] [LICENSE] System Id: L1203060376076A90--U120306035F37E239--OL
19/Nov/2021 18:25:03 [NtopPro.cpp:764] [LICENSE] Edition: Enterprise L (Bundle)
19/Nov/2021 18:25:03 [NtopPro.cpp:765] [LICENSE] License Type: Time-Limited [Empty license file] License
19/Nov/2021 18:25:03 [NtopPro.cpp:785] [LICENSE] Validity: Until Fri Nov 19 18:35:02 2021
19/Nov/2021 18:25:03 [PeriodicActivities.cpp:106] Started periodic activities loop...
19/Nov/2021 18:25:04 [startup.lua:37] Processing startup.lua: please hold on...
19/Nov/2021 18:25:04 [startup.lua:169] [lists_utils.lua:784] Refreshing category lists...
19/Nov/2021 18:25:04 [startup.lua:169] [lists_utils.lua:420] Updating list 'Abuse.ch URLhaus' [https://urlhaus.abuse.ch/downloads/hostfile/]... OK
19/Nov/2021 18:25:05 [startup.lua:169] [lists_utils.lua:420] Updating list 'Emerging Threats' [https://rules.emergingthreats.net/fwrules/emerging-Block-IPs.txt]... OK
19/Nov/2021 18:25:05 [startup.lua:169] [lists_utils.lua:420] Updating list 'Feodo Tracker Botnet C2 IP Blocklist' [https://feodotracker.abuse.ch/downloads/ipblocklist.txt]... OK
19/Nov/2021 18:25:05 [startup.lua:169] [lists_utils.lua:420] Updating list 'NoCoin Filter List' [https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt]... OK
19/Nov/2021 18:25:06 [startup.lua:169] [lists_utils.lua:420] Updating list 'SSLBL Botnet C2 IP Blacklist' [https://sslbl.abuse.ch/blacklist/sslipblacklist.txt]... OK
19/Nov/2021 18:25:06 [startup.lua:169] [lists_utils.lua:420] Updating list 'SSLBL JA3' [https://sslbl.abuse.ch/blacklist/ja3_fingerprints.csv]... OK
19/Nov/2021 18:25:07 [startup.lua:169] [lists_utils.lua:420] Updating list 'Snort IP Block List' [https://snort.org/downloads/ip-block-list]... OK
19/Nov/2021 18:25:07 [startup.lua:169] [lists_utils.lua:717] Category Lists (1894 hosts, 3242 IPs, 100 JA3) loaded in 0 sec
19/Nov/2021 18:25:07 [startup.lua:288] Completed startup.lua
19/Nov/2021 18:25:07 [PeriodicActivities.cpp:167] Each periodic activity script will use 2 threads
19/Nov/2021 18:25:07 [NetworkInterface.cpp:3153] Started packet polling on interface stdin [id: 0]...
It seems that it can start without problems but if I open 127.0.0.1:3000 the is no webserver accessible
Since there is --net=host I've also tried to use my local IP: 192.168.178.32:3000
Have you guys tried something like this before and could someone help me and guide how run the script fritzdump.sh for ntopng running under a docker container?
I tried change container port and local port into 1054 and the docker always restart. how to fix it? my 3000 port was used by sharepoint
thank you
Hey dude
I have a Synology DS218+ with Docker.
Can I use ur Software there?
Big thanks
How do you configure maxmind geoip when using docker? I read https://github.com/ntop/ntopng/blob/dev/doc/README.geolocation.md but could find anything about docker in there.
Starting up docker image
ntop/nprobe stable b78c3cce5f23 7 weeks ago 703MB
produces the following log message...
ntopng-1 | 27/Mar/2024 18:40:44 [nprobe.c:5387] WARNING: Invalid license (/etc/nprobe.license) [Missing license file. Please read https://www.ntop.org/support/faq/license-inside-a-container]
ntopng-1 | 27/Mar/2024 18:40:44 [nprobe.c:5397] WARNING: ******************************************
ntopng-1 | 27/Mar/2024 18:40:44 [nprobe.c:5398] WARNING: ** **
ntopng-1 | 27/Mar/2024 18:40:44 [nprobe.c:5399] WARNING: ** Switching to DEMO MODE **
ntopng-1 | 27/Mar/2024 18:40:44 [nprobe.c:5400] WARNING: ** - Missing license file. Please read https://www.ntop.org/support/faq/license-inside-a-container **
... however the given url is a dead link.
Environment:
What happened:
I try to start the docker with the localtime correctly configured.
But, anytime, he use the UTC and not my localtime file indicated in the compose file
ntopng:
container_name: ntopng
image: 'docker.io/ntop/ntopng:stable'
restart: always
depends_on:
- clickhouse
- redis
- nprobe
- influxdb
volumes:
- "/usr/share/zoneinfo:/usr/share/zoneinfo:ro"
- "/etc/localtime:/etc/localtime:ro"
- "/opt/ntopng/ntopng.license:/etc/ntopng.license:ro"
- "/opt/ntopng/ntopng/config:/etc/ntopng:rw"
- "/opt/ntopng/ntopng/data:/var/lib/ntopng:rw"
environment:
- NTOP_CONFIG="/etc/ntopng/ntopng.conf"
- TZ="Europe/Zurich"
network_mode: "host"
command:
- "/etc/ntopng/ntopng.conf"
How did you reproduce it?
Modify the compose file and restart the compose with command docker compose up -d
Debug Information:
With this configuration, I have that on the shell:
dadmrossetam:ntopng/ $ sudo docker exec -ti ntopng /bin/sh
# ls -al /etc/localtime
lrwxrwxrwx 1 root root 23 May 31 15:35 /etc/localtime -> /usr/share/zoneinfo/UTC
#
I think the issue is related to the following part that is present in stable Dockerfile:
FROM ubuntu:22.04
MAINTAINER ntop.org
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && \
apt-get -y -q install wget lsb-release gnupg libelf1 && \
So, even if I try to override it, it can not work...
Well i use ntopng with docker-compose. Because of nature of docker containers every time when you do small change in docker-compose.yml. And after running command docker-compose up -d ntopng forget all settings which were done in web ui. But i also have to say that default situation even worse i.e all collected data also lost(it is solvable by moving /var/lib/ntopng to separate volume). But gui settings location not documented anywhere so not possible.
So i have question and suggestion. Please or document where exactly stored settings-> Preferences and settings->Users. Or please make possible to set volume(folder) to store it during runtime.
It is also will be very nice to have version tags in dockerhub to be able to use previous versions instead of single latest tag
17/Jul/2020 18:48:28 [Redis.cpp:99] ERROR: Connection error [Connection refused]
17/Jul/2020 18:48:29 [Redis.cpp:148] ERROR: ntopng requires redis server to be up and running
17/Jul/2020 18:48:29 [Redis.cpp:149] ERROR: Please start it and try again or use -r
17/Jul/2020 18:48:29 [Redis.cpp:150] ERROR: to specify a redis server other than the default
Starting redis-server: redis-server.
17/Jul/2020 18:48:30 [Ntop.cpp:2236] Setting local networks to 127.0.0.0/8
17/Jul/2020 18:48:30 [Redis.cpp:99] ERROR: Connection error [Connection refused]
17/Jul/2020 18:48:31 [Redis.cpp:83] Redis has disconnected, reconnecting [remaining attempts: 14]
17/Jul/2020 18:48:31 [Redis.cpp:99] ERROR: Connection error [Connection refused]
17/Jul/2020 18:48:32 [Redis.cpp:83] Redis has disconnected, reconnecting [remaining attempts: 13]
17/Jul/2020 18:48:32 [Redis.cpp:99] ERROR: Connection error [Connection refused]
When trying to use the following Dockerfile to install NTOPNG, nProbe, and Redis, nProbe container fails to start .
I am using the official Github for NTOPNG here https://github.com/ntop/docker-ntop/tree/master. (one from Readme without clickhouse) Once the Docker compose up is done installing, I ran the "docker ps -a" and see two nProbe containers running. One says up, one says restarting.
Does the office Docker image ntop/ntopng:stable already include nProbe?
if I dont run the detach and watch the startup, I see the following error
nProbe keeps restarting with error of "[nprobe.c:5572] ERROR: Unable to read config. file nprobe netmon-nprobe_collector-1 exited with code 255"
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1fee9505eebf redis:alpine "docker-entrypoint.s…" 21 minutes ago Up 4 minutes 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp netmon-redis-1
4a2c854e789f ntop/nprobe:stable "/run.sh nprobe --zm…" 21 minutes ago Restarting (255) 15 seconds ago netmon-nprobe_collector-1
4dcadf54887c ntop/ntopng:stable "/run.sh --community…" 21 minutes ago Up 4 minutes
I do not see an directory or nprobe .conf file in the nprobe container. The NTOPNG container has in /etc/nprobe.
docker exec -it 4dcadf54887c ls -la /etc/ntopng
total 20
drwxrwxr-x 3 ntopng ntopng 4096 Aug 25 10:38 .
drwxr-xr-x 1 root root 4096 Aug 28 18:13 ..
-rw-rw-r-- 1 ntopng ntopng 3087 Aug 25 10:25 ntopng.conf
drwxrwxr-x 2 ntopng ntopng 4096 Aug 25 10:38 ntopng.conf.d
-rw-rw-r-- 1 ntopng ntopng 1472 Aug 25 10:25 ntopng.conf.nprobe.sample
I cant find anything on the web that has a solution.
Did somehting change with the permissions, all I did was a compose pull and compose up and now the docker image won't start, I see this in the logs:
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/-1/top_talkers/) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/-1/alerts/) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/2/top_talkers/) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/2/alerts/) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/scripts_data) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/interface) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/interface/flow) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/system) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/system/syslog) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/interface) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/interface/interface) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/system) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/system/snmp_device) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/check_definitions) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/alert_definitions) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/http_lint) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/menu_items) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/templates) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/ts_schemas) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/modules) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/system) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/system/active_monitoring) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/system) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/system/system) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/interface) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/interface/network) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/scripts) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/interface) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/callbacks/interface/host) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/httpdocs) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/locales) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/scripts/alert_endpoints) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/3/top_talkers/) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/3/alerts/) failed [13/Permission denied]
[Utils.cpp:761] WARNING: mkdir(/var/lib/ntopng/tmp/influxdb/) failed [13/Permission denied]
Per the documentation using pfring in docker requires that the version installed on the host is the same as that installed on the container. The containers released here continually update to follow whatever version is the latest with the ubuntu 20.04 apt package. This is an issue because licensing is (relatively) static and packages installed on the host are placed in packaging holds to prevent updates.
This means that:
It would be great to have tags in the docker releases with the version of pfring in order to support containers for older pfring releases. (i.e. ntop/pfring:8.0.0-ubuntu
, ntop/pfring:7.8.0-ubuntu
, ntop/pfring:7.6.0-ubuntu
, etc)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.