Added tutorial about container to README
This commit is contained in:
30
Docker/Dockerfile/entrypoint.sh
Normal file
30
Docker/Dockerfile/entrypoint.sh
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Default to 1600 if not provided
|
||||||
|
PUID="${PUID:-1600}"
|
||||||
|
PGID="${PGID:-1600}"
|
||||||
|
USER="${USER:-apiusr}"
|
||||||
|
GROUP="${USER:-apiusr}"
|
||||||
|
CHOWNPATH="/netflowParser"
|
||||||
|
|
||||||
|
# Create group if missing
|
||||||
|
if ! getent group "$GROUP" >/dev/null 2>&1; then
|
||||||
|
addgroup -g "$PGID" "$GROUP"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create user if missing
|
||||||
|
if ! id -u "$USER" >/dev/null 2>&1; then
|
||||||
|
adduser -D -u "$PUID" -G "$GROUP" "$USER"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Download IP2Location database
|
||||||
|
if [[ -n "$IP2LOC_TOKEN" ]]; then
|
||||||
|
wget -O "$CHOWNPATH"/IP2LOCATION-LITE-DB9.BIN "https://www.ip2location.com/download/?token="$IP2LOC_TOKEN"&file=DB9LITEBIN"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fix permissions (only do this on /app/API)
|
||||||
|
chown -R "$PUID:$PGID" "$CHOWNPATH"
|
||||||
|
|
||||||
|
# Drop privileges & run command
|
||||||
|
exec su-exec "$PUID:$PGID" "$@"
|
||||||
@@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
It works.
|
It works.
|
||||||
|
|
||||||
|
## IP2Location-DB
|
||||||
|
|
||||||
|
To get IP2Locatio-Lite-DB go to [lite.ip2location](https://lite.ip2location.com/) and create a account.
|
||||||
|
|
||||||
|
Then you need to get your **Token**. You can find it [here](https://lite.ip2location.com/database-download) and under **Download Token**
|
||||||
|
|
||||||
|
Then pass that token as ```IP2LOC_TOKEN``` environment variable to the container
|
||||||
|
|
||||||
## Python script
|
## Python script
|
||||||
Install required modules with
|
Install required modules with
|
||||||
```
|
```
|
||||||
@@ -18,3 +26,4 @@ Second is when there are a ton of flows that need to be collected. More flows ak
|
|||||||
## sysctl.d
|
## sysctl.d
|
||||||
Place it in /etc/sysctl.d/ and apply with ```sysctl -p```
|
Place it in /etc/sysctl.d/ and apply with ```sysctl -p```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
netflow==0.12.2
|
netflow==0.12.2
|
||||||
#socket==
|
|
||||||
#json==
|
|
||||||
influxdb-client==1.48.0
|
influxdb-client==1.48.0
|
||||||
ipaddress==1.0.23
|
ipaddress==1.0.23
|
||||||
typing==3.7.4.3
|
typing==3.7.4.3
|
||||||
|
|||||||
Reference in New Issue
Block a user