Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 15 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
docker-compose.yml
docker-compose.yml
.git
.github
build
cmake-build-*
**/__pycache__
**/*.o
**/*.a
**/*.log
tests/
nDPId/
heidpi-logger-py/
heidpi-rust/
*.swp
.DS_Store
69 changes: 0 additions & 69 deletions .github/workflows/python-app.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/python-publish.yml

This file was deleted.

53 changes: 39 additions & 14 deletions Dockerfile.consumer
Original file line number Diff line number Diff line change
@@ -1,24 +1,49 @@
FROM pypy:3.9-slim-bookworm
# ---------- Build stage ----------
FROM debian:bookworm AS build
ARG CMAKE_BUILD_TYPE=Release

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential cmake pkg-config git ca-certificates \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /src
COPY heidpi-logger/ ./heidpi-logger/

RUN cmake -S heidpi-logger -B /build \
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
-DBUILD_TESTING=OFF \
-DMAXMINDDB_BUILD_BINARIES=OFF \
-DMAXMINDDB_TOOLS=OFF \
-DMAXMINDDB_INSTALL=OFF \
&& cmake --build /build --target heidpi_cpp -- -j"$(nproc)" \
&& strip /build/heidpi_cpp || true

# ---------- Runtime stage ----------
FROM debian:bookworm-slim AS runtime

RUN apt-get update && apt-get install -y --no-install-recommends \
libstdc++6 ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# non-root
RUN useradd -r -u 10001 appuser
WORKDIR /app

# Configs (aus Repo-Root)
COPY config.yml /app/config.yml

COPY --from=build /build/heidpi_cpp /usr/local/bin/app

ENV WRITE="/var/log" \
SHOW_FLOW_EVENTS=1 \
SHOW_PACKET_EVENTS=0 \
SHOW_PACKET_EVENTS=1 \
SHOW_ERROR_EVENTS=0 \
SHOW_DAEMON_EVENTS=0 \
UNIX="" \
PORT=7000 \
HOST=""

WORKDIR /usr/src/app

COPY heidpi ./ \
config.yml ./ \
LICENSE ./ \
README.md ./ \
requirements.txt ./ \
pyproject.toml ./

RUN pip install . \
pip install -r requirements.txt
USER appuser

CMD [ "heiDPI"]
ENTRYPOINT ["/usr/local/bin/app"]
CMD ["--config","/app/config.yml"]
56 changes: 8 additions & 48 deletions README.consumer.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,6 @@
[nDPId](https://github.com/utoni/nDPId) Docker Image for deep packet inspection. As described in [nDPId](https://github.com/utoni/nDPId/blob/main/README.md), we split the image into producer and consumer image for a more generic purpose. For the producer, the image starts the UNIX and UDP socket and nDPId respectively. Via environment variables, users can adapt the nDPId daemon and nDPIsrvd. As by now, we support all current nDPId parameters.

<table>
<tr>
<td><b>Live Notebook</b></td>
<td>
<a href="https://mybinder.org/v2/gh/heidpi/heiDPI-tutorials/main?filepath=demo_notebook.ipynb">
<img src="https://img.shields.io/badge/notebook-launch-blue?logo=jupyter&style=for-the-badge" alt="live notebook" />
</a>
</td>
</tr>
<tr>
<td><b>Latest Release</b></td>
<td>
<a href="https://pypi.python.org/pypi/heidpi">
<img src="https://img.shields.io/pypi/v/heidpi.svg?logo=pypi&style=for-the-badge" alt="latest release" />
</a>
</td>
</tr>
<tr>
<td><b>Supported Versions</b></td>
<td>
<a href="https://pypi.org/project/heidpi/">
<img src="https://img.shields.io/pypi/pyversions/heidpi?logo=python&style=for-the-badge" alt="python3" />
</a>
<a href="https://pypi.org/project/heidpi/">
<img src="https://img.shields.io/badge/pypy-3.7%20%7C%203.8%20%7C%203.9-blue?logo=pypy&style=for-the-badge" alt="pypy3" />
</a>
</td>
</tr>
<tr>
<td><b>Project License</b></td>
<td>
Expand All @@ -59,32 +32,19 @@
Install using PyPi:

```sh
pip install heiDPI
cd ./heidpi-logger && cmake . && make
```

Use the CLI for quick usage:

```
> heiDPI -h
usage: heiDPI [-h] [--host HOST | --unix UNIX] [--port PORT] [--write WRITE] [--config CONFIG] [--show-daemon-events SHOW_DAEMON_EVENTS] [--show-packet-events SHOW_PACKET_EVENTS] [--show-error-events SHOW_ERROR_EVENTS] [--show-flow-events SHOW_FLOW_EVENTS]

heiDPI Python Interface

options:
-h, --help show this help message and exit
--host HOST nDPIsrvd host IP (default: None)
--unix UNIX nDPIsrvd unix socket path (default: None)
--port PORT nDPIsrvd TCP port (default: 7000)
--write WRITE heiDPI write path for logs (default: /var/log)
--config CONFIG heiDPI write path for logs (default: /home/smachmeier/projects/emcl/heiDPI/config.yml)
--show-daemon-events SHOW_DAEMON_EVENTS
heiDPI shows daemon events (default: 0)
--show-packet-events SHOW_PACKET_EVENTS
heiDPI shows packet events (default: 0)
--show-error-events SHOW_ERROR_EVENTS
heiDPI shows error events (default: 0)
--show-flow-events SHOW_FLOW_EVENTS
heiDPI shows flow events (default: 0)
> ./heidpi_cpp -h
usage: heidpi_cpp [-h] [--host HOST | --unix UNIX] [--port PORT] [--write WRITE]
[--config CONFIG] [--filter FILTER]
[--show-daemon-events]
[--show-packet-events]
[--show-error-events]
[--show-flow-events]
```

### Prerequisities
Expand Down
19 changes: 0 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,6 @@
</a>
</td>
</tr>
<tr>
<td><b>Latest Release</b></td>
<td>
<a href="https://pypi.python.org/pypi/heidpi">
<img src="https://img.shields.io/pypi/v/heidpi.svg?logo=pypi&style=for-the-badge" alt="latest release" />
</a>
</td>
</tr>
<tr>
<td><b>Supported Versions</b></td>
<td>
<a href="https://pypi.org/project/heidpi/">
<img src="https://img.shields.io/pypi/pyversions/heidpi?logo=python&style=for-the-badge" alt="python3" />
</a>
<a href="https://pypi.org/project/heidpi/">
<img src="https://img.shields.io/badge/pypy-3.7%20%7C%203.8%20%7C%203.9-blue?logo=pypy&style=for-the-badge" alt="pypy3" />
</a>
</td>
</tr>
<tr>
<td><b>Project License</b></td>
<td>
Expand Down
31 changes: 0 additions & 31 deletions config.toml

This file was deleted.

10 changes: 5 additions & 5 deletions config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
appName: heiDPI

logging:
level: INFO
level: ERROR
encoding: utf-8
format: "%(asctime)s %(levelname)s:%(message)s"
datefmt: "%Y-%m-%dT%I:%M:%S"
Expand All @@ -28,26 +28,26 @@ flow_event:
# - city
# - traits
# - postal
threads: 4
# threads: 4

daemon_event:
ignore_fields: []
daemon_event_name:
- init
- status
filename: daemon_event
threads: 4
# threads: 4

packet_event:
ignore_fields: []
packet_event_name:
- packet-flow
filename: packet_event
threads: 4
# threads: 4

error_event:
ignore_fields: []
error_event_name:
- error-flow
filename: error_event
threads: 4
# threads: 4
Loading