Compare commits
325 Commits
6a20128960
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1bd6723ab9 | ||
|
|
73c8965637 | ||
|
|
dc7ff8317c | ||
|
|
cd1ce2a3d8 | ||
|
|
c6de72467e | ||
|
|
6ee9064676 | ||
|
|
2c75285148 | ||
|
|
ecb5c1455b | ||
|
|
17f495c444 | ||
|
|
e7f25560c8 | ||
|
|
fc4d32ebe7 | ||
|
|
b47325d06a | ||
|
|
436ac6de49 | ||
|
|
c1bd611e57 | ||
|
|
edde2596b5 | ||
|
|
da9d37c718 | ||
|
|
5bcb727305 | ||
|
|
2dc688b16c | ||
|
|
0ac9fd79b3 | ||
|
|
3d17dc47b5 | ||
|
|
ef2e7886c4 | ||
|
|
c8f3a84b92 | ||
|
|
9688fee2d2 | ||
|
|
2dcd9eda19 | ||
|
|
24187495e1 | ||
|
|
c27d25d4ab | ||
|
|
93a2dad2eb | ||
|
|
b235863644 | ||
|
|
f387f8c5b6 | ||
|
|
5af760f5ee | ||
|
|
d93a3981fa | ||
|
|
fbb4a2f8b4 | ||
|
|
54bce6505b | ||
|
|
6da47cc830 | ||
|
|
9cabbf3622 | ||
|
|
6c28a08bee | ||
|
|
86e3decd4e | ||
|
|
e14e0bb9e8 | ||
|
|
b6023d1373 | ||
|
|
1812cc8ef8 | ||
|
|
5df39f984a | ||
|
|
d007ed711a | ||
|
|
61824abb9f | ||
|
|
33c5548fe1 | ||
|
|
fd41c395ae | ||
|
|
1a980844f0 | ||
|
|
82e018e284 | ||
|
|
e0e1233b1c | ||
|
|
74677f940e | ||
|
|
21a4d20579 | ||
|
|
9634e4e0f7 | ||
|
|
00a47ab5d3 | ||
|
|
59b417705e | ||
|
|
525d082f3d | ||
|
|
ba3481759b | ||
|
|
7125cea29b | ||
|
|
8586c5a307 | ||
|
|
0d81315809 | ||
|
|
8f193f1e2c | ||
|
|
b1eef8aa09 | ||
|
|
2da17f272c | ||
|
|
7bcb4586b2 | ||
|
|
d3326b3362 | ||
|
|
b9d3f430fe | ||
|
|
067336dcc1 | ||
|
|
8acb0a876a | ||
|
|
d1be41eca4 | ||
|
|
00e953a7ce | ||
|
|
b9ef9ad041 | ||
|
|
e90fbf17d3 | ||
|
|
139447b253 | ||
|
|
fa9fc2c8e3 | ||
|
|
30071c6848 | ||
|
|
b0bd3c8191 | ||
|
|
c753da9e15 | ||
|
|
4770ee5942 | ||
|
|
5cd53bc8f9 | ||
|
|
5e47ccc9ef | ||
|
|
f5d7c0f9a0 | ||
|
|
35b7e80be4 | ||
|
|
07eeac0a0b | ||
|
|
240d86bf1e | ||
|
|
274fd50a92 | ||
|
|
bbf49c3686 | ||
|
|
e3458630ba | ||
|
|
2f6f1e49e9 | ||
|
|
4f5a40ffce | ||
|
|
f5aea55b29 | ||
|
|
e3e7e2f52e | ||
|
|
872ac1ce0f | ||
|
|
ebeb7a07af | ||
|
|
5c14b34a8b | ||
|
|
f0abd500d9 | ||
|
|
8503cb86f1 | ||
|
|
5f0b670a82 | ||
|
|
9df814e351 | ||
|
|
88509ce8c2 | ||
|
|
995c371f48 | ||
|
|
aee5e04b9f | ||
|
|
e0c96052bb | ||
|
|
fd5235dd0a | ||
|
|
f3de66a287 | ||
|
|
9a4fb35ea5 | ||
|
|
a1ad904042 | ||
|
|
81ff1da756 | ||
|
|
85c9b0b99b | ||
|
|
4ccac66a73 | ||
|
|
c7b9fdaff2 | ||
|
|
c7dcc20a1d | ||
|
|
bb365a5e81 | ||
|
|
e2633d0251 | ||
|
|
09c40e76b2 | ||
|
|
abc3e71440 | ||
|
|
d13596c35c | ||
|
|
7d5dcf061c | ||
|
|
6206e483a9 | ||
|
|
f1ecc61de3 | ||
|
|
92a6a3a916 | ||
|
|
8a89f3b340 | ||
|
|
a93e87493f | ||
|
|
c7032bceba | ||
|
|
0cd7528284 | ||
|
|
2309b8eb3f | ||
|
|
dbd1bdabc2 | ||
|
|
093d595fc5 | ||
|
|
c38758d61a | ||
|
|
6034b12af6 | ||
|
|
972654dc78 | ||
|
|
ec417b0dac | ||
|
|
2e9352dc12 | ||
|
|
566b263d0a | ||
|
|
61b42b4fea | ||
|
|
a45de018fb | ||
|
|
bfe6987867 | ||
|
|
b6567ab5fc | ||
|
|
f71c2fbe94 | ||
|
|
aeb03f50ba | ||
|
|
734db423ee | ||
|
|
4f47dbfe14 | ||
|
|
d23bf45310 | ||
|
|
9c366881f1 | ||
|
|
9dd482618b | ||
|
|
84cc01566d | ||
|
|
ac7b912b45 | ||
|
|
62852f1b2f | ||
|
|
b659a0f06d | ||
|
|
fb3620a378 | ||
|
|
9d56e13818 | ||
|
|
43c5a11271 | ||
|
|
ac957ce599 | ||
|
|
3567906fcd | ||
|
|
be6801d98f | ||
|
|
bb9b242d0a | ||
|
|
5f27d3b9aa | ||
|
|
93af0e9d19 | ||
|
|
398e2a896f | ||
|
|
a98bac331d | ||
|
|
9f6086e5cf | ||
|
|
c5a1f19567 | ||
|
|
6d70a8a71d | ||
|
|
4161261c43 | ||
|
|
179821a527 | ||
|
|
2028b1a6e3 | ||
|
|
5b871865db | ||
|
|
76bcec335d | ||
|
|
8483a741b4 | ||
|
|
68c8e16828 | ||
|
|
76150b2ca7 | ||
|
|
5cf8a25bae | ||
|
|
593aa16f17 | ||
|
|
af9793c2ed | ||
|
|
552d2a8286 | ||
|
|
7822b11d51 | ||
|
|
cbe5a4a732 | ||
|
|
58de31d0ea | ||
|
|
5c06dc68c6 | ||
|
|
44d65cca96 | ||
|
|
71e0d13bef | ||
|
|
30269a6a73 | ||
|
|
6374219e05 | ||
|
|
6e745fc6d1 | ||
|
|
85aa04c490 | ||
|
|
1fd8d97d56 | ||
|
|
286d5555d2 | ||
|
|
57096a9258 | ||
|
|
c08eb1dbba | ||
|
|
746f1a8922 | ||
|
|
0845b7f445 | ||
|
|
a6fffe06b7 | ||
|
|
ea8cea16c5 | ||
|
|
5452b7287b | ||
|
|
80d7ef7f24 | ||
|
|
dc4da5b4c9 | ||
|
|
59477e7b38 | ||
|
|
6dd7251c84 | ||
|
|
c52e44f90c | ||
|
|
db18ca76b4 | ||
|
|
288427c939 | ||
|
|
90a07c61eb | ||
|
|
13341e35c9 | ||
|
|
4c92a941a8 | ||
|
|
4cec88aaad | ||
|
|
031d810566 | ||
|
|
b806f84946 | ||
|
|
7c90c2e93c | ||
|
|
cb69990734 | ||
|
|
7037cf1bc6 | ||
|
|
a27ee5c2f2 | ||
|
|
c3c570ef5f | ||
|
|
71646e1645 | ||
|
|
2215272e78 | ||
|
|
dde542c484 | ||
|
|
23a0fac973 | ||
|
|
2fdeccebe1 | ||
|
|
db5381db14 | ||
|
|
f1fbc47508 | ||
|
|
2a9d352322 | ||
|
|
51aa3d4a2e | ||
|
|
70373b1fbd | ||
|
|
e7ed9e0896 | ||
|
|
79887f0bd7 | ||
|
|
a6bc96d2dd | ||
|
|
8edef9e852 | ||
|
|
1e63cec37c | ||
|
|
ff96d38339 | ||
|
|
537be0f848 | ||
|
|
b89917ca3e | ||
|
|
daea3a2cd7 | ||
|
|
b86f636b12 | ||
|
|
0b08995223 | ||
|
|
f42186b616 | ||
|
|
bc9fb6bcde | ||
|
|
88f889f03e | ||
|
|
533c99eb61 | ||
|
|
afa257f245 | ||
|
|
78ab0fbd2d | ||
|
|
64e4586be6 | ||
|
|
2f7d9a02ae | ||
|
|
d29700acf8 | ||
|
|
75072dad5f | ||
|
|
19b1fc960c | ||
|
|
63d6410bb4 | ||
|
|
b89a44d0ec | ||
|
|
929eb1626b | ||
|
|
8cb1836777 | ||
|
|
512dedff4e | ||
|
|
2a2782b4c7 | ||
|
|
b726518f87 | ||
|
|
274becab97 | ||
|
|
869f28b036 | ||
|
|
f81a1b93f9 | ||
|
|
58fe531393 | ||
|
|
8da136f192 | ||
|
|
50f9277e5e | ||
|
|
7ca9d2a6c5 | ||
|
|
b76272bbdc | ||
|
|
fba5359839 | ||
|
|
55171e06b6 | ||
|
|
22aa995fc5 | ||
|
|
af80cff8e0 | ||
|
|
647defb4cc | ||
|
|
2148a7ffc5 | ||
|
|
ea5e2361da | ||
|
|
0079ece1e2 | ||
|
|
61de63771b | ||
|
|
57f3d6f7ab | ||
|
|
2e76ff1df7 | ||
|
|
8d4c7ea074 | ||
|
|
b4027b6eee | ||
|
|
b36b3be176 | ||
|
|
7ddb7d293e | ||
|
|
40341a856f | ||
|
|
304d4d0837 | ||
|
|
a353acff2d | ||
|
|
6afa52e604 | ||
|
|
5962312afd | ||
|
|
3ba410053e | ||
|
|
a6ac492d76 | ||
|
|
4d148f35ce | ||
|
|
9b0f45b88b | ||
|
|
84183f09ad | ||
|
|
5dba0f1ca1 | ||
|
|
095372a22b | ||
|
|
d8c2dc0563 | ||
|
|
cfffaf4503 | ||
|
|
01b64cce66 | ||
|
|
63c4b0d7c2 | ||
|
|
5ec35aa50e | ||
|
|
ededd39d5b | ||
|
|
15bc1635c2 | ||
|
|
74a67e3b38 | ||
|
|
52b747be0b | ||
|
|
d2c28f6a28 | ||
|
|
816b9076ae | ||
|
|
fb02774814 | ||
|
|
26632277d4 | ||
|
|
dfc64fd85f | ||
|
|
b44369a493 | ||
|
|
8ada2c36f9 | ||
|
|
c4a041e6e1 | ||
|
|
170aeb041f | ||
|
|
fe69972caa | ||
|
|
32f9111f66 | ||
|
|
bb35417213 | ||
|
|
fe69bc4afd | ||
|
|
05890b3ddf | ||
|
|
c27886521a | ||
|
|
7f74c2d6f3 | ||
|
|
5a63b7243b | ||
|
|
0897c05200 | ||
|
|
7a3bf6716c | ||
|
|
edd5bd27b0 | ||
|
|
3b7830b922 | ||
|
|
356cacab2b | ||
|
|
d12ffb31ec | ||
|
|
f70d3f3b76 | ||
|
|
27899469af | ||
|
|
59c7d7b415 | ||
|
|
0851680ef6 | ||
|
|
1af19fe9fd | ||
|
|
ce8bb53bc8 | ||
|
|
5636a159b8 | ||
|
|
05f083730b | ||
|
|
3441f77a78 | ||
|
|
d6bcb27c42 |
@@ -1,4 +1,4 @@
|
|||||||
# DO NOT MODIFY THIS FILE DIRECTLY. IT IS AUTO-GENERATED BY .devcontainer/scripts/generate-dockerfile.sh
|
# DO NOT MODIFY THIS FILE DIRECTLY. IT IS AUTO-GENERATED BY .devcontainer/scripts/generate-configs.sh
|
||||||
|
|
||||||
# ---/Dockerfile---
|
# ---/Dockerfile---
|
||||||
# The NetAlertX Dockerfile has 3 stages:
|
# The NetAlertX Dockerfile has 3 stages:
|
||||||
@@ -35,7 +35,7 @@ RUN apk add --no-cache bash shadow python3 python3-dev gcc musl-dev libffi-dev o
|
|||||||
# Create virtual environment owned by root, but readable by everyone else. This makes it easy to copy
|
# Create virtual environment owned by root, but readable by everyone else. This makes it easy to copy
|
||||||
# into hardened stage without worrying about permissions and keeps image size small. Keeping the commands
|
# into hardened stage without worrying about permissions and keeps image size small. Keeping the commands
|
||||||
# together makes for a slightly smaller image size.
|
# together makes for a slightly smaller image size.
|
||||||
RUN pip install -r /tmp/requirements.txt && \
|
RUN pip install --no-cache-dir -r /tmp/requirements.txt && \
|
||||||
chmod -R u-rwx,g-rwx /opt
|
chmod -R u-rwx,g-rwx /opt
|
||||||
|
|
||||||
# second stage is the main runtime stage with just the minimum required to run the application
|
# second stage is the main runtime stage with just the minimum required to run the application
|
||||||
@@ -46,14 +46,16 @@ ARG INSTALL_DIR=/app
|
|||||||
|
|
||||||
# NetAlertX app directories
|
# NetAlertX app directories
|
||||||
ENV NETALERTX_APP=${INSTALL_DIR}
|
ENV NETALERTX_APP=${INSTALL_DIR}
|
||||||
ENV NETALERTX_CONFIG=${NETALERTX_APP}/config
|
ENV NETALERTX_DATA=/data
|
||||||
|
ENV NETALERTX_CONFIG=${NETALERTX_DATA}/config
|
||||||
ENV NETALERTX_FRONT=${NETALERTX_APP}/front
|
ENV NETALERTX_FRONT=${NETALERTX_APP}/front
|
||||||
|
ENV NETALERTX_PLUGINS=${NETALERTX_FRONT}/plugins
|
||||||
ENV NETALERTX_SERVER=${NETALERTX_APP}/server
|
ENV NETALERTX_SERVER=${NETALERTX_APP}/server
|
||||||
ENV NETALERTX_API=${NETALERTX_APP}/api
|
ENV NETALERTX_API=/tmp/api
|
||||||
ENV NETALERTX_DB=${NETALERTX_APP}/db
|
ENV NETALERTX_DB=${NETALERTX_DATA}/db
|
||||||
ENV NETALERTX_DB_FILE=${NETALERTX_DB}/app.db
|
ENV NETALERTX_DB_FILE=${NETALERTX_DB}/app.db
|
||||||
ENV NETALERTX_BACK=${NETALERTX_APP}/back
|
ENV NETALERTX_BACK=${NETALERTX_APP}/back
|
||||||
ENV NETALERTX_LOG=${NETALERTX_APP}/log
|
ENV NETALERTX_LOG=/tmp/log
|
||||||
ENV NETALERTX_PLUGINS_LOG=${NETALERTX_LOG}/plugins
|
ENV NETALERTX_PLUGINS_LOG=${NETALERTX_LOG}/plugins
|
||||||
ENV NETALERTX_CONFIG_FILE=${NETALERTX_CONFIG}/app.conf
|
ENV NETALERTX_CONFIG_FILE=${NETALERTX_CONFIG}/app.conf
|
||||||
|
|
||||||
@@ -69,32 +71,37 @@ ENV LOG_APP_PHP_ERRORS=${NETALERTX_LOG}/app.php_errors.log
|
|||||||
ENV LOG_EXECUTION_QUEUE=${NETALERTX_LOG}/execution_queue.log
|
ENV LOG_EXECUTION_QUEUE=${NETALERTX_LOG}/execution_queue.log
|
||||||
ENV LOG_REPORT_OUTPUT_JSON=${NETALERTX_LOG}/report_output.json
|
ENV LOG_REPORT_OUTPUT_JSON=${NETALERTX_LOG}/report_output.json
|
||||||
ENV LOG_STDOUT=${NETALERTX_LOG}/stdout.log
|
ENV LOG_STDOUT=${NETALERTX_LOG}/stdout.log
|
||||||
ENV LOG_CROND=${NETALERTX_LOG}/crond.log
|
ENV LOG_CRON=${NETALERTX_LOG}/cron.log
|
||||||
|
ENV LOG_NGINX_ERROR=${NETALERTX_LOG}/nginx-error.log
|
||||||
|
|
||||||
# System Services configuration files
|
# System Services configuration files
|
||||||
|
ENV ENTRYPOINT_CHECKS=/entrypoint.d
|
||||||
ENV SYSTEM_SERVICES=/services
|
ENV SYSTEM_SERVICES=/services
|
||||||
ENV SYSTEM_SERVICES_SCRIPTS=${SYSTEM_SERVICES}/scripts
|
ENV SYSTEM_SERVICES_SCRIPTS=${SYSTEM_SERVICES}/scripts
|
||||||
ENV SYSTEM_SERVICES_CONFIG=${SYSTEM_SERVICES}/config
|
ENV SYSTEM_SERVICES_CONFIG=${SYSTEM_SERVICES}/config
|
||||||
ENV SYSTEM_NGINX_CONFIG=${SYSTEM_SERVICES_CONFIG}/nginx
|
ENV SYSTEM_NGINX_CONFIG=${SYSTEM_SERVICES_CONFIG}/nginx
|
||||||
ENV SYSTEM_NGINX_CONFIG_FILE=${SYSTEM_NGINX_CONFIG}/nginx.conf
|
ENV SYSTEM_NGINX_CONFIG_TEMPLATE=${SYSTEM_NGINX_CONFIG}/netalertx.conf.template
|
||||||
|
ENV SYSTEM_SERVICES_CONFIG_CRON=${SYSTEM_SERVICES_CONFIG}/cron
|
||||||
|
ENV SYSTEM_SERVICES_ACTIVE_CONFIG=/tmp/nginx/active-config
|
||||||
|
ENV SYSTEM_SERVICES_ACTIVE_CONFIG_FILE=${SYSTEM_SERVICES_ACTIVE_CONFIG}/nginx.conf
|
||||||
ENV SYSTEM_SERVICES_PHP_FOLDER=${SYSTEM_SERVICES_CONFIG}/php
|
ENV SYSTEM_SERVICES_PHP_FOLDER=${SYSTEM_SERVICES_CONFIG}/php
|
||||||
ENV SYSTEM_SERVICES_PHP_FPM_D=${SYSTEM_SERVICES_PHP_FOLDER}/php-fpm.d
|
ENV SYSTEM_SERVICES_PHP_FPM_D=${SYSTEM_SERVICES_PHP_FOLDER}/php-fpm.d
|
||||||
ENV SYSTEM_SERVICES_CROND=${SYSTEM_SERVICES_CONFIG}/crond
|
ENV SYSTEM_SERVICES_RUN=/tmp/run
|
||||||
ENV SYSTEM_SERVICES_RUN=${SYSTEM_SERVICES}/run
|
|
||||||
ENV SYSTEM_SERVICES_RUN_TMP=${SYSTEM_SERVICES_RUN}/tmp
|
ENV SYSTEM_SERVICES_RUN_TMP=${SYSTEM_SERVICES_RUN}/tmp
|
||||||
ENV SYSTEM_SERVICES_RUN_LOG=${SYSTEM_SERVICES_RUN}/logs
|
ENV SYSTEM_SERVICES_RUN_LOG=${SYSTEM_SERVICES_RUN}/logs
|
||||||
ENV PHP_FPM_CONFIG_FILE=${SYSTEM_SERVICES_PHP_FOLDER}/php-fpm.conf
|
ENV PHP_FPM_CONFIG_FILE=${SYSTEM_SERVICES_PHP_FOLDER}/php-fpm.conf
|
||||||
ENV READ_ONLY_FOLDERS="${NETALERTX_BACK} ${NETALERTX_FRONT} ${NETALERTX_SERVER} ${SYSTEM_SERVICES} \
|
ENV READ_ONLY_FOLDERS="${NETALERTX_BACK} ${NETALERTX_FRONT} ${NETALERTX_SERVER} ${SYSTEM_SERVICES} \
|
||||||
${SYSTEM_SERVICES_CONFIG}"
|
${SYSTEM_SERVICES_CONFIG} ${ENTRYPOINT_CHECKS}"
|
||||||
ENV READ_WRITE_FOLDERS="${NETALERTX_CONFIG} ${NETALERTX_DB} ${NETALERTX_API} ${NETALERTX_LOG} \
|
ENV READ_WRITE_FOLDERS="${NETALERTX_DATA} ${NETALERTX_CONFIG} ${NETALERTX_DB} ${NETALERTX_API} \
|
||||||
${NETALERTX_PLUGINS_LOG} ${SYSTEM_SERVICES_RUN} ${SYSTEM_SERVICES_RUN_TMP} \
|
${NETALERTX_LOG} ${NETALERTX_PLUGINS_LOG} ${SYSTEM_SERVICES_RUN} \
|
||||||
${SYSTEM_SERVICES_RUN_LOG}"
|
${SYSTEM_SERVICES_RUN_TMP} ${SYSTEM_SERVICES_RUN_LOG} \
|
||||||
|
${SYSTEM_SERVICES_ACTIVE_CONFIG}"
|
||||||
|
|
||||||
#Python environment
|
#Python environment
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
ENV VIRTUAL_ENV=/opt/venv
|
ENV VIRTUAL_ENV=/opt/venv
|
||||||
ENV VIRTUAL_ENV_BIN=/opt/venv/bin
|
ENV VIRTUAL_ENV_BIN=/opt/venv/bin
|
||||||
ENV PYTHONPATH=${NETALERTX_APP}:${NETALERTX_SERVER}:${VIRTUAL_ENV}/lib/python3.12/site-packages
|
ENV PYTHONPATH=${NETALERTX_APP}:${NETALERTX_SERVER}:${NETALERTX_PLUGINS}:${VIRTUAL_ENV}/lib/python3.12/site-packages
|
||||||
ENV PATH="${SYSTEM_SERVICES}:${VIRTUAL_ENV_BIN}:$PATH"
|
ENV PATH="${SYSTEM_SERVICES}:${VIRTUAL_ENV_BIN}:$PATH"
|
||||||
|
|
||||||
# App Environment
|
# App Environment
|
||||||
@@ -102,8 +109,7 @@ ENV LISTEN_ADDR=0.0.0.0
|
|||||||
ENV PORT=20211
|
ENV PORT=20211
|
||||||
ENV NETALERTX_DEBUG=0
|
ENV NETALERTX_DEBUG=0
|
||||||
ENV VENDORSPATH=/app/back/ieee-oui.txt
|
ENV VENDORSPATH=/app/back/ieee-oui.txt
|
||||||
ENV VENDORSPATH_NEWEST=/services/run/tmp/ieee-oui.txt
|
ENV VENDORSPATH_NEWEST=${SYSTEM_SERVICES_RUN_TMP}/ieee-oui.txt
|
||||||
ENV PYTHONPATHPATH="${NETALERTX_APP}:${VIRTUAL_ENV}/bin:${PATH}"
|
|
||||||
ENV ENVIRONMENT=alpine
|
ENV ENVIRONMENT=alpine
|
||||||
ENV READ_ONLY_USER=readonly READ_ONLY_GROUP=readonly
|
ENV READ_ONLY_USER=readonly READ_ONLY_GROUP=readonly
|
||||||
ENV NETALERTX_USER=netalertx NETALERTX_GROUP=netalertx
|
ENV NETALERTX_USER=netalertx NETALERTX_GROUP=netalertx
|
||||||
@@ -113,7 +119,7 @@ ENV LANG=C.UTF-8
|
|||||||
RUN apk add --no-cache bash mtr libbsd zip lsblk tzdata curl arp-scan iproute2 iproute2-ss nmap \
|
RUN apk add --no-cache bash mtr libbsd zip lsblk tzdata curl arp-scan iproute2 iproute2-ss nmap \
|
||||||
nmap-scripts traceroute nbtscan net-tools net-snmp-tools bind-tools awake ca-certificates \
|
nmap-scripts traceroute nbtscan net-tools net-snmp-tools bind-tools awake ca-certificates \
|
||||||
sqlite php83 php83-fpm php83-cgi php83-curl php83-sqlite3 php83-session python3 envsubst \
|
sqlite php83 php83-fpm php83-cgi php83-curl php83-sqlite3 php83-session python3 envsubst \
|
||||||
nginx shadow && \
|
nginx supercronic shadow && \
|
||||||
rm -Rf /var/cache/apk/* && \
|
rm -Rf /var/cache/apk/* && \
|
||||||
rm -Rf /etc/nginx && \
|
rm -Rf /etc/nginx && \
|
||||||
addgroup -g 20211 ${NETALERTX_GROUP} && \
|
addgroup -g 20211 ${NETALERTX_GROUP} && \
|
||||||
@@ -127,11 +133,15 @@ COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} install/production-filesystem/
|
|||||||
COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} --chmod=755 back ${NETALERTX_BACK}
|
COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} --chmod=755 back ${NETALERTX_BACK}
|
||||||
COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} --chmod=755 front ${NETALERTX_FRONT}
|
COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} --chmod=755 front ${NETALERTX_FRONT}
|
||||||
COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} --chmod=755 server ${NETALERTX_SERVER}
|
COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} --chmod=755 server ${NETALERTX_SERVER}
|
||||||
RUN install -d -o ${NETALERTX_USER} -g ${NETALERTX_GROUP} -m 755 ${NETALERTX_API} \
|
|
||||||
${NETALERTX_LOG} ${SYSTEM_SERVICES_RUN_TMP} ${SYSTEM_SERVICES_RUN_LOG} && \
|
# Create required folders with correct ownership and permissions
|
||||||
|
RUN install -d -o ${NETALERTX_USER} -g ${NETALERTX_GROUP} -m 700 ${READ_WRITE_FOLDERS} && \
|
||||||
sh -c "find ${NETALERTX_APP} -type f \( -name '*.sh' -o -name 'speedtest-cli' \) \
|
sh -c "find ${NETALERTX_APP} -type f \( -name '*.sh' -o -name 'speedtest-cli' \) \
|
||||||
-exec chmod 750 {} \;"
|
-exec chmod 750 {} \;"
|
||||||
|
|
||||||
|
# Copy version information into the image
|
||||||
|
COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} .[V]ERSION ${NETALERTX_APP}/.VERSION
|
||||||
|
|
||||||
# Copy the virtualenv from the builder stage
|
# Copy the virtualenv from the builder stage
|
||||||
COPY --from=builder --chown=20212:20212 ${VIRTUAL_ENV} ${VIRTUAL_ENV}
|
COPY --from=builder --chown=20212:20212 ${VIRTUAL_ENV} ${VIRTUAL_ENV}
|
||||||
|
|
||||||
@@ -140,19 +150,26 @@ COPY --from=builder --chown=20212:20212 ${VIRTUAL_ENV} ${VIRTUAL_ENV}
|
|||||||
# This is done after the copy of the venv to ensure the venv is in place
|
# This is done after the copy of the venv to ensure the venv is in place
|
||||||
# although it may be quicker to do it before the copy, it keeps the image
|
# although it may be quicker to do it before the copy, it keeps the image
|
||||||
# layers smaller to do it after.
|
# layers smaller to do it after.
|
||||||
RUN apk add libcap && \
|
RUN if [ -f '.VERSION' ]; then \
|
||||||
|
cp '.VERSION' "${NETALERTX_APP}/.VERSION"; \
|
||||||
|
else \
|
||||||
|
echo "DEVELOPMENT 00000000" > "${NETALERTX_APP}/.VERSION"; \
|
||||||
|
fi && \
|
||||||
|
chown 20212:20212 "${NETALERTX_APP}/.VERSION" && \
|
||||||
|
apk add --no-cache libcap && \
|
||||||
setcap cap_net_raw+ep /bin/busybox && \
|
setcap cap_net_raw+ep /bin/busybox && \
|
||||||
setcap cap_net_raw,cap_net_admin+eip /usr/bin/nmap && \
|
setcap cap_net_raw,cap_net_admin+eip /usr/bin/nmap && \
|
||||||
setcap cap_net_raw,cap_net_admin+eip /usr/bin/arp-scan && \
|
setcap cap_net_raw,cap_net_admin+eip /usr/bin/arp-scan && \
|
||||||
setcap cap_net_raw,cap_net_admin,cap_net_bind_service+eip /usr/bin/nbtscan && \
|
setcap cap_net_raw,cap_net_admin,cap_net_bind_service+eip /usr/bin/nbtscan && \
|
||||||
setcap cap_net_raw,cap_net_admin+eip /usr/bin/traceroute && \
|
setcap cap_net_raw,cap_net_admin+eip /usr/bin/traceroute && \
|
||||||
setcap cap_net_raw,cap_net_admin+eip ${VIRTUAL_ENV_BIN}/scapy && \
|
setcap cap_net_raw,cap_net_admin+eip "$(readlink -f ${VIRTUAL_ENV_BIN}/python)" && \
|
||||||
/bin/sh /build/init-nginx.sh && \
|
/bin/sh /build/init-nginx.sh && \
|
||||||
/bin/sh /build/init-php-fpm.sh && \
|
/bin/sh /build/init-php-fpm.sh && \
|
||||||
/bin/sh /build/init-crond.sh && \
|
/bin/sh /build/init-cron.sh && \
|
||||||
/bin/sh /build/init-backend.sh && \
|
/bin/sh /build/init-backend.sh && \
|
||||||
rm -rf /build && \
|
rm -rf /build && \
|
||||||
apk del libcap
|
apk del libcap && \
|
||||||
|
date +%s > "${NETALERTX_FRONT}/buildtimestamp.txt"
|
||||||
|
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/sh","/entrypoint.sh"]
|
ENTRYPOINT ["/bin/sh","/entrypoint.sh"]
|
||||||
@@ -169,13 +186,15 @@ ENV UMASK=0077
|
|||||||
# AI may claim this is stupid, but it's actually least possible permissions as
|
# AI may claim this is stupid, but it's actually least possible permissions as
|
||||||
# read-only user cannot login, cannot sudo, has no write permission, and cannot even
|
# read-only user cannot login, cannot sudo, has no write permission, and cannot even
|
||||||
# read the files it owns. The read-only user is ownership-as-a-lock hardening pattern.
|
# read the files it owns. The read-only user is ownership-as-a-lock hardening pattern.
|
||||||
RUN addgroup -g 20212 ${READ_ONLY_GROUP} && \
|
RUN addgroup -g 20212 "${READ_ONLY_GROUP}" && \
|
||||||
adduser -u 20212 -G ${READ_ONLY_GROUP} -D -h /app ${READ_ONLY_USER}
|
adduser -u 20212 -G "${READ_ONLY_GROUP}" -D -h /app "${READ_ONLY_USER}"
|
||||||
|
|
||||||
|
|
||||||
# reduce permissions to minimum necessary for all NetAlertX files and folders
|
# reduce permissions to minimum necessary for all NetAlertX files and folders
|
||||||
# Permissions 005 and 004 are not typos, they enable read-only. Everyone can
|
# Permissions 005 and 004 are not typos, they enable read-only. Everyone can
|
||||||
# read the read-only files, and nobody can write to them, even the readonly user.
|
# read the read-only files, and nobody can write to them, even the readonly user.
|
||||||
|
|
||||||
|
# hadolint ignore=SC2114
|
||||||
RUN chown -R ${READ_ONLY_USER}:${READ_ONLY_GROUP} ${READ_ONLY_FOLDERS} && \
|
RUN chown -R ${READ_ONLY_USER}:${READ_ONLY_GROUP} ${READ_ONLY_FOLDERS} && \
|
||||||
chmod -R 004 ${READ_ONLY_FOLDERS} && \
|
chmod -R 004 ${READ_ONLY_FOLDERS} && \
|
||||||
find ${READ_ONLY_FOLDERS} -type d -exec chmod 005 {} + && \
|
find ${READ_ONLY_FOLDERS} -type d -exec chmod 005 {} + && \
|
||||||
@@ -184,14 +203,17 @@ RUN chown -R ${READ_ONLY_USER}:${READ_ONLY_GROUP} ${READ_ONLY_FOLDERS} && \
|
|||||||
chmod -R 600 ${READ_WRITE_FOLDERS} && \
|
chmod -R 600 ${READ_WRITE_FOLDERS} && \
|
||||||
find ${READ_WRITE_FOLDERS} -type d -exec chmod 700 {} + && \
|
find ${READ_WRITE_FOLDERS} -type d -exec chmod 700 {} + && \
|
||||||
chown ${READ_ONLY_USER}:${READ_ONLY_GROUP} /entrypoint.sh /opt /opt/venv && \
|
chown ${READ_ONLY_USER}:${READ_ONLY_GROUP} /entrypoint.sh /opt /opt/venv && \
|
||||||
chmod 005 /entrypoint.sh ${SYSTEM_SERVICES}/*.sh /app /opt /opt/venv && \
|
chmod 005 /entrypoint.sh ${SYSTEM_SERVICES}/*.sh ${SYSTEM_SERVICES_SCRIPTS}/* ${ENTRYPOINT_CHECKS}/* /app /opt /opt/venv && \
|
||||||
|
for dir in ${READ_WRITE_FOLDERS}; do \
|
||||||
|
install -d -o ${NETALERTX_USER} -g ${NETALERTX_GROUP} -m 700 "$dir"; \
|
||||||
|
done && \
|
||||||
apk del apk-tools && \
|
apk del apk-tools && \
|
||||||
rm -Rf /var /etc/sudoers.d/* /etc/shadow /etc/gshadow /etc/sudoers \
|
rm -Rf /var /etc/sudoers.d/* /etc/shadow /etc/gshadow /etc/sudoers \
|
||||||
/lib/apk /lib/firmware /lib/modules-load.d /lib/sysctl.d /mnt /home/ /root \
|
/lib/apk /lib/firmware /lib/modules-load.d /lib/sysctl.d /mnt /home/ /root \
|
||||||
/srv /media && \
|
/srv /media && \
|
||||||
sed -i "/^\(${READ_ONLY_USER}\|${NETALERTX_USER}\):/!d" /etc/passwd && \
|
sed -i "/^\(${READ_ONLY_USER}\|${NETALERTX_USER}\):/!d" /etc/passwd && \
|
||||||
sed -i "/^\(${READ_ONLY_GROUP}\|${NETALERTX_GROUP}\):/!d" /etc/group && \
|
sed -i "/^\(${READ_ONLY_GROUP}\|${NETALERTX_GROUP}\):/!d" /etc/group && \
|
||||||
echo -ne '#!/bin/sh\n"$@"\n' > /usr/bin/sudo && chmod +x /usr/bin/sudo
|
printf '#!/bin/sh\n"$@"\n' > /usr/bin/sudo && chmod +x /usr/bin/sudo
|
||||||
|
|
||||||
USER netalertx
|
USER netalertx
|
||||||
|
|
||||||
@@ -206,11 +228,15 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
|||||||
# .devcontainer/scripts/generate-configs.sh
|
# .devcontainer/scripts/generate-configs.sh
|
||||||
# The generator appends this stage to produce .devcontainer/Dockerfile.
|
# The generator appends this stage to produce .devcontainer/Dockerfile.
|
||||||
# Prefer to place dev-only setup here; use setup.sh only for runtime fixes.
|
# Prefer to place dev-only setup here; use setup.sh only for runtime fixes.
|
||||||
|
# Permissions in devcontainer should be of a brutalist nature. They will be
|
||||||
|
# Open and wide to avoid permission issues during development allowing max
|
||||||
|
# flexibility.
|
||||||
|
|
||||||
|
# hadolint ignore=DL3006
|
||||||
FROM runner AS netalertx-devcontainer
|
FROM runner AS netalertx-devcontainer
|
||||||
ENV INSTALL_DIR=/app
|
ENV INSTALL_DIR=/app
|
||||||
|
|
||||||
ENV PYTHONPATH=/workspaces/NetAlertX/test:/workspaces/NetAlertX/server:/app:/app/server:/opt/venv/lib/python3.12/site-packages
|
ENV PYTHONPATH=${PYTHONPATH}:/workspaces/NetAlertX/test:/workspaces/NetAlertX/server:/usr/lib/python3.12/site-packages
|
||||||
ENV PATH=/services:${PATH}
|
ENV PATH=/services:${PATH}
|
||||||
ENV PHP_INI_SCAN_DIR=/services/config/php/conf.d:/etc/php83/conf.d
|
ENV PHP_INI_SCAN_DIR=/services/config/php/conf.d:/etc/php83/conf.d
|
||||||
ENV LISTEN_ADDR=0.0.0.0
|
ENV LISTEN_ADDR=0.0.0.0
|
||||||
@@ -218,19 +244,37 @@ ENV PORT=20211
|
|||||||
ENV NETALERTX_DEBUG=1
|
ENV NETALERTX_DEBUG=1
|
||||||
ENV PYDEVD_DISABLE_FILE_VALIDATION=1
|
ENV PYDEVD_DISABLE_FILE_VALIDATION=1
|
||||||
COPY .devcontainer/resources/devcontainer-overlay/ /
|
COPY .devcontainer/resources/devcontainer-overlay/ /
|
||||||
|
USER root
|
||||||
# Install common tools, create user, and set up sudo
|
# Install common tools, create user, and set up sudo
|
||||||
RUN apk add --no-cache git nano vim jq php83-pecl-xdebug py3-pip nodejs sudo gpgconf pytest pytest-cov fish shfmt sudo
|
|
||||||
|
RUN apk add --no-cache git nano vim jq php83-pecl-xdebug py3-pip nodejs sudo gpgconf pytest \
|
||||||
|
pytest-cov zsh alpine-zsh-config shfmt github-cli py3-yaml py3-docker-py docker-cli docker-cli-buildx \
|
||||||
|
docker-cli-compose shellcheck
|
||||||
|
|
||||||
|
# Install hadolint (Dockerfile linter)
|
||||||
|
RUN curl -L https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64 -o /usr/local/bin/hadolint && \
|
||||||
|
chmod +x /usr/local/bin/hadolint
|
||||||
|
|
||||||
RUN install -d -o netalertx -g netalertx -m 755 /services/php/modules && \
|
RUN install -d -o netalertx -g netalertx -m 755 /services/php/modules && \
|
||||||
cp -a /usr/lib/php83/modules/. /services/php/modules/ && \
|
cp -a /usr/lib/php83/modules/. /services/php/modules/ && \
|
||||||
echo "${NETALERTX_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
echo "${NETALERTX_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||||
# Install debugpy in the virtualenv if present, otherwise into system python3
|
ENV SHELL=/bin/zsh
|
||||||
RUN /bin/sh -c '(/opt/venv/bin/python3 -m pip install --no-cache-dir debugpy) || (python3 -m pip install --no-cache-dir debugpy) || true' && \
|
|
||||||
mkdir /workspaces && \
|
|
||||||
install -d -o netalertx -g netalertx -m 777 /services/run/logs && \
|
|
||||||
install -d -o netalertx -g netalertx -m 777 /app/run/tmp/client_body && \
|
|
||||||
sed -i -e 's|:/app:|:/workspaces:|' /etc/passwd && \
|
|
||||||
python -m pip install -U pytest pytest-cov
|
|
||||||
|
|
||||||
|
RUN mkdir -p /workspaces && \
|
||||||
|
install -d -m 777 /data /data/config /data/db && \
|
||||||
|
install -d -m 777 /tmp/log /tmp/log/plugins /tmp/api /tmp/run /tmp/nginx && \
|
||||||
|
install -d -m 777 /tmp/nginx/active-config /tmp/nginx/client_body /tmp/nginx/config && \
|
||||||
|
install -d -m 777 /tmp/nginx/fastcgi /tmp/nginx/proxy /tmp/nginx/scgi /tmp/nginx/uwsgi && \
|
||||||
|
install -d -m 777 /tmp/run/tmp /tmp/run/logs && \
|
||||||
|
chmod 777 /workspaces && \
|
||||||
|
chown -R netalertx:netalertx /data && \
|
||||||
|
chmod 666 /data/config/app.conf /data/db/app.db && \
|
||||||
|
chmod 1777 /tmp && \
|
||||||
|
install -d -o root -g root -m 1777 /tmp/.X11-unix && \
|
||||||
|
mkdir -p /home/netalertx && \
|
||||||
|
chown netalertx:netalertx /home/netalertx && \
|
||||||
|
sed -i -e 's#/app:#/workspaces:#' /etc/passwd && \
|
||||||
|
find /opt/venv -type d -exec chmod o+rwx {} \;
|
||||||
|
|
||||||
|
USER netalertx
|
||||||
ENTRYPOINT ["/bin/sh","-c","sleep infinity"]
|
ENTRYPOINT ["/bin/sh","-c","sleep infinity"]
|
||||||
|
|||||||
37
.devcontainer/NetAlertX.code-workspace
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"name": "NetAlertX Source",
|
||||||
|
"path": "/workspaces/NetAlertX"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "💾 NetAlertX Data",
|
||||||
|
"path": "/data"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "🔍 Active NetAlertX log",
|
||||||
|
"path": "/tmp/log"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "🌐 Active NetAlertX nginx",
|
||||||
|
"path": "/tmp/nginx"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "📊 Active NetAlertX api",
|
||||||
|
"path": "/tmp/api"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "⚙️ Active NetAlertX run",
|
||||||
|
"path": "/tmp/run"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"terminal.integrated.suggest.enabled": true,
|
||||||
|
"terminal.integrated.defaultProfile.linux": "zsh",
|
||||||
|
"terminal.integrated.profiles.linux": {
|
||||||
|
"zsh": {
|
||||||
|
"path": "/usr/bin/fish"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,6 +19,17 @@ Common workflows (F1->Tasks: Run Task)
|
|||||||
- Backend (GraphQL/Flask): `.devcontainer/scripts/restart-backend.sh` starts it under debugpy and logs to `/app/log/app.log`
|
- Backend (GraphQL/Flask): `.devcontainer/scripts/restart-backend.sh` starts it under debugpy and logs to `/app/log/app.log`
|
||||||
- Frontend (nginx + PHP-FPM): Started via setup.sh; can be restarted by the task "Start Frontend (nginx and PHP-FPM)".
|
- Frontend (nginx + PHP-FPM): Started via setup.sh; can be restarted by the task "Start Frontend (nginx and PHP-FPM)".
|
||||||
|
|
||||||
|
Production Container Evaulation
|
||||||
|
1. F1 → Tasks: Shutdown services ([Dev Container] Stop Frontend & Backend Services)
|
||||||
|
2. F1 → Tasks: Docker system and build prune ([Any] Docker system and build Prune)
|
||||||
|
3. F1 → Remote: Close Unused Forwarded Ports (VS Code command)
|
||||||
|
4. F1 → Tasks: Build & Launch Production (Build & Launch Prodcution Docker
|
||||||
|
5. visit http://localhost:20211
|
||||||
|
|
||||||
|
Unit tests
|
||||||
|
1. F1 → Tasks: Rebuild test container ([Any] Build Unit Test Docker image)
|
||||||
|
2. F1 → Test: Run all tests
|
||||||
|
|
||||||
Testing
|
Testing
|
||||||
- pytest is installed via Alpine packages (py3-pytest, py3-pytest-cov).
|
- pytest is installed via Alpine packages (py3-pytest, py3-pytest-cov).
|
||||||
- PYTHONPATH includes workspace and venv site-packages so tests can import `server/*` modules and third-party libs.
|
- PYTHONPATH includes workspace and venv site-packages so tests can import `server/*` modules and third-party libs.
|
||||||
|
|||||||
26
.devcontainer/WORKSPACE.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# NetAlertX Multi-Folder Workspace
|
||||||
|
|
||||||
|
This repository uses a multi-folder workspace configuration to provide easy access to runtime directories.
|
||||||
|
|
||||||
|
## Opening the Multi-Folder Workspace
|
||||||
|
|
||||||
|
After the devcontainer builds, open the workspace file to access all folders:
|
||||||
|
|
||||||
|
1. **File** → **Open Workspace from File**
|
||||||
|
2. Select `NetAlertX.code-workspace`
|
||||||
|
|
||||||
|
Or use Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
|
||||||
|
- Type: `Workspaces: Open Workspace from File`
|
||||||
|
- Select `NetAlertX.code-workspace`
|
||||||
|
|
||||||
|
## Workspace Folders
|
||||||
|
|
||||||
|
The workspace includes:
|
||||||
|
- **NetAlertX** - Main source code
|
||||||
|
- **/tmp** - Runtime temporary files
|
||||||
|
- **/tmp/api** - API response cache (JSON files)
|
||||||
|
- **/tmp/log** - Application and plugin logs
|
||||||
|
|
||||||
|
## Testing Configuration
|
||||||
|
|
||||||
|
Pytest is configured to only discover tests in the main `test/` directory, not in `/tmp` folders.
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
"name": "NetAlertX DevContainer",
|
"name": "NetAlertX DevContainer",
|
||||||
"remoteUser": "netalertx",
|
"remoteUser": "netalertx",
|
||||||
"workspaceFolder": "/workspaces/NetAlertX",
|
"workspaceFolder": "/workspaces/NetAlertX",
|
||||||
|
"workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/NetAlertX,type=bind,consistency=cached",
|
||||||
|
"onCreateCommand": "mkdir -p /tmp/api /tmp/log",
|
||||||
"build": {
|
"build": {
|
||||||
"dockerfile": "./Dockerfile", // Dockerfile generated by script
|
"dockerfile": "./Dockerfile", // Dockerfile generated by script
|
||||||
"context": "../", // Context is the root of the repository
|
"context": "../", // Context is the root of the repository
|
||||||
@@ -23,6 +25,9 @@
|
|||||||
// even within this container and connect to them as needed.
|
// even within this container and connect to them as needed.
|
||||||
// "--network=host",
|
// "--network=host",
|
||||||
],
|
],
|
||||||
|
"mounts": [
|
||||||
|
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" //used for testing various conditions in docker
|
||||||
|
],
|
||||||
// ATTENTION: If running with --network=host, COMMENT `forwardPorts` OR ELSE THERE WILL BE NO WEBUI!
|
// ATTENTION: If running with --network=host, COMMENT `forwardPorts` OR ELSE THERE WILL BE NO WEBUI!
|
||||||
"forwardPorts": [20211, 20212, 5678],
|
"forwardPorts": [20211, 20212, 5678],
|
||||||
"portsAttributes": { // the ports we care about
|
"portsAttributes": { // the ports we care about
|
||||||
@@ -40,8 +45,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"postStartCommand": "${containerWorkspaceFolder}/.devcontainer/scripts/setup.sh",
|
"postCreateCommand": {
|
||||||
|
"Install Pip Requirements": "/opt/venv/bin/pip3 install pytest docker debugpy",
|
||||||
|
"Workspace Instructions": "printf '\n\n<> DevContainer Ready!\n\n📁 To access /tmp folders in the workspace:\n File → Open Workspace from File → NetAlertX.code-workspace\n\n📖 See .devcontainer/WORKSPACE.md for details\n\n'"
|
||||||
|
},
|
||||||
|
"postStartCommand": {
|
||||||
|
"Start Environment":"${containerWorkspaceFolder}/.devcontainer/scripts/setup.sh",
|
||||||
|
"Build test-container":"echo building netalertx-test container in background. check /tmp/build.log for progress. && setsid docker buildx build -t netalertx-test . > /tmp/build.log 2>&1 &"
|
||||||
|
},
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"extensions": [
|
"extensions": [
|
||||||
@@ -62,15 +73,27 @@
|
|||||||
"esbenp.prettier-vscode",
|
"esbenp.prettier-vscode",
|
||||||
"eamodio.gitlens",
|
"eamodio.gitlens",
|
||||||
"alexcvzz.vscode-sqlite",
|
"alexcvzz.vscode-sqlite",
|
||||||
"yzhang.markdown-all-in-one",
|
"mkhl.shfmt",
|
||||||
"mkhl.shfmt"
|
"charliermarsh.ruff",
|
||||||
|
"ms-python.flake8",
|
||||||
|
"exiasr.hadolint",
|
||||||
|
"timonwong.shellcheck"
|
||||||
],
|
],
|
||||||
"settings": {
|
"settings": {
|
||||||
"terminal.integrated.cwd": "${containerWorkspaceFolder}",
|
"terminal.integrated.cwd": "${containerWorkspaceFolder}",
|
||||||
|
"terminal.integrated.profiles.linux": {
|
||||||
|
"zsh": {
|
||||||
|
"path": "/bin/zsh",
|
||||||
|
"args": ["-l"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"terminal.integrated.defaultProfile.linux": "zsh",
|
||||||
|
|
||||||
// Python testing configuration
|
// Python testing configuration
|
||||||
"python.testing.pytestEnabled": true,
|
"python.testing.pytestEnabled": true,
|
||||||
"python.testing.unittestEnabled": false,
|
"python.testing.unittestEnabled": false,
|
||||||
"python.testing.pytestArgs": ["test"],
|
"python.testing.pytestArgs": ["test"],
|
||||||
|
"python.testing.cwd": "${containerWorkspaceFolder}",
|
||||||
// Make sure we discover tests and import server correctly
|
// Make sure we discover tests and import server correctly
|
||||||
"python.analysis.extraPaths": [
|
"python.analysis.extraPaths": [
|
||||||
"/workspaces/NetAlertX",
|
"/workspaces/NetAlertX",
|
||||||
|
|||||||
@@ -3,11 +3,15 @@
|
|||||||
# .devcontainer/scripts/generate-configs.sh
|
# .devcontainer/scripts/generate-configs.sh
|
||||||
# The generator appends this stage to produce .devcontainer/Dockerfile.
|
# The generator appends this stage to produce .devcontainer/Dockerfile.
|
||||||
# Prefer to place dev-only setup here; use setup.sh only for runtime fixes.
|
# Prefer to place dev-only setup here; use setup.sh only for runtime fixes.
|
||||||
|
# Permissions in devcontainer should be of a brutalist nature. They will be
|
||||||
|
# Open and wide to avoid permission issues during development allowing max
|
||||||
|
# flexibility.
|
||||||
|
|
||||||
|
# hadolint ignore=DL3006
|
||||||
FROM runner AS netalertx-devcontainer
|
FROM runner AS netalertx-devcontainer
|
||||||
ENV INSTALL_DIR=/app
|
ENV INSTALL_DIR=/app
|
||||||
|
|
||||||
ENV PYTHONPATH=/workspaces/NetAlertX/test:/workspaces/NetAlertX/server:/app:/app/server:/opt/venv/lib/python3.12/site-packages
|
ENV PYTHONPATH=${PYTHONPATH}:/workspaces/NetAlertX/test:/workspaces/NetAlertX/server:/usr/lib/python3.12/site-packages
|
||||||
ENV PATH=/services:${PATH}
|
ENV PATH=/services:${PATH}
|
||||||
ENV PHP_INI_SCAN_DIR=/services/config/php/conf.d:/etc/php83/conf.d
|
ENV PHP_INI_SCAN_DIR=/services/config/php/conf.d:/etc/php83/conf.d
|
||||||
ENV LISTEN_ADDR=0.0.0.0
|
ENV LISTEN_ADDR=0.0.0.0
|
||||||
@@ -15,19 +19,37 @@ ENV PORT=20211
|
|||||||
ENV NETALERTX_DEBUG=1
|
ENV NETALERTX_DEBUG=1
|
||||||
ENV PYDEVD_DISABLE_FILE_VALIDATION=1
|
ENV PYDEVD_DISABLE_FILE_VALIDATION=1
|
||||||
COPY .devcontainer/resources/devcontainer-overlay/ /
|
COPY .devcontainer/resources/devcontainer-overlay/ /
|
||||||
|
USER root
|
||||||
# Install common tools, create user, and set up sudo
|
# Install common tools, create user, and set up sudo
|
||||||
RUN apk add --no-cache git nano vim jq php83-pecl-xdebug py3-pip nodejs sudo gpgconf pytest pytest-cov fish shfmt github-cli
|
|
||||||
|
RUN apk add --no-cache git nano vim jq php83-pecl-xdebug py3-pip nodejs sudo gpgconf pytest \
|
||||||
|
pytest-cov zsh alpine-zsh-config shfmt github-cli py3-yaml py3-docker-py docker-cli docker-cli-buildx \
|
||||||
|
docker-cli-compose shellcheck
|
||||||
|
|
||||||
|
# Install hadolint (Dockerfile linter)
|
||||||
|
RUN curl -L https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64 -o /usr/local/bin/hadolint && \
|
||||||
|
chmod +x /usr/local/bin/hadolint
|
||||||
|
|
||||||
RUN install -d -o netalertx -g netalertx -m 755 /services/php/modules && \
|
RUN install -d -o netalertx -g netalertx -m 755 /services/php/modules && \
|
||||||
cp -a /usr/lib/php83/modules/. /services/php/modules/ && \
|
cp -a /usr/lib/php83/modules/. /services/php/modules/ && \
|
||||||
echo "${NETALERTX_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
echo "${NETALERTX_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||||
# Install debugpy in the virtualenv if present, otherwise into system python3
|
ENV SHELL=/bin/zsh
|
||||||
RUN /bin/sh -c '(/opt/venv/bin/python3 -m pip install --no-cache-dir debugpy) || (python3 -m pip install --no-cache-dir debugpy) || true' && \
|
|
||||||
mkdir /workspaces && \
|
|
||||||
install -d -o netalertx -g netalertx -m 777 /services/run/logs && \
|
|
||||||
install -d -o netalertx -g netalertx -m 777 /app/run/tmp/client_body && \
|
|
||||||
sed -i -e 's|:/app:|:/workspaces:|' /etc/passwd && \
|
|
||||||
python -m pip install -U pytest pytest-cov
|
|
||||||
|
|
||||||
|
RUN mkdir -p /workspaces && \
|
||||||
|
install -d -m 777 /data /data/config /data/db && \
|
||||||
|
install -d -m 777 /tmp/log /tmp/log/plugins /tmp/api /tmp/run /tmp/nginx && \
|
||||||
|
install -d -m 777 /tmp/nginx/active-config /tmp/nginx/client_body /tmp/nginx/config && \
|
||||||
|
install -d -m 777 /tmp/nginx/fastcgi /tmp/nginx/proxy /tmp/nginx/scgi /tmp/nginx/uwsgi && \
|
||||||
|
install -d -m 777 /tmp/run/tmp /tmp/run/logs && \
|
||||||
|
chmod 777 /workspaces && \
|
||||||
|
chown -R netalertx:netalertx /data && \
|
||||||
|
chmod 666 /data/config/app.conf /data/db/app.db && \
|
||||||
|
chmod 1777 /tmp && \
|
||||||
|
install -d -o root -g root -m 1777 /tmp/.X11-unix && \
|
||||||
|
mkdir -p /home/netalertx && \
|
||||||
|
chown netalertx:netalertx /home/netalertx && \
|
||||||
|
sed -i -e 's#/app:#/workspaces:#' /etc/passwd && \
|
||||||
|
find /opt/venv -type d -exec chmod o+rwx {} \;
|
||||||
|
|
||||||
|
USER netalertx
|
||||||
ENTRYPOINT ["/bin/sh","-c","sleep infinity"]
|
ENTRYPOINT ["/bin/sh","-c","sleep infinity"]
|
||||||
|
|||||||
@@ -1,118 +0,0 @@
|
|||||||
# DO NOT MODIFY THIS FILE DIRECTLY. IT IS AUTO-GENERATED BY .devcontainer/scripts/generate-configs.sh
|
|
||||||
# Generated from: install/production-filesystem/services/config/nginx/netalertx.conf.template
|
|
||||||
|
|
||||||
# Set number of worker processes automatically based on number of CPU cores.
|
|
||||||
worker_processes auto;
|
|
||||||
|
|
||||||
# Enables the use of JIT for regular expressions to speed-up their processing.
|
|
||||||
pcre_jit on;
|
|
||||||
|
|
||||||
# Configures default error logger.
|
|
||||||
error_log /app/log/nginx-error.log warn;
|
|
||||||
|
|
||||||
events {
|
|
||||||
# The maximum number of simultaneous connections that can be opened by
|
|
||||||
# a worker process.
|
|
||||||
worker_connections 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
http {
|
|
||||||
|
|
||||||
# Mapping of temp paths for various nginx modules.
|
|
||||||
client_body_temp_path /services/run/tmp/client_body;
|
|
||||||
proxy_temp_path /services/run/tmp/proxy;
|
|
||||||
fastcgi_temp_path /services/run/tmp/fastcgi;
|
|
||||||
uwsgi_temp_path /services/run/tmp/uwsgi;
|
|
||||||
scgi_temp_path /services/run/tmp/scgi;
|
|
||||||
|
|
||||||
# Includes mapping of file name extensions to MIME types of responses
|
|
||||||
# and defines the default type.
|
|
||||||
include /services/config/nginx/mime.types;
|
|
||||||
default_type application/octet-stream;
|
|
||||||
|
|
||||||
# Name servers used to resolve names of upstream servers into addresses.
|
|
||||||
# It's also needed when using tcpsocket and udpsocket in Lua modules.
|
|
||||||
#resolver 1.1.1.1 1.0.0.1 [2606:4700:4700::1111] [2606:4700:4700::1001];
|
|
||||||
|
|
||||||
# Don't tell nginx version to the clients. Default is 'on'.
|
|
||||||
server_tokens off;
|
|
||||||
|
|
||||||
# Specifies the maximum accepted body size of a client request, as
|
|
||||||
# indicated by the request header Content-Length. If the stated content
|
|
||||||
# length is greater than this size, then the client receives the HTTP
|
|
||||||
# error code 413. Set to 0 to disable. Default is '1m'.
|
|
||||||
client_max_body_size 1m;
|
|
||||||
|
|
||||||
# Sendfile copies data between one FD and other from within the kernel,
|
|
||||||
# which is more efficient than read() + write(). Default is off.
|
|
||||||
sendfile on;
|
|
||||||
|
|
||||||
# Causes nginx to attempt to send its HTTP response head in one packet,
|
|
||||||
# instead of using partial frames. Default is 'off'.
|
|
||||||
tcp_nopush on;
|
|
||||||
|
|
||||||
|
|
||||||
# Enables the specified protocols. Default is TLSv1 TLSv1.1 TLSv1.2.
|
|
||||||
# TIP: If you're not obligated to support ancient clients, remove TLSv1.1.
|
|
||||||
ssl_protocols TLSv1.2 TLSv1.3;
|
|
||||||
|
|
||||||
# Path of the file with Diffie-Hellman parameters for EDH ciphers.
|
|
||||||
# TIP: Generate with: `openssl dhparam -out /etc/ssl/nginx/dh2048.pem 2048`
|
|
||||||
#ssl_dhparam /etc/ssl/nginx/dh2048.pem;
|
|
||||||
|
|
||||||
# Specifies that our cipher suits should be preferred over client ciphers.
|
|
||||||
# Default is 'off'.
|
|
||||||
ssl_prefer_server_ciphers on;
|
|
||||||
|
|
||||||
# Enables a shared SSL cache with size that can hold around 8000 sessions.
|
|
||||||
# Default is 'none'.
|
|
||||||
ssl_session_cache shared:SSL:2m;
|
|
||||||
|
|
||||||
# Specifies a time during which a client may reuse the session parameters.
|
|
||||||
# Default is '5m'.
|
|
||||||
ssl_session_timeout 1h;
|
|
||||||
|
|
||||||
# Disable TLS session tickets (they are insecure). Default is 'on'.
|
|
||||||
ssl_session_tickets off;
|
|
||||||
|
|
||||||
|
|
||||||
# Enable gzipping of responses.
|
|
||||||
gzip on;
|
|
||||||
|
|
||||||
# Set the Vary HTTP header as defined in the RFC 2616. Default is 'off'.
|
|
||||||
gzip_vary on;
|
|
||||||
|
|
||||||
|
|
||||||
# Specifies the main log format.
|
|
||||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
||||||
'$status $body_bytes_sent "$http_referer" '
|
|
||||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
||||||
|
|
||||||
# Sets the path, format, and configuration for a buffered log write.
|
|
||||||
access_log /app/log/nginx-access.log main;
|
|
||||||
|
|
||||||
|
|
||||||
# Virtual host config
|
|
||||||
server {
|
|
||||||
listen 0.0.0.0:20211 default_server;
|
|
||||||
large_client_header_buffers 4 16k;
|
|
||||||
root /app/front;
|
|
||||||
index index.php;
|
|
||||||
add_header X-Forwarded-Prefix "/app" always;
|
|
||||||
|
|
||||||
|
|
||||||
location ~* \.php$ {
|
|
||||||
# Set Cache-Control header to prevent caching on the first load
|
|
||||||
add_header Cache-Control "no-store";
|
|
||||||
fastcgi_pass unix:/services/run/php.sock;
|
|
||||||
include /services/config/nginx/fastcgi_params;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
||||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
|
||||||
|
|
||||||
fastcgi_param PHP_VALUE "xdebug.remote_enable=1";
|
|
||||||
fastcgi_connect_timeout 75;
|
|
||||||
fastcgi_send_timeout 600;
|
|
||||||
fastcgi_read_timeout 600;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# NetAlertX devcontainer zsh configuration
|
||||||
|
# Keep this lightweight and deterministic so shells behave consistently.
|
||||||
|
|
||||||
|
export PATH="$HOME/.local/bin:$PATH"
|
||||||
|
export EDITOR=vim
|
||||||
|
export SHELL=/bin/zsh
|
||||||
|
|
||||||
|
# Start inside the workspace if it exists
|
||||||
|
if [ -d "/workspaces/NetAlertX" ]; then
|
||||||
|
cd /workspaces/NetAlertX
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enable basic completion and prompt helpers
|
||||||
|
autoload -Uz compinit promptinit colors
|
||||||
|
colors
|
||||||
|
compinit -u
|
||||||
|
promptinit
|
||||||
|
|
||||||
|
# Friendly prompt with virtualenv awareness
|
||||||
|
setopt PROMPT_SUBST
|
||||||
|
|
||||||
|
_venv_segment() {
|
||||||
|
if [ -n "$VIRTUAL_ENV" ]; then
|
||||||
|
printf '(%s) ' "${VIRTUAL_ENV:t}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT='%F{green}$(_venv_segment)%f%F{cyan}%n@%m%f %F{yellow}%~%f %# '
|
||||||
|
RPROMPT='%F{magenta}$(git rev-parse --abbrev-ref HEAD 2>/dev/null)%f'
|
||||||
|
|
||||||
|
# Sensible defaults
|
||||||
|
setopt autocd
|
||||||
|
setopt correct
|
||||||
|
setopt extendedglob
|
||||||
|
HISTFILE="$HOME/.zsh_history"
|
||||||
|
HISTSIZE=5000
|
||||||
|
SAVEHIST=5000
|
||||||
|
|
||||||
|
alias ll='ls -alF'
|
||||||
|
alias la='ls -A'
|
||||||
|
alias gs='git status -sb'
|
||||||
|
alias gp='git pull --ff-only'
|
||||||
|
|
||||||
|
# Ensure pyenv/virtualenv activate hooks adjust the prompt cleanly
|
||||||
|
if [ -f "$HOME/.zshrc.local" ]; then
|
||||||
|
source "$HOME/.zshrc.local"
|
||||||
|
fi
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
read -r -p "Are you sure you want to destroy your host docker containers and images? Type YES to continue: " reply
|
if [[ -n "${CONFIRM_PRUNE:-}" && "${CONFIRM_PRUNE}" == "YES" ]]; then
|
||||||
|
reply="YES"
|
||||||
|
else
|
||||||
|
read -r -p "Are you sure you want to destroy your host docker containers and images? Type YES to continue: " reply
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "${reply}" == "YES" ]]; then
|
if [[ "${reply}" == "YES" ]]; then
|
||||||
docker system prune -af
|
docker system prune -af
|
||||||
|
|||||||
@@ -7,56 +7,28 @@
|
|||||||
# the final .devcontainer/Dockerfile used by the devcontainer.
|
# the final .devcontainer/Dockerfile used by the devcontainer.
|
||||||
|
|
||||||
echo "Generating .devcontainer/Dockerfile"
|
echo "Generating .devcontainer/Dockerfile"
|
||||||
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
SCRIPT_PATH=$(set -- "$0"; dirname -- "$1")
|
||||||
|
SCRIPT_DIR=$(cd "$SCRIPT_PATH" && pwd -P)
|
||||||
DEVCONTAINER_DIR="${SCRIPT_DIR%/scripts}"
|
DEVCONTAINER_DIR="${SCRIPT_DIR%/scripts}"
|
||||||
ROOT_DIR="${DEVCONTAINER_DIR%/.devcontainer}"
|
ROOT_DIR="${DEVCONTAINER_DIR%/.devcontainer}"
|
||||||
|
|
||||||
OUT_FILE="${DEVCONTAINER_DIR}/Dockerfile"
|
OUT_FILE="${DEVCONTAINER_DIR}/Dockerfile"
|
||||||
|
|
||||||
echo "Adding base Dockerfile from $ROOT_DIR..."
|
echo "Adding base Dockerfile from $ROOT_DIR and merging to devcontainer-Dockerfile"
|
||||||
|
{
|
||||||
|
|
||||||
echo "# DO NOT MODIFY THIS FILE DIRECTLY. IT IS AUTO-GENERATED BY .devcontainer/scripts/generate-configs.sh" > "$OUT_FILE"
|
echo "# DO NOT MODIFY THIS FILE DIRECTLY. IT IS AUTO-GENERATED BY .devcontainer/scripts/generate-configs.sh"
|
||||||
echo "" >> "$OUT_FILE"
|
echo ""
|
||||||
echo "# ---/Dockerfile---" >> "$OUT_FILE"
|
echo "# ---/Dockerfile---"
|
||||||
|
|
||||||
cat "${ROOT_DIR}/Dockerfile" >> "$OUT_FILE"
|
cat "${ROOT_DIR}/Dockerfile"
|
||||||
|
|
||||||
echo "" >> "$OUT_FILE"
|
echo ""
|
||||||
echo "# ---/resources/devcontainer-Dockerfile---" >> "$OUT_FILE"
|
echo "# ---/resources/devcontainer-Dockerfile---"
|
||||||
echo "" >> "$OUT_FILE"
|
echo ""
|
||||||
|
cat "${DEVCONTAINER_DIR}/resources/devcontainer-Dockerfile"
|
||||||
|
} > "$OUT_FILE"
|
||||||
|
|
||||||
echo "Adding devcontainer-Dockerfile from $DEVCONTAINER_DIR/resources..."
|
echo "Generated $OUT_FILE using root dir $ROOT_DIR"
|
||||||
cat "${DEVCONTAINER_DIR}/resources/devcontainer-Dockerfile" >> "$OUT_FILE"
|
|
||||||
|
|
||||||
echo "Generated $OUT_FILE using root dir $ROOT_DIR" >&2
|
|
||||||
|
|
||||||
# Generate devcontainer nginx config from production template
|
|
||||||
echo "Generating devcontainer nginx config"
|
|
||||||
NGINX_TEMPLATE="${ROOT_DIR}/install/production-filesystem/services/config/nginx/netalertx.conf.template"
|
|
||||||
NGINX_OUT="${DEVCONTAINER_DIR}/resources/devcontainer-overlay/services/config/nginx/netalertx.conf.template"
|
|
||||||
|
|
||||||
# Create output directory if it doesn't exist
|
|
||||||
mkdir -p "$(dirname "$NGINX_OUT")"
|
|
||||||
|
|
||||||
# Start with header comment
|
|
||||||
cat > "$NGINX_OUT" << 'EOF'
|
|
||||||
# DO NOT MODIFY THIS FILE DIRECTLY. IT IS AUTO-GENERATED BY .devcontainer/scripts/generate-configs.sh
|
|
||||||
# Generated from: install/production-filesystem/services/config/nginx/netalertx.conf.template
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Process the template: replace listen directive and inject Xdebug params
|
|
||||||
sed 's/${LISTEN_ADDR}:${PORT}/0.0.0.0:20211/g' "$NGINX_TEMPLATE" | \
|
|
||||||
awk '
|
|
||||||
/fastcgi_param SCRIPT_NAME \$fastcgi_script_name;/ {
|
|
||||||
print $0
|
|
||||||
print ""
|
|
||||||
print " fastcgi_param PHP_VALUE \"xdebug.remote_enable=1\";"
|
|
||||||
next
|
|
||||||
}
|
|
||||||
{ print }
|
|
||||||
' >> "$NGINX_OUT"
|
|
||||||
|
|
||||||
echo "Generated $NGINX_OUT from $NGINX_TEMPLATE" >&2
|
|
||||||
|
|
||||||
echo "Done."
|
echo "Done."
|
||||||
@@ -1,137 +1,104 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Runtime setup for devcontainer (executed after container starts).
|
# NetAlertX Devcontainer Setup Script
|
||||||
# Prefer building setup into resources/devcontainer-Dockerfile when possible.
|
#
|
||||||
# Use this script for runtime-only adjustments (permissions, sockets, ownership,
|
# This script forcefully resets all runtime state for a single-user devcontainer.
|
||||||
# and services managed without init) that are difficult at build time.
|
# It is intentionally idempotent: every run wipes and recreates all relevant folders,
|
||||||
id
|
# symlinks, and files, so the environment is always fresh and predictable.
|
||||||
|
#
|
||||||
# Define variables (paths, ports, environment)
|
# - No conditional logic: everything is (re)created, overwritten, or reset unconditionally.
|
||||||
|
# - No security hardening: this is for disposable, local dev use only.
|
||||||
export APP_DIR="/app"
|
# - No checks for existing files, mounts, or processes—just do the work.
|
||||||
export APP_COMMAND="/workspaces/NetAlertX/.devcontainer/scripts/restart-backend.sh"
|
#
|
||||||
export PHP_FPM_BIN="/usr/sbin/php-fpm83"
|
# If you add new runtime files or folders, add them to the creation/reset section below.
|
||||||
export CROND_BIN="/usr/sbin/crond -f"
|
#
|
||||||
|
# Do not add if-then logic or error handling for missing/existing files. Simplicity is the goal.
|
||||||
|
|
||||||
|
|
||||||
export ALWAYS_FRESH_INSTALL=false
|
SOURCE_DIR=${SOURCE_DIR:-/workspaces/NetAlertX}
|
||||||
export INSTALL_DIR=/app
|
PY_SITE_PACKAGES="${VIRTUAL_ENV:-/opt/venv}/lib/python3.12/site-packages"
|
||||||
export LOGS_LOCATION=/app/logs
|
|
||||||
export CONF_FILE="app.conf"
|
|
||||||
export DB_FILE="app.db"
|
|
||||||
export FULL_FILEDB_PATH="${INSTALL_DIR}/db/${DB_FILE}"
|
|
||||||
export OUI_FILE="/usr/share/arp-scan/ieee-oui.txt" # Define the path to ieee-oui.txt and ieee-iab.txt
|
|
||||||
export TZ=Europe/Paris
|
|
||||||
export PORT=20211
|
|
||||||
export SOURCE_DIR="/workspaces/NetAlertX"
|
|
||||||
|
|
||||||
|
LOG_FILES=(
|
||||||
|
LOG_APP
|
||||||
|
LOG_APP_FRONT
|
||||||
|
LOG_STDOUT
|
||||||
|
LOG_STDERR
|
||||||
|
LOG_EXECUTION_QUEUE
|
||||||
|
LOG_APP_PHP_ERRORS
|
||||||
|
LOG_IP_CHANGES
|
||||||
|
LOG_CRON
|
||||||
|
LOG_REPORT_OUTPUT_TXT
|
||||||
|
LOG_REPORT_OUTPUT_HTML
|
||||||
|
LOG_REPORT_OUTPUT_JSON
|
||||||
|
LOG_DB_IS_LOCKED
|
||||||
|
LOG_NGINX_ERROR
|
||||||
|
)
|
||||||
|
|
||||||
main() {
|
sudo chmod 666 /var/run/docker.sock 2>/dev/null || true
|
||||||
echo "=== NetAlertX Development Container Setup ==="
|
sudo chown "$(id -u)":"$(id -g)" /workspaces
|
||||||
killall php-fpm83 nginx crond python3 2>/dev/null
|
sudo chmod 755 /workspaces
|
||||||
sleep 1
|
|
||||||
echo "Setting up ${SOURCE_DIR}..."
|
|
||||||
sudo chown $(id -u):$(id -g) /workspaces
|
|
||||||
sudo chmod 755 /workspaces
|
|
||||||
configure_source
|
|
||||||
|
|
||||||
echo "--- Starting Development Services ---"
|
killall php-fpm83 nginx crond python3 2>/dev/null || true
|
||||||
configure_php
|
|
||||||
|
|
||||||
|
# Mount ramdisks for volatile data
|
||||||
|
sudo mount -t tmpfs -o size=100m,mode=0777 tmpfs /tmp/log 2>/dev/null || true
|
||||||
|
sudo mount -t tmpfs -o size=50m,mode=0777 tmpfs /tmp/api 2>/dev/null || true
|
||||||
|
sudo mount -t tmpfs -o size=50m,mode=0777 tmpfs /tmp/run 2>/dev/null || true
|
||||||
|
sudo mount -t tmpfs -o size=50m,mode=0777 tmpfs /tmp/nginx 2>/dev/null || true
|
||||||
|
|
||||||
start_services
|
sudo chmod 777 /tmp/log /tmp/api /tmp/run /tmp/nginx
|
||||||
}
|
|
||||||
|
|
||||||
isRamDisk() {
|
|
||||||
if [ -z "$1" ] || [ ! -d "$1" ]; then
|
|
||||||
echo "Usage: isRamDisk <directory>" >&2
|
|
||||||
return 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
local fstype
|
|
||||||
fstype=$(df -T "$1" | awk 'NR==2 {print $2}')
|
|
||||||
|
|
||||||
if [ "$fstype" = "tmpfs" ] || [ "$fstype" = "ramfs" ]; then
|
|
||||||
return 0 # Success (is a ramdisk)
|
|
||||||
else
|
|
||||||
return 1 # Failure (is not a ramdisk)
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Setup source directory
|
|
||||||
configure_source() {
|
|
||||||
echo "[1/4] Configuring System..."
|
|
||||||
echo " -> Setting up /services permissions"
|
|
||||||
sudo chown -R netalertx /services
|
|
||||||
|
|
||||||
echo "[2/4] Configuring Source..."
|
|
||||||
echo " -> Cleaning up previous instances"
|
|
||||||
|
|
||||||
test -e ${NETALERTX_LOG} && sudo umount "${NETALERTX_LOG}" 2>/dev/null || true
|
|
||||||
test -e ${NETALERTX_API} && sudo umount "${NETALERTX_API}" 2>/dev/null || true
|
|
||||||
test -e ${NETALERTX_APP} && sudo rm -Rf ${NETALERTX_APP}/
|
|
||||||
|
|
||||||
echo " -> Linking source to ${NETALERTX_APP}"
|
|
||||||
sudo ln -s ${SOURCE_DIR}/ ${NETALERTX_APP}
|
|
||||||
|
|
||||||
echo " -> Mounting ramdisks for /log and /api"
|
|
||||||
mkdir -p ${NETALERTX_LOG} ${NETALERTX_API}
|
|
||||||
sudo mount -o uid=$(id -u netalertx),gid=$(id -g netalertx),mode=775 -t tmpfs -o size=256M tmpfs "${NETALERTX_LOG}"
|
|
||||||
sudo mount -o uid=$(id -u netalertx),gid=$(id -g netalertx),mode=775 -t tmpfs -o size=256M tmpfs "${NETALERTX_API}"
|
|
||||||
mkdir -p ${NETALERTX_PLUGINS_LOG}
|
|
||||||
touch ${NETALERTX_PLUGINS_LOG}/.dockerignore ${NETALERTX_API}/.dockerignore
|
|
||||||
# tmpfs mounts configured with netalertx ownership and 775 permissions above
|
|
||||||
|
|
||||||
touch /app/log/nginx_error.log
|
|
||||||
echo " -> Empty log"|tee ${INSTALL_DIR}/log/app.log \
|
|
||||||
${INSTALL_DIR}/log/app_front.log \
|
|
||||||
${INSTALL_DIR}/log/stdout.log
|
|
||||||
touch ${INSTALL_DIR}/log/stderr.log \
|
|
||||||
${INSTALL_DIR}/log/execution_queue.log
|
|
||||||
echo 0 > ${INSTALL_DIR}/log/db_is_locked.log
|
|
||||||
for f in ${INSTALL_DIR}/log/*.log; do
|
|
||||||
sudo chown netalertx:www-data $f
|
|
||||||
sudo chmod 664 $f
|
|
||||||
echo "" > $f
|
|
||||||
done
|
|
||||||
|
|
||||||
mkdir -p /app/log/plugins
|
|
||||||
sudo chown -R netalertx:www-data ${INSTALL_DIR}
|
|
||||||
|
|
||||||
|
|
||||||
while ps ax | grep -v grep | grep python3 > /dev/null; do
|
|
||||||
killall python3 &>/dev/null
|
|
||||||
sleep 0.2
|
|
||||||
done
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# configure_php: configure PHP-FPM and enable dev debug options
|
|
||||||
configure_php() {
|
|
||||||
echo "[3/4] Configuring PHP-FPM..."
|
|
||||||
sudo chown -R netalertx:netalertx ${SYSTEM_SERVICES_RUN} 2>/dev/null || true
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# start_services: start crond, PHP-FPM, nginx and the application
|
|
||||||
start_services() {
|
|
||||||
echo "[4/4] Starting services"
|
|
||||||
|
|
||||||
sudo chmod +x /entrypoint.sh
|
|
||||||
setsid bash /entrypoint.sh&
|
|
||||||
sleep 1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sudo chmod 755 /app/
|
|
||||||
echo "Development $(git rev-parse --short=8 HEAD)"| sudo tee /app/.VERSION
|
|
||||||
# Run the main function
|
|
||||||
main
|
|
||||||
|
|
||||||
# create a services readme file
|
|
||||||
echo "This folder is auto-generated by the container and devcontainer setup.sh script." > /services/README.md
|
|
||||||
echo "Any changes here will be lost on rebuild. To make permanent changes, edit files in .devcontainer or production filesystem and rebuild the container." >> /services/README.md
|
|
||||||
echo "Only make temporary/test changes in this folder, then perform a rebuild to reset." >> /services/README.md
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sudo rm -rf /entrypoint.d
|
||||||
|
sudo ln -s "${SOURCE_DIR}/install/production-filesystem/entrypoint.d" /entrypoint.d
|
||||||
|
|
||||||
|
sudo rm -rf "${NETALERTX_APP}"
|
||||||
|
sudo ln -s "${SOURCE_DIR}/" "${NETALERTX_APP}"
|
||||||
|
|
||||||
|
for dir in "${NETALERTX_DATA}" "${NETALERTX_CONFIG}" "${NETALERTX_DB}"; do
|
||||||
|
sudo install -d -m 777 "${dir}"
|
||||||
|
done
|
||||||
|
|
||||||
|
for dir in \
|
||||||
|
"${SYSTEM_SERVICES_RUN_LOG}" \
|
||||||
|
"${SYSTEM_SERVICES_ACTIVE_CONFIG}" \
|
||||||
|
"${NETALERTX_PLUGINS_LOG}" \
|
||||||
|
"${SYSTEM_SERVICES_RUN_TMP}" \
|
||||||
|
"/tmp/nginx/client_body" \
|
||||||
|
"/tmp/nginx/proxy" \
|
||||||
|
"/tmp/nginx/fastcgi" \
|
||||||
|
"/tmp/nginx/uwsgi" \
|
||||||
|
"/tmp/nginx/scgi"; do
|
||||||
|
sudo install -d -m 777 "${dir}"
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
for var in "${LOG_FILES[@]}"; do
|
||||||
|
path=${!var}
|
||||||
|
dir=$(dirname "${path}")
|
||||||
|
sudo install -d -m 777 "${dir}"
|
||||||
|
touch "${path}"
|
||||||
|
done
|
||||||
|
|
||||||
|
printf '0\n' | sudo tee "${LOG_DB_IS_LOCKED}" >/dev/null
|
||||||
|
sudo chmod 777 "${LOG_DB_IS_LOCKED}"
|
||||||
|
|
||||||
|
sudo pkill -f python3 2>/dev/null || true
|
||||||
|
|
||||||
|
sudo chmod 777 "${PY_SITE_PACKAGES}" "${NETALERTX_DATA}" "${NETALERTX_DATA}"/* 2>/dev/null || true
|
||||||
|
|
||||||
|
sudo chmod 005 "${PY_SITE_PACKAGES}" 2>/dev/null || true
|
||||||
|
|
||||||
|
sudo chown -R "${NETALERTX_USER}:${NETALERTX_GROUP}" "${NETALERTX_APP}"
|
||||||
|
date +%s | sudo tee "${NETALERTX_FRONT}/buildtimestamp.txt" >/dev/null
|
||||||
|
|
||||||
|
sudo chmod 755 "${NETALERTX_APP}"
|
||||||
|
|
||||||
|
sudo chmod +x /entrypoint.sh
|
||||||
|
setsid bash /entrypoint.sh &
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
echo "Development $(git rev-parse --short=8 HEAD)" | sudo tee "${NETALERTX_APP}/.VERSION" >/dev/null
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
.dockerignore
|
.dockerignore
|
||||||
|
**/.dockerignore
|
||||||
.env
|
.env
|
||||||
.git
|
.git
|
||||||
.github
|
.github
|
||||||
|
|||||||
3
.flake8
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[flake8]
|
||||||
|
max-line-length = 180
|
||||||
|
ignore = E221,E222,E251,E203
|
||||||
38
.github/ISSUE_TEMPLATE/i-have-an-issue.yml
vendored
@@ -44,9 +44,9 @@ body:
|
|||||||
required: false
|
required: false
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: app.conf
|
label: Relevant `app.conf` settings
|
||||||
description: |
|
description: |
|
||||||
Paste your `app.conf` (remove personal info)
|
Paste relevant `app.conf`settings (remove sensitive info)
|
||||||
render: python
|
render: python
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
@@ -55,7 +55,7 @@ body:
|
|||||||
label: docker-compose.yml
|
label: docker-compose.yml
|
||||||
description: |
|
description: |
|
||||||
Paste your `docker-compose.yml`
|
Paste your `docker-compose.yml`
|
||||||
render: python
|
render: yaml
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
@@ -70,21 +70,37 @@ body:
|
|||||||
- Bare-metal (community only support - Check Discord)
|
- Bare-metal (community only support - Check Discord)
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
- type: checkboxes
|
||||||
|
attributes:
|
||||||
|
label: Debug or Trace enabled
|
||||||
|
description: I confirm I set `LOG_LEVEL` to `debug` or `trace`
|
||||||
|
options:
|
||||||
|
- label: I have read and followed the steps in the wiki link above and provided the required debug logs and the log section covers the time when the issue occurs.
|
||||||
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: app.log
|
label: Relevant `app.log` section
|
||||||
|
value: |
|
||||||
|
```
|
||||||
|
PASTE LOG HERE. Using the triple backticks preserves format.
|
||||||
|
```
|
||||||
description: |
|
description: |
|
||||||
Logs with debug enabled (https://github.com/jokob-sk/NetAlertX/blob/main/docs/DEBUG_TIPS.md) ⚠
|
Logs with debug enabled (https://github.com/jokob-sk/NetAlertX/blob/main/docs/DEBUG_TIPS.md) ⚠
|
||||||
***Generally speaking, all bug reports should have logs provided.***
|
***Generally speaking, all bug reports should have logs provided.***
|
||||||
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
|
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
|
||||||
Additionally, any additional info? Screenshots? References? Anything that will give us more context about the issue you are encountering!
|
Additionally, any additional info? Screenshots? References? Anything that will give us more context about the issue you are encountering!
|
||||||
You can use `tail -100 /app/log/app.log` in the container if you have trouble getting to the log files.
|
You can use `tail -100 /app/log/app.log` in the container if you have trouble getting to the log files or send them to netalertx@gmail.com with the issue number.
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
- type: checkboxes
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Debug enabled
|
label: Docker Logs
|
||||||
description: I confirm I enabled `debug`
|
description: |
|
||||||
options:
|
You can retrieve the logs from Portainer -> Containers -> your NetAlertX container -> Logs or by running `sudo docker logs netalertx`.
|
||||||
- label: I have read and followed the steps in the wiki link above and provided the required debug logs and the log section covers the time when the issue occurs.
|
value: |
|
||||||
required: true
|
```
|
||||||
|
PASTE DOCKER LOG HERE. Using the triple backticks preserves format.
|
||||||
|
```
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
|||||||
25
.github/copilot-instructions.md
vendored
@@ -18,7 +18,7 @@ Backend loop phases (see `server/__main__.py` and `server/plugin.py`): `once`, `
|
|||||||
## Plugin patterns that matter
|
## Plugin patterns that matter
|
||||||
- Manifest lives at `front/plugins/<code_name>/config.json`; `code_name` == folder, `unique_prefix` drives settings and filenames (e.g., `ARPSCAN`).
|
- Manifest lives at `front/plugins/<code_name>/config.json`; `code_name` == folder, `unique_prefix` drives settings and filenames (e.g., `ARPSCAN`).
|
||||||
- Control via settings: `<PREF>_RUN` (phase), `<PREF>_RUN_SCHD` (cron-like), `<PREF>_CMD` (script path), `<PREF>_RUN_TIMEOUT`, `<PREF>_WATCH` (diff columns).
|
- Control via settings: `<PREF>_RUN` (phase), `<PREF>_RUN_SCHD` (cron-like), `<PREF>_CMD` (script path), `<PREF>_RUN_TIMEOUT`, `<PREF>_WATCH` (diff columns).
|
||||||
- Data contract: scripts write `/app/log/plugins/last_result.<PREF>.log` (pipe‑delimited: 9 required cols + optional 4). Use `front/plugins/plugin_helper.py`’s `Plugin_Objects` to sanitize text and normalize MACs, then `write_result_file()`.
|
- Data contract: scripts write `/tmp/log/plugins/last_result.<PREF>.log` (pipe‑delimited: 9 required cols + optional 4). Use `front/plugins/plugin_helper.py`’s `Plugin_Objects` to sanitize text and normalize MACs, then `write_result_file()`.
|
||||||
- Device import: define `database_column_definitions` when creating/updating devices; watched fields trigger notifications.
|
- Device import: define `database_column_definitions` when creating/updating devices; watched fields trigger notifications.
|
||||||
|
|
||||||
### Standard Plugin Formats
|
### Standard Plugin Formats
|
||||||
@@ -30,6 +30,7 @@ Backend loop phases (see `server/__main__.py` and `server/plugin.py`): `once`, `
|
|||||||
* other: Miscellaneous plugins. Runs at various times. Data source: self / Template.
|
* other: Miscellaneous plugins. Runs at various times. Data source: self / Template.
|
||||||
|
|
||||||
### Plugin logging & outputs
|
### Plugin logging & outputs
|
||||||
|
- Always check relevant logs first.
|
||||||
- Use logging as shown in other plugins.
|
- Use logging as shown in other plugins.
|
||||||
- Collect results with `Plugin_Objects.add_object(...)` during processing and call `plugin_objects.write_result_file()` exactly once at the end of the script.
|
- Collect results with `Plugin_Objects.add_object(...)` during processing and call `plugin_objects.write_result_file()` exactly once at the end of the script.
|
||||||
- Prefer to log a brief summary before writing (e.g., total objects added) to aid troubleshooting; keep logs concise at `info` level and use `verbose` or `debug` for extra context.
|
- Prefer to log a brief summary before writing (e.g., total objects added) to aid troubleshooting; keep logs concise at `info` level and use `verbose` or `debug` for extra context.
|
||||||
@@ -42,22 +43,32 @@ Backend loop phases (see `server/__main__.py` and `server/plugin.py`): `once`, `
|
|||||||
## Conventions & helpers to reuse
|
## Conventions & helpers to reuse
|
||||||
- Settings: add/modify via `ccd()` in `server/initialise.py` or per‑plugin manifest. Never hardcode ports or secrets; use `get_setting_value()`.
|
- Settings: add/modify via `ccd()` in `server/initialise.py` or per‑plugin manifest. Never hardcode ports or secrets; use `get_setting_value()`.
|
||||||
- Logging: use `logger.mylog(level, [message])`; levels: none/minimal/verbose/debug/trace.
|
- Logging: use `logger.mylog(level, [message])`; levels: none/minimal/verbose/debug/trace.
|
||||||
- Time/MAC/strings: `helper.py` (`timeNowTZ`, `normalize_mac`, sanitizers). Validate MACs before DB writes.
|
- Time/MAC/strings: `helper.py` (`timeNowDB`, `normalize_mac`, sanitizers). Validate MACs before DB writes.
|
||||||
- DB helpers: prefer `server/db/db_helper.py` functions (e.g., `get_table_json`, device condition helpers) over raw SQL in new paths.
|
- DB helpers: prefer `server/db/db_helper.py` functions (e.g., `get_table_json`, device condition helpers) over raw SQL in new paths.
|
||||||
|
|
||||||
## Dev workflow (devcontainer)
|
## Dev workflow (devcontainer)
|
||||||
|
- **Devcontainer philosophy: brutal simplicity.** One user, everything writable, completely idempotent. No permission checks, no conditional logic, no sudo needed. If something doesn't work, tear down the wall and rebuild - don't patch. We unit test permissions in the hardened build.
|
||||||
|
- **Permissions:** Never `chmod` or `chown` during operations. Everything is already writable. If you need permissions, the devcontainer setup is broken - fix `.devcontainer/scripts/setup.sh` or `.devcontainer/resources/devcontainer-Dockerfile` instead.
|
||||||
|
- **Files & Paths:** Use environment variables (`NETALERTX_DB`, `NETALERTX_LOG`, etc.) everywhere. `/data` for persistent config/db, `/tmp` for runtime logs/api/nginx state. Never hardcode `/data/db` or relative paths.
|
||||||
|
- **Database reset:** Use the `[Dev Container] Wipe and Regenerate Database` task. Kills backend, deletes `/data/{db,config}/*`, runs first-time setup scripts. Clean slate, no questions.
|
||||||
- Services: use tasks to (re)start backend and nginx/PHP-FPM. Backend runs with debugpy on 5678; attach a Python debugger if needed.
|
- Services: use tasks to (re)start backend and nginx/PHP-FPM. Backend runs with debugpy on 5678; attach a Python debugger if needed.
|
||||||
- Run a plugin manually: `python3 front/plugins/<code_name>/script.py` (ensure `sys.path` includes `/app/front/plugins` and `/app/server` like the template).
|
- Run a plugin manually: `python3 front/plugins/<code_name>/script.py` (ensure `sys.path` includes `/app/front/plugins` and `/app/server` like the template).
|
||||||
- Testing: pytest available via Alpine packages. Tests live in `test/`; app code is under `server/`. PYTHONPATH is preconfigured to include workspace and `/opt/venv` site‑packages.
|
- Testing: pytest available via Alpine packages. Tests live in `test/`; app code is under `server/`. PYTHONPATH is preconfigured to include workspace and `/opt/venv` site‑packages.
|
||||||
|
- **Subprocess calls:** ALWAYS set explicit timeouts. Default to 60s minimum unless plugin config specifies otherwise. Nested subprocess calls (e.g., plugins calling external tools) need their own timeout - outer plugin timeout won't save you.
|
||||||
|
|
||||||
## What “done right” looks like
|
## What “done right” looks like
|
||||||
- When adding a plugin, start from `front/plugins/__template`, implement with `plugin_helper`, define manifest settings, and wire phase via `<PREF>_RUN`. Verify logs in `/app/log/plugins/` and data in `api/*.json`.
|
- When adding a plugin, start from `front/plugins/__template`, implement with `plugin_helper`, define manifest settings, and wire phase via `<PREF>_RUN`. Verify logs in `/tmp/log/plugins/` and data in `api/*.json`.
|
||||||
- When introducing new config, define it once (core `ccd()` or plugin manifest) and read it via helpers everywhere.
|
- When introducing new config, define it once (core `ccd()` or plugin manifest) and read it via helpers everywhere.
|
||||||
- When exposing new server functionality, add endpoints in `server/api_server/*` and keep authorization consistent; update UI by reading/writing JSON cache rather than bypassing the pipeline.
|
- When exposing new server functionality, add endpoints in `server/api_server/*` and keep authorization consistent; update UI by reading/writing JSON cache rather than bypassing the pipeline.
|
||||||
|
|
||||||
## Useful references
|
## Useful references
|
||||||
- Docs: `docs/PLUGINS_DEV.md`, `docs/SETTINGS_SYSTEM.md`, `docs/API_*.md`, `docs/DEBUG_*.md`
|
- Docs: `docs/PLUGINS_DEV.md`, `docs/SETTINGS_SYSTEM.md`, `docs/API_*.md`, `docs/DEBUG_*.md`
|
||||||
- Logs: backend `/app/log/app.log`, plugin logs under `/app/log/plugins/`, nginx/php logs under `/var/log/*`
|
- Logs: All logs are under `/tmp/log/`. Plugin logs are very shortly under `/tmp/log/plugins/` until picked up by the server.
|
||||||
|
- plugin logs: `/tmp/log/app.log`
|
||||||
|
- backend logs: `/tmp/log/stdout.log` and `/tmp/log/stderr.log`
|
||||||
|
- frontend commands logs: `/tmp/log/app_front.log`
|
||||||
|
- php errors: `/tmp/log/app.php_errors.log`
|
||||||
|
- nginx logs: `/tmp/log/nginx-access.log` and `/tmp/log/nginx-error.log`
|
||||||
|
|
||||||
## Assistant expectations:
|
## Assistant expectations:
|
||||||
- Be concise, opinionated, and biased toward security and simplicity.
|
- Be concise, opinionated, and biased toward security and simplicity.
|
||||||
@@ -72,3 +83,9 @@ Backend loop phases (see `server/__main__.py` and `server/plugin.py`): `once`, `
|
|||||||
- Be sure to offer choices when appropriate.
|
- Be sure to offer choices when appropriate.
|
||||||
- Always understand the intent of the user's request and undo/redo as needed.
|
- Always understand the intent of the user's request and undo/redo as needed.
|
||||||
- Above all, use the simplest possible code that meets the need so it can be easily audited and maintained.
|
- Above all, use the simplest possible code that meets the need so it can be easily audited and maintained.
|
||||||
|
- Always leave logging enabled. If there is a possiblity it will be difficult to debug with current logging, add more logging.
|
||||||
|
- Always run the testFailure tool before executing any tests to gather current failure information and avoid redundant runs.
|
||||||
|
- Always prioritize using the appropriate tools in the environment first. As an example if a test is failing use `testFailure` then `runTests`. Never `runTests` first.
|
||||||
|
- Docker tests take an extremely long time to run. Avoid changes to docker or tests until you've examined the exisiting testFailures and runTests results.
|
||||||
|
- Environment tools are designed specifically for your use in this project and running them in this order will give you the best results.
|
||||||
|
|
||||||
|
|||||||
60
.github/workflows/code_checks.yml
vendored
@@ -21,7 +21,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "🔍 Checking for incorrect absolute '/php/' URLs (should be 'php/' or './php/')..."
|
echo "🔍 Checking for incorrect absolute '/php/' URLs (should be 'php/' or './php/')..."
|
||||||
|
|
||||||
MATCHES=$(grep -rE "['\"]\/php\/" --include=\*.{js,php,html} ./front | grep -E "\.get|\.post|\.ajax|fetch|url\s*:") || true
|
MATCHES=$(grep -rE "['\"]/php/" --include=\*.{js,php,html} ./front \
|
||||||
|
| grep -E "\.get|\.post|\.ajax|fetch|url\s*:") || true
|
||||||
|
|
||||||
if [ -n "$MATCHES" ]; then
|
if [ -n "$MATCHES" ]; then
|
||||||
echo "$MATCHES"
|
echo "$MATCHES"
|
||||||
@@ -39,3 +40,60 @@ jobs:
|
|||||||
echo "🔍 Checking Python syntax..."
|
echo "🔍 Checking Python syntax..."
|
||||||
find . -name "*.py" -print0 | xargs -0 -n1 python3 -m py_compile
|
find . -name "*.py" -print0 | xargs -0 -n1 python3 -m py_compile
|
||||||
|
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
|
||||||
|
- name: Install linting tools
|
||||||
|
run: |
|
||||||
|
# Python linting
|
||||||
|
pip install flake8
|
||||||
|
# Docker linting
|
||||||
|
wget -O /tmp/hadolint https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64
|
||||||
|
chmod +x /tmp/hadolint
|
||||||
|
# PHP and shellcheck for syntax checking
|
||||||
|
sudo apt-get update && sudo apt-get install -y php-cli shellcheck
|
||||||
|
|
||||||
|
- name: Shell check
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
echo "🔍 Checking shell scripts..."
|
||||||
|
find . -name "*.sh" -exec shellcheck {} \;
|
||||||
|
|
||||||
|
- name: Python lint
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
echo "🔍 Linting Python code..."
|
||||||
|
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||||
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||||
|
|
||||||
|
- name: PHP check
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
echo "🔍 Checking PHP syntax..."
|
||||||
|
find . -name "*.php" -exec php -l {} \;
|
||||||
|
|
||||||
|
- name: Docker lint
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
echo "🔍 Linting Dockerfiles..."
|
||||||
|
/tmp/hadolint --config .hadolint.yaml Dockerfile* || true
|
||||||
|
|
||||||
|
docker-tests:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Run Docker-based tests
|
||||||
|
run: |
|
||||||
|
echo "🐳 Running Docker-based tests..."
|
||||||
|
chmod +x ./test/docker_tests/run_docker_tests.sh
|
||||||
|
./test/docker_tests/run_docker_tests.sh
|
||||||
|
|||||||
23
.github/workflows/docker_dev.yml
vendored
@@ -20,6 +20,7 @@ jobs:
|
|||||||
if: >
|
if: >
|
||||||
contains(github.event.head_commit.message, 'PUSHPROD') != 'True' &&
|
contains(github.event.head_commit.message, 'PUSHPROD') != 'True' &&
|
||||||
github.repository == 'jokob-sk/NetAlertX'
|
github.repository == 'jokob-sk/NetAlertX'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -30,6 +31,14 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
# --- Generate timestamped dev version
|
||||||
|
- name: Generate timestamp version
|
||||||
|
id: timestamp
|
||||||
|
run: |
|
||||||
|
ts=$(date -u +'%Y%m%d-%H%M%S')
|
||||||
|
echo "version=dev-${ts}" >> $GITHUB_OUTPUT
|
||||||
|
echo "Generated version: dev-${ts}"
|
||||||
|
|
||||||
- name: Set up dynamic build ARGs
|
- name: Set up dynamic build ARGs
|
||||||
id: getargs
|
id: getargs
|
||||||
run: echo "version=$(cat ./stable/VERSION)" >> $GITHUB_OUTPUT
|
run: echo "version=$(cat ./stable/VERSION)" >> $GITHUB_OUTPUT
|
||||||
@@ -38,18 +47,26 @@ jobs:
|
|||||||
id: get_version
|
id: get_version
|
||||||
run: echo "version=Dev" >> $GITHUB_OUTPUT
|
run: echo "version=Dev" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# --- debug output
|
||||||
|
- name: Debug version
|
||||||
|
run: |
|
||||||
|
echo "GITHUB_REF: $GITHUB_REF"
|
||||||
|
echo "Version: '${{ steps.get_version.outputs.version }}'"
|
||||||
|
|
||||||
|
# --- Write the timestamped version to .VERSION file
|
||||||
- name: Create .VERSION file
|
- name: Create .VERSION file
|
||||||
run: echo "${{ steps.get_version.outputs.version }}" >> .VERSION
|
run: echo "${{ steps.timestamp.outputs.version }}" > .VERSION
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
ghcr.io/jokob-sk/netalertx-dev
|
ghcr.io/jokob-sk/netalertx-dev
|
||||||
jokobsk/netalertx-dev
|
jokobsk/netalertx-dev
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest
|
type=raw,value=latest
|
||||||
|
type=raw,value=${{ steps.timestamp.outputs.version }}
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
type=ref,event=pr
|
type=ref,event=pr
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
@@ -72,7 +89,7 @@ jobs:
|
|||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
|
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
|
||||||
|
|||||||
43
.github/workflows/docker_prod.yml
vendored
@@ -6,7 +6,6 @@
|
|||||||
# GitHub recommends pinning actions to a commit SHA.
|
# GitHub recommends pinning actions to a commit SHA.
|
||||||
# To get a newer version, you will need to update the SHA.
|
# To get a newer version, you will need to update the SHA.
|
||||||
# You can also reference a tag or branch, but the action may change without warning.
|
# You can also reference a tag or branch, but the action may change without warning.
|
||||||
|
|
||||||
name: Publish Docker image
|
name: Publish Docker image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -14,6 +13,7 @@ on:
|
|||||||
types: [published]
|
types: [published]
|
||||||
tags:
|
tags:
|
||||||
- '*.[1-9]+[0-9]?.[1-9]+*'
|
- '*.[1-9]+[0-9]?.[1-9]+*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -21,6 +21,7 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -31,42 +32,59 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
# --- Previous approach Get release version from tag
|
||||||
- name: Set up dynamic build ARGs
|
- name: Set up dynamic build ARGs
|
||||||
id: getargs
|
id: getargs
|
||||||
run: echo "version=$(cat ./stable/VERSION)" >> $GITHUB_OUTPUT
|
run: echo "version=$(cat ./stable/VERSION)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Get release version
|
- name: Get release version
|
||||||
id: get_version
|
id: get_version_prev
|
||||||
run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
|
run: echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
|
||||||
|
|
||||||
- name: Create .VERSION file
|
- name: Create .VERSION file
|
||||||
run: echo "${{ steps.get_version.outputs.version }}" >> .VERSION
|
run: echo "${{ steps.get_version.outputs.version }}" >> .VERSION_PREV
|
||||||
|
|
||||||
|
# --- Get release version from tag
|
||||||
|
- name: Get release version
|
||||||
|
id: get_version
|
||||||
|
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
|
||||||
|
# --- debug output
|
||||||
|
- name: Debug version
|
||||||
|
run: |
|
||||||
|
echo "GITHUB_REF: $GITHUB_REF"
|
||||||
|
echo "Version: '${{ steps.get_version.outputs.version }}'"
|
||||||
|
echo "Version prev: '${{ steps.get_version_prev.outputs.version }}'"
|
||||||
|
|
||||||
|
# --- Write version to .VERSION file
|
||||||
|
- name: Create .VERSION file
|
||||||
|
run: echo -n "${{ steps.get_version.outputs.version }}" > .VERSION
|
||||||
|
|
||||||
|
# --- Generate Docker metadata and tags
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
# list of Docker images to use as base name for tags
|
|
||||||
images: |
|
images: |
|
||||||
ghcr.io/jokob-sk/netalertx
|
ghcr.io/jokob-sk/netalertx
|
||||||
jokobsk/netalertx
|
jokobsk/netalertx
|
||||||
# generate Docker tags based on the following events/attributes
|
|
||||||
tags: |
|
tags: |
|
||||||
type=semver,pattern={{version}},value=${{ inputs.version }}
|
type=semver,pattern={{version}},value=${{ steps.get_version.outputs.version }}
|
||||||
type=semver,pattern={{major}}.{{minor}},value=${{ inputs.version }}
|
type=semver,pattern={{major}}.{{minor}},value=${{ steps.get_version.outputs.version }}
|
||||||
type=semver,pattern={{major}},value=${{ inputs.version }}
|
type=semver,pattern={{major}},value=${{ steps.get_version.outputs.version }}
|
||||||
type=ref,event=branch,suffix=-{{ sha }}
|
type=ref,event=branch,suffix=-{{ sha }}
|
||||||
type=ref,event=pr
|
type=ref,event=pr
|
||||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
|
||||||
- name: Log in to Github Container registry
|
- name: Log in to Github Container Registry (GHCR)
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: jokob-sk
|
username: jokob-sk
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Log in to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
@@ -74,13 +92,12 @@ jobs:
|
|||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
|
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
# # ⚠ disable cache if build is failing to download debian packages
|
|
||||||
# cache-from: type=registry,ref=ghcr.io/jokob-sk/netalertx:buildcache
|
# cache-from: type=registry,ref=ghcr.io/jokob-sk/netalertx:buildcache
|
||||||
# cache-to: type=registry,ref=ghcr.io/jokob-sk/netalertx:buildcache,mode=max
|
# cache-to: type=registry,ref=ghcr.io/jokob-sk/netalertx:buildcache,mode=max
|
||||||
|
|||||||
2
.github/workflows/docker_rewrite.yml
vendored
@@ -43,7 +43,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v4
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
ghcr.io/jokob-sk/netalertx-dev-rewrite
|
ghcr.io/jokob-sk/netalertx-dev-rewrite
|
||||||
|
|||||||
2
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
.coverage
|
||||||
.vscode
|
.vscode
|
||||||
.dotnet
|
.dotnet
|
||||||
.vscode-server
|
.vscode-server
|
||||||
@@ -10,6 +11,7 @@ nohup.out
|
|||||||
config/*
|
config/*
|
||||||
.ash_history
|
.ash_history
|
||||||
.VERSION
|
.VERSION
|
||||||
|
.VERSION_PREV
|
||||||
config/pialert.conf
|
config/pialert.conf
|
||||||
config/app.conf
|
config/app.conf
|
||||||
db/*
|
db/*
|
||||||
|
|||||||
2
.hadolint.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
ignored:
|
||||||
|
- DL3018
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import sys, importlib
|
|
||||||
mods = [
|
|
||||||
'json', 'simplejson',
|
|
||||||
'httplib', 'http.client',
|
|
||||||
'urllib2', 'urllib.request',
|
|
||||||
'Queue', 'queue',
|
|
||||||
'cStringIO', 'StringIO', 'io',
|
|
||||||
'md5', 'hashlib',
|
|
||||||
'ssl'
|
|
||||||
]
|
|
||||||
print('PYTHON_EXE:' + sys.executable)
|
|
||||||
print('PYTHON_VER:' + sys.version.replace('\n', ' '))
|
|
||||||
for m in mods:
|
|
||||||
try:
|
|
||||||
mod = importlib.import_module(m)
|
|
||||||
ver = getattr(mod, '__version__', None)
|
|
||||||
if ver is None:
|
|
||||||
# try common attributes
|
|
||||||
ver = getattr(mod, 'version', None)
|
|
||||||
info = (' version=' + str(ver)) if ver is not None else ''
|
|
||||||
print('OK %s%s' % (m, info))
|
|
||||||
except Exception as e:
|
|
||||||
print('MISSING %s %s: %s' % (m, e.__class__.__name__, e))
|
|
||||||
8
.vscode/launch.json
vendored
@@ -29,6 +29,14 @@
|
|||||||
"pathMappings": {
|
"pathMappings": {
|
||||||
"/app": "${workspaceFolder}"
|
"/app": "${workspaceFolder}"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Python: Current File",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${file}",
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"justMyCode": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
18
.vscode/settings.json
vendored
@@ -11,13 +11,23 @@
|
|||||||
// Let the Python extension invoke pytest via the interpreter; avoid hardcoded paths
|
// Let the Python extension invoke pytest via the interpreter; avoid hardcoded paths
|
||||||
// Removed python.testing.pytestPath and legacy pytest.command overrides
|
// Removed python.testing.pytestPath and legacy pytest.command overrides
|
||||||
|
|
||||||
"terminal.integrated.defaultProfile.linux": "fish",
|
"terminal.integrated.defaultProfile.linux": "zsh",
|
||||||
"terminal.integrated.profiles.linux": {
|
"terminal.integrated.profiles.linux": {
|
||||||
"fish": {
|
"zsh": {
|
||||||
"path": "/usr/bin/fish"
|
"path": "/bin/zsh"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
// Fallback for older VS Code versions or schema validators that don't accept custom profiles
|
// Fallback for older VS Code versions or schema validators that don't accept custom profiles
|
||||||
"terminal.integrated.shell.linux": "/usr/bin/fish"
|
"terminal.integrated.shell.linux": "/usr/bin/zsh"
|
||||||
|
,
|
||||||
|
"python.linting.flake8Enabled": true,
|
||||||
|
"python.linting.enabled": true,
|
||||||
|
"python.linting.flake8Args": [
|
||||||
|
"--config=.flake8"
|
||||||
|
],
|
||||||
|
"python.formatting.provider": "black",
|
||||||
|
"python.formatting.blackArgs": [
|
||||||
|
"--line-length=180"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
96
.vscode/tasks.json
vendored
@@ -1,16 +1,27 @@
|
|||||||
{
|
{
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"id": "confirmPrune",
|
||||||
|
"type": "promptString",
|
||||||
|
"description": "DANGER! Type YES to confirm pruning all unused Docker resources. This will destroy containers, images, volumes, and networks!",
|
||||||
|
"default": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
"tasks": [
|
"tasks": [
|
||||||
{
|
{
|
||||||
"label": "[Any POSIX] Generate Devcontainer Configs",
|
"label": "[Any POSIX] Generate Devcontainer Configs",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": ".devcontainer/scripts/generate-configs.sh",
|
"command": ".devcontainer/scripts/generate-configs.sh",
|
||||||
|
"detail": "Generates devcontainer configs from the template. This must be run after changes to devcontainer to combine/merge them into the final config used by VS Code. Note- this has no bearing on the production or test image.",
|
||||||
"presentation": {
|
"presentation": {
|
||||||
"echo": true,
|
"echo": true,
|
||||||
"reveal": "always",
|
"reveal": "always",
|
||||||
"panel": "shared",
|
"panel": "shared",
|
||||||
"showReuseMessage": false
|
"showReuseMessage": false,
|
||||||
|
"group": "POSIX Tasks"
|
||||||
},
|
},
|
||||||
|
|
||||||
"problemMatcher": [],
|
"problemMatcher": [],
|
||||||
"group": {
|
"group": {
|
||||||
"kind": "build",
|
"kind": "build",
|
||||||
@@ -24,12 +35,19 @@
|
|||||||
{
|
{
|
||||||
"label": "[Any] Docker system and build Prune",
|
"label": "[Any] Docker system and build Prune",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": ".devcontainer/scripts/confirm-docker-prune.sh",
|
"command": ".devcontainer/scripts/confirm-docker-prune.sh",
|
||||||
|
"detail": "DANGER! Prunes all unused Docker resources (images, containers, volumes, networks). Any stopped container will be wiped and data will be lost. Use with caution.",
|
||||||
|
"options": {
|
||||||
|
"env": {
|
||||||
|
"CONFIRM_PRUNE": "${input:confirmPrune}"
|
||||||
|
}
|
||||||
|
},
|
||||||
"presentation": {
|
"presentation": {
|
||||||
"echo": true,
|
"echo": true,
|
||||||
"reveal": "always",
|
"reveal": "always",
|
||||||
"panel": "shared",
|
"panel": "shared",
|
||||||
"showReuseMessage": false
|
"showReuseMessage": false,
|
||||||
|
"group": "Any"
|
||||||
},
|
},
|
||||||
"problemMatcher": [],
|
"problemMatcher": [],
|
||||||
"group": {
|
"group": {
|
||||||
@@ -45,6 +63,7 @@
|
|||||||
"label": "[Dev Container] Re-Run Startup Script",
|
"label": "[Dev Container] Re-Run Startup Script",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "./isDevContainer.sh || exit 1;/workspaces/NetAlertX/.devcontainer/scripts/setup.sh",
|
"command": "./isDevContainer.sh || exit 1;/workspaces/NetAlertX/.devcontainer/scripts/setup.sh",
|
||||||
|
"detail": "The startup script runs directly after the container is started. It reprovisions permissions, links folders, and performs other setup tasks. Run this if you have made changes to the setup script or need to reprovision the container.",
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "/workspaces/NetAlertX/.devcontainer/scripts"
|
"cwd": "/workspaces/NetAlertX/.devcontainer/scripts"
|
||||||
},
|
},
|
||||||
@@ -65,6 +84,7 @@
|
|||||||
"label": "[Dev Container] Start Backend (Python)",
|
"label": "[Dev Container] Start Backend (Python)",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "./isDevContainer.sh || exit 1; /services/start-backend.sh",
|
"command": "./isDevContainer.sh || exit 1; /services/start-backend.sh",
|
||||||
|
"detail": "Restarts the NetAlertX backend (Python) service in the dev container. This may take 5 seconds to be completely ready.",
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "/workspaces/NetAlertX/.devcontainer/scripts"
|
"cwd": "/workspaces/NetAlertX/.devcontainer/scripts"
|
||||||
},
|
},
|
||||||
@@ -73,7 +93,8 @@
|
|||||||
"reveal": "always",
|
"reveal": "always",
|
||||||
"panel": "shared",
|
"panel": "shared",
|
||||||
"showReuseMessage": false,
|
"showReuseMessage": false,
|
||||||
"clear": false
|
"clear": false,
|
||||||
|
"group": "Devcontainer"
|
||||||
},
|
},
|
||||||
"problemMatcher": [],
|
"problemMatcher": [],
|
||||||
"icon": {
|
"icon": {
|
||||||
@@ -85,6 +106,7 @@
|
|||||||
"label": "[Dev Container] Start CronD (Scheduler)",
|
"label": "[Dev Container] Start CronD (Scheduler)",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "./isDevContainer.sh || exit 1; /services/start-crond.sh",
|
"command": "./isDevContainer.sh || exit 1; /services/start-crond.sh",
|
||||||
|
"detail": "Stops and restarts the crond service.",
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "/workspaces/NetAlertX/.devcontainer/scripts"
|
"cwd": "/workspaces/NetAlertX/.devcontainer/scripts"
|
||||||
},
|
},
|
||||||
@@ -93,7 +115,8 @@
|
|||||||
"reveal": "always",
|
"reveal": "always",
|
||||||
"panel": "shared",
|
"panel": "shared",
|
||||||
"showReuseMessage": false,
|
"showReuseMessage": false,
|
||||||
"clear": false
|
"clear": false,
|
||||||
|
"group": "Devcontainer"
|
||||||
},
|
},
|
||||||
"problemMatcher": [],
|
"problemMatcher": [],
|
||||||
"icon": {
|
"icon": {
|
||||||
@@ -105,6 +128,7 @@
|
|||||||
"label": "[Dev Container] Start Frontend (nginx and PHP-FPM)",
|
"label": "[Dev Container] Start Frontend (nginx and PHP-FPM)",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "./isDevContainer.sh || exit 1; /services/start-php-fpm.sh & /services/start-nginx.sh &",
|
"command": "./isDevContainer.sh || exit 1; /services/start-php-fpm.sh & /services/start-nginx.sh &",
|
||||||
|
"detail": "Stops and restarts the NetAlertX frontend services (nginx and PHP-FPM) in the dev container. This launches almost instantly.",
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "/workspaces/NetAlertX/.devcontainer/scripts"
|
"cwd": "/workspaces/NetAlertX/.devcontainer/scripts"
|
||||||
|
|
||||||
@@ -114,7 +138,8 @@
|
|||||||
"reveal": "always",
|
"reveal": "always",
|
||||||
"panel": "shared",
|
"panel": "shared",
|
||||||
"showReuseMessage": false,
|
"showReuseMessage": false,
|
||||||
"clear": false
|
"clear": false,
|
||||||
|
"group": "Devcontainer"
|
||||||
},
|
},
|
||||||
"problemMatcher": [],
|
"problemMatcher": [],
|
||||||
"icon": {
|
"icon": {
|
||||||
@@ -126,6 +151,7 @@
|
|||||||
"label": "[Dev Container] Stop Frontend & Backend Services",
|
"label": "[Dev Container] Stop Frontend & Backend Services",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "./isDevContainer.sh || exit 1; pkill -f 'php-fpm83|nginx|crond|python3' || true",
|
"command": "./isDevContainer.sh || exit 1; pkill -f 'php-fpm83|nginx|crond|python3' || true",
|
||||||
|
"detail": "Stops all NetAlertX services running in the dev container.",
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "/workspaces/NetAlertX/.devcontainer/scripts"
|
"cwd": "/workspaces/NetAlertX/.devcontainer/scripts"
|
||||||
},
|
},
|
||||||
@@ -133,7 +159,8 @@
|
|||||||
"echo": true,
|
"echo": true,
|
||||||
"reveal": "always",
|
"reveal": "always",
|
||||||
"panel": "shared",
|
"panel": "shared",
|
||||||
"showReuseMessage": false
|
"showReuseMessage": false,
|
||||||
|
"group": "Devcontainer"
|
||||||
},
|
},
|
||||||
"problemMatcher": [],
|
"problemMatcher": [],
|
||||||
"icon": {
|
"icon": {
|
||||||
@@ -142,11 +169,54 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "[Dev Container] List NetAlertX Ports",
|
"label": "[Any] Build Unit Test Docker image",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
"command": "list-ports.sh",
|
"command": "docker buildx build -t netalertx-test . && echo '🧪 Unit Test Docker image built: netalertx-test'",
|
||||||
|
"detail": "This must be run after changes to the container. Unit testing will not register changes until after this image is rebuilt. It takes about 30 seconds to build unless changes to the venv stage are made. venv takes 90s alone.",
|
||||||
|
"presentation": {
|
||||||
|
"echo": true,
|
||||||
|
"reveal": "always",
|
||||||
|
"panel": "shared",
|
||||||
|
"showReuseMessage": false,
|
||||||
|
"group": "Any"
|
||||||
|
|
||||||
|
},
|
||||||
|
"problemMatcher": [],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": false
|
||||||
|
},
|
||||||
|
"icon": {
|
||||||
|
"id": "beaker",
|
||||||
|
"color": "terminal.ansiBlue"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "[Dev Container] Wipe and Regenerate Database",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "killall 'python3' || true && sleep 1 && rm -rf /data/db/* /data/config/* && bash /entrypoint.d/15-first-run-config.sh && bash /entrypoint.d/20-first-run-db.sh && echo '✅ Database and config wiped and regenerated'",
|
||||||
|
"detail": "Wipes devcontainer db and config. Provides a fresh start in devcontainer, run this task, then run the Rerun Startup Task",
|
||||||
|
"options": {},
|
||||||
|
"presentation": {
|
||||||
|
"echo": true,
|
||||||
|
"reveal": "always",
|
||||||
|
"panel": "shared",
|
||||||
|
"showReuseMessage": false,
|
||||||
|
"group": "Devcontainer"
|
||||||
|
},
|
||||||
|
"problemMatcher": [],
|
||||||
|
"icon": {
|
||||||
|
"id": "database",
|
||||||
|
"color": "terminal.ansiRed"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Build & Launch Prodcution Docker Container",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "docker compose up -d --build --force-recreate",
|
||||||
|
"detail": "Before launching, ensure VSCode Ports are closed and services are stopped. Tasks: Stop Frontend & Backend Services & Remote: Close Unused Forwarded Ports to ensure proper operation of the new container.",
|
||||||
"options": {
|
"options": {
|
||||||
"cwd": "/workspaces/NetAlertX/.devcontainer/scripts"
|
"cwd": "/workspaces/NetAlertX"
|
||||||
},
|
},
|
||||||
"presentation": {
|
"presentation": {
|
||||||
"echo": true,
|
"echo": true,
|
||||||
@@ -155,8 +225,12 @@
|
|||||||
"showReuseMessage": false
|
"showReuseMessage": false
|
||||||
},
|
},
|
||||||
"problemMatcher": [],
|
"problemMatcher": [],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": false
|
||||||
|
},
|
||||||
"icon": {
|
"icon": {
|
||||||
"id": "output",
|
"id": "package",
|
||||||
"color": "terminal.ansiBlue"
|
"color": "terminal.ansiBlue"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
75
Dockerfile
@@ -32,7 +32,7 @@ RUN apk add --no-cache bash shadow python3 python3-dev gcc musl-dev libffi-dev o
|
|||||||
# Create virtual environment owned by root, but readable by everyone else. This makes it easy to copy
|
# Create virtual environment owned by root, but readable by everyone else. This makes it easy to copy
|
||||||
# into hardened stage without worrying about permissions and keeps image size small. Keeping the commands
|
# into hardened stage without worrying about permissions and keeps image size small. Keeping the commands
|
||||||
# together makes for a slightly smaller image size.
|
# together makes for a slightly smaller image size.
|
||||||
RUN pip install -r /tmp/requirements.txt && \
|
RUN pip install --no-cache-dir -r /tmp/requirements.txt && \
|
||||||
chmod -R u-rwx,g-rwx /opt
|
chmod -R u-rwx,g-rwx /opt
|
||||||
|
|
||||||
# second stage is the main runtime stage with just the minimum required to run the application
|
# second stage is the main runtime stage with just the minimum required to run the application
|
||||||
@@ -43,14 +43,16 @@ ARG INSTALL_DIR=/app
|
|||||||
|
|
||||||
# NetAlertX app directories
|
# NetAlertX app directories
|
||||||
ENV NETALERTX_APP=${INSTALL_DIR}
|
ENV NETALERTX_APP=${INSTALL_DIR}
|
||||||
ENV NETALERTX_CONFIG=${NETALERTX_APP}/config
|
ENV NETALERTX_DATA=/data
|
||||||
|
ENV NETALERTX_CONFIG=${NETALERTX_DATA}/config
|
||||||
ENV NETALERTX_FRONT=${NETALERTX_APP}/front
|
ENV NETALERTX_FRONT=${NETALERTX_APP}/front
|
||||||
|
ENV NETALERTX_PLUGINS=${NETALERTX_FRONT}/plugins
|
||||||
ENV NETALERTX_SERVER=${NETALERTX_APP}/server
|
ENV NETALERTX_SERVER=${NETALERTX_APP}/server
|
||||||
ENV NETALERTX_API=${NETALERTX_APP}/api
|
ENV NETALERTX_API=/tmp/api
|
||||||
ENV NETALERTX_DB=${NETALERTX_APP}/db
|
ENV NETALERTX_DB=${NETALERTX_DATA}/db
|
||||||
ENV NETALERTX_DB_FILE=${NETALERTX_DB}/app.db
|
ENV NETALERTX_DB_FILE=${NETALERTX_DB}/app.db
|
||||||
ENV NETALERTX_BACK=${NETALERTX_APP}/back
|
ENV NETALERTX_BACK=${NETALERTX_APP}/back
|
||||||
ENV NETALERTX_LOG=${NETALERTX_APP}/log
|
ENV NETALERTX_LOG=/tmp/log
|
||||||
ENV NETALERTX_PLUGINS_LOG=${NETALERTX_LOG}/plugins
|
ENV NETALERTX_PLUGINS_LOG=${NETALERTX_LOG}/plugins
|
||||||
ENV NETALERTX_CONFIG_FILE=${NETALERTX_CONFIG}/app.conf
|
ENV NETALERTX_CONFIG_FILE=${NETALERTX_CONFIG}/app.conf
|
||||||
|
|
||||||
@@ -66,32 +68,37 @@ ENV LOG_APP_PHP_ERRORS=${NETALERTX_LOG}/app.php_errors.log
|
|||||||
ENV LOG_EXECUTION_QUEUE=${NETALERTX_LOG}/execution_queue.log
|
ENV LOG_EXECUTION_QUEUE=${NETALERTX_LOG}/execution_queue.log
|
||||||
ENV LOG_REPORT_OUTPUT_JSON=${NETALERTX_LOG}/report_output.json
|
ENV LOG_REPORT_OUTPUT_JSON=${NETALERTX_LOG}/report_output.json
|
||||||
ENV LOG_STDOUT=${NETALERTX_LOG}/stdout.log
|
ENV LOG_STDOUT=${NETALERTX_LOG}/stdout.log
|
||||||
ENV LOG_CROND=${NETALERTX_LOG}/crond.log
|
ENV LOG_CRON=${NETALERTX_LOG}/cron.log
|
||||||
|
ENV LOG_NGINX_ERROR=${NETALERTX_LOG}/nginx-error.log
|
||||||
|
|
||||||
# System Services configuration files
|
# System Services configuration files
|
||||||
|
ENV ENTRYPOINT_CHECKS=/entrypoint.d
|
||||||
ENV SYSTEM_SERVICES=/services
|
ENV SYSTEM_SERVICES=/services
|
||||||
ENV SYSTEM_SERVICES_SCRIPTS=${SYSTEM_SERVICES}/scripts
|
ENV SYSTEM_SERVICES_SCRIPTS=${SYSTEM_SERVICES}/scripts
|
||||||
ENV SYSTEM_SERVICES_CONFIG=${SYSTEM_SERVICES}/config
|
ENV SYSTEM_SERVICES_CONFIG=${SYSTEM_SERVICES}/config
|
||||||
ENV SYSTEM_NGINX_CONFIG=${SYSTEM_SERVICES_CONFIG}/nginx
|
ENV SYSTEM_NGINX_CONFIG=${SYSTEM_SERVICES_CONFIG}/nginx
|
||||||
ENV SYSTEM_NGINX_CONFIG_FILE=${SYSTEM_NGINX_CONFIG}/nginx.conf
|
ENV SYSTEM_NGINX_CONFIG_TEMPLATE=${SYSTEM_NGINX_CONFIG}/netalertx.conf.template
|
||||||
|
ENV SYSTEM_SERVICES_CONFIG_CRON=${SYSTEM_SERVICES_CONFIG}/cron
|
||||||
|
ENV SYSTEM_SERVICES_ACTIVE_CONFIG=/tmp/nginx/active-config
|
||||||
|
ENV SYSTEM_SERVICES_ACTIVE_CONFIG_FILE=${SYSTEM_SERVICES_ACTIVE_CONFIG}/nginx.conf
|
||||||
ENV SYSTEM_SERVICES_PHP_FOLDER=${SYSTEM_SERVICES_CONFIG}/php
|
ENV SYSTEM_SERVICES_PHP_FOLDER=${SYSTEM_SERVICES_CONFIG}/php
|
||||||
ENV SYSTEM_SERVICES_PHP_FPM_D=${SYSTEM_SERVICES_PHP_FOLDER}/php-fpm.d
|
ENV SYSTEM_SERVICES_PHP_FPM_D=${SYSTEM_SERVICES_PHP_FOLDER}/php-fpm.d
|
||||||
ENV SYSTEM_SERVICES_CROND=${SYSTEM_SERVICES_CONFIG}/crond
|
ENV SYSTEM_SERVICES_RUN=/tmp/run
|
||||||
ENV SYSTEM_SERVICES_RUN=${SYSTEM_SERVICES}/run
|
|
||||||
ENV SYSTEM_SERVICES_RUN_TMP=${SYSTEM_SERVICES_RUN}/tmp
|
ENV SYSTEM_SERVICES_RUN_TMP=${SYSTEM_SERVICES_RUN}/tmp
|
||||||
ENV SYSTEM_SERVICES_RUN_LOG=${SYSTEM_SERVICES_RUN}/logs
|
ENV SYSTEM_SERVICES_RUN_LOG=${SYSTEM_SERVICES_RUN}/logs
|
||||||
ENV PHP_FPM_CONFIG_FILE=${SYSTEM_SERVICES_PHP_FOLDER}/php-fpm.conf
|
ENV PHP_FPM_CONFIG_FILE=${SYSTEM_SERVICES_PHP_FOLDER}/php-fpm.conf
|
||||||
ENV READ_ONLY_FOLDERS="${NETALERTX_BACK} ${NETALERTX_FRONT} ${NETALERTX_SERVER} ${SYSTEM_SERVICES} \
|
ENV READ_ONLY_FOLDERS="${NETALERTX_BACK} ${NETALERTX_FRONT} ${NETALERTX_SERVER} ${SYSTEM_SERVICES} \
|
||||||
${SYSTEM_SERVICES_CONFIG}"
|
${SYSTEM_SERVICES_CONFIG} ${ENTRYPOINT_CHECKS}"
|
||||||
ENV READ_WRITE_FOLDERS="${NETALERTX_CONFIG} ${NETALERTX_DB} ${NETALERTX_API} ${NETALERTX_LOG} \
|
ENV READ_WRITE_FOLDERS="${NETALERTX_DATA} ${NETALERTX_CONFIG} ${NETALERTX_DB} ${NETALERTX_API} \
|
||||||
${NETALERTX_PLUGINS_LOG} ${SYSTEM_SERVICES_RUN} ${SYSTEM_SERVICES_RUN_TMP} \
|
${NETALERTX_LOG} ${NETALERTX_PLUGINS_LOG} ${SYSTEM_SERVICES_RUN} \
|
||||||
${SYSTEM_SERVICES_RUN_LOG}"
|
${SYSTEM_SERVICES_RUN_TMP} ${SYSTEM_SERVICES_RUN_LOG} \
|
||||||
|
${SYSTEM_SERVICES_ACTIVE_CONFIG}"
|
||||||
|
|
||||||
#Python environment
|
#Python environment
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1
|
||||||
ENV VIRTUAL_ENV=/opt/venv
|
ENV VIRTUAL_ENV=/opt/venv
|
||||||
ENV VIRTUAL_ENV_BIN=/opt/venv/bin
|
ENV VIRTUAL_ENV_BIN=/opt/venv/bin
|
||||||
ENV PYTHONPATH=${NETALERTX_APP}:${NETALERTX_SERVER}:${VIRTUAL_ENV}/lib/python3.12/site-packages
|
ENV PYTHONPATH=${NETALERTX_APP}:${NETALERTX_SERVER}:${NETALERTX_PLUGINS}:${VIRTUAL_ENV}/lib/python3.12/site-packages
|
||||||
ENV PATH="${SYSTEM_SERVICES}:${VIRTUAL_ENV_BIN}:$PATH"
|
ENV PATH="${SYSTEM_SERVICES}:${VIRTUAL_ENV_BIN}:$PATH"
|
||||||
|
|
||||||
# App Environment
|
# App Environment
|
||||||
@@ -99,7 +106,7 @@ ENV LISTEN_ADDR=0.0.0.0
|
|||||||
ENV PORT=20211
|
ENV PORT=20211
|
||||||
ENV NETALERTX_DEBUG=0
|
ENV NETALERTX_DEBUG=0
|
||||||
ENV VENDORSPATH=/app/back/ieee-oui.txt
|
ENV VENDORSPATH=/app/back/ieee-oui.txt
|
||||||
ENV VENDORSPATH_NEWEST=/services/run/tmp/ieee-oui.txt
|
ENV VENDORSPATH_NEWEST=${SYSTEM_SERVICES_RUN_TMP}/ieee-oui.txt
|
||||||
ENV ENVIRONMENT=alpine
|
ENV ENVIRONMENT=alpine
|
||||||
ENV READ_ONLY_USER=readonly READ_ONLY_GROUP=readonly
|
ENV READ_ONLY_USER=readonly READ_ONLY_GROUP=readonly
|
||||||
ENV NETALERTX_USER=netalertx NETALERTX_GROUP=netalertx
|
ENV NETALERTX_USER=netalertx NETALERTX_GROUP=netalertx
|
||||||
@@ -109,7 +116,7 @@ ENV LANG=C.UTF-8
|
|||||||
RUN apk add --no-cache bash mtr libbsd zip lsblk tzdata curl arp-scan iproute2 iproute2-ss nmap \
|
RUN apk add --no-cache bash mtr libbsd zip lsblk tzdata curl arp-scan iproute2 iproute2-ss nmap \
|
||||||
nmap-scripts traceroute nbtscan net-tools net-snmp-tools bind-tools awake ca-certificates \
|
nmap-scripts traceroute nbtscan net-tools net-snmp-tools bind-tools awake ca-certificates \
|
||||||
sqlite php83 php83-fpm php83-cgi php83-curl php83-sqlite3 php83-session python3 envsubst \
|
sqlite php83 php83-fpm php83-cgi php83-curl php83-sqlite3 php83-session python3 envsubst \
|
||||||
nginx shadow && \
|
nginx supercronic shadow && \
|
||||||
rm -Rf /var/cache/apk/* && \
|
rm -Rf /var/cache/apk/* && \
|
||||||
rm -Rf /etc/nginx && \
|
rm -Rf /etc/nginx && \
|
||||||
addgroup -g 20211 ${NETALERTX_GROUP} && \
|
addgroup -g 20211 ${NETALERTX_GROUP} && \
|
||||||
@@ -123,11 +130,16 @@ COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} install/production-filesystem/
|
|||||||
COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} --chmod=755 back ${NETALERTX_BACK}
|
COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} --chmod=755 back ${NETALERTX_BACK}
|
||||||
COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} --chmod=755 front ${NETALERTX_FRONT}
|
COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} --chmod=755 front ${NETALERTX_FRONT}
|
||||||
COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} --chmod=755 server ${NETALERTX_SERVER}
|
COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} --chmod=755 server ${NETALERTX_SERVER}
|
||||||
RUN install -d -o ${NETALERTX_USER} -g ${NETALERTX_GROUP} -m 755 ${NETALERTX_API} \
|
|
||||||
${NETALERTX_LOG} ${SYSTEM_SERVICES_RUN_TMP} ${SYSTEM_SERVICES_RUN_LOG} && \
|
# Create required folders with correct ownership and permissions
|
||||||
|
RUN install -d -o ${NETALERTX_USER} -g ${NETALERTX_GROUP} -m 700 ${READ_WRITE_FOLDERS} && \
|
||||||
sh -c "find ${NETALERTX_APP} -type f \( -name '*.sh' -o -name 'speedtest-cli' \) \
|
sh -c "find ${NETALERTX_APP} -type f \( -name '*.sh' -o -name 'speedtest-cli' \) \
|
||||||
-exec chmod 750 {} \;"
|
-exec chmod 750 {} \;"
|
||||||
|
|
||||||
|
# Copy version information into the image
|
||||||
|
COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} .[V]ERSION ${NETALERTX_APP}/.VERSION
|
||||||
|
COPY --chown=${NETALERTX_USER}:${NETALERTX_GROUP} .[V]ERSION ${NETALERTX_APP}/.VERSION_PREV
|
||||||
|
|
||||||
# Copy the virtualenv from the builder stage
|
# Copy the virtualenv from the builder stage
|
||||||
COPY --from=builder --chown=20212:20212 ${VIRTUAL_ENV} ${VIRTUAL_ENV}
|
COPY --from=builder --chown=20212:20212 ${VIRTUAL_ENV} ${VIRTUAL_ENV}
|
||||||
|
|
||||||
@@ -136,20 +148,26 @@ COPY --from=builder --chown=20212:20212 ${VIRTUAL_ENV} ${VIRTUAL_ENV}
|
|||||||
# This is done after the copy of the venv to ensure the venv is in place
|
# This is done after the copy of the venv to ensure the venv is in place
|
||||||
# although it may be quicker to do it before the copy, it keeps the image
|
# although it may be quicker to do it before the copy, it keeps the image
|
||||||
# layers smaller to do it after.
|
# layers smaller to do it after.
|
||||||
RUN apk add libcap && \
|
RUN for vfile in .VERSION .VERSION_PREV; do \
|
||||||
|
if [ ! -f "${NETALERTX_APP}/${vfile}" ]; then \
|
||||||
|
echo "DEVELOPMENT 00000000" > "${NETALERTX_APP}/${vfile}"; \
|
||||||
|
fi; \
|
||||||
|
chown 20212:20212 "${NETALERTX_APP}/${vfile}"; \
|
||||||
|
done && \
|
||||||
|
apk add --no-cache libcap && \
|
||||||
setcap cap_net_raw+ep /bin/busybox && \
|
setcap cap_net_raw+ep /bin/busybox && \
|
||||||
setcap cap_net_raw,cap_net_admin+eip /usr/bin/nmap && \
|
setcap cap_net_raw,cap_net_admin+eip /usr/bin/nmap && \
|
||||||
setcap cap_net_raw,cap_net_admin+eip /usr/bin/arp-scan && \
|
setcap cap_net_raw,cap_net_admin+eip /usr/bin/arp-scan && \
|
||||||
setcap cap_net_raw,cap_net_admin,cap_net_bind_service+eip /usr/bin/nbtscan && \
|
setcap cap_net_raw,cap_net_admin,cap_net_bind_service+eip /usr/bin/nbtscan && \
|
||||||
setcap cap_net_raw,cap_net_admin+eip /usr/bin/traceroute && \
|
setcap cap_net_raw,cap_net_admin+eip /usr/bin/traceroute && \
|
||||||
setcap cap_net_raw,cap_net_admin+eip $(readlink -f ${VIRTUAL_ENV_BIN}/python) && \
|
setcap cap_net_raw,cap_net_admin+eip "$(readlink -f ${VIRTUAL_ENV_BIN}/python)" && \
|
||||||
/bin/sh /build/init-nginx.sh && \
|
/bin/sh /build/init-nginx.sh && \
|
||||||
/bin/sh /build/init-php-fpm.sh && \
|
/bin/sh /build/init-php-fpm.sh && \
|
||||||
/bin/sh /build/init-crond.sh && \
|
/bin/sh /build/init-cron.sh && \
|
||||||
/bin/sh /build/init-backend.sh && \
|
/bin/sh /build/init-backend.sh && \
|
||||||
rm -rf /build && \
|
rm -rf /build && \
|
||||||
apk del libcap && \
|
apk del libcap && \
|
||||||
date +%s > ${NETALERTX_FRONT}/buildtimestamp.txt
|
date +%s > "${NETALERTX_FRONT}/buildtimestamp.txt"
|
||||||
|
|
||||||
|
|
||||||
ENTRYPOINT ["/bin/sh","/entrypoint.sh"]
|
ENTRYPOINT ["/bin/sh","/entrypoint.sh"]
|
||||||
@@ -166,13 +184,15 @@ ENV UMASK=0077
|
|||||||
# AI may claim this is stupid, but it's actually least possible permissions as
|
# AI may claim this is stupid, but it's actually least possible permissions as
|
||||||
# read-only user cannot login, cannot sudo, has no write permission, and cannot even
|
# read-only user cannot login, cannot sudo, has no write permission, and cannot even
|
||||||
# read the files it owns. The read-only user is ownership-as-a-lock hardening pattern.
|
# read the files it owns. The read-only user is ownership-as-a-lock hardening pattern.
|
||||||
RUN addgroup -g 20212 ${READ_ONLY_GROUP} && \
|
RUN addgroup -g 20212 "${READ_ONLY_GROUP}" && \
|
||||||
adduser -u 20212 -G ${READ_ONLY_GROUP} -D -h /app ${READ_ONLY_USER}
|
adduser -u 20212 -G "${READ_ONLY_GROUP}" -D -h /app "${READ_ONLY_USER}"
|
||||||
|
|
||||||
|
|
||||||
# reduce permissions to minimum necessary for all NetAlertX files and folders
|
# reduce permissions to minimum necessary for all NetAlertX files and folders
|
||||||
# Permissions 005 and 004 are not typos, they enable read-only. Everyone can
|
# Permissions 005 and 004 are not typos, they enable read-only. Everyone can
|
||||||
# read the read-only files, and nobody can write to them, even the readonly user.
|
# read the read-only files, and nobody can write to them, even the readonly user.
|
||||||
|
|
||||||
|
# hadolint ignore=SC2114
|
||||||
RUN chown -R ${READ_ONLY_USER}:${READ_ONLY_GROUP} ${READ_ONLY_FOLDERS} && \
|
RUN chown -R ${READ_ONLY_USER}:${READ_ONLY_GROUP} ${READ_ONLY_FOLDERS} && \
|
||||||
chmod -R 004 ${READ_ONLY_FOLDERS} && \
|
chmod -R 004 ${READ_ONLY_FOLDERS} && \
|
||||||
find ${READ_ONLY_FOLDERS} -type d -exec chmod 005 {} + && \
|
find ${READ_ONLY_FOLDERS} -type d -exec chmod 005 {} + && \
|
||||||
@@ -181,14 +201,17 @@ RUN chown -R ${READ_ONLY_USER}:${READ_ONLY_GROUP} ${READ_ONLY_FOLDERS} && \
|
|||||||
chmod -R 600 ${READ_WRITE_FOLDERS} && \
|
chmod -R 600 ${READ_WRITE_FOLDERS} && \
|
||||||
find ${READ_WRITE_FOLDERS} -type d -exec chmod 700 {} + && \
|
find ${READ_WRITE_FOLDERS} -type d -exec chmod 700 {} + && \
|
||||||
chown ${READ_ONLY_USER}:${READ_ONLY_GROUP} /entrypoint.sh /opt /opt/venv && \
|
chown ${READ_ONLY_USER}:${READ_ONLY_GROUP} /entrypoint.sh /opt /opt/venv && \
|
||||||
chmod 005 /entrypoint.sh ${SYSTEM_SERVICES}/*.sh /app /opt /opt/venv && \
|
chmod 005 /entrypoint.sh ${SYSTEM_SERVICES}/*.sh ${SYSTEM_SERVICES_SCRIPTS}/* ${ENTRYPOINT_CHECKS}/* /app /opt /opt/venv && \
|
||||||
|
for dir in ${READ_WRITE_FOLDERS}; do \
|
||||||
|
install -d -o ${NETALERTX_USER} -g ${NETALERTX_GROUP} -m 700 "$dir"; \
|
||||||
|
done && \
|
||||||
apk del apk-tools && \
|
apk del apk-tools && \
|
||||||
rm -Rf /var /etc/sudoers.d/* /etc/shadow /etc/gshadow /etc/sudoers \
|
rm -Rf /var /etc/sudoers.d/* /etc/shadow /etc/gshadow /etc/sudoers \
|
||||||
/lib/apk /lib/firmware /lib/modules-load.d /lib/sysctl.d /mnt /home/ /root \
|
/lib/apk /lib/firmware /lib/modules-load.d /lib/sysctl.d /mnt /home/ /root \
|
||||||
/srv /media && \
|
/srv /media && \
|
||||||
sed -i "/^\(${READ_ONLY_USER}\|${NETALERTX_USER}\):/!d" /etc/passwd && \
|
sed -i "/^\(${READ_ONLY_USER}\|${NETALERTX_USER}\):/!d" /etc/passwd && \
|
||||||
sed -i "/^\(${READ_ONLY_GROUP}\|${NETALERTX_GROUP}\):/!d" /etc/group && \
|
sed -i "/^\(${READ_ONLY_GROUP}\|${NETALERTX_GROUP}\):/!d" /etc/group && \
|
||||||
echo -ne '#!/bin/sh\n"$@"\n' > /usr/bin/sudo && chmod +x /usr/bin/sudo
|
printf '#!/bin/sh\n"$@"\n' > /usr/bin/sudo && chmod +x /usr/bin/sudo
|
||||||
|
|
||||||
USER netalertx
|
USER netalertx
|
||||||
|
|
||||||
|
|||||||
@@ -49,14 +49,15 @@ FROM debian:bookworm-slim
|
|||||||
# NetAlertX app directories
|
# NetAlertX app directories
|
||||||
ENV INSTALL_DIR=/app
|
ENV INSTALL_DIR=/app
|
||||||
ENV NETALERTX_APP=${INSTALL_DIR}
|
ENV NETALERTX_APP=${INSTALL_DIR}
|
||||||
ENV NETALERTX_CONFIG=${NETALERTX_APP}/config
|
ENV NETALERTX_DATA=/data
|
||||||
|
ENV NETALERTX_CONFIG=${NETALERTX_DATA}/config
|
||||||
ENV NETALERTX_FRONT=${NETALERTX_APP}/front
|
ENV NETALERTX_FRONT=${NETALERTX_APP}/front
|
||||||
ENV NETALERTX_SERVER=${NETALERTX_APP}/server
|
ENV NETALERTX_SERVER=${NETALERTX_APP}/server
|
||||||
ENV NETALERTX_API=${NETALERTX_APP}/api
|
ENV NETALERTX_API=/tmp/api
|
||||||
ENV NETALERTX_DB=${NETALERTX_APP}/db
|
ENV NETALERTX_DB=${NETALERTX_DATA}/db
|
||||||
ENV NETALERTX_DB_FILE=${NETALERTX_DB}/app.db
|
ENV NETALERTX_DB_FILE=${NETALERTX_DB}/app.db
|
||||||
ENV NETALERTX_BACK=${NETALERTX_APP}/back
|
ENV NETALERTX_BACK=${NETALERTX_APP}/back
|
||||||
ENV NETALERTX_LOG=${NETALERTX_APP}/log
|
ENV NETALERTX_LOG=/tmp/log
|
||||||
ENV NETALERTX_PLUGINS_LOG=${NETALERTX_LOG}/plugins
|
ENV NETALERTX_PLUGINS_LOG=${NETALERTX_LOG}/plugins
|
||||||
|
|
||||||
# NetAlertX log files
|
# NetAlertX log files
|
||||||
@@ -71,18 +72,20 @@ ENV LOG_APP_PHP_ERRORS=${NETALERTX_LOG}/app.php_errors.log
|
|||||||
ENV LOG_EXECUTION_QUEUE=${NETALERTX_LOG}/execution_queue.log
|
ENV LOG_EXECUTION_QUEUE=${NETALERTX_LOG}/execution_queue.log
|
||||||
ENV LOG_REPORT_OUTPUT_JSON=${NETALERTX_LOG}/report_output.json
|
ENV LOG_REPORT_OUTPUT_JSON=${NETALERTX_LOG}/report_output.json
|
||||||
ENV LOG_STDOUT=${NETALERTX_LOG}/stdout.log
|
ENV LOG_STDOUT=${NETALERTX_LOG}/stdout.log
|
||||||
ENV LOG_CROND=${NETALERTX_LOG}/crond.log
|
ENV LOG_CRON=${NETALERTX_LOG}/cron.log
|
||||||
|
ENV LOG_NGINX_ERROR=${NETALERTX_LOG}/nginx-error.log
|
||||||
|
|
||||||
# System Services configuration files
|
# System Services configuration files
|
||||||
ENV SYSTEM_SERVICES=/services
|
ENV SYSTEM_SERVICES=/services
|
||||||
ENV SYSTEM_SERVICES_CONFIG=${SYSTEM_SERVICES}/config
|
ENV SYSTEM_SERVICES_CONFIG=${SYSTEM_SERVICES}/config
|
||||||
ENV SYSTEM_NGINIX_CONFIG=${SYSTEM_SERVICES_CONFIG}/nginx
|
ENV SYSTEM_NGINIX_CONFIG=${SYSTEM_SERVICES_CONFIG}/nginx
|
||||||
ENV SYSTEM_NGINX_CONFIG_FILE=${SYSTEM_NGINIX_CONFIG}/nginx.conf
|
ENV SYSTEM_NGINX_CONFIG_FILE=${SYSTEM_NGINIX_CONFIG}/nginx.conf
|
||||||
|
ENV SYSTEM_SERVICES_ACTIVE_CONFIG=/tmp/nginx/active-config
|
||||||
ENV NETALERTX_CONFIG_FILE=${NETALERTX_CONFIG}/app.conf
|
ENV NETALERTX_CONFIG_FILE=${NETALERTX_CONFIG}/app.conf
|
||||||
ENV SYSTEM_SERVICES_PHP_FOLDER=${SYSTEM_SERVICES_CONFIG}/php
|
ENV SYSTEM_SERVICES_PHP_FOLDER=${SYSTEM_SERVICES_CONFIG}/php
|
||||||
ENV SYSTEM_SERVICES_PHP_FPM_D=${SYSTEM_SERVICES_PHP_FOLDER}/php-fpm.d
|
ENV SYSTEM_SERVICES_PHP_FPM_D=${SYSTEM_SERVICES_PHP_FOLDER}/php-fpm.d
|
||||||
ENV SYSTEM_SERVICES_CROND=${SYSTEM_SERVICES_CONFIG}/crond
|
ENV SYSTEM_SERVICES_CROND=${SYSTEM_SERVICES_CONFIG}/crond
|
||||||
ENV SYSTEM_SERVICES_RUN=${SYSTEM_SERVICES}/run
|
ENV SYSTEM_SERVICES_RUN=/tmp/run
|
||||||
ENV SYSTEM_SERVICES_RUN_TMP=${SYSTEM_SERVICES_RUN}/tmp
|
ENV SYSTEM_SERVICES_RUN_TMP=${SYSTEM_SERVICES_RUN}/tmp
|
||||||
ENV SYSTEM_SERVICES_RUN_LOG=${SYSTEM_SERVICES_RUN}/logs
|
ENV SYSTEM_SERVICES_RUN_LOG=${SYSTEM_SERVICES_RUN}/logs
|
||||||
ENV PHP_FPM_CONFIG_FILE=${SYSTEM_SERVICES_PHP_FOLDER}/php-fpm.conf
|
ENV PHP_FPM_CONFIG_FILE=${SYSTEM_SERVICES_PHP_FOLDER}/php-fpm.conf
|
||||||
@@ -94,7 +97,7 @@ ENV VIRTUAL_ENV=/opt/venv
|
|||||||
ENV VIRTUAL_ENV_BIN=/opt/venv/bin
|
ENV VIRTUAL_ENV_BIN=/opt/venv/bin
|
||||||
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}:/services"
|
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}:/services"
|
||||||
ENV VENDORSPATH=/app/back/ieee-oui.txt
|
ENV VENDORSPATH=/app/back/ieee-oui.txt
|
||||||
ENV VENDORSPATH_NEWEST=/services/run/tmp/ieee-oui.txt
|
ENV VENDORSPATH_NEWEST=${SYSTEM_SERVICES_RUN_TMP}/ieee-oui.txt
|
||||||
|
|
||||||
|
|
||||||
# App Environment
|
# App Environment
|
||||||
@@ -129,25 +132,29 @@ COPY --chmod=775 --chown=${USER_ID}:${USER_GID} . ${INSTALL_DIR}/
|
|||||||
|
|
||||||
|
|
||||||
# ❗ IMPORTANT - if you modify this file modify the /install/install_dependecies.debian.sh file as well ❗
|
# ❗ IMPORTANT - if you modify this file modify the /install/install_dependecies.debian.sh file as well ❗
|
||||||
RUN apt update && apt-get install -y \
|
# hadolint ignore=DL3008,DL3027
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
tini snmp ca-certificates curl libwww-perl arp-scan sudo gettext-base \
|
tini snmp ca-certificates curl libwww-perl arp-scan sudo gettext-base \
|
||||||
nginx-light php php-cgi php-fpm php-sqlite3 php-curl sqlite3 dnsutils net-tools \
|
nginx-light php php-cgi php-fpm php-sqlite3 php-curl sqlite3 dnsutils net-tools \
|
||||||
python3 python3-dev iproute2 nmap python3-pip zip git systemctl usbutils traceroute nbtscan openrc \
|
python3 python3-dev iproute2 nmap python3-pip zip git systemctl usbutils traceroute nbtscan openrc \
|
||||||
busybox nginx nginx-core mtr python3-venv
|
busybox nginx nginx-core mtr python3-venv && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# While php8.3 is in debian bookworm repos, php-fpm is not included so we need to add sury.org repo
|
# While php8.3 is in debian bookworm repos, php-fpm is not included so we need to add sury.org repo
|
||||||
# (Ondřej Surý maintains php packages for debian. This is temp until debian includes php-fpm in their
|
# (Ondřej Surý maintains php packages for debian. This is temp until debian includes php-fpm in their
|
||||||
# repos. Likely it will be in Debian Trixie.). This keeps the image up-to-date with the alpine version.
|
# repos. Likely it will be in Debian Trixie.). This keeps the image up-to-date with the alpine version.
|
||||||
|
# hadolint ignore=DL3008
|
||||||
RUN apt-get install -y --no-install-recommends \
|
RUN apt-get install -y --no-install-recommends \
|
||||||
apt-transport-https \
|
apt-transport-https \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
lsb-release \
|
lsb-release \
|
||||||
wget && \
|
wget && \
|
||||||
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && \
|
wget -q -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && \
|
||||||
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list && \
|
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list && \
|
||||||
apt-get update && \
|
apt-get update && \
|
||||||
apt-get install -y php8.3-fpm php8.3-cli php8.3-sqlite3 php8.3-common php8.3-curl php8.3-cgi && \
|
apt-get install -y --no-install-recommends php8.3-fpm php8.3-cli php8.3-sqlite3 php8.3-common php8.3-curl php8.3-cgi && \
|
||||||
ln -s /usr/sbin/php-fpm8.3 /usr/sbin/php-fpm83 # make it compatible with alpine version
|
ln -s /usr/sbin/php-fpm8.3 /usr/sbin/php-fpm83 && \
|
||||||
|
rm -rf /var/lib/apt/lists/* # make it compatible with alpine version
|
||||||
|
|
||||||
# Setup virtual python environment and use pip3 to install packages
|
# Setup virtual python environment and use pip3 to install packages
|
||||||
RUN python3 -m venv ${VIRTUAL_ENV} && \
|
RUN python3 -m venv ${VIRTUAL_ENV} && \
|
||||||
|
|||||||
64
README.md
@@ -6,38 +6,60 @@
|
|||||||
|
|
||||||
# NetAlertX - Network, presence scanner and alert framework
|
# NetAlertX - Network, presence scanner and alert framework
|
||||||
|
|
||||||
Get visibility of what's going on on your WIFI/LAN network and enable presence detection of important devices. Schedule scans for devices, port changes and get alerts if unknown devices or changes are found. Write your own [Plugin](https://github.com/jokob-sk/NetAlertX/tree/main/docs/PLUGINS.md#readme) with auto-generated UI and in-build notification system. Build out and easily maintain your network source of truth (NSoT).
|
Get visibility of what's going on on your WIFI/LAN network and enable presence detection of important devices. Schedule scans for devices, port changes and get alerts if unknown devices or changes are found. Write your own [Plugin](https://github.com/jokob-sk/NetAlertX/tree/main/docs/PLUGINS.md#readme) with auto-generated UI and in-build notification system. Build out and easily maintain your network source of truth (NSoT) and device inventory.
|
||||||
|
|
||||||
## 📋 Table of Contents
|
## 📋 Table of Contents
|
||||||
|
|
||||||
- [Features](#-features)
|
- [NetAlertX - Network, presence scanner and alert framework](#netalertx---network-presence-scanner-and-alert-framework)
|
||||||
- [Documentation](#-documentation)
|
- [📋 Table of Contents](#-table-of-contents)
|
||||||
- [Quick Start](#-quick-start)
|
- [🚀 Quick Start](#-quick-start)
|
||||||
- [Alternative Apps](#-other-alternative-apps)
|
- [📦 Features](#-features)
|
||||||
- [Security & Privacy](#-security--privacy)
|
- [Scanners](#scanners)
|
||||||
- [FAQ](#-faq)
|
- [Notification gateways](#notification-gateways)
|
||||||
- [Known Issues](#-known-issues)
|
- [Integrations and Plugins](#integrations-and-plugins)
|
||||||
- [Donations](#-donations)
|
- [Workflows](#workflows)
|
||||||
- [Contributors](#-contributors)
|
- [📚 Documentation](#-documentation)
|
||||||
- [Translations](#-translations)
|
- [🔐 Security \& Privacy](#-security--privacy)
|
||||||
- [License](#license)
|
- [❓ FAQ](#-faq)
|
||||||
|
- [🐞 Known Issues](#-known-issues)
|
||||||
|
- [📃 Everything else](#-everything-else)
|
||||||
|
- [📧 Get notified what's new](#-get-notified-whats-new)
|
||||||
|
- [🔀 Other Alternative Apps](#-other-alternative-apps)
|
||||||
|
- [💙 Donations](#-donations)
|
||||||
|
- [🏗 Contributors](#-contributors)
|
||||||
|
- [🌍 Translations](#-translations)
|
||||||
|
- [License](#license)
|
||||||
|
|
||||||
|
|
||||||
## 🚀 Quick Start
|
## 🚀 Quick Start
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> ⚠️ **Important:** The docker-compose has recently changed. Carefully read the [Migration guide](https://jokob-sk.github.io/NetAlertX/MIGRATION/?h=migrat#12-migration-from-netalertx-v25524) for detailed instructions.
|
||||||
|
|
||||||
Start NetAlertX in seconds with Docker:
|
Start NetAlertX in seconds with Docker:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -d --rm --network=host \
|
docker run -d \
|
||||||
-v local_path/config:/app/config \
|
--network=host \
|
||||||
-v local_path/db:/app/db \
|
--restart unless-stopped \
|
||||||
--mount type=tmpfs,target=/app/api \
|
-v /local_data_dir:/data \
|
||||||
-e PUID=200 -e PGID=300 \
|
-v /etc/localtime:/etc/localtime:ro \
|
||||||
-e TZ=Europe/Berlin \
|
--tmpfs /tmp:uid=20211,gid=20211,mode=1700 \
|
||||||
-e PORT=20211 \
|
-e PORT=20211 \
|
||||||
|
-e APP_CONF_OVERRIDE='{"GRAPHQL_PORT":"20214"}' \
|
||||||
ghcr.io/jokob-sk/netalertx:latest
|
ghcr.io/jokob-sk/netalertx:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note: Your `/local_data_dir` should contain a `config` and `db` folder.
|
||||||
|
|
||||||
|
To deploy a containerized instance directly from the source repository, execute the following BASH sequence:
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/jokob-sk/NetAlertX.git
|
||||||
|
cd NetAlertX
|
||||||
|
docker compose up --force-recreate --build
|
||||||
|
# To customize: edit docker-compose.yaml and run that last command again
|
||||||
|
```
|
||||||
|
|
||||||
Need help configuring it? Check the [usage guide](https://github.com/jokob-sk/NetAlertX/blob/main/docs/README.md) or [full documentation](https://jokob-sk.github.io/NetAlertX/).
|
Need help configuring it? Check the [usage guide](https://github.com/jokob-sk/NetAlertX/blob/main/docs/README.md) or [full documentation](https://jokob-sk.github.io/NetAlertX/).
|
||||||
|
|
||||||
For Home Assistant users: [Click here to add NetAlertX](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Falexbelgium%2Fhassio-addons)
|
For Home Assistant users: [Click here to add NetAlertX](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Falexbelgium%2Fhassio-addons)
|
||||||
@@ -45,7 +67,7 @@ For Home Assistant users: [Click here to add NetAlertX](https://my.home-assistan
|
|||||||
For other install methods, check the [installation docs](#-documentation)
|
For other install methods, check the [installation docs](#-documentation)
|
||||||
|
|
||||||
|
|
||||||
| [📑 Docker guide](https://github.com/jokob-sk/NetAlertX/blob/main/dockerfiles/README.md) | [🚀 Releases](https://github.com/jokob-sk/NetAlertX/releases) | [📚 Docs](https://jokob-sk.github.io/NetAlertX/) | [🔌 Plugins](https://github.com/jokob-sk/NetAlertX/blob/main/docs/PLUGINS.md) | [🤖 Ask AI](https://gurubase.io/g/netalertx)
|
| [📑 Docker guide](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DOCKER_INSTALLATION.md) | [🚀 Releases](https://github.com/jokob-sk/NetAlertX/releases) | [📚 Docs](https://jokob-sk.github.io/NetAlertX/) | [🔌 Plugins](https://github.com/jokob-sk/NetAlertX/blob/main/docs/PLUGINS.md) | [🤖 Ask AI](https://gurubase.io/g/netalertx)
|
||||||
|----------------------| ----------------------| ----------------------| ----------------------| ----------------------|
|
|----------------------| ----------------------| ----------------------| ----------------------| ----------------------|
|
||||||
|
|
||||||
![showcase][showcase]
|
![showcase][showcase]
|
||||||
@@ -87,7 +109,7 @@ The [workflows module](https://github.com/jokob-sk/NetAlertX/blob/main/docs/WORK
|
|||||||
|
|
||||||
Supported browsers: Chrome, Firefox
|
Supported browsers: Chrome, Firefox
|
||||||
|
|
||||||
- [[Installation] Docker](https://github.com/jokob-sk/NetAlertX/blob/main/dockerfiles/README.md)
|
- [[Installation] Docker](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DOCKER_INSTALLATION.md)
|
||||||
- [[Installation] Home Assistant](https://github.com/alexbelgium/hassio-addons/tree/master/netalertx)
|
- [[Installation] Home Assistant](https://github.com/alexbelgium/hassio-addons/tree/master/netalertx)
|
||||||
- [[Installation] Bare metal](https://github.com/jokob-sk/NetAlertX/blob/main/docs/HW_INSTALL.md)
|
- [[Installation] Bare metal](https://github.com/jokob-sk/NetAlertX/blob/main/docs/HW_INSTALL.md)
|
||||||
- [[Installation] Unraid App](https://unraid.net/community/apps)
|
- [[Installation] Unraid App](https://unraid.net/community/apps)
|
||||||
@@ -124,7 +146,7 @@ A: No. All scans and data remain local, unless you set up cloud-based notificati
|
|||||||
A: Yes! You can install it bare-metal. See the [bare metal installation guide](https://github.com/jokob-sk/NetAlertX/blob/main/docs/HW_INSTALL.md).
|
A: Yes! You can install it bare-metal. See the [bare metal installation guide](https://github.com/jokob-sk/NetAlertX/blob/main/docs/HW_INSTALL.md).
|
||||||
|
|
||||||
**Q: Where is the data stored?**
|
**Q: Where is the data stored?**
|
||||||
A: In the `/config` and `/db` folders, mapped in Docker. Back up these folders regularly.
|
A: In the `/data/config` and `/data/db` folders. Back up these folders regularly.
|
||||||
|
|
||||||
|
|
||||||
## 🐞 Known Issues
|
## 🐞 Known Issues
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export INSTALL_DIR=/app
|
export INSTALL_DIR=/app
|
||||||
|
|
||||||
LOG_FILE="${INSTALL_DIR}/log/execution_queue.log"
|
if [ -f "${LOG_EXECUTION_QUEUE}" ] && grep -q "cron_restart_backend" "${LOG_EXECUTION_QUEUE}"; then
|
||||||
|
echo "$(date): Restarting backend triggered by cron_restart_backend"
|
||||||
# Check if there are any entries with cron_restart_backend
|
killall python3 || echo "killall python3 failed or no process found"
|
||||||
if grep -q "cron_restart_backend" "$LOG_FILE"; then
|
sleep 2
|
||||||
# Restart python application using s6
|
/services/start-backend.sh &
|
||||||
s6-svc -r /var/run/s6-rc/servicedirs/netalertx
|
|
||||||
echo 'done'
|
|
||||||
|
|
||||||
# Remove all lines containing cron_restart_backend from the log file
|
# Remove all lines containing cron_restart_backend from the log file
|
||||||
sed -i '/cron_restart_backend/d' "$LOG_FILE"
|
# Atomic replacement with temp file. grep returns 1 if no lines selected (file becomes empty), which is valid here.
|
||||||
|
grep -v "cron_restart_backend" "${LOG_EXECUTION_QUEUE}" > "${LOG_EXECUTION_QUEUE}.tmp"
|
||||||
|
RC=$?
|
||||||
|
if [ $RC -eq 0 ] || [ $RC -eq 1 ]; then
|
||||||
|
mv "${LOG_EXECUTION_QUEUE}.tmp" "${LOG_EXECUTION_QUEUE}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
2
db/.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
*
|
|
||||||
!.gitignore
|
|
||||||
@@ -1,89 +1,75 @@
|
|||||||
services:
|
services:
|
||||||
netalertx:
|
netalertx:
|
||||||
network_mode: host # Use host networking for ARP scanning and other services
|
#use an environmental variable to set host networking mode if needed
|
||||||
|
network_mode: ${NETALERTX_NETWORK_MODE:-host} # Use host networking for ARP scanning and other services
|
||||||
build:
|
build:
|
||||||
context: . # Build context is the current directory
|
context: . # Build context is the current directory
|
||||||
dockerfile: Dockerfile # Specify the Dockerfile to use
|
dockerfile: Dockerfile # Specify the Dockerfile to use
|
||||||
image: netalertx:latest
|
image: netalertx:latest
|
||||||
container_name: netalertx # The name when you docker contiainer ls
|
container_name: netalertx # The name when you docker contiainer ls
|
||||||
read_only: true # Make the container filesystem read-only
|
read_only: true # Make the container filesystem read-only
|
||||||
cap_drop: # Drop all capabilities for enhanced security
|
cap_drop: # Drop all capabilities for enhanced security
|
||||||
- ALL
|
- ALL
|
||||||
cap_add: # Add only the necessary capabilities
|
cap_add: # Add only the necessary capabilities
|
||||||
- NET_ADMIN # Required for ARP scanning
|
- NET_ADMIN # Required for ARP scanning
|
||||||
- NET_RAW # Required for raw socket operations
|
- NET_RAW # Required for raw socket operations
|
||||||
- NET_BIND_SERVICE # Required to bind to privileged ports (nbtscan)
|
- NET_BIND_SERVICE # Required to bind to privileged ports (nbtscan)
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- type: bind
|
|
||||||
source: ${APP_DATA_LOCATION}/netalertx/config
|
|
||||||
target: /app/config
|
|
||||||
read_only: false
|
|
||||||
|
|
||||||
- type: bind
|
- type: volume # Persistent Docker-managed Named Volume for storage
|
||||||
source: ${APP_DATA_LOCATION}/netalertx/db
|
source: netalertx_data # the default name of the volume is netalertx_data
|
||||||
target: /app/db
|
target: /data # consolidated configuration and database storage
|
||||||
read_only: false
|
read_only: false # writable volume
|
||||||
|
|
||||||
- type: bind
|
# Example custom local folder called /home/user/netalertx_data
|
||||||
|
# - type: bind
|
||||||
|
# source: /home/user/netalertx_data
|
||||||
|
# target: /data
|
||||||
|
# read_only: false
|
||||||
|
# ... or use the alternative format
|
||||||
|
# - /home/user/netalertx_data:/data:rw
|
||||||
|
|
||||||
|
- type: bind # Bind mount for timezone consistency
|
||||||
source: /etc/localtime
|
source: /etc/localtime
|
||||||
target: /etc/localtime
|
target: /etc/localtime
|
||||||
read_only: true
|
read_only: true
|
||||||
|
|
||||||
# Retain logs - comment out tmpfs /app/log if you want to retain logs between container restarts
|
# Use a custom Enterprise-configured nginx config for ldap or other settings
|
||||||
# - /path/on/host/log:/app/log
|
# - /custom-enterprise.conf:/tmp/nginx/active-config/netalertx.conf:ro
|
||||||
# Optional logs
|
|
||||||
# - type: bind
|
|
||||||
# source: ${LOGS_LOCATION}
|
|
||||||
# target: /app/log
|
|
||||||
# read_only: false
|
|
||||||
|
|
||||||
# Optional development mounts
|
|
||||||
- type: bind
|
|
||||||
source: ${DEV_LOCATION}
|
|
||||||
target: /app/front/plugins/custom
|
|
||||||
read_only: false
|
|
||||||
|
|
||||||
# Use a custom Enterprise-configured nginx config for ldap or other settings
|
|
||||||
# - /custom-enterprise.conf:/services/config/nginx/conf.active/netalertx.conf:ro
|
|
||||||
|
|
||||||
# Test your plugin on the production container
|
# Test your plugin on the production container
|
||||||
# - /path/on/host:/app/front/plugins/custom
|
# - /path/on/host:/app/front/plugins/custom
|
||||||
|
|
||||||
# Tempfs mounts for writable directories in a read-only container and improve system performance
|
# Retain logs - comment out tmpfs /tmp/log if you want to retain logs between container restarts
|
||||||
|
# - /path/on/host/log:/tmp/log
|
||||||
|
|
||||||
|
# tmpfs mounts for writable directories in a read-only container and improve system performance
|
||||||
|
# All writes now live under /tmp/* subdirectories which are created dynamically by entrypoint.d scripts
|
||||||
|
# uid=20211 and gid=20211 is the netalertx user inside the container
|
||||||
|
# mode=1700 gives rwx------ permissions to the netalertx user only
|
||||||
tmpfs:
|
tmpfs:
|
||||||
# Speed up logging. This can be commented out to retain logs between container restarts
|
|
||||||
- "/app/log:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,async,noatime,nodiratime"
|
|
||||||
# Speed up API access as frontend/backend API is very chatty
|
|
||||||
- "/app/api:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,sync,noatime,nodiratime"
|
|
||||||
# Required for customization of the nginx listen addr/port without rebuilding the container
|
|
||||||
- "/services/config/nginx/conf.active:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,async,noatime,nodiratime"
|
|
||||||
# /services/config/nginx/conf.d is required for nginx and php to start
|
|
||||||
- "/services/run:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,async,noatime,nodiratime"
|
|
||||||
# /tmp is required by php for session save this should be reworked to /services/run/tmp
|
|
||||||
- "/tmp:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,async,noatime,nodiratime"
|
- "/tmp:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,async,noatime,nodiratime"
|
||||||
environment:
|
environment:
|
||||||
LISTEN_ADDR: 0.0.0.0 # Listen for connections on all interfaces
|
LISTEN_ADDR: ${LISTEN_ADDR:-0.0.0.0} # Listen for connections on all interfaces
|
||||||
PORT: ${PORT} # Application port
|
PORT: ${PORT:-20211} # Application port
|
||||||
ALWAYS_FRESH_INSTALL: ${ALWAYS_FRESH_INSTALL} # Set to true to reset your config and database on each container start
|
GRAPHQL_PORT: ${GRAPHQL_PORT:-20212} # GraphQL API port
|
||||||
NETALERTX_DEBUG: 0 # 0=kill all services and restart if any dies. 1 keeps running dead services.
|
ALWAYS_FRESH_INSTALL: ${ALWAYS_FRESH_INSTALL:-false} # Set to true to reset your config and database on each container start
|
||||||
TZ: ${TZ} # Timezone, e.g. Europe/Paris
|
NETALERTX_DEBUG: ${NETALERTX_DEBUG:-0} # 0=kill all services and restart if any dies. 1 keeps running dead services.
|
||||||
# APP_CONF_OVERRIDE={"SCAN_SUBNETS":"['192.168.1.0/24 --interface=eth1']","GRAPHQL_PORT":"20223","UI_theme":"Light"} # (optional) app.conf settings override
|
|
||||||
# LOADED_PLUGINS=["DHCPLSS","PIHOLE","ASUSWRT","FREEBOX"] # (optional) default plugins to load
|
|
||||||
|
|
||||||
# Resource limits to prevent resource exhaustion
|
# Resource limits to prevent resource exhaustion
|
||||||
mem_limit: 2048m
|
mem_limit: 2048m # Maximum memory usage
|
||||||
mem_reservation: 1024m
|
mem_reservation: 1024m # Soft memory limit
|
||||||
cpus: 4
|
cpu_shares: 512 # Relative CPU weight for CPU contention scenarios
|
||||||
pids_limit: 512
|
pids_limit: 512 # Limit the number of processes/threads to prevent fork bombs
|
||||||
logging:
|
logging:
|
||||||
driver: "json-file"
|
driver: "json-file" # Use JSON file logging driver
|
||||||
options:
|
options:
|
||||||
max-size: "10m"
|
max-size: "10m" # Rotate log files after they reach 10MB
|
||||||
max-file: "3"
|
max-file: "3" # Keep a maximum of 3 log files
|
||||||
|
|
||||||
|
# Always restart the container unless explicitly stopped
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
# volumes:
|
volumes: # Persistent volume for configuration and database storage
|
||||||
# netalertx_config:
|
netalertx_data:
|
||||||
# netalertx_db:
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# NetAlertX API Documentation
|
# API Documentation
|
||||||
|
|
||||||
This API provides programmatic access to **devices, events, sessions, metrics, network tools, and sync** in NetAlertX. It is implemented as a **REST and GraphQL server**. All requests require authentication via **API Token** (`API_TOKEN` setting) unless explicitly noted. For example, to authorize a GraphQL request, you need to use a `Authorization: Bearer API_TOKEN` header as per example below:
|
This API provides programmatic access to **devices, events, sessions, metrics, network tools, and sync** in NetAlertX. It is implemented as a **REST and GraphQL server**. All requests require authentication via **API Token** (`API_TOKEN` setting) unless explicitly noted. For example, to authorize a GraphQL request, you need to use a `Authorization: Bearer API_TOKEN` header as per example below:
|
||||||
|
|
||||||
@@ -64,8 +64,9 @@ http://<server>:<GRAPHQL_PORT>/
|
|||||||
* [Metrics](API_METRICS.md) – Prometheus metrics and per-device status
|
* [Metrics](API_METRICS.md) – Prometheus metrics and per-device status
|
||||||
* [Network Tools](API_NETTOOLS.md) – Utilities like Wake-on-LAN, traceroute, nslookup, nmap, and internet info
|
* [Network Tools](API_NETTOOLS.md) – Utilities like Wake-on-LAN, traceroute, nslookup, nmap, and internet info
|
||||||
* [Online History](API_ONLINEHISTORY.md) – Online/offline device records
|
* [Online History](API_ONLINEHISTORY.md) – Online/offline device records
|
||||||
* [GraphQL](API_GRAPHQL.md) – Advanced queries and filtering
|
* [GraphQL](API_GRAPHQL.md) – Advanced queries and filtering for Devices, Settings and Language Strings
|
||||||
* [Sync](API_SYNC.md) – Synchronization between multiple NetAlertX instances
|
* [Sync](API_SYNC.md) – Synchronization between multiple NetAlertX instances
|
||||||
|
* [Logs](API_LOGS.md) – Purging of logs and adding to the event execution queue for user triggered events
|
||||||
* [DB query](API_DBQUERY.md) (⚠ Internal) - Low level database access - use other endpoints if possible
|
* [DB query](API_DBQUERY.md) (⚠ Internal) - Low level database access - use other endpoints if possible
|
||||||
|
|
||||||
See [Testing](API_TESTS.md) for example requests and usage.
|
See [Testing](API_TESTS.md) for example requests and usage.
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
# GraphQL API Endpoint
|
# GraphQL API Endpoint
|
||||||
|
|
||||||
GraphQL queries are **read-optimized for speed**. Data may be slightly out of date until the file system cache refreshes. The GraphQL endpoints allows you to access the following objects:
|
GraphQL queries are **read-optimized for speed**. Data may be slightly out of date until the file system cache refreshes. The GraphQL endpoints allow you to access the following objects:
|
||||||
|
|
||||||
- Devices
|
* Devices
|
||||||
- Settings
|
* Settings
|
||||||
|
* Language Strings (LangStrings)
|
||||||
|
|
||||||
## Endpoints
|
## Endpoints
|
||||||
|
|
||||||
@@ -190,11 +191,74 @@ curl 'http://host:GRAPHQL_PORT/graphql' \
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## LangStrings Query
|
||||||
|
|
||||||
|
The **LangStrings query** provides access to localized strings. Supports filtering by `langCode` and `langStringKey`. If the requested string is missing or empty, you can optionally fallback to `en_us`.
|
||||||
|
|
||||||
|
### Sample Query
|
||||||
|
|
||||||
|
```graphql
|
||||||
|
query GetLangStrings {
|
||||||
|
langStrings(langCode: "de_de", langStringKey: "settings_other_scanners") {
|
||||||
|
langStrings {
|
||||||
|
langCode
|
||||||
|
langStringKey
|
||||||
|
langStringText
|
||||||
|
}
|
||||||
|
count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Query Parameters
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
| ---------------- | ------- | ---------------------------------------------------------------------------------------- |
|
||||||
|
| `langCode` | String | Optional language code (e.g., `en_us`, `de_de`). If omitted, all languages are returned. |
|
||||||
|
| `langStringKey` | String | Optional string key to retrieve a specific entry. |
|
||||||
|
| `fallback_to_en` | Boolean | Optional (default `true`). If `true`, empty or missing strings fallback to `en_us`. |
|
||||||
|
|
||||||
|
### `curl` Example
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl 'http://host:GRAPHQL_PORT/graphql' \
|
||||||
|
-X POST \
|
||||||
|
-H 'Authorization: Bearer API_TOKEN' \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"query": "query GetLangStrings { langStrings(langCode: \"de_de\", langStringKey: \"settings_other_scanners\") { langStrings { langCode langStringKey langStringText } count } }"
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Sample Response
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"langStrings": {
|
||||||
|
"count": 1,
|
||||||
|
"langStrings": [
|
||||||
|
{
|
||||||
|
"langCode": "de_de",
|
||||||
|
"langStringKey": "settings_other_scanners",
|
||||||
|
"langStringText": "Other, non-device scanner plugins that are currently enabled." // falls back to en_us if empty
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
* Device and settings queries can be combined in one request since GraphQL supports batching.
|
* Device, settings, and LangStrings queries can be combined in **one request** since GraphQL supports batching.
|
||||||
|
* The `fallback_to_en` feature ensures UI always has a value even if a translation is missing.
|
||||||
|
* Data is **cached in memory** per JSON file; changes to language or plugin files will only refresh after the cache detects a file modification.
|
||||||
* The `setOverriddenByEnv` flag helps identify setting values that are locked at container runtime.
|
* The `setOverriddenByEnv` flag helps identify setting values that are locked at container runtime.
|
||||||
* The schema is **read-only** — updates must be performed through other APIs or configuration management. See the other [API](API.md) endpoints for details.
|
* The schema is **read-only** — updates must be performed through other APIs or configuration management. See the other [API](API.md) endpoints for details.
|
||||||
|
|
||||||
|
|||||||
179
docs/API_LOGS.md
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
# Logs API Endpoints
|
||||||
|
|
||||||
|
Manage or purge application log files stored under `/app/log` and manage the execution queue. These endpoints are primarily used for maintenance tasks such as clearing accumulated logs or adding system actions without restarting the container.
|
||||||
|
|
||||||
|
Only specific, pre-approved log files can be purged for security and stability reasons.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Delete (Purge) a Log File
|
||||||
|
|
||||||
|
* **DELETE** `/logs?file=<log_file>` → Purge the contents of an allowed log file.
|
||||||
|
|
||||||
|
**Query Parameter:**
|
||||||
|
|
||||||
|
* `file` → The name of the log file to purge (e.g., `app.log`, `stdout.log`)
|
||||||
|
|
||||||
|
**Allowed Files:**
|
||||||
|
|
||||||
|
```
|
||||||
|
app.log
|
||||||
|
app_front.log
|
||||||
|
IP_changes.log
|
||||||
|
stdout.log
|
||||||
|
stderr.log
|
||||||
|
app.php_errors.log
|
||||||
|
execution_queue.log
|
||||||
|
db_is_locked.log
|
||||||
|
```
|
||||||
|
|
||||||
|
**Authorization:**
|
||||||
|
Requires a valid API token in the `Authorization` header.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `curl` Example (Success)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -X DELETE 'http://<server_ip>:<GRAPHQL_PORT>/logs?file=app.log' \
|
||||||
|
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||||
|
-H 'Accept: application/json'
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"message": "[clean_log] File app.log purged successfully"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `curl` Example (Not Allowed)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -X DELETE 'http://<server_ip>:<GRAPHQL_PORT>/logs?file=not_allowed.log' \
|
||||||
|
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||||
|
-H 'Accept: application/json'
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"message": "[clean_log] File not_allowed.log is not allowed to be purged"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `curl` Example (Unauthorized)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -X DELETE 'http://<server_ip>:<GRAPHQL_PORT>/logs?file=app.log' \
|
||||||
|
-H 'Accept: application/json'
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Forbidden"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Add an Action to the Execution Queue
|
||||||
|
|
||||||
|
* **POST** `/logs/add-to-execution-queue` → Add a system action to the execution queue.
|
||||||
|
|
||||||
|
**Request Body (JSON):**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"action": "update_api|devices"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Authorization:**
|
||||||
|
Requires a valid API token in the `Authorization` header.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `curl` Example (Success)
|
||||||
|
|
||||||
|
The below will update the API cache for Devices
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -X POST 'http://<server_ip>:<GRAPHQL_PORT>/logs/add-to-execution-queue' \
|
||||||
|
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
--data '{"action": "update_api|devices"}'
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"message": "[UserEventsQueueInstance] Action \"update_api|devices\" added to the execution queue."
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `curl` Example (Missing Parameter)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -X POST 'http://<server_ip>:<GRAPHQL_PORT>/logs/add-to-execution-queue' \
|
||||||
|
-H 'Authorization: Bearer <API_TOKEN>' \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
--data '{}'
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"message": "Missing parameters",
|
||||||
|
"error": "Missing required 'action' field in JSON body"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### `curl` Example (Unauthorized)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl -X POST 'http://<server_ip>:<GRAPHQL_PORT>/logs/add-to-execution-queue' \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
--data '{"action": "update_api|devices"}'
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Forbidden"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
* Only predefined files in `/app/log` can be purged — arbitrary paths are **not permitted**.
|
||||||
|
* When a log file is purged:
|
||||||
|
|
||||||
|
* Its content is replaced with a short marker text: `"File manually purged"`.
|
||||||
|
* A backend log entry is created via `mylog()`.
|
||||||
|
* A frontend notification is generated via `write_notification()`.
|
||||||
|
* Execution queue actions are appended to `execution_queue.log` and can be processed asynchronously by background tasks or workflows.
|
||||||
|
* Unauthorized or invalid attempts are safely logged and rejected.
|
||||||
|
* For advanced log retrieval, analysis, or structured querying, use the frontend log viewer.
|
||||||
|
* Always ensure that sensitive or production logs are handled carefully — purging cannot be undone.
|
||||||
@@ -52,7 +52,7 @@ query GetDevices($options: PageQueryOptionsInput) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
See also: [Debugging GraphQL issues](./DEBUG_GRAPHQL.md)
|
See also: [Debugging GraphQL issues](./DEBUG_API_SERVER.md)
|
||||||
|
|
||||||
### `curl` Command
|
### `curl` Command
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ The endpoints are updated when objects in the API endpoints are changed.
|
|||||||
|
|
||||||
### Location of the endpoints
|
### Location of the endpoints
|
||||||
|
|
||||||
In the container, these files are located under the `/app/api/` folder. You can access them via the `/php/server/query_json.php?file=user_notifications.json` endpoint.
|
In the container, these files are located under the API directory (default: `/tmp/api/`, configurable via `NETALERTX_API` environment variable). You can access them via the `/php/server/query_json.php?file=user_notifications.json` endpoint.
|
||||||
|
|
||||||
### Available endpoints
|
### Available endpoints
|
||||||
|
|
||||||
@@ -332,7 +332,7 @@ Grafana template sample: [Download json](./samples/API/Grafana_Dashboard.json)
|
|||||||
|
|
||||||
## API Endpoint: /log files
|
## API Endpoint: /log files
|
||||||
|
|
||||||
This API endpoint retrieves files from the `/app/log` folder.
|
This API endpoint retrieves files from the `/tmp/log` folder.
|
||||||
|
|
||||||
- Endpoint URL: `php/server/query_logs.php?file=<file name>`
|
- Endpoint URL: `php/server/query_logs.php?file=<file name>`
|
||||||
- Host: `same as front end (web ui)`
|
- Host: `same as front end (web ui)`
|
||||||
@@ -357,7 +357,7 @@ This API endpoint retrieves files from the `/app/log` folder.
|
|||||||
|
|
||||||
## API Endpoint: /config files
|
## API Endpoint: /config files
|
||||||
|
|
||||||
To retrieve files from the `/app/config` folder.
|
To retrieve files from the `/data/config` folder.
|
||||||
|
|
||||||
- Endpoint URL: `php/server/query_config.php?file=<file name>`
|
- Endpoint URL: `php/server/query_config.php?file=<file name>`
|
||||||
- Host: `same as front end (web ui)`
|
- Host: `same as front end (web ui)`
|
||||||
|
|||||||
210
docs/BACKUPS.md
@@ -1,90 +1,162 @@
|
|||||||
# Backing things up
|
# Backing Things Up
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> To backup 99% of your configuration backup at least the `/app/config` folder. Please read the whole page (or at least "Scenario 2: Corrupted database") for details.
|
> To back up 99% of your configuration, back up at least the `/data/config` folder.
|
||||||
> Note that database definitions might change over time. The safest way is to restore your older backups into the **same version** of the app they were taken from and then gradually upgarde between releases to the latest version.
|
> Database definitions can change between releases, so the safest method is to restore backups using the **same app version** they were taken from, then upgrade incrementally.
|
||||||
|
|
||||||
There are 4 artifacts that can be used to backup the application:
|
---
|
||||||
|
|
||||||
| File | Description | Limitations |
|
## What to Back Up
|
||||||
|-----------------------|-------------------------------|-------------------------------|
|
|
||||||
| `/db/app.db` | Database file(s) | The database file might be in an uncommitted state or corrupted |
|
|
||||||
| `/config/app.conf` | Configuration file | Can be overridden with the [`APP_CONF_OVERRIDE` env variable](https://github.com/jokob-sk/NetAlertX/tree/main/dockerfiles#docker-environment-variables). |
|
|
||||||
| `/config/devices.csv` | CSV file containing device information | Doesn't contain historical data |
|
|
||||||
| `/config/workflows.json` | A JSON file containing your workflows | N/A |
|
|
||||||
|
|
||||||
|
There are four key artifacts you can use to back up your NetAlertX configuration:
|
||||||
|
|
||||||
## Backup strategies
|
| File | Description | Limitations |
|
||||||
|
| ------------------------ | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| `/db/app.db` | The application database | Might be in an uncommitted state or corrupted |
|
||||||
|
| `/config/app.conf` | Configuration file | Can be overridden using the [`APP_CONF_OVERRIDE`](https://github.com/jokob-sk/NetAlertX/tree/main/dockerfiles#docker-environment-variables) variable |
|
||||||
|
| `/config/devices.csv` | CSV file containing device data | Does not include historical data |
|
||||||
|
| `/config/workflows.json` | JSON file containing your workflows | N/A |
|
||||||
|
|
||||||
The safest approach to backups is to backup everything, by taking regular file system backups of the `/db` and `/config` folders (I use [Kopia](https://github.com/kopia/kopia)).
|
---
|
||||||
|
|
||||||
Arguably, the most time is spent setting up the device list, so if only one file is kept I'd recommend to have a latest backup of the `devices_<timestamp>.csv` or `devices.csv` file, followed by the `app.conf` and `workflows.json` files. You can also download `app.conf` and `devices.csv` file in the Maintenance section:
|
## Where the Data Lives
|
||||||
|
|
||||||

|
Understanding where your data is stored helps you plan your backup strategy.
|
||||||
|
|
||||||
### Scenario 1: Full backup
|
|
||||||
|
|
||||||
End-result: Full restore
|
|
||||||
|
|
||||||
#### 💾 Source artifacts:
|
|
||||||
|
|
||||||
- `/app/db/app.db` (uncorrupted)
|
|
||||||
- `/app/config/app.conf`
|
|
||||||
- `/app/config/workflows.json`
|
|
||||||
|
|
||||||
#### 📥 Recovery:
|
|
||||||
|
|
||||||
To restore the application map the above files as described in the [Setup documentation](https://github.com/jokob-sk/NetAlertX/blob/main/dockerfiles/README.md#docker-paths).
|
|
||||||
|
|
||||||
|
|
||||||
### Scenario 2: Corrupted database
|
|
||||||
|
|
||||||
End-result: Partial restore (historical data and some plugin data will be missing)
|
|
||||||
|
|
||||||
#### 💾 Source artifacts:
|
|
||||||
|
|
||||||
- `/app/config/app.conf`
|
|
||||||
- `/app/config/devices_<timestamp>.csv` or `/app/config/devices.csv`
|
|
||||||
- `/app/config/workflows.json`
|
|
||||||
|
|
||||||
#### 📥 Recovery:
|
|
||||||
|
|
||||||
Even with a corrupted database you can recover what I would argue is 99% of the configuration.
|
|
||||||
|
|
||||||
- upload the `app.conf` and `workflows.json` files into the mounted `/app/config/` folder as described in the [Setup documentation](https://github.com/jokob-sk/NetAlertX/blob/main/dockerfiles/README.md#docker-paths).
|
|
||||||
- rename the `devices_<timestamp>.csv` to `devices.csv` and place it in the `/app/config` folder
|
|
||||||
- Restore the `devices.csv` backup via the [Maintenance section](./DEVICES_BULK_EDITING.md)
|
|
||||||
|
|
||||||
## Data and backup storage
|
|
||||||
|
|
||||||
To decide on a backup strategy, check where the data is stored:
|
|
||||||
|
|
||||||
### Core Configuration
|
### Core Configuration
|
||||||
|
|
||||||
The core application configuration is in the `app.conf` file (See [Settings System](./SETTINGS_SYSTEM.md) for details), such as:
|
Stored in `/data/config/app.conf`.
|
||||||
|
This includes settings for:
|
||||||
|
|
||||||
- Notification settings
|
* Notifications
|
||||||
- Scanner settings
|
* Scanning
|
||||||
- Scheduled maintenance settings
|
* Scheduled maintenance
|
||||||
- UI configuration
|
* UI preferences
|
||||||
|
|
||||||
### Core Device Data
|
(See [Settings System](./SETTINGS_SYSTEM.md) for details.)
|
||||||
|
|
||||||
The core device data is backed up to the `devices_<timestamp>.csv` or `devices.csv` file via the [CSV Backup `CSVBCKP` Plugin](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/csv_backup). This file contains data, such as:
|
### Device Data
|
||||||
|
|
||||||
- Device names
|
Stored in `/data/config/devices_<timestamp>.csv` or `/data/config/devices.csv`, created by the [CSV Backup `CSVBCKP` Plugin](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/csv_backup).
|
||||||
- Device icons
|
Contains:
|
||||||
- Device network configuration
|
|
||||||
- Device categorization
|
|
||||||
- Device custom properties data
|
|
||||||
|
|
||||||
### Historical data
|
* Device names, icons, and categories
|
||||||
|
* Network configuration
|
||||||
|
* Custom properties
|
||||||
|
|
||||||
Historical data is stored in the `app.db` database (See [Database overview](./DATABASE.md) for details). This data includes:
|
### Historical Data
|
||||||
|
|
||||||
- Plugin objects
|
Stored in `/data/db/app.db` (see [Database Overview](./DATABASE.md)).
|
||||||
- Plugin historical entries
|
Contains:
|
||||||
- History of Events, Notifications, Workflow Events
|
|
||||||
- Presence history
|
|
||||||
|
|
||||||
|
* Plugin data and historical entries
|
||||||
|
* Event and notification history
|
||||||
|
* Device presence history
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Backup Strategies
|
||||||
|
|
||||||
|
The safest approach is to back up **both** the `/db` and `/config` folders regularly. Tools like [Kopia](https://github.com/kopia/kopia) make this simple and efficient.
|
||||||
|
|
||||||
|
If you can only keep a few files, prioritize:
|
||||||
|
|
||||||
|
1. The latest `devices_<timestamp>.csv` or `devices.csv`
|
||||||
|
2. `app.conf`
|
||||||
|
3. `workflows.json`
|
||||||
|
|
||||||
|
You can also download the `app.conf` and `devices.csv` files from the **Maintenance** section:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Scenario 1: Full Backup and Restore
|
||||||
|
|
||||||
|
**Goal:** Full recovery of your configuration and data.
|
||||||
|
|
||||||
|
### 💾 What to Back Up
|
||||||
|
|
||||||
|
* `/data/db/app.db` (uncorrupted)
|
||||||
|
* `/data/config/app.conf`
|
||||||
|
* `/data/config/workflows.json`
|
||||||
|
|
||||||
|
### 📥 How to Restore
|
||||||
|
|
||||||
|
Map these files into your container as described in the [Setup documentation](./DOCKER_INSTALLATION.md).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Scenario 2: Corrupted Database
|
||||||
|
|
||||||
|
**Goal:** Recover configuration and device data when the database is lost or corrupted.
|
||||||
|
|
||||||
|
### 💾 What to Back Up
|
||||||
|
|
||||||
|
* `/data/config/app.conf`
|
||||||
|
* `/data/config/workflows.json`
|
||||||
|
* `/data/config/devices_<timestamp>.csv` (rename to `devices.csv` during restore)
|
||||||
|
|
||||||
|
### 📥 How to Restore
|
||||||
|
|
||||||
|
1. Copy `app.conf` and `workflows.json` into `/data/config/`
|
||||||
|
2. Rename and place `devices_<timestamp>.csv` → `/data/config/devices.csv`
|
||||||
|
3. Restore via the **Maintenance** section under *Devices → Bulk Editing*
|
||||||
|
|
||||||
|
This recovers nearly all configuration, workflows, and device metadata.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Docker-Based Backup and Restore
|
||||||
|
|
||||||
|
For users running NetAlertX via Docker, you can back up or restore directly from your host system — a convenient and scriptable option.
|
||||||
|
|
||||||
|
### Full Backup (File-Level)
|
||||||
|
|
||||||
|
1. **Stop the container:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker stop netalertx
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Create a compressed archive** of your configuration and database volumes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --rm -v local_path/config:/config -v local_path/db:/db alpine tar -cz /config /db > netalertx-backup.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Restart the container:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker start netalertx
|
||||||
|
```
|
||||||
|
|
||||||
|
### Restore from Backup
|
||||||
|
|
||||||
|
1. **Stop the container:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker stop netalertx
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Restore from your backup file:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --rm -i -v local_path/config:/config -v local_path/db:/db alpine tar -C / -xz < netalertx-backup.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Restart the container:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker start netalertx
|
||||||
|
```
|
||||||
|
|
||||||
|
> This approach uses a temporary, minimal `alpine` container to access Docker-managed volumes. The `tar` command creates or extracts an archive directly from your host’s filesystem, making it fast, clean, and reliable for both automation and manual recovery.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
* Back up `/data/config` for configuration and devices; `/data/db` for history
|
||||||
|
* Keep regular backups, especially before upgrades
|
||||||
|
* For Docker setups, use the lightweight `alpine`-based backup method for consistency and portability
|
||||||
|
|||||||
82
docs/BUILDS.md
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
# NetAlertX Builds: Choose Your Path
|
||||||
|
|
||||||
|
NetAlertX provides different installation methods for different needs. This guide helps you choose the right path for security, experimentation, or development.
|
||||||
|
|
||||||
|
## 1. Hardened Appliance (Default Production)
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> Use this image if: You want to use NetAlertX securely.
|
||||||
|
|
||||||
|
### Who is this for?
|
||||||
|
|
||||||
|
All users who want a stable, secure, "set-it-and-forget-it" appliance.
|
||||||
|
|
||||||
|
### Methodology
|
||||||
|
|
||||||
|
- Multi-stage Alpine build
|
||||||
|
- Aggressively "amputated"
|
||||||
|
- Locked down for max security
|
||||||
|
|
||||||
|
### Source
|
||||||
|
|
||||||
|
`Dockerfile (hardened target)`
|
||||||
|
|
||||||
|
## 2. "Tinkerer's" Image (Insecure VM-Style)
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> Use this image if: You want to experiment with NetAlertX.
|
||||||
|
|
||||||
|
### Who is this for?
|
||||||
|
|
||||||
|
Power users, developers, and "tinkerers" wanting a familiar "VM-like" experience.
|
||||||
|
|
||||||
|
### Methodology
|
||||||
|
|
||||||
|
- Traditional Debian build
|
||||||
|
- Includes full un-hardened OS
|
||||||
|
- Contains `apt`, `sudo`, `git`
|
||||||
|
|
||||||
|
### Source
|
||||||
|
|
||||||
|
`Dockerfile.debian`
|
||||||
|
|
||||||
|
## 3. Contributor's Devcontainer (Project Developers)
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> Use this image if: You want to develop NetAlertX itself.
|
||||||
|
|
||||||
|
### Who is this for?
|
||||||
|
|
||||||
|
Project contributors who are actively writing and debugging code for NetAlertX.
|
||||||
|
|
||||||
|
### Methodology
|
||||||
|
|
||||||
|
|
||||||
|
- Builds `FROM runner` stage
|
||||||
|
- Loaded by VS Code
|
||||||
|
- Full debug tools: `xdebug`, `pytest`
|
||||||
|
|
||||||
|
|
||||||
|
### Source
|
||||||
|
|
||||||
|
`Dockerfile (devcontainer target)`
|
||||||
|
|
||||||
|
# Visualizing the Trade-Offs
|
||||||
|
|
||||||
|
This chart compares the three builds across key attributes. A higher score means "more of" that attribute. Notice the clear trade-offs between security and development features.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
# Build Process & Origins
|
||||||
|
|
||||||
|
The final images originate from two different files and build paths. The main `Dockerfile` uses stages to create *both* the hardened and development container images.
|
||||||
|
|
||||||
|
## Official Build Path
|
||||||
|
|
||||||
|
Dockerfile -> builder (Stage 1) -> runner (Stage 2) -> hardened (Final Stage) (Production Image) + devcontainer (Final Stage) (Developer Image)
|
||||||
|
|
||||||
|
|
||||||
|
## Legacy Build Path
|
||||||
|
|
||||||
|
Dockerfile.debian -> "Tinkerer's" Image (Insecure VM-Style Image)
|
||||||
@@ -1,57 +1,122 @@
|
|||||||
### Loading...
|
# Troubleshooting Common Issues
|
||||||
|
|
||||||
Often if the application is misconfigured the `Loading...` dialog is continuously displayed. This is most likely caused by the backed failing to start. The **Maintenance -> Logs** section should give you more details on what's happening. If there is no exception, check the Portainer log, or start the container in the foreground (without the `-d` parameter) to observe any exceptions. It's advisable to enable `trace` or `debug`. Check the [Debug tips](./DEBUG_TIPS.md) on detailed instructions.
|
> [!TIP]
|
||||||
|
> Before troubleshooting, ensure you have set the correct [Debugging and LOG_LEVEL](./DEBUG_TIPS.md).
|
||||||
|
|
||||||
### Incorrect SCAN_SUBNETS
|
---
|
||||||
|
|
||||||
One of the most common issues is not configuring `SCAN_SUBNETS` correctly. If this setting is misconfigured you will only see one or two devices in your devices list after a scan. Please read the [subnets docs](./SUBNETS.md) carefully to resolve this.
|
## Docker Container Doesn't Start
|
||||||
|
|
||||||
### Duplicate devices and notifications
|
Initial setup issues are often caused by **missing permissions** or **incorrectly mapped volumes**. Always double-check your `docker run` or `docker-compose.yml` against the [official setup guide](./DOCKER_INSTALLATION.md) before proceeding.
|
||||||
|
|
||||||
The app uses the MAC address as an unique identifier for devices. If a new MAC is detected a new device is added to the application and corresponding notifications are triggered. This means that if the MAC of an existing device changes, the device will be logged as a new device. You can usually prevent this from happening by changing the device configuration (in Android, iOS, or Windows) for your network. See the [Random Macs](./RANDOM_MAC.md) guide for details.
|
|
||||||
|
|
||||||
### Permissions
|
### Permissions
|
||||||
|
|
||||||
Make sure you [File permissions](./FILE_PERMISSIONS.md) are set correctly.
|
Make sure your [file permissions](./FILE_PERMISSIONS.md) are correctly set:
|
||||||
|
|
||||||
* If facing issues (AJAX errors, can't write to DB, empty screen, etc,) make sure permissions are set correctly, and check the logs under `/app/log`.
|
* If you encounter AJAX errors, cannot write to the database, or see an empty screen, check that permissions are correct and review the logs under `/tmp/log`.
|
||||||
* To solve permission issues you can try setting the owner and group of the `app.db` by executing the following on the host system: `docker exec netalertx chown -R www-data:www-data /app/db/app.db`.
|
* To fix permission issues with the database, update the owner and group of `app.db` as described in the [File Permissions guide](./FILE_PERMISSIONS.md).
|
||||||
* If still facing issues, try to map the app.db file (⚠ not folder) to `:/app/db/app.db` (see [docker-compose Examples](https://github.com/jokob-sk/NetAlertX/blob/main/dockerfiles/README.md#-docker-composeyml-examples) for details)
|
|
||||||
|
|
||||||
### Container restarts / crashes
|
### Container Restarts / Crashes
|
||||||
|
|
||||||
* Check the logs for details. Often a required setting for a notification method is missing.
|
* Check the logs for details. Often, required settings are missing.
|
||||||
|
* For more detailed troubleshooting, see [Debug and Troubleshooting Tips](./DEBUG_TIPS.md).
|
||||||
|
* To observe errors directly, run the container in the foreground instead of `-d`:
|
||||||
|
|
||||||
### unable to resolve host
|
```bash
|
||||||
|
docker run --rm -it <your_image>
|
||||||
|
```
|
||||||
|
|
||||||
* Check that your `SCAN_SUBNETS` variable is using the correct mask and `--interface`. See the [subnets docs for details](./SUBNETS.md).
|
---
|
||||||
|
|
||||||
### Invalid JSON
|
## Docker Container Starts, But the Application Misbehaves
|
||||||
|
|
||||||
Check the [Invalid JSON errors debug help](./DEBUG_INVALID_JSON.md) docs on how to proceed.
|
If the container starts but the app shows unexpected behavior, the cause is often **data corruption**, **incorrect configuration**, or **unexpected input data**.
|
||||||
|
|
||||||
### sudo execution failing (e.g.: on arpscan) on a Raspberry Pi 4
|
### Continuous "Loading..." Screen
|
||||||
|
|
||||||
> sudo: unexpected child termination condition: 0
|
A misconfigured application may display a persistent `Loading...` dialog. This is usually caused by the backend failing to start.
|
||||||
|
|
||||||
Resolution based on [this issue](https://github.com/linuxserver/docker-papermerge/issues/4#issuecomment-1003657581)
|
**Steps to troubleshoot:**
|
||||||
|
|
||||||
|
1. Check **Maintenance → Logs** for exceptions.
|
||||||
|
2. If no exception is visible, check the Portainer logs.
|
||||||
|
3. Start the container in the foreground to observe exceptions.
|
||||||
|
4. Enable `trace` or `debug` logging for detailed output (see [Debug Tips](./DEBUG_TIPS.md)).
|
||||||
|
5. Verify that `GRAPHQL_PORT` is correctly configured.
|
||||||
|
6. Check browser logs (press `F12`):
|
||||||
|
|
||||||
|
* **Console tab** → refresh the page
|
||||||
|
* **Network tab** → refresh the page
|
||||||
|
|
||||||
|
If you are unsure how to resolve errors, provide screenshots or log excerpts in your issue report or Discord discussion.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Common Configuration Issues
|
||||||
|
|
||||||
|
#### Incorrect `SCAN_SUBNETS`
|
||||||
|
|
||||||
|
If `SCAN_SUBNETS` is misconfigured, you may see only a few devices in your device list after a scan. See the [Subnets Documentation](./SUBNETS.md) for proper configuration.
|
||||||
|
|
||||||
|
#### Duplicate Devices and Notifications
|
||||||
|
|
||||||
|
* Devices are identified by their **MAC address**.
|
||||||
|
* If a device's MAC changes, it will be treated as a new device, triggering notifications.
|
||||||
|
* Prevent this by adjusting your device configuration for Android, iOS, or Windows. See the [Random MACs Guide](./RANDOM_MAC.md).
|
||||||
|
|
||||||
|
#### Unable to Resolve Host
|
||||||
|
|
||||||
|
* Ensure `SCAN_SUBNETS` uses the correct mask and `--interface`.
|
||||||
|
* Refer to the [Subnets Documentation](./SUBNETS.md) for detailed guidance.
|
||||||
|
|
||||||
|
#### Invalid JSON Errors
|
||||||
|
|
||||||
|
* Follow the steps in [Invalid JSON Errors Debug Help](./DEBUG_INVALID_JSON.md).
|
||||||
|
|
||||||
|
#### Sudo Execution Fails (e.g., on arpscan on Raspberry Pi 4)
|
||||||
|
|
||||||
|
Error:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
sudo: unexpected child termination condition: 0
|
||||||
|
```
|
||||||
|
|
||||||
|
**Resolution**:
|
||||||
|
|
||||||
|
```bash
|
||||||
wget ftp.us.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.3-2_armhf.deb
|
wget ftp.us.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.3-2_armhf.deb
|
||||||
sudo dpkg -i libseccomp2_2.5.3-2_armhf.deb
|
sudo dpkg -i libseccomp2_2.5.3-2_armhf.deb
|
||||||
```
|
```
|
||||||
|
|
||||||
The link above will probably break in time too. Go to https://packages.debian.org/sid/armhf/libseccomp2/download to find the new version number and put that in the url.
|
> ⚠️ The link may break over time. Check [Debian Packages](https://packages.debian.org/sid/armhf/libseccomp2/download) for the latest version.
|
||||||
|
|
||||||
### Only Router and own device show up
|
#### Only Router and Own Device Show Up
|
||||||
|
|
||||||
Make sure that the subnet and interface in `SCAN_SUBNETS` are correct. If your device/NAS has multiple ethernet ports, you probably need to change `eth0` to something else.
|
* Verify the subnet and interface in `SCAN_SUBNETS`.
|
||||||
|
* On devices with multiple Ethernet ports, you may need to change `eth0` to the correct interface.
|
||||||
|
|
||||||
### Losing my settings and devices after an update
|
#### Losing Settings or Devices After Update
|
||||||
|
|
||||||
If you lose your devices and/or settings after an update that means you don't have the `/app/db` and `/app/config` folders mapped to a permanent storage. That means every time you update these folders are re-created. Make sure you have the [volumes specified correctly](./DOCKER_COMPOSE.md) in your `docker-compose.yml` or run command.
|
* Ensure `/data/db` and `/data/config` are mapped to persistent storage.
|
||||||
|
* Without persistent volumes, these folders are recreated on every update.
|
||||||
|
* See [Docker Volumes Setup](./DOCKER_COMPOSE.md) for proper configuration.
|
||||||
|
|
||||||
|
#### Application Performance Issues
|
||||||
|
|
||||||
|
Slowness can be caused by:
|
||||||
|
|
||||||
|
* Incorrect settings (causing app restarts) → check `app.log`.
|
||||||
|
* Too many background processes → disable unnecessary scanners.
|
||||||
|
* Long scans → limit the number of scanned devices.
|
||||||
|
* Excessive disk operations or failing maintenance plugins.
|
||||||
|
|
||||||
|
> See [Performance Tips](./PERFORMANCE.md) for detailed optimization steps.
|
||||||
|
|
||||||
|
|
||||||
### The application is slow
|
#### IP flipping
|
||||||
|
|
||||||
Slowness is usually caused by incorrect settings (the app might restart, so check the `app.log`), too many background processes (disable unnecessary scanners), too long scans (limit the number of scanned devices), too many disk operations, or some maintenance plugins might have failed. See the [Performance tips](./PERFORMANCE.md) docs for details.
|
With `ARPSCAN` scans some devices might flip IP addresses after each scan triggering false notifications. This is because some devices respond to broadcast calls and thus different IPs after scans are logged.
|
||||||
|
|
||||||
|
See how to prevent IP flipping in the [ARPSCAN plugin guide](/front/plugins/arp_scan/README.md).
|
||||||
|
|
||||||
|
Alternatively adjust your [notification settings](./NOTIFICATIONS.md) to prevent false positives by filtering out events or devices.
|
||||||
|
|||||||
13
docs/DEBUG_GRAPHQL.md → docs/DEBUG_API_SERVER.md
Executable file → Normal file
@@ -12,7 +12,7 @@ As a first troubleshooting step try changing the default `GRAPHQL_PORT` setting.
|
|||||||
|
|
||||||
Ideally use the Settings UI to update the setting under General -> Core -> GraphQL port:
|
Ideally use the Settings UI to update the setting under General -> Core -> GraphQL port:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
You might need to temporarily stop other applications or NetAlertX instances causing conflicts to update the setting. The `API_TOKEN` is used to authenticate any API calls, including GraphQL requests.
|
You might need to temporarily stop other applications or NetAlertX instances causing conflicts to update the setting. The `API_TOKEN` is used to authenticate any API calls, including GraphQL requests.
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ You might need to temporarily stop other applications or NetAlertX instances cau
|
|||||||
|
|
||||||
If the UI is not accessible, you can directly edit the `app.conf` file in your `/config` folder:
|
If the UI is not accessible, you can directly edit the `app.conf` file in your `/config` folder:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Using a docker variable
|
### Using a docker variable
|
||||||
|
|
||||||
@@ -29,7 +29,6 @@ All application settings can also be initialized via the `APP_CONF_OVERRIDE` doc
|
|||||||
```yaml
|
```yaml
|
||||||
...
|
...
|
||||||
environment:
|
environment:
|
||||||
- TZ=Europe/Berlin
|
|
||||||
- PORT=20213
|
- PORT=20213
|
||||||
- APP_CONF_OVERRIDE={"GRAPHQL_PORT":"20214"}
|
- APP_CONF_OVERRIDE={"GRAPHQL_PORT":"20214"}
|
||||||
...
|
...
|
||||||
@@ -43,22 +42,22 @@ There are several ways to check if the GraphQL server is running.
|
|||||||
|
|
||||||
You can navigate to Maintenance -> Init Check to see if `isGraphQLServerRunning` is ticked:
|
You can navigate to Maintenance -> Init Check to see if `isGraphQLServerRunning` is ticked:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Checking the Logs
|
### Checking the Logs
|
||||||
|
|
||||||
You can navigate to Maintenance -> Logs and search for `graphql` to see if it started correctly and serving requests:
|
You can navigate to Maintenance -> Logs and search for `graphql` to see if it started correctly and serving requests:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Inspecting the Browser console
|
### Inspecting the Browser console
|
||||||
|
|
||||||
In your browser open the dev console (usually F12) and navigate to the Network tab where you can filter GraphQL requests (e.g., reload the Devices page).
|
In your browser open the dev console (usually F12) and navigate to the Network tab where you can filter GraphQL requests (e.g., reload the Devices page).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
You can then inspect any of the POST requests by opening them in a new tab.
|
You can then inspect any of the POST requests by opening them in a new tab.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
@@ -8,8 +8,8 @@ Check the the HTTP response of the failing backend call by following these steps
|
|||||||
![F12DeveloperConsole][F12DeveloperConsole]
|
![F12DeveloperConsole][F12DeveloperConsole]
|
||||||
|
|
||||||
- Copy the URL causing the error and enter it in the address bar of your browser directly and hit enter. The copied URLs could look something like this (notice the query strings at the end):
|
- Copy the URL causing the error and enter it in the address bar of your browser directly and hit enter. The copied URLs could look something like this (notice the query strings at the end):
|
||||||
- `http://<NetAlertX URL>:20211/api/table_devices.json?nocache=1704141103121`
|
- `http://<server>:20211/api/table_devices.json?nocache=1704141103121`
|
||||||
- `http://<NetAlertX URL>:20211/php/server/devices.php?action=getDevicesTotals`
|
- `http://<server>:20211/php/server/devices.php?action=getDevicesTotals`
|
||||||
|
|
||||||
|
|
||||||
- Post the error response in the existing issue thread on GitHub or create a new issue and include the redacted response of the failing query.
|
- Post the error response in the existing issue thread on GitHub or create a new issue and include the redacted response of the failing query.
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ Sometimes, the UI might not be accessible. In that case, you can access the logs
|
|||||||
3. **Check the PHP application error log:**
|
3. **Check the PHP application error log:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cat /app/log/app.php_errors.log
|
cat /tmp/log/app.php_errors.log
|
||||||
```
|
```
|
||||||
|
|
||||||
These logs will help identify syntax issues, fatal errors, or startup problems when the UI fails to load properly.
|
These logs will help identify syntax issues, fatal errors, or startup problems when the UI fails to load properly.
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
# Troubleshooting plugins
|
# Troubleshooting plugins
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> Before troubleshooting, please ensure you have the right [Debugging and LOG_LEVEL set](./DEBUG_TIPS.md).
|
||||||
|
|
||||||
## High-level overview
|
## High-level overview
|
||||||
|
|
||||||
If a Plugin supplies data to the main app it's done either vie a SQL query or via a script that updates the `last_result.log` file in the plugin log folder (`app/log/plugins/`).
|
If a Plugin supplies data to the main app it's done either vie a SQL query or via a script that updates the `last_result.log` file in the plugin log folder (`app/log/plugins/`).
|
||||||
|
|||||||
@@ -13,16 +13,22 @@ When debugging an issue always set the highest log level:
|
|||||||
Start the container via the **terminal** with a command similar to this one:
|
Start the container via the **terminal** with a command similar to this one:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run --rm --network=host \
|
docker run \
|
||||||
-v local/path/netalertx/config:/app/config \
|
--network=host \
|
||||||
-v local/path/netalertx/db:/app/db \
|
--restart unless-stopped \
|
||||||
-e TZ=Europe/Berlin \
|
-v /local_data_dir:/data \
|
||||||
|
-v /etc/localtime:/etc/localtime:ro \
|
||||||
|
--tmpfs /tmp:uid=20211,gid=20211,mode=1700 \
|
||||||
-e PORT=20211 \
|
-e PORT=20211 \
|
||||||
|
-e APP_CONF_OVERRIDE='{"GRAPHQL_PORT":"20214"}' \
|
||||||
ghcr.io/jokob-sk/netalertx:latest
|
ghcr.io/jokob-sk/netalertx:latest
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> ⚠ Please note, don't use the `-d` parameter so you see the error when the container crashes. Use this error in your issue description.
|
Note: Your `/local_data_dir` should contain a `config` and `db` folder.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> ⚠ The most important part is NOT to use the `-d` parameter so you see the error when the container crashes. Use this error in your issue description.
|
||||||
|
|
||||||
## 3. Check the _dev image and open issues
|
## 3. Check the _dev image and open issues
|
||||||
|
|
||||||
@@ -48,7 +54,12 @@ services:
|
|||||||
# Other service configurations...
|
# Other service configurations...
|
||||||
```
|
```
|
||||||
|
|
||||||
## 5. Sharing application state
|
## 5. TMP mount directories to rule host out permission issues
|
||||||
|
|
||||||
|
Try starting the container with all data to be in non-persistent volumes. If this works, the issue might be related to the permissions of your persistent data mount locations on your server. See teh [Permissions guide](./FILE_PERMISSIONS.md) for details.
|
||||||
|
|
||||||
|
|
||||||
|
## 6. Sharing application state
|
||||||
|
|
||||||
Sometimes specific log sections are needed to debug issues. The Devices and CurrentScan table data is sometimes needed to figure out what's wrong.
|
Sometimes specific log sections are needed to debug issues. The Devices and CurrentScan table data is sometimes needed to figure out what's wrong.
|
||||||
|
|
||||||
@@ -61,4 +72,4 @@ Sometimes specific log sections are needed to debug issues. The Devices and Curr
|
|||||||
|
|
||||||
## Common issues
|
## Common issues
|
||||||
|
|
||||||
See [Common issues](./COMMON_ISSUES.md) for details.
|
See [Common issues](./COMMON_ISSUES.md) for additional troubleshooting tips.
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ The database and device structure may change with new releases. When using the C
|
|||||||

|

|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> The file containing a list of Devices including the Network relationships between Network Nodes and connected devices. You can also trigger this by acessing this URL: `<your netalertx url>/php/server/devices.php?action=ExportCSV` or via the `CSV Backup` plugin. (💡 You can schedule this)
|
> The file containing a list of Devices including the Network relationships between Network Nodes and connected devices. You can also trigger this by acessing this URL: `<server>:20211/php/server/devices.php?action=ExportCSV` or via the `CSV Backup` plugin. (💡 You can schedule this)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# NetAlertX - Device Management
|
# Device Management
|
||||||
|
|
||||||
The Main Info section is where most of the device identifiable information is stored and edited. Some of the information is autodetected via various plugins. Initial values for most of the fields can be specified in the `NEWDEV` plugin.
|
The Main Info section is where most of the device identifiable information is stored and edited. Some of the information is autodetected via various plugins. Initial values for most of the fields can be specified in the `NEWDEV` plugin.
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ The file content should be following, with your custom values.
|
|||||||
#--------------------------------
|
#--------------------------------
|
||||||
#NETALERTX
|
#NETALERTX
|
||||||
#--------------------------------
|
#--------------------------------
|
||||||
TZ=Europe/Berlin
|
|
||||||
PORT=22222 # make sure this port is unique on your whole network
|
PORT=22222 # make sure this port is unique on your whole network
|
||||||
DEV_LOCATION=/development/NetAlertX
|
DEV_LOCATION=/development/NetAlertX
|
||||||
APP_DATA_LOCATION=/volume/docker_appdata
|
APP_DATA_LOCATION=/volume/docker_appdata
|
||||||
|
|||||||
@@ -1,203 +1,232 @@
|
|||||||
# `docker-compose.yaml` Examples
|
# NetAlertX and Docker Compose
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> ⚠️ **Important:** The docker-compose has recently changed. Carefully read the [Migration guide](https://jokob-sk.github.io/NetAlertX/MIGRATION/?h=migrat#12-migration-from-netalertx-v25524) for detailed instructions.
|
||||||
|
|
||||||
|
Great care is taken to ensure NetAlertX meets the needs of everyone while being flexible enough for anyone. This document outlines how you can configure your docker-compose. There are many settings, so we recommend using the Baseline Docker Compose as-is, or modifying it for your system.Good care is taken to ensure NetAlertX meets the needs of everyone while being flexible enough for anyone. This document outlines how you can configure your docker-compose. There are many settings, so we recommend using the Baseline Docker Compose as-is, or modifying it for your system.
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> The container needs to run in `network_mode:"host"`. This also means that not all functionality is supported on a Windows host as Docker for Windows doesn't support this networking option.
|
> The container needs to run in `network_mode:"host"` to access Layer 2 networking such as arp, nmap and others. Due to lack of support for this feature, Windows host is not a supported operating system.
|
||||||
|
|
||||||
### Example 1
|
## Baseline Docker Compose
|
||||||
|
|
||||||
|
There is one baseline for NetAlertX. That's the default security-enabled official distribution.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
services:
|
services:
|
||||||
netalertx:
|
netalertx:
|
||||||
container_name: netalertx
|
#use an environmental variable to set host networking mode if needed
|
||||||
# use the below line if you want to test the latest dev image
|
container_name: netalertx # The name when you docker contiainer ls
|
||||||
# image: "ghcr.io/jokob-sk/netalertx-dev:latest"
|
|
||||||
image: "ghcr.io/jokob-sk/netalertx:latest"
|
|
||||||
network_mode: "host"
|
|
||||||
restart: unless-stopped
|
|
||||||
volumes:
|
|
||||||
- local_path/config:/app/config
|
|
||||||
- local_path/db:/app/db
|
|
||||||
# (optional) useful for debugging if you have issues setting up the container
|
|
||||||
- local_path/logs:/app/log
|
|
||||||
# (API: OPTION 1) use for performance
|
|
||||||
- type: tmpfs
|
|
||||||
target: /app/api
|
|
||||||
# (API: OPTION 2) use when debugging issues
|
|
||||||
# - local_path/api:/app/api
|
|
||||||
environment:
|
|
||||||
- TZ=Europe/Berlin
|
|
||||||
- PORT=20211
|
|
||||||
```
|
|
||||||
|
|
||||||
To run the container execute: `sudo docker-compose up -d`
|
|
||||||
|
|
||||||
### Example 2
|
|
||||||
|
|
||||||
Example by [SeimuS](https://github.com/SeimusS).
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
services:
|
|
||||||
netalertx:
|
|
||||||
container_name: NetAlertX
|
|
||||||
hostname: NetAlertX
|
|
||||||
privileged: true
|
|
||||||
# use the below line if you want to test the latest dev image
|
|
||||||
# image: "ghcr.io/jokob-sk/netalertx-dev:latest"
|
|
||||||
image: ghcr.io/jokob-sk/netalertx:latest
|
image: ghcr.io/jokob-sk/netalertx:latest
|
||||||
environment:
|
network_mode: ${NETALERTX_NETWORK_MODE:-host} # Use host networking for ARP scanning and other services
|
||||||
- TZ=Europe/Bratislava
|
|
||||||
restart: always
|
read_only: true # Make the container filesystem read-only
|
||||||
|
cap_drop: # Drop all capabilities for enhanced security
|
||||||
|
- ALL
|
||||||
|
cap_add: # Add only the necessary capabilities
|
||||||
|
- NET_ADMIN # Required for ARP scanning
|
||||||
|
- NET_RAW # Required for raw socket operations
|
||||||
|
- NET_BIND_SERVICE # Required to bind to privileged ports (nbtscan)
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./netalertx/db:/app/db
|
- type: volume # Persistent Docker-managed named volume for config + database
|
||||||
- ./netalertx/config:/app/config
|
source: netalertx_data
|
||||||
network_mode: host
|
target: /data # `/data/config` and `/data/db` live inside this mount
|
||||||
```
|
read_only: false
|
||||||
|
|
||||||
To run the container execute: `sudo docker-compose up -d`
|
# Example custom local folder called /home/user/netalertx_data
|
||||||
|
# - type: bind
|
||||||
|
# source: /home/user/netalertx_data
|
||||||
|
# target: /data
|
||||||
|
# read_only: false
|
||||||
|
# ... or use the alternative format
|
||||||
|
# - /home/user/netalertx_data:/data:rw
|
||||||
|
|
||||||
### Example 3
|
- type: bind # Bind mount for timezone consistency
|
||||||
|
source: /etc/localtime
|
||||||
|
target: /etc/localtime
|
||||||
|
read_only: true
|
||||||
|
|
||||||
`docker-compose.yml`
|
# Mount your DHCP server file into NetAlertX for a plugin to access
|
||||||
|
# - path/on/host/to/dhcp.file:/resources/dhcp.file
|
||||||
|
|
||||||
```yaml
|
# tmpfs mount consolidates writable state for a read-only container and improves performance
|
||||||
services:
|
# uid=20211 and gid=20211 is the netalertx user inside the container
|
||||||
netalertx:
|
# mode=1700 grants rwx------ permissions to the netalertx user only
|
||||||
container_name: netalertx
|
tmpfs:
|
||||||
# use the below line if you want to test the latest dev image
|
# Comment out to retain logs between container restarts - this has a server performance impact.
|
||||||
# image: "ghcr.io/jokob-sk/netalertx-dev:latest"
|
- "/tmp:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,async,noatime,nodiratime"
|
||||||
image: "ghcr.io/jokob-sk/netalertx:latest"
|
|
||||||
network_mode: "host"
|
# Retain logs - comment out tmpfs /tmp if you want to retain logs between container restarts
|
||||||
|
# Please note if you remove the /tmp mount, you must create and maintain sub-folder mounts.
|
||||||
|
# - /path/on/host/log:/tmp/log
|
||||||
|
# - "/tmp/api:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,async,noatime,nodiratime"
|
||||||
|
# - "/tmp/nginx:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,async,noatime,nodiratime"
|
||||||
|
# - "/tmp/run:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,async,noatime,nodiratime"
|
||||||
|
|
||||||
|
environment:
|
||||||
|
LISTEN_ADDR: ${LISTEN_ADDR:-0.0.0.0} # Listen for connections on all interfaces
|
||||||
|
PORT: ${PORT:-20211} # Application port
|
||||||
|
GRAPHQL_PORT: ${GRAPHQL_PORT:-20212} # GraphQL API port (passed into APP_CONF_OVERRIDE at runtime)
|
||||||
|
# NETALERTX_DEBUG: ${NETALERTX_DEBUG:-0} # 0=kill all services and restart if any dies. 1 keeps running dead services.
|
||||||
|
|
||||||
|
# Resource limits to prevent resource exhaustion
|
||||||
|
mem_limit: 2048m # Maximum memory usage
|
||||||
|
mem_reservation: 1024m # Soft memory limit
|
||||||
|
cpu_shares: 512 # Relative CPU weight for CPU contention scenarios
|
||||||
|
pids_limit: 512 # Limit the number of processes/threads to prevent fork bombs
|
||||||
|
logging:
|
||||||
|
driver: "json-file" # Use JSON file logging driver
|
||||||
|
options:
|
||||||
|
max-size: "10m" # Rotate log files after they reach 10MB
|
||||||
|
max-file: "3" # Keep a maximum of 3 log files
|
||||||
|
|
||||||
|
# Always restart the container unless explicitly stopped
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
|
||||||
- ${APP_CONFIG_LOCATION}/netalertx/config:/app/config
|
volumes: # Persistent volume for configuration and database storage
|
||||||
- ${APP_DATA_LOCATION}/netalertx/db/:/app/db/
|
netalertx_data:
|
||||||
# (optional) useful for debugging if you have issues setting up the container
|
|
||||||
- ${LOGS_LOCATION}:/app/log
|
|
||||||
# (API: OPTION 1) use for performance
|
|
||||||
- type: tmpfs
|
|
||||||
target: /app/api
|
|
||||||
# (API: OPTION 2) use when debugging issues
|
|
||||||
# - local/path/api:/app/api
|
|
||||||
environment:
|
|
||||||
- TZ=${TZ}
|
|
||||||
- PORT=${PORT}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
`.env` file
|
Run or re-run it:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker compose up --force-recreate
|
||||||
|
```
|
||||||
|
|
||||||
|
### Customize with Environmental Variables
|
||||||
|
|
||||||
|
You can override the default settings by passing environmental variables to the `docker compose up` command.
|
||||||
|
|
||||||
|
**Example using a single variable:**
|
||||||
|
|
||||||
|
This command runs NetAlertX on port 8080 instead of the default 20211.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
PORT=8080 docker compose up
|
||||||
|
```
|
||||||
|
|
||||||
|
**Example using all available variables:**
|
||||||
|
|
||||||
|
This command demonstrates overriding all primary environmental variables: running with host networking, on port 20211, GraphQL on 20212, and listening on all IPs.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
NETALERTX_NETWORK_MODE=host \
|
||||||
|
LISTEN_ADDR=0.0.0.0 \
|
||||||
|
PORT=20211 \
|
||||||
|
GRAPHQL_PORT=20212 \
|
||||||
|
NETALERTX_DEBUG=0 \
|
||||||
|
docker compose up
|
||||||
|
```
|
||||||
|
|
||||||
|
## `docker-compose.yaml` Modifications
|
||||||
|
|
||||||
|
### Modification 1: Use a Local Folder (Bind Mount)
|
||||||
|
|
||||||
|
By default, the baseline compose file uses a single named volume (netalertx_data) mounted at `/data`. This single-volume layout is preferred because NetAlertX manages both configuration and the database under `/data` (for example, `/data/config` and `/data/db`) via its web UI. Using one named volume simplifies permissions and portability: Docker manages the storage and NetAlertX manages the files inside `/data`.
|
||||||
|
|
||||||
|
A two-volume layout that mounts `/data/config` and `/data/db` separately (for example, `netalertx_config` and `netalertx_db`) is supported for backward compatibility and some advanced workflows, but it is an abnormal/legacy layout and not recommended for new deployments.
|
||||||
|
|
||||||
|
However, if you prefer to have direct, file-level access to your configuration for manual editing, a "bind mount" is a simple alternative. This tells Docker to use a specific folder from your computer (the "host") inside the container.
|
||||||
|
|
||||||
|
**How to make the change:**
|
||||||
|
|
||||||
|
1. Choose a location on your computer. For example, `/local_data_dir`.
|
||||||
|
|
||||||
|
2. Create the subfolders: `mkdir -p /local_data_dir/config` and `mkdir -p /local_data_dir/db`.
|
||||||
|
|
||||||
|
3. Edit your `docker-compose.yml` and find the `volumes:` section (the one *inside* the `netalertx:` service).
|
||||||
|
|
||||||
|
4. Comment out (add a `#` in front) or delete the `type: volume` blocks for `netalertx_config` and `netalertx_db`.
|
||||||
|
|
||||||
|
5. Add new lines pointing to your local folders.
|
||||||
|
|
||||||
|
**Before (Using Named Volumes - Preferred):**
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
#GLOBAL PATH VARIABLES
|
...
|
||||||
|
volumes:
|
||||||
APP_DATA_LOCATION=/path/to/docker_appdata
|
- netalertx_config:/data/config:rw #short-form volume (no /path is a short volume)
|
||||||
APP_CONFIG_LOCATION=/path/to/docker_config
|
- netalertx_db:/data/db:rw
|
||||||
LOGS_LOCATION=/path/to/docker_logs
|
...
|
||||||
|
|
||||||
#ENVIRONMENT VARIABLES
|
|
||||||
|
|
||||||
TZ=Europe/Paris
|
|
||||||
PORT=20211
|
|
||||||
|
|
||||||
#DEVELOPMENT VARIABLES
|
|
||||||
|
|
||||||
DEV_LOCATION=/path/to/local/source/code
|
|
||||||
```
|
```
|
||||||
|
|
||||||
To run the container execute: `sudo docker-compose --env-file /path/to/.env up`
|
**After (Using a Local Folder / Bind Mount):**
|
||||||
|
Make sure to replace `/local_data_dir` with your actual path. The format is `<path_on_your_computer>:<path_inside_container>:<options>`.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
...
|
||||||
|
volumes:
|
||||||
|
# - netalertx_config:/data/config:rw
|
||||||
|
# - netalertx_db:/data/db:rw
|
||||||
|
- /local_data_dir/config:/data/config:rw
|
||||||
|
- /local_data_dir/db:/data/db:rw
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
### Example 4: Docker swarm
|
Now, any files created by NetAlertX in `/data/config` will appear in your `/local_data_dir/config` folder.
|
||||||
|
|
||||||
Notice how the host network is defined in a swarm setup:
|
This same method works for mounting other things, like custom plugins or enterprise NGINX files, as shown in the commented-out examples in the baseline file.
|
||||||
|
|
||||||
|
## Example Configuration Summaries
|
||||||
|
|
||||||
|
Here are the essential modifications for common alternative setups.
|
||||||
|
|
||||||
|
### Example 2: External `.env` File for Paths
|
||||||
|
|
||||||
|
This method is useful for keeping your paths and other settings separate from your main compose file, making it more portable.
|
||||||
|
|
||||||
|
**`docker-compose.yml` changes:**
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
...
|
||||||
|
services:
|
||||||
|
netalertx:
|
||||||
|
environment:
|
||||||
|
- PORT=${PORT}
|
||||||
|
- GRAPHQL_PORT=${GRAPHQL_PORT}
|
||||||
|
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
**`.env` file contents:**
|
||||||
|
|
||||||
|
```sh
|
||||||
|
PORT=20211
|
||||||
|
NETALERTX_NETWORK_MODE=host
|
||||||
|
LISTEN_ADDR=0.0.0.0
|
||||||
|
GRAPHQL_PORT=20212
|
||||||
|
```
|
||||||
|
|
||||||
|
Run with: `sudo docker-compose --env-file /path/to/.env up`
|
||||||
|
|
||||||
|
### Example 3: Docker Swarm
|
||||||
|
|
||||||
|
This is for deploying on a Docker Swarm cluster. The key differences from the baseline are the removal of `network_mode:` from the service, and the addition of `deploy:` and `networks:` blocks at both the service and top-level.
|
||||||
|
|
||||||
|
Here are the *only* changes you need to make to the baseline compose file to make it Swarm-compatible.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
services:
|
services:
|
||||||
netalertx:
|
netalertx:
|
||||||
# Use the below line if you want to test the latest dev image
|
...
|
||||||
# image: "jokobsk/netalertx-dev:latest"
|
# network_mode: ${NETALERTX_NETWORK_MODE:-host} # <-- DELETE THIS LINE
|
||||||
image: "ghcr.io/jokob-sk/netalertx:latest"
|
...
|
||||||
volumes:
|
|
||||||
- /mnt/MYSERVER/netalertx/config:/config:rw
|
# 2. ADD a 'networks:' block INSIDE the service to connect to the external host network.
|
||||||
- /mnt/MYSERVER/netalertx/db:/netalertx/db:rw
|
|
||||||
- /mnt/MYSERVER/netalertx/logs:/netalertx/front/log:rw
|
|
||||||
environment:
|
|
||||||
- TZ=Europe/London
|
|
||||||
- PORT=20211
|
|
||||||
networks:
|
networks:
|
||||||
- outside
|
- outside
|
||||||
|
# 3. ADD a 'deploy:' block to manage the service as a swarm replica.
|
||||||
deploy:
|
deploy:
|
||||||
mode: replicated
|
mode: replicated
|
||||||
replicas: 1
|
replicas: 1
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: on-failure
|
condition: on-failure
|
||||||
|
|
||||||
|
|
||||||
|
# 4. ADD a new top-level 'networks:' block at the end of the file to define 'outside' as the external 'host' network.
|
||||||
networks:
|
networks:
|
||||||
outside:
|
outside:
|
||||||
external:
|
external:
|
||||||
name: "host"
|
name: "host"
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Example 5: same as 3 but with a top-level root directory; also works in Portainer as-is
|
|
||||||
|
|
||||||
`docker-compose.yml`
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
services:
|
|
||||||
netalertx:
|
|
||||||
container_name: netalertx
|
|
||||||
# use the below line if you want to test the latest dev image instead of the stable release
|
|
||||||
# image: "ghcr.io/jokob-sk/netalertx-dev:latest"
|
|
||||||
image: "ghcr.io/jokob-sk/netalertx:latest"
|
|
||||||
|
|
||||||
network_mode: "host"
|
|
||||||
restart: unless-stopped
|
|
||||||
volumes:
|
|
||||||
- ${APP_FOLDER}/netalertx/config:/app/config
|
|
||||||
- ${APP_FOLDER}/netalertx/db:/app/db
|
|
||||||
# (optional) useful for debugging if you have issues setting up the container
|
|
||||||
- ${APP_FOLDER}/netalertx/log:/app/log
|
|
||||||
# (API: OPTION 1) default -> use for performance
|
|
||||||
- type: tmpfs
|
|
||||||
target: /app/api
|
|
||||||
# (API: OPTION 2) use when debugging issues
|
|
||||||
# - ${APP_FOLDER}/netalertx/api:/app/api
|
|
||||||
environment:
|
|
||||||
|
|
||||||
- TZ=${TZ}
|
|
||||||
- PORT=${PORT}
|
|
||||||
- PUID=${PUID}
|
|
||||||
- PGID=${PGID}
|
|
||||||
- LISTEN_ADDR=${LISTEN_ADDR}
|
|
||||||
```
|
|
||||||
|
|
||||||
`.env` file
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
APP_FOLDER=/path/to/local/NetAlertX/location
|
|
||||||
|
|
||||||
#ENVIRONMENT VARIABLES
|
|
||||||
|
|
||||||
PUID=200
|
|
||||||
PGID=300
|
|
||||||
|
|
||||||
TZ=America/New_York
|
|
||||||
LISTEN_ADDR=0.0.0.0
|
|
||||||
PORT=20211
|
|
||||||
#GLOBAL PATH VARIABLE
|
|
||||||
|
|
||||||
# you may want to create a dedicated user and group to run the container with
|
|
||||||
# sudo groupadd -g 300 nax-g
|
|
||||||
# sudo useradd -u 200 -g 300 nax-u
|
|
||||||
# mkdir -p $APP_FOLDER/{db,config,log}
|
|
||||||
# chown -R 200:300 $APP_FOLDER
|
|
||||||
# chmod -R 775 $APP_FOLDER
|
|
||||||
|
|
||||||
# DEVELOPMENT VARIABLES
|
|
||||||
# you can create multiple env files called .env.dev1, .env.dev2 etc and use them by running:
|
|
||||||
# docker compose --env-file .env.dev1 up -d
|
|
||||||
# you can then clone multiple dev copies of NetAlertX just make sure to change the APP_FOLDER and PORT variables in each .env.devX file
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
To run the container execute: `sudo docker-compose --env-file /path/to/.env up`
|
|
||||||
|
|||||||
124
docs/DOCKER_INSTALLATION.md
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
[](https://hub.docker.com/r/jokobsk/netalertx)
|
||||||
|
[](https://hub.docker.com/r/jokobsk/netalertx)
|
||||||
|
[](https://github.com/jokob-sk/NetAlertX/releases)
|
||||||
|
[](https://discord.gg/NczTUTWyRr)
|
||||||
|
[](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Falexbelgium%2Fhassio-addons)
|
||||||
|
|
||||||
|
# NetAlertX - Network scanner & notification framework
|
||||||
|
|
||||||
|
| [📑 Docker guide](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DOCKER_INSTALLATION.md) | [🚀 Releases](https://github.com/jokob-sk/NetAlertX/releases) | [📚 Docs](https://jokob-sk.github.io/NetAlertX/) | [🔌 Plugins](https://github.com/jokob-sk/NetAlertX/blob/main/docs/PLUGINS.md) | [🤖 Ask AI](https://gurubase.io/g/netalertx)
|
||||||
|
|----------------------| ----------------------| ----------------------| ----------------------| ----------------------|
|
||||||
|
|
||||||
|
<a href="https://raw.githubusercontent.com/jokob-sk/NetAlertX/main/docs/img/GENERAL/github_social_image.jpg" target="_blank">
|
||||||
|
<img src="https://raw.githubusercontent.com/jokob-sk/NetAlertX/main/docs/img/GENERAL/github_social_image.jpg" width="1000px" />
|
||||||
|
</a>
|
||||||
|
|
||||||
|
Head to [https://netalertx.com/](https://netalertx.com/) for more gifs and screenshots 📷.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> There is also an experimental 🧪 [bare-metal install](https://github.com/jokob-sk/NetAlertX/blob/main/docs/HW_INSTALL.md) method available.
|
||||||
|
|
||||||
|
## 📕 Basic Usage
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> You will have to run the container on the `host` network and specify `SCAN_SUBNETS` unless you use other [plugin scanners](https://github.com/jokob-sk/NetAlertX/blob/main/docs/PLUGINS.md). The initial scan can take a few minutes, so please wait 5-10 minutes for the initial discovery to finish.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -d --rm --network=host \
|
||||||
|
-v /local_data_dir:/data \
|
||||||
|
-v /etc/localtime:/etc/localtime \
|
||||||
|
--tmpfs /tmp:uid=20211,gid=20211,mode=1700 \
|
||||||
|
-e PORT=20211 \
|
||||||
|
-e APP_CONF_OVERRIDE={"GRAPHQL_PORT":"20214"} \
|
||||||
|
ghcr.io/jokob-sk/netalertx:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
See alternative [docked-compose examples](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DOCKER_COMPOSE.md).
|
||||||
|
|
||||||
|
### Default ports
|
||||||
|
|
||||||
|
| Default | Description | How to override |
|
||||||
|
| :------------- |:-------------------------------| ----------------------------------------------------------------------------------:|
|
||||||
|
| `20211` |Port of the web interface | `-e PORT=20222` |
|
||||||
|
| `20212` |Port of the backend API server | `-e APP_CONF_OVERRIDE={"GRAPHQL_PORT":"20214"}` or via the `GRAPHQL_PORT` Setting |
|
||||||
|
|
||||||
|
### Docker environment variables
|
||||||
|
|
||||||
|
| Variable | Description | Example Value |
|
||||||
|
| :------------- |:------------------------| -----:|
|
||||||
|
| `PORT` |Port of the web interface | `20211` |
|
||||||
|
| `LISTEN_ADDR` |Set the specific IP Address for the listener address for the nginx webserver (web interface). This could be useful when using multiple subnets to hide the web interface from all untrusted networks. | `0.0.0.0` |
|
||||||
|
|`LOADED_PLUGINS` | Default [plugins](https://github.com/jokob-sk/NetAlertX/blob/main/docs/PLUGINS.md) to load. Plugins cannot be loaded with `APP_CONF_OVERRIDE`, you need to use this variable instead and then specify the plugins settings with `APP_CONF_OVERRIDE`. | `["PIHOLE","ASUSWRT"]` |
|
||||||
|
|`APP_CONF_OVERRIDE` | JSON override for settings (except `LOADED_PLUGINS`). | `{"SCAN_SUBNETS":"['192.168.1.0/24 --interface=eth1']","GRAPHQL_PORT":"20212"}` |
|
||||||
|
|`ALWAYS_FRESH_INSTALL` | ⚠ If `true` will delete the content of the `/db` & `/config` folders. For testing purposes. Can be coupled with [watchtower](https://github.com/containrrr/watchtower) to have an always freshly installed `netalertx`/`netalertx-dev` image. | `true` |
|
||||||
|
|
||||||
|
> You can override the default GraphQL port setting `GRAPHQL_PORT` (set to `20212`) by using the `APP_CONF_OVERRIDE` env variable. `LOADED_PLUGINS` and settings in `APP_CONF_OVERRIDE` can be specified via the UI as well.
|
||||||
|
|
||||||
|
### Docker paths
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> See also [Backup strategies](https://github.com/jokob-sk/NetAlertX/blob/main/docs/BACKUPS.md).
|
||||||
|
|
||||||
|
| Required | Path | Description |
|
||||||
|
| :------------- | :------------- | :-------------|
|
||||||
|
| ✅ | `:/data` | Folder which needs to contain a `/db` and `/config` sub-folders. |
|
||||||
|
| ✅ | `/etc/localtime:/etc/localtime:ro` | Ensuring the timezone is the same as on the server. |
|
||||||
|
| | `:/tmp/log` | Logs folder useful for debugging if you have issues setting up the container |
|
||||||
|
| | `:/tmp/api` | The [API endpoint](https://github.com/jokob-sk/NetAlertX/blob/main/docs/API.md) containing static (but regularly updated) json and other files. Path configurable via `NETALERTX_API` environment variable. |
|
||||||
|
| | `:/app/front/plugins/<plugin>/ignore_plugin` | Map a file `ignore_plugin` to ignore a plugin. Plugins can be soft-disabled via settings. More in the [Plugin docs](https://github.com/jokob-sk/NetAlertX/blob/main/docs/PLUGINS.md). |
|
||||||
|
| | `:/etc/resolv.conf` | Use a custom `resolv.conf` file for [better name resolution](https://github.com/jokob-sk/NetAlertX/blob/main/docs/REVERSE_DNS.md). |
|
||||||
|
|
||||||
|
### Folder structure
|
||||||
|
|
||||||
|
Use separate `db` and `config` directories, do not nest them:
|
||||||
|
|
||||||
|
```
|
||||||
|
data
|
||||||
|
├── config
|
||||||
|
└── db
|
||||||
|
```
|
||||||
|
|
||||||
|
### Permissions
|
||||||
|
|
||||||
|
If you are facing permissions issues run the following commands on your server. This will change the owner and assure sufficient access to the database and config files that are stored in the `/local_data_dir/db` and `/local_data_dir/config` folders (replace `local_data_dir` with the location where your `/db` and `/config` folders are located).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo chown -R 20211:20211 /local_data_dir
|
||||||
|
sudo chmod -R a+rwx /local_data_dir
|
||||||
|
```
|
||||||
|
|
||||||
|
### Initial setup
|
||||||
|
|
||||||
|
- If unavailable, the app generates a default `app.conf` and `app.db` file on the first run.
|
||||||
|
- The preferred way is to manage the configuration via the Settings section in the UI, if UI is inaccessible you can modify [app.conf](https://github.com/jokob-sk/NetAlertX/tree/main/back) in the `/data/config/` folder directly
|
||||||
|
|
||||||
|
|
||||||
|
#### Setting up scanners
|
||||||
|
|
||||||
|
You have to specify which network(s) should be scanned. This is done by entering subnets that are accessible from the host. If you use the default `ARPSCAN` plugin, you have to specify at least one valid subnet and interface in the `SCAN_SUBNETS` setting. See the documentation on [How to set up multiple SUBNETS, VLANs and what are limitations](https://github.com/jokob-sk/NetAlertX/blob/main/docs/SUBNETS.md) for troubleshooting and more advanced scenarios.
|
||||||
|
|
||||||
|
If you are running PiHole you can synchronize devices directly. Check the [PiHole configuration guide](https://github.com/jokob-sk/NetAlertX/blob/main/docs/PIHOLE_GUIDE.md) for details.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> You can bulk-import devices via the [CSV import method](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DEVICES_BULK_EDITING.md).
|
||||||
|
|
||||||
|
#### Community guides
|
||||||
|
|
||||||
|
You can read or watch several [community configuration guides](https://github.com/jokob-sk/NetAlertX/blob/main/docs/COMMUNITY_GUIDES.md) in Chinese, Korean, German, or French.
|
||||||
|
|
||||||
|
> Please note these might be outdated. Rely on official documentation first.
|
||||||
|
|
||||||
|
#### Common issues
|
||||||
|
|
||||||
|
- Before creating a new issue, please check if a similar issue was [already resolved](https://github.com/jokob-sk/NetAlertX/issues?q=is%3Aissue+is%3Aclosed).
|
||||||
|
- Check also common issues and [debugging tips](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DEBUG_TIPS.md).
|
||||||
|
|
||||||
|
## 💙 Support me
|
||||||
|
|
||||||
|
| [](https://github.com/sponsors/jokob-sk) | [](https://www.buymeacoffee.com/jokobsk) | [](https://www.patreon.com/user?u=84385063) |
|
||||||
|
| --- | --- | --- |
|
||||||
|
|
||||||
|
- Bitcoin: `1N8tupjeCK12qRVU2XrV17WvKK7LCawyZM`
|
||||||
|
- Ethereum: `0x6e2749Cb42F4411bc98501406BdcD82244e3f9C7`
|
||||||
|
|
||||||
|
> 📧 Email me at [netalertx@gmail.com](mailto:netalertx@gmail.com?subject=NetAlertX Donations) if you want to get in touch or if I should add other sponsorship platforms.
|
||||||
203
docs/DOCKER_MAINTENANCE.md
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
# The NetAlertX Container Operator's Guide
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> ⚠️ **Important:** The docker-compose has recently changed. Carefully read the [Migration guide](https://jokob-sk.github.io/NetAlertX/MIGRATION/?h=migrat#12-migration-from-netalertx-v25524) for detailed instructions.
|
||||||
|
|
||||||
|
This guide assumes you are starting with the official `docker-compose.yml` file provided with the project. We strongly recommend you start with or migrate to this file as your baseline and modify it to suit your specific needs (e.g., changing file paths). While there are many ways to configure NetAlertX, the default file is designed to meet the mandatory security baseline with layer-2 networking capabilities while operating securely and without startup warnings.
|
||||||
|
|
||||||
|
This guide provides direct, concise solutions for common NetAlertX administrative tasks. It is structured to help you identify a problem, implement the solution, and understand the details.
|
||||||
|
|
||||||
|
## Guide Contents
|
||||||
|
|
||||||
|
- Using a Local Folder for Configuration
|
||||||
|
- Migrating from a Local Folder to a Docker Volume
|
||||||
|
- Applying a Custom Nginx Configuration
|
||||||
|
- Mounting Additional Files for Plugins
|
||||||
|
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
>
|
||||||
|
> Other relevant resources
|
||||||
|
> - [Fixing Permission Issues](./FILE_PERMISSIONS.md)
|
||||||
|
> - [Handling Backups](./BACKUPS.md)
|
||||||
|
> - [Accessing Application Logs](./LOGGING.md)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Task: Using a Local Folder for Configuration
|
||||||
|
|
||||||
|
### Problem
|
||||||
|
|
||||||
|
You want to edit your `app.conf` and other configuration files directly from your host machine, instead of using a Docker-managed volume.
|
||||||
|
|
||||||
|
### Solution
|
||||||
|
|
||||||
|
1. Stop the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose down
|
||||||
|
```
|
||||||
|
2. (Optional but Recommended) Back up your data using the method in Part 1.
|
||||||
|
3. Create a local folder on your host machine (e.g., `/data/netalertx_config`).
|
||||||
|
4. Edit `docker-compose.yml`:
|
||||||
|
|
||||||
|
* **Comment out** the `netalertx_config` volume entry.
|
||||||
|
* **Uncomment** and **set the path** for the "Example custom local folder" bind mount entry.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
...
|
||||||
|
volumes:
|
||||||
|
# - type: volume
|
||||||
|
# source: netalertx_config
|
||||||
|
# target: /data/config
|
||||||
|
# read_only: false
|
||||||
|
...
|
||||||
|
# Example custom local folder called /data/netalertx_config
|
||||||
|
- type: bind
|
||||||
|
source: /data/netalertx_config
|
||||||
|
target: /data/config
|
||||||
|
read_only: false
|
||||||
|
...
|
||||||
|
```
|
||||||
|
5. (Optional) Restore your backup.
|
||||||
|
6. Restart the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### About This Method
|
||||||
|
|
||||||
|
This replaces the Docker-managed volume with a "bind mount." This is a direct mapping between a folder on your host computer (`/data/netalertx_config`) and a folder inside the container (`/data/config`), allowing you to edit the files directly.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Task: Migrating from a Local Folder to a Docker Volume
|
||||||
|
|
||||||
|
### Problem
|
||||||
|
|
||||||
|
You are currently using a local folder (bind mount) for your configuration (e.g., `/data/netalertx_config`) and want to switch to the recommended Docker-managed volume (`netalertx_config`).
|
||||||
|
|
||||||
|
### Solution
|
||||||
|
|
||||||
|
1. Stop the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose down
|
||||||
|
```
|
||||||
|
2. Edit `docker-compose.yml`:
|
||||||
|
|
||||||
|
* **Comment out** the bind mount entry for your local folder.
|
||||||
|
* **Uncomment** the `netalertx_config` volume entry.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
...
|
||||||
|
volumes:
|
||||||
|
- type: volume
|
||||||
|
source: netalertx_config
|
||||||
|
target: /data/config
|
||||||
|
read_only: false
|
||||||
|
...
|
||||||
|
# Example custom local folder called /data/netalertx_config
|
||||||
|
# - type: bind
|
||||||
|
# source: /data/netalertx_config
|
||||||
|
# target: /data/config
|
||||||
|
# read_only: false
|
||||||
|
...
|
||||||
|
```
|
||||||
|
3. (Optional) Initialize the volume:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d && docker-compose down
|
||||||
|
```
|
||||||
|
4. Run the migration command (**replace `/data/netalertx_config` with your actual path**):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --rm -v netalertx_config:/config -v /data/netalertx_config:/local-config alpine \
|
||||||
|
sh -c "tar -C /local-config -c . | tar -C /config -x"
|
||||||
|
```
|
||||||
|
5. Restart the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### About This Method
|
||||||
|
|
||||||
|
This uses a temporary `alpine` container that mounts *both* your source folder (`/local-config`) and destination volume (`/config`). The `tar ... | tar ...` command safely copies all files, including hidden ones, preserving structure.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Task: Applying a Custom Nginx Configuration
|
||||||
|
|
||||||
|
### Problem
|
||||||
|
|
||||||
|
You need to override the default Nginx configuration to add features like LDAP, SSO, or custom SSL settings.
|
||||||
|
|
||||||
|
### Solution
|
||||||
|
|
||||||
|
1. Stop the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose down
|
||||||
|
```
|
||||||
|
2. Create your custom config file on your host (e.g., `/data/my-netalertx.conf`).
|
||||||
|
3. Edit `docker-compose.yml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
...
|
||||||
|
# Use a custom Enterprise-configured nginx config for ldap or other settings
|
||||||
|
- /data/my-netalertx.conf:/tmp/nginx/active-config/netalertx.conf:ro
|
||||||
|
...
|
||||||
|
```
|
||||||
|
4. Restart the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
### About This Method
|
||||||
|
|
||||||
|
Docker’s bind mount overlays your host file (`my-netalertx.conf`) on top of the default file inside the container. The container remains read-only, but Nginx reads your file as if it were the default.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Task: Mounting Additional Files for Plugins
|
||||||
|
|
||||||
|
### Problem
|
||||||
|
|
||||||
|
A plugin (like `DHCPLSS`) needs to read a file from your host machine (e.g., `/var/lib/dhcp/dhcpd.leases`).
|
||||||
|
|
||||||
|
### Solution
|
||||||
|
|
||||||
|
1. Stop the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose down
|
||||||
|
```
|
||||||
|
2. Edit `docker-compose.yml` and add a new line under the `volumes:` section:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
...
|
||||||
|
volumes:
|
||||||
|
...
|
||||||
|
# Mount for DHCPLSS plugin
|
||||||
|
- /var/lib/dhcp/dhcpd.leases:/mnt/dhcpd.leases:ro
|
||||||
|
...
|
||||||
|
```
|
||||||
|
3. Restart the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
4. In the NetAlertX web UI, configure the plugin to read from:
|
||||||
|
|
||||||
|
```
|
||||||
|
/mnt/dhcpd.leases
|
||||||
|
```
|
||||||
|
|
||||||
|
### About This Method
|
||||||
|
|
||||||
|
This maps your host file to a new, read-only (`:ro`) location inside the container. The plugin can then safely read this file without exposing anything else on your host filesystem.
|
||||||
|
|
||||||
|
|
||||||
@@ -8,12 +8,12 @@ This guide shows you how to set up **NetAlertX** using Portainer’s **Stacks**
|
|||||||
|
|
||||||
## 1. Prepare Your Host
|
## 1. Prepare Your Host
|
||||||
|
|
||||||
Before deploying, make sure you have a folder on your Docker host for NetAlertX data. Replace `APP_FOLDER` with your preferred location, for example `/opt` here:
|
Before deploying, make sure you have a folder on your Docker host for NetAlertX data. Replace `APP_FOLDER` with your preferred location, for example `/local_data_dir` here:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir -p /opt/netalertx/config
|
mkdir -p /local_data_dir/netalertx/config
|
||||||
mkdir -p /opt/netalertx/db
|
mkdir -p /local_data_dir/netalertx/db
|
||||||
mkdir -p /opt/netalertx/log
|
mkdir -p /local_data_dir/netalertx/log
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -34,32 +34,27 @@ Copy and paste the following YAML into the **Web editor**:
|
|||||||
services:
|
services:
|
||||||
netalertx:
|
netalertx:
|
||||||
container_name: netalertx
|
container_name: netalertx
|
||||||
|
|
||||||
# Use this line for stable release
|
# Use this line for stable release
|
||||||
image: "ghcr.io/jokob-sk/netalertx:latest"
|
image: "ghcr.io/jokob-sk/netalertx:latest"
|
||||||
|
|
||||||
# Or, use this for the latest development build
|
# Or, use this for the latest development build
|
||||||
# image: "ghcr.io/jokob-sk/netalertx-dev:latest"
|
# image: "ghcr.io/jokob-sk/netalertx-dev:latest"
|
||||||
|
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
cap_drop: # Drop all capabilities for enhanced security
|
||||||
|
- ALL
|
||||||
|
cap_add: # Re-add necessary capabilities
|
||||||
|
- NET_RAW
|
||||||
|
- NET_ADMIN
|
||||||
|
- NET_BIND_SERVICE
|
||||||
volumes:
|
volumes:
|
||||||
- ${APP_FOLDER}/netalertx/config:/app/config
|
- ${APP_FOLDER}/netalertx/config:/data/config
|
||||||
- ${APP_FOLDER}/netalertx/db:/app/db
|
- ${APP_FOLDER}/netalertx/db:/data/db
|
||||||
# Optional: logs (useful for debugging setup issues, comment out for performance)
|
# to sync with system time
|
||||||
- ${APP_FOLDER}/netalertx/log:/app/log
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
tmpfs:
|
||||||
# API storage options:
|
# All writable runtime state resides under /tmp; comment out to persist logs between restarts
|
||||||
# (Option 1) tmpfs (default, best performance)
|
- "/tmp:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,async,noatime,nodiratime"
|
||||||
- type: tmpfs
|
|
||||||
target: /app/api
|
|
||||||
|
|
||||||
# (Option 2) bind mount (useful for debugging)
|
|
||||||
# - ${APP_FOLDER}/netalertx/api:/app/api
|
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
- TZ=${TZ}
|
|
||||||
- PORT=${PORT}
|
- PORT=${PORT}
|
||||||
- APP_CONF_OVERRIDE=${APP_CONF_OVERRIDE}
|
- APP_CONF_OVERRIDE=${APP_CONF_OVERRIDE}
|
||||||
```
|
```
|
||||||
@@ -70,14 +65,26 @@ services:
|
|||||||
|
|
||||||
In the **Environment variables** section of Portainer, add the following:
|
In the **Environment variables** section of Portainer, add the following:
|
||||||
|
|
||||||
* `APP_FOLDER=/opt` (or wherever you created the directories in step 1)
|
* `APP_FOLDER=/local_data_dir` (or wherever you created the directories in step 1)
|
||||||
* `TZ=Europe/Berlin` (replace with your timezone)
|
|
||||||
* `PORT=22022` (or another port if needed)
|
* `PORT=22022` (or another port if needed)
|
||||||
* `APP_CONF_OVERRIDE={"GRAPHQL_PORT":"22023"}` (optional advanced settings)
|
* `APP_CONF_OVERRIDE={"GRAPHQL_PORT":"22023"}` (optional advanced settings, otherwise the backend API server PORT defaults to `20212`)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 5. Deploy the Stack
|
## 5. Ensure permissions
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> If you are facing permissions issues run the following commands on your server. This will change the owner and assure sufficient access to the database and config files that are stored in the `/local_data_dir/db` and `/local_data_dir/config` folders (replace `local_data_dir` with the location where your `/db` and `/config` folders are located).
|
||||||
|
>
|
||||||
|
> `sudo chown -R 20211:20211 /local_data_dir`
|
||||||
|
>
|
||||||
|
> `sudo chmod -R a+rwx /local_data_dir`
|
||||||
|
>
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Deploy the Stack
|
||||||
|
|
||||||
1. Scroll down and click **Deploy the stack**.
|
1. Scroll down and click **Deploy the stack**.
|
||||||
2. Portainer will pull the image and start NetAlertX.
|
2. Portainer will pull the image and start NetAlertX.
|
||||||
@@ -89,7 +96,7 @@ http://<your-docker-host-ip>:22022
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 6. Verify and Troubleshoot
|
## 7. Verify and Troubleshoot
|
||||||
|
|
||||||
* Check logs via Portainer → **Containers** → `netalertx` → **Logs**.
|
* Check logs via Portainer → **Containers** → `netalertx` → **Logs**.
|
||||||
* Logs are stored under `${APP_FOLDER}/netalertx/log` if you enabled that volume.
|
* Logs are stored under `${APP_FOLDER}/netalertx/log` if you enabled that volume.
|
||||||
|
|||||||
@@ -41,15 +41,7 @@ Use the following Compose snippet to deploy NetAlertX with a **static LAN IP** a
|
|||||||
services:
|
services:
|
||||||
netalertx:
|
netalertx:
|
||||||
image: ghcr.io/jokob-sk/netalertx:latest
|
image: ghcr.io/jokob-sk/netalertx:latest
|
||||||
ports:
|
...
|
||||||
- 20211:20211
|
|
||||||
volumes:
|
|
||||||
- /mnt/YOUR_SERVER/netalertx/config:/app/config:rw
|
|
||||||
- /mnt/YOUR_SERVER/netalertx/db:/netalertx/app/db:rw
|
|
||||||
- /mnt/YOUR_SERVER/netalertx/logs:/netalertx/app/log:rw
|
|
||||||
environment:
|
|
||||||
- TZ=Europe/London
|
|
||||||
- PORT=20211
|
|
||||||
networks:
|
networks:
|
||||||
swarm-ipvlan:
|
swarm-ipvlan:
|
||||||
ipv4_address: 192.168.1.240 # ⚠️ Choose a free IP from your LAN
|
ipv4_address: 192.168.1.240 # ⚠️ Choose a free IP from your LAN
|
||||||
|
|||||||
@@ -1,23 +1,96 @@
|
|||||||
# Managing File Permissions for NetAlertX on Nginx with Docker
|
# Managing File Permissions for NetAlertX on a Read-Only Container
|
||||||
|
|
||||||
|
Sometimes, permission issues arise if your existing host directories were created by a previous container running as root or another UID. The container will fail to start with "Permission Denied" errors.
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
> If you are facing permission issues, try to start the container without mapping your volumes. If that works, then the issue is permission related. You can try e.g., the following command:
|
> NetAlertX runs in a **secure, read-only Alpine-based container** under a dedicated `netalertx` user (UID 20211, GID 20211). All writable paths are either mounted as **persistent volumes** or **`tmpfs` filesystems**. This ensures consistent file ownership and prevents privilege escalation.
|
||||||
> ```
|
|
||||||
> docker run -d --rm --network=host \
|
|
||||||
> -e TZ=Europe/Berlin \
|
|
||||||
> -e PUID=200 -e PGID=200 \
|
|
||||||
> -e PORT=20211 \
|
|
||||||
> ghcr.io/jokob-sk/netalertx:latest
|
|
||||||
> ```
|
|
||||||
NetAlertX runs on an Nginx web server. On Alpine Linux, Nginx operates as the `nginx` user (if PUID and GID environment variables are not specified, nginx user UID will be set to 102, and its supplementary group `www-data` ID to 82). Consequently, files accessed or written by the NetAlertX application are owned by `nginx:www-data`.
|
|
||||||
|
|
||||||
Upon starting, NetAlertX changes nginx user UID and www-data GID to specified values (or defaults), and the ownership of files on the host system mapped to `/app/config` and `/app/db` in the container to `nginx:www-data`. This ensures that Nginx can access and write to these files. Since the user in the Docker container is mapped to a user on the host system by ID:GID, the files in `/app/config` and `/app/db` on the host system are owned by a user with the same ID and GID (defaults are ID 102 and GID 82). On different systems, this ID:GID may belong to different users, or there may not be a group with ID 82 at all.
|
Try starting the container with all data to be in non-persistent volumes. If this works, the issue might be related to the permissions of your persistent data mount locations on your server.
|
||||||
|
|
||||||
Option to set specific user UID and GID can be useful for host system users needing to access these files (e.g., backup scripts).
|
```bash
|
||||||
|
docker run --rm --network=host \
|
||||||
|
-v /etc/localtime:/etc/localtime:ro \
|
||||||
|
--tmpfs /tmp:uid=20211,gid=20211,mode=1700 \
|
||||||
|
-e PORT=20211 \
|
||||||
|
ghcr.io/jokob-sk/netalertx:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> The above should be only used as a test - once the container restarts, all data is lost.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Writable Paths
|
||||||
|
|
||||||
|
NetAlertX requires certain paths to be writable at runtime. These paths should be mounted either as **host volumes** or **`tmpfs`** in your `docker-compose.yml` or `docker run` command:
|
||||||
|
|
||||||
|
| Path | Purpose | Notes |
|
||||||
|
| ------------------------------------ | ----------------------------------- | ------------------------------------------------------ |
|
||||||
|
| `/data/config` | Application configuration | Persistent volume recommended |
|
||||||
|
| `/data/db` | Database files | Persistent volume recommended |
|
||||||
|
| `/tmp/log` | Logs | Lives under `/tmp`; optional host bind to retain logs |
|
||||||
|
| `/tmp/api` | API cache | Subdirectory of `/tmp` |
|
||||||
|
| `/tmp/nginx/active-config` | Active nginx configuration override | Mount `/tmp` (or override specific file) |
|
||||||
|
| `/tmp/run` | Runtime directories for nginx & PHP | Subdirectory of `/tmp` |
|
||||||
|
| `/tmp` | PHP session save directory | Backed by `tmpfs` for runtime writes |
|
||||||
|
|
||||||
|
> Mounting `/tmp` as `tmpfs` automatically covers all of its subdirectories (`log`, `api`, `run`, `nginx/active-config`, etc.).
|
||||||
|
|
||||||
|
> All these paths will have **UID 20211 / GID 20211** inside the container. Files on the host will appear owned by `20211:20211`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Solution
|
||||||
|
|
||||||
|
1. **Run the container once as root** (`--user "0"`) to allow it to correct permissions automatically:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -it --rm --name netalertx --user "0" \
|
||||||
|
-v /local_data_dir:/data \
|
||||||
|
--tmpfs /tmp:uid=20211,gid=20211,mode=1700 \
|
||||||
|
ghcr.io/jokob-sk/netalertx:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Wait for logs showing **permissions being fixed**. The container will then **hang intentionally**.
|
||||||
|
3. Press **Ctrl+C** to stop the container.
|
||||||
|
4. Start the container normally with your `docker-compose.yml` or `docker run` command.
|
||||||
|
|
||||||
|
> The container startup script detects `root` and runs `chown -R 20211:20211` on all volumes, fixing ownership for the secure `netalertx` user.
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> If you are facing permissions issues run the following commands on your server. This will change the owner and assure sufficient access to the database and config files that are stored in the `/local_data_dir/db` and `/local_data_dir/config` folders (replace `local_data_dir` with the location where your `/db` and `/config` folders are located).
|
||||||
|
>
|
||||||
|
> `sudo chown -R 20211:20211 /local_data_dir`
|
||||||
|
>
|
||||||
|
> `sudo chmod -R a+rwx /local_data_dir`
|
||||||
|
>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Example: docker-compose.yml with `tmpfs`
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
netalertx:
|
||||||
|
container_name: netalertx
|
||||||
|
image: "ghcr.io/jokob-sk/netalertx"
|
||||||
|
network_mode: "host"
|
||||||
|
cap_drop: # Drop all capabilities for enhanced security
|
||||||
|
- ALL
|
||||||
|
cap_add: # Add only the necessary capabilities
|
||||||
|
- NET_ADMIN # Required for ARP scanning
|
||||||
|
- NET_RAW # Required for raw socket operations
|
||||||
|
- NET_BIND_SERVICE # Required to bind to privileged ports (nbtscan)
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /local_data_dir:/data
|
||||||
|
- /etc/localtime:/etc/localtime
|
||||||
|
environment:
|
||||||
|
- PORT=20211
|
||||||
|
tmpfs:
|
||||||
|
- "/tmp:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,async,noatime,nodiratime"
|
||||||
|
```
|
||||||
|
|
||||||
|
> This setup ensures all writable paths are either in `tmpfs` or host-mounted, and the container never writes outside of controlled volumes.
|
||||||
|
|
||||||
### Permissions Table for Individual Folders
|
|
||||||
|
|
||||||
| Folder | User | User ID | Group | Group ID | Permissions | Notes |
|
|
||||||
|----------------|--------|---------|-----------|----------|-------------|---------------------------------------------------------------------|
|
|
||||||
| `/app/config` | nginx | PUID (default 102) | www-data | PGID (default 82) | rwxr-xr-x | Ensure `nginx` can read/write; other users can read if in `www-data` |
|
|
||||||
| `/app/db` | nginx | PUID (default 102) | www-data | PGID (default 82) | rwxr-xr-x | Same as above |
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# NetAlertX Community Helper Scripts Overview
|
# Community Helper Scripts Overview
|
||||||
|
|
||||||
This page provides an overview of community-contributed scripts for NetAlertX. These scripts are not actively maintained and are provided as-is.
|
This page provides an overview of community-contributed scripts for NetAlertX. These scripts are not actively maintained and are provided as-is.
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ To download and install NetAlertX on the hardware/server directly use the `curl`
|
|||||||
> Data loss is a possibility, **it is recommended to install NetAlertX using the supplied Docker image**.
|
> Data loss is a possibility, **it is recommended to install NetAlertX using the supplied Docker image**.
|
||||||
|
|
||||||
> [!WARNING]
|
> [!WARNING]
|
||||||
> A warning to the installation method below: Piping to bash is [controversial](https://pi-hole.net/2016/07/25/curling-and-piping-to-bash) and may
|
> A warning to the installation method below: Piping to bash is [controversial](https://pi-hole.net/2016/07/25/curling-and-piping-to-bash) and may be dangerous, as you cannot see the code that's about to be executed on your system.
|
||||||
be dangerous, as you cannot see the code that's about to be executed on your system.
|
|
||||||
|
|
||||||
If you trust this repo, you can download the install script via one of the methods (curl/wget) below and it will fo its best to install NetAlertX on your system.
|
If you trust this repo, you can download the install script via one of the methods (curl/wget) below and it will fo its best to install NetAlertX on your system.
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
NetAlertX can be installed several ways. The best supported option is Docker, followed by a supervised Home Assistant instance, as an Unraid app, and lastly, on bare metal.
|
NetAlertX can be installed several ways. The best supported option is Docker, followed by a supervised Home Assistant instance, as an Unraid app, and lastly, on bare metal.
|
||||||
|
|
||||||
- [[Installation] Docker (recommended)](https://github.com/jokob-sk/NetAlertX/blob/main/dockerfiles/README.md)
|
- [[Installation] Docker (recommended)](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DOCKER_INSTALLATION.md)
|
||||||
- [[Installation] Home Assistant](https://github.com/alexbelgium/hassio-addons/tree/master/netalertx)
|
- [[Installation] Home Assistant](https://github.com/alexbelgium/hassio-addons/tree/master/netalertx)
|
||||||
- [[Installation] Unraid App](https://unraid.net/community/apps)
|
- [[Installation] Unraid App](https://unraid.net/community/apps)
|
||||||
- [[Installation] Bare metal (experimental - looking for maintainers)](https://github.com/jokob-sk/NetAlertX/blob/main/docs/HW_INSTALL.md)
|
- [[Installation] Bare metal (experimental - looking for maintainers)](https://github.com/jokob-sk/NetAlertX/blob/main/docs/HW_INSTALL.md)
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
# Logging
|
# Logging
|
||||||
|
|
||||||
NetAlertX comes with several logs that help to identify application issues.
|
NetAlertX comes with several logs that help to identify application issues. These include nginx logs, app, or plugin logs. For plugin-specific log debugging, please read the [Debug Plugins](./DEBUG_PLUGINS.md) guide.
|
||||||
|
|
||||||
For plugin-specific log debugging, please read the [Debug Plugins](./DEBUG_PLUGINS.md) guide.
|
|
||||||
|
|
||||||
When debugging any issue, increase the `LOG_LEVEL` Setting as per the [Debug tips](./DEBUG_TIPS.md) documentation.
|
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> When debugging any issue, increase the `LOG_LEVEL` Setting as per the [Debug tips](./DEBUG_TIPS.md) documentation.
|
||||||
|
|
||||||
## Main logs
|
## Main logs
|
||||||
|
|
||||||
You can find most of the logs exposed in the UI under _Maintenance -> Logs_.
|
You can find most of the logs exposed in the UI under _Maintenance -> Logs_.
|
||||||
|
|
||||||
If the UI is inaccessible, you can access them under `/app/log`.
|
If the UI is inaccessible, you can access them under `/tmp/log`.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -24,3 +22,54 @@ If a Plugin supplies data to the main app it's done either vie a SQL query or vi
|
|||||||
The data is in most of the cases then displayed in the application under _Integrations -> Plugins_ (or _Device -> Plugins_ if the plugin is supplying device-specific data).
|
The data is in most of the cases then displayed in the application under _Integrations -> Plugins_ (or _Device -> Plugins_ if the plugin is supplying device-specific data).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## Viewing Logs on the File System
|
||||||
|
|
||||||
|
You cannot find any log files on the filesystem. The container is `read-only` and writes logs to a temporary in-memory filesystem (`tmpfs`) for security and performance. The application follows container best-practices by writing all logs to the standard output (`stdout`) and standard error (`stderr`) streams. Docker's logging driver (set in `docker-compose.yml`) captures this stream automatically, allowing you to access it with the `docker logs <image_name>` command.
|
||||||
|
|
||||||
|
* **To see all logs since the last restart:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker logs netalertx
|
||||||
|
```
|
||||||
|
* **To watch the logs live (live feed):**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker logs -f netalertx
|
||||||
|
```
|
||||||
|
## Enabling Persistent File-Based Logs
|
||||||
|
|
||||||
|
The default logs are erased every time the container restarts because they are stored in temporary in-memory storage (`tmpfs`). If you need to keep a persistent, file-based log history, follow the steps below.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> This might lead to performance degradation so this approach is only suggested when actively debugging issues. See the [Performance optimization](./PERFORMANCE.md) documentation for details.
|
||||||
|
|
||||||
|
1. Stop the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose down
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Edit your `docker-compose.yml` file:
|
||||||
|
|
||||||
|
* **Comment out** the `/tmp/log` line under the `tmpfs:` section.
|
||||||
|
* **Uncomment** the "Retain logs" line under the `volumes:` section and set your desired host path.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
...
|
||||||
|
tmpfs:
|
||||||
|
# - "/tmp/log:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,async,noatime,nodiratime"
|
||||||
|
...
|
||||||
|
volumes:
|
||||||
|
...
|
||||||
|
# Retain logs - comment out tmpfs /tmp/log if you want to retain logs between container restarts
|
||||||
|
- /home/adam/netalertx_logs:/tmp/log
|
||||||
|
...
|
||||||
|
```
|
||||||
|
3. Restart the container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
This change stops Docker from mounting a temporary in-memory volume at `/tmp/log`. Instead, it "bind mounts" a persistent folder from your host computer (e.g., `/data/netalertx_logs`) to that *same location* inside the container.
|
||||||
|
|||||||
@@ -1,32 +1,52 @@
|
|||||||
# Migration form PiAlert to NetAlertX
|
# Migration
|
||||||
|
|
||||||
> [!WARNING]
|
When upgrading from older versions of NetAlertX (or PiAlert by jokob-sk), follow the migration steps below to ensure your data and configuration are properly transferred.
|
||||||
> Follow this guide only after you you downloaded and started a version of NetAlertX prior to v25.6.7 (e.g. `docker pull ghcr.io/jokob-sk/netalertx:25.5.24`) at least once after previously using the PiAlert image. Later versions don't support migration and devices and settings will have to migrated manually, e.g. via [CSV import](./DEVICES_BULK_EDITING.md).
|
|
||||||
|
|
||||||
## STEPS:
|
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
> In short: The application will auto-migrate the database, config, and all device information. A ticker message on top will be displayed until you update your docker mount points. It's always good to have a [backup strategy](./BACKUPS.md) in place.
|
> It's always important to have a [backup strategy](./BACKUPS.md) in place.
|
||||||
|
|
||||||
1. Backup your current config and database (optional `devices.csv` to have a backup) (See bellow tip if facing issues)
|
## Migration scenarios
|
||||||
2. Stop the container
|
|
||||||
2. Update the Docker file mount locations in your `docker-compose.yml` or docker run command (See bellow **New Docker mount locations**).
|
- You are running PiAlert (by jokob-sk)
|
||||||
3. Rename the DB and conf files to `app.db` and `app.conf` and place them in the appropriate location.
|
→ [Read the 1.1 Migration from PiAlert to NetAlertX `v25.5.24`](#11-migration-from-pialert-to-netalertx-v25524)
|
||||||
4. Start the Container
|
|
||||||
|
- You are running NetAlertX (by jokob-sk) `25.5.24` or older
|
||||||
|
→ [Read the 1.2 Migration from NetAlertX `v25.5.24`](#12-migration-from-netalertx-v25524)
|
||||||
|
|
||||||
|
- You are running NetAlertX (by jokob-sk) (`v25.6.7` to `v25.10.1`)
|
||||||
|
→ [Read the 1.3 Migration from NetAlertX `v25.10.1`](#13-migration-from-netalertx-v25101)
|
||||||
|
|
||||||
|
|
||||||
|
### 1.0 Manual Migration
|
||||||
|
|
||||||
|
You can migrate data manually, for example by exporting and importing devices using the [CSV import](./DEVICES_BULK_EDITING.md) method.
|
||||||
|
|
||||||
|
|
||||||
|
### 1.1 Migration from PiAlert to NetAlertX `v25.5.24`
|
||||||
|
|
||||||
|
#### STEPS:
|
||||||
|
|
||||||
|
The application will automatically migrate the database, configuration, and all device information.
|
||||||
|
A banner message will appear at the top of the web UI reminding you to update your Docker mount points.
|
||||||
|
|
||||||
|
1. Stop the container
|
||||||
|
2. [Back up your setup](./BACKUPS.md)
|
||||||
|
3. Update the Docker file mount locations in your `docker-compose.yml` or docker run command (See below **New Docker mount locations**).
|
||||||
|
4. Rename the DB and conf files to `app.db` and `app.conf` and place them in the appropriate location.
|
||||||
|
5. Start the container
|
||||||
|
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
> If you have troubles accessing past backups, config or database files you can copy them into the newly mapped directories, for example by running this command in the container: `cp -r /app/config /home/pi/pialert/config/old_backup_files`. This should create a folder in the `config` directory called `old_backup_files` conatining all the files in that location. Another approach is to map the old location and the new one at the same time to copy things over.
|
> If you have trouble accessing past backups, config or database files you can copy them into the newly mapped directories, for example by running this command in the container: `cp -r /data/config /home/pi/pialert/config/old_backup_files`. This should create a folder in the `config` directory called `old_backup_files` containing all the files in that location. Another approach is to map the old location and the new one at the same time to copy things over.
|
||||||
|
|
||||||
|
#### New Docker mount locations
|
||||||
|
|
||||||
### New Docker mount locations
|
The internal application path in the container has changed from `/home/pi/pialert` to `/app`. Update your volume mounts as follows:
|
||||||
|
|
||||||
The application installation folder in the docker container has changed from `/home/pi/pialert` to `/app`. That means the new mount points are:
|
|
||||||
|
|
||||||
| Old mount point | New mount point |
|
| Old mount point | New mount point |
|
||||||
|----------------------|---------------|
|
|----------------------|---------------|
|
||||||
| `/home/pi/pialert/config` | `/app/config` |
|
| `/home/pi/pialert/config` | `/data/config` |
|
||||||
| `/home/pi/pialert/db` | `/app/db` |
|
| `/home/pi/pialert/db` | `/data/db` |
|
||||||
|
|
||||||
|
|
||||||
If you were mounting files directly, please note the file names have changed:
|
If you were mounting files directly, please note the file names have changed:
|
||||||
@@ -38,16 +58,16 @@ The application installation folder in the docker container has changed from `/h
|
|||||||
|
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> The application uses symlinks linking the old db and config locations to the new ones, so data loss should not occur. [Backup strategies](./BACKUPS.md) are still recommended to backup your setup.
|
> The application automatically creates symlinks from the old database and config locations to the new ones, so data loss should not occur. Read the [backup strategies](./BACKUPS.md) guide to backup your setup.
|
||||||
|
|
||||||
|
|
||||||
# Examples
|
#### Examples
|
||||||
|
|
||||||
Examples of docker files with the new mount points.
|
Examples of docker files with the new mount points.
|
||||||
|
|
||||||
## Example 1: Mapping folders
|
##### Example 1: Mapping folders
|
||||||
|
|
||||||
### Old docker-compose.yml
|
###### Old docker-compose.yml
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
services:
|
services:
|
||||||
@@ -59,43 +79,41 @@ services:
|
|||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- local/path/config:/home/pi/pialert/config
|
- /local_data_dir/config:/home/pi/pialert/config
|
||||||
- local/path/db:/home/pi/pialert/db
|
- /local_data_dir/db:/home/pi/pialert/db
|
||||||
# (optional) useful for debugging if you have issues setting up the container
|
# (optional) useful for debugging if you have issues setting up the container
|
||||||
- local/path/logs:/home/pi/pialert/front/log
|
- /local_data_dir/logs:/home/pi/pialert/front/log
|
||||||
environment:
|
environment:
|
||||||
- TZ=Europe/Berlin
|
- TZ=Europe/Berlin
|
||||||
- PORT=20211
|
- PORT=20211
|
||||||
```
|
```
|
||||||
|
|
||||||
### New docker-compose.yml
|
###### New docker-compose.yml
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
services:
|
services:
|
||||||
netalertx: # ⚠ This has changed (🟡optional)
|
netalertx: # 🆕 This has changed
|
||||||
container_name: netalertx # ⚠ This has changed (🟡optional)
|
container_name: netalertx # 🆕 This has changed
|
||||||
# use the below line if you want to test the latest dev image
|
image: "ghcr.io/jokob-sk/netalertx:25.5.24" # 🆕 This has changed
|
||||||
# image: "ghcr.io/jokob-sk/netalertx-dev:latest"
|
|
||||||
image: "ghcr.io/jokob-sk/netalertx:latest" # ⚠ This has changed (🟡optional/🔺required in future)
|
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- local/path/config:/app/config # ⚠ This has changed (🔺required)
|
- /local_data_dir/config:/data/config # 🆕 This has changed
|
||||||
- local/path/db:/app/db # ⚠ This has changed (🔺required)
|
- /local_data_dir/db:/data/db # 🆕 This has changed
|
||||||
# (optional) useful for debugging if you have issues setting up the container
|
# (optional) useful for debugging if you have issues setting up the container
|
||||||
- local/path/logs:/app/log # ⚠ This has changed (🟡optional)
|
- /local_data_dir/logs:/tmp/log # 🆕 This has changed
|
||||||
environment:
|
environment:
|
||||||
- TZ=Europe/Berlin
|
- TZ=Europe/Berlin
|
||||||
- PORT=20211
|
- PORT=20211
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Example 2: Mapping files
|
##### Example 2: Mapping files
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> The recommendation is to map folders as in Example 1, map files directly only when needed.
|
> The recommendation is to map folders as in Example 1, map files directly only when needed.
|
||||||
|
|
||||||
### Old docker-compose.yml
|
###### Old docker-compose.yml
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
services:
|
services:
|
||||||
@@ -107,32 +125,177 @@ services:
|
|||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- local/path/config/pialert.conf:/home/pi/pialert/config/pialert.conf
|
- /local_data_dir/config/pialert.conf:/home/pi/pialert/config/pialert.conf
|
||||||
- local/path/db/pialert.db:/home/pi/pialert/db/pialert.db
|
- /local_data_dir/db/pialert.db:/home/pi/pialert/db/pialert.db
|
||||||
# (optional) useful for debugging if you have issues setting up the container
|
# (optional) useful for debugging if you have issues setting up the container
|
||||||
- local/path/logs:/home/pi/pialert/front/log
|
- /local_data_dir/logs:/home/pi/pialert/front/log
|
||||||
environment:
|
environment:
|
||||||
- TZ=Europe/Berlin
|
- TZ=Europe/Berlin
|
||||||
- PORT=20211
|
- PORT=20211
|
||||||
```
|
```
|
||||||
|
|
||||||
### New docker-compose.yml
|
###### New docker-compose.yml
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
services:
|
services:
|
||||||
netalertx: # ⚠ This has changed (🟡optional)
|
netalertx: # 🆕 This has changed
|
||||||
container_name: netalertx # ⚠ This has changed (🟡optional)
|
container_name: netalertx # 🆕 This has changed
|
||||||
# use the below line if you want to test the latest dev image
|
image: "ghcr.io/jokob-sk/netalertx:25.5.24" # 🆕 This has changed
|
||||||
# image: "ghcr.io/jokob-sk/netalertx-dev:latest"
|
|
||||||
image: "ghcr.io/jokob-sk/netalertx:latest" # ⚠ This has changed (🟡optional/🔺required in future)
|
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- local/path/config/app.conf:/app/config/app.conf # ⚠ This has changed (🔺required)
|
- /local_data_dir/config/app.conf:/data/config/app.conf # 🆕 This has changed
|
||||||
- local/path/db/app.db:/app/db/app.db # ⚠ This has changed (🔺required)
|
- /local_data_dir/db/app.db:/data/db/app.db # 🆕 This has changed
|
||||||
# (optional) useful for debugging if you have issues setting up the container
|
# (optional) useful for debugging if you have issues setting up the container
|
||||||
- local/path/logs:/app/log # ⚠ This has changed (🟡optional)
|
- /local_data_dir/logs:/tmp/log # 🆕 This has changed
|
||||||
environment:
|
environment:
|
||||||
- TZ=Europe/Berlin
|
- TZ=Europe/Berlin
|
||||||
- PORT=20211
|
- PORT=20211
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### 1.2 Migration from NetAlertX `v25.5.24`
|
||||||
|
|
||||||
|
Versions before `v25.10.1` require an intermediate migration through `v25.5.24` to ensure database compatibility. Skipping this step may cause compatibility issues due to database schema changes introduced after `v25.5.24`.
|
||||||
|
|
||||||
|
#### STEPS:
|
||||||
|
|
||||||
|
1. Stop the container
|
||||||
|
2. [Back up your setup](./BACKUPS.md)
|
||||||
|
3. Upgrade to `v25.5.24` by pinning the release version (See Examples below)
|
||||||
|
4. Start the container and verify everything works as expected.
|
||||||
|
5. Stop the container
|
||||||
|
6. Upgrade to `v25.10.1` by pinning the release version (See Examples below)
|
||||||
|
7. Start the container and verify everything works as expected.
|
||||||
|
|
||||||
|
#### Examples
|
||||||
|
|
||||||
|
Examples of docker files with the tagged version.
|
||||||
|
|
||||||
|
##### Example 1: Mapping folders
|
||||||
|
|
||||||
|
###### docker-compose.yml changes
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
netalertx:
|
||||||
|
container_name: netalertx
|
||||||
|
image: "ghcr.io/jokob-sk/netalertx:25.5.24" # 🆕 This is important
|
||||||
|
network_mode: "host"
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /local_data_dir/config:/data/config
|
||||||
|
- /local_data_dir/db:/data/db
|
||||||
|
# (optional) useful for debugging if you have issues setting up the container
|
||||||
|
- /local_data_dir/logs:/tmp/log
|
||||||
|
environment:
|
||||||
|
- TZ=Europe/Berlin
|
||||||
|
- PORT=20211
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
netalertx:
|
||||||
|
container_name: netalertx
|
||||||
|
image: "ghcr.io/jokob-sk/netalertx:25.10.1" # 🆕 This is important
|
||||||
|
network_mode: "host"
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /local_data_dir/config:/data/config
|
||||||
|
- /local_data_dir/db:/data/db
|
||||||
|
# (optional) useful for debugging if you have issues setting up the container
|
||||||
|
- /local_data_dir/logs:/tmp/log
|
||||||
|
environment:
|
||||||
|
- TZ=Europe/Berlin
|
||||||
|
- PORT=20211
|
||||||
|
```
|
||||||
|
|
||||||
|
### 1.3 Migration from NetAlertX `v25.10.1`
|
||||||
|
|
||||||
|
Starting from v25.10.1, the container uses a [more secure, read-only runtime environment](./SECURITY_FEATURES.md), which requires all writable paths (e.g., logs, API cache, temporary data) to be mounted as `tmpfs` or permanent writable volumes, with sufficient access [permissions](./FILE_PERMISSIONS.md). The data location has also hanged from `/app/db` and `/app/config` to `/data/db` and `/data/config`. See detailed steps below.
|
||||||
|
|
||||||
|
#### STEPS:
|
||||||
|
|
||||||
|
1. Stop the container
|
||||||
|
2. [Back up your setup](./BACKUPS.md)
|
||||||
|
3. Upgrade to `v25.10.1` by pinning the release version (See the example below)
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
netalertx:
|
||||||
|
container_name: netalertx
|
||||||
|
image: "ghcr.io/jokob-sk/netalertx:25.10.1" # 🆕 This is important
|
||||||
|
network_mode: "host"
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /local_data_dir/config:/app/config
|
||||||
|
- /local_data_dir/db:/app/db
|
||||||
|
# (optional) useful for debugging if you have issues setting up the container
|
||||||
|
- /local_data_dir/logs:/tmp/log
|
||||||
|
environment:
|
||||||
|
- TZ=Europe/Berlin
|
||||||
|
- PORT=20211
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Start the container and verify everything works as expected.
|
||||||
|
5. Stop the container.
|
||||||
|
6. Update the `docker-compose.yml` as per example below.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
netalertx:
|
||||||
|
container_name: netalertx
|
||||||
|
image: "ghcr.io/jokob-sk/netalertx" # 🆕 This has changed
|
||||||
|
network_mode: "host"
|
||||||
|
cap_drop: # 🆕 New line
|
||||||
|
- ALL # 🆕 New line
|
||||||
|
cap_add: # 🆕 New line
|
||||||
|
- NET_RAW # 🆕 New line
|
||||||
|
- NET_ADMIN # 🆕 New line
|
||||||
|
- NET_BIND_SERVICE # 🆕 New line
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /local_data_dir:/data # 🆕 This folder contains your /db and /config directories and the parent changed from /app to /data
|
||||||
|
# Ensuring the timezone is the same as on the server - make sure also the TIMEZONE setting is configured
|
||||||
|
- /etc/localtime:/etc/localtime:ro # 🆕 New line
|
||||||
|
environment:
|
||||||
|
- PORT=20211
|
||||||
|
# 🆕 New "tmpfs" section START 🔽
|
||||||
|
tmpfs:
|
||||||
|
# All writable runtime state resides under /tmp; comment out to persist logs between restarts
|
||||||
|
- "/tmp:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,async,noatime,nodiratime"
|
||||||
|
# 🆕 New "tmpfs" section END 🔼
|
||||||
|
```
|
||||||
|
7. Perform a one-off migration to the latest `netalertx` image and `20211` user.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> The examples below assumes your `/config` and `/db` folders are stored in `local_data_dir`.
|
||||||
|
> Replace this path with your actual configuration directory. `netalertx` is the container name, which might differ from your setup.
|
||||||
|
|
||||||
|
**Automated approach**:
|
||||||
|
|
||||||
|
Run the container with the `--user "0"` parameter. Please note, some systems will require the manual approach below.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run -it --rm --name netalertx --user "0" \
|
||||||
|
-v /local_data_dir/config:/app/config \
|
||||||
|
-v /local_data_dir/db:/app/db \
|
||||||
|
-v /local_data_dir:/data \
|
||||||
|
--tmpfs /tmp:uid=20211,gid=20211,mode=1700 \
|
||||||
|
ghcr.io/jokob-sk/netalertx:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Stop the container and run it as you would normally.
|
||||||
|
|
||||||
|
**Manual approach**:
|
||||||
|
|
||||||
|
Use the manual approach if the Automated approach fails. Execute the below commands:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo chown -R 20211:20211 /local_data_dir
|
||||||
|
sudo chmod -R a+rwx /local_data_dir
|
||||||
|
```
|
||||||
|
|
||||||
|
8. Start the container and verify everything works as expeexpected.
|
||||||
|
9. Check the [Permissions -> Writable-paths](https://jokob-sk.github.io/NetAlertX/FILE_PERMISSIONS/#writable-paths) what directories to mount if you'd like to access the API or log files.
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ Let’s walk through setting up a device named `raspberrypi` to act as a network
|
|||||||
|
|
||||||
- Optionally assign a **Parent Node** (where this device connects to) and the **Relationship type** of the connection.
|
- Optionally assign a **Parent Node** (where this device connects to) and the **Relationship type** of the connection.
|
||||||
The `nic` relationship type can affect parent notifications — see the setting description and [Notifications documentation](./NOTIFICATIONS.md) for more.
|
The `nic` relationship type can affect parent notifications — see the setting description and [Notifications documentation](./NOTIFICATIONS.md) for more.
|
||||||
|
- A device’s parent MAC will be overwritten by plugins if its current value is any of the following: "null", "(unknown)" "(Unknown)".
|
||||||
|
- If you want plugins to be able to overwrite the parent value (for example, when mixing plugins that do not provide parent MACs like `ARPSCAN` with those that do, like `UNIFIAPI`), you must set the setting `NEWDEV_devParentMAC` to None.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -44,10 +44,13 @@ In Notification Processing settings, you can specify blanket rules. These allow
|
|||||||
|
|
||||||
1. Notify on (`NTFPRCS_INCLUDED_SECTIONS`) allows you to specify which events trigger notifications. Usual setups will have `new_devices`, `down_devices`, and possibly `down_reconnected` set. Including `plugin` (dependenton the Plugin `<plugin>_WATCH` and `<plugin>_REPORT_ON` settings) and `events` (dependent on the on-device **Alert Events** setting) might be too noisy for most setups. More info in the [NTFPRCS plugin](https://github.com/jokob-sk/NetAlertX/blob/main/front/plugins/notification_processing/README.md) on what events these selections include.
|
1. Notify on (`NTFPRCS_INCLUDED_SECTIONS`) allows you to specify which events trigger notifications. Usual setups will have `new_devices`, `down_devices`, and possibly `down_reconnected` set. Including `plugin` (dependenton the Plugin `<plugin>_WATCH` and `<plugin>_REPORT_ON` settings) and `events` (dependent on the on-device **Alert Events** setting) might be too noisy for most setups. More info in the [NTFPRCS plugin](https://github.com/jokob-sk/NetAlertX/blob/main/front/plugins/notification_processing/README.md) on what events these selections include.
|
||||||
2. Alert down after (`NTFPRCS_alert_down_time`) is useful if you want to wait for some time before the system sends out a down notification for a device. This is related to the on-device **Alert down** setting and only devices with this checked will trigger a down notification.
|
2. Alert down after (`NTFPRCS_alert_down_time`) is useful if you want to wait for some time before the system sends out a down notification for a device. This is related to the on-device **Alert down** setting and only devices with this checked will trigger a down notification.
|
||||||
3. A filter to allow you to set device-specific exceptions to New devices being added to the app.
|
|
||||||
4. A filter to allow you to set device-specific exceptions to generated Events.
|
|
||||||
|
|
||||||
## Ignoring devices 🔕
|
You can filter out unwanted notifications globally. This could be because of a misbehaving device (GoogleNest/GoogleHub (See also [ARPSAN docs and the `--exclude-broadcast` flag](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/arp_scan#ip-flipping-on-google-nest-devices))) which flips between IP addresses, or because you want to ignore new device notifications of a certain pattern.
|
||||||
|
|
||||||
|
1. Events Filter (`NTFPRCS_event_condition`) - Filter out Events from notifications.
|
||||||
|
2. New Devices Filter (`NTFPRCS_new_dev_condition`) - Filter out New Devices from notifications, but log and keep a new device in the system.
|
||||||
|
|
||||||
|
## Ignoring devices 💻
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -55,3 +58,5 @@ You can completely ignore detected devices globally. This could be because your
|
|||||||
|
|
||||||
1. Ignored MACs (`NEWDEV_ignored_MACs`) - List of MACs to ignore.
|
1. Ignored MACs (`NEWDEV_ignored_MACs`) - List of MACs to ignore.
|
||||||
2. Ignored IPs (`NEWDEV_ignored_IPs`) - List of IPs to ignore.
|
2. Ignored IPs (`NEWDEV_ignored_IPs`) - List of IPs to ignore.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,47 +1,50 @@
|
|||||||
# Performance Optimization Guide
|
# Performance Optimization Guide
|
||||||
|
|
||||||
There are several ways to improve the application's performance. The application has been tested on a range of devices, from a Raspberry Pi 4 to NAS and NUC systems. If you are running the application on a lower-end device, carefully fine-tune the performance settings to ensure an optimal user experience.
|
There are several ways to improve the application's performance. The application has been tested on a range of devices, from Raspberry Pi 4 units to NAS and NUC systems. If you are running the application on a lower-end device, fine-tuning the performance settings can significantly improve the user experience.
|
||||||
|
|
||||||
## Common Causes of Slowness
|
## Common Causes of Slowness
|
||||||
|
|
||||||
Performance issues are usually caused by:
|
Performance issues are usually caused by:
|
||||||
|
|
||||||
- **Incorrect settings** – The app may restart unexpectedly. Check `app.log` under **Maintenance → Logs** for details.
|
* **Incorrect settings** – The app may restart unexpectedly. Check `app.log` under **Maintenance → Logs** for details.
|
||||||
- **Too many background processes** – Disable unnecessary scanners.
|
* **Too many background processes** – Disable unnecessary scanners.
|
||||||
- **Long scan durations** – Limit the number of scanned devices.
|
* **Long scan durations** – Limit the number of scanned devices.
|
||||||
- **Excessive disk operations** – Optimize scanning and logging settings.
|
* **Excessive disk operations** – Optimize scanning and logging settings.
|
||||||
- **Failed maintenance plugins** – Ensure maintenance tasks are running properly.
|
* **Maintenance plugin failures** – If cleanup tasks fail, performance can degrade over time.
|
||||||
|
|
||||||
The application performs regular maintenance and database cleanup. If these tasks fail, performance may degrade.
|
The application performs regular maintenance and database cleanup. If these tasks are failing, you will see slowdowns.
|
||||||
|
|
||||||
### Database and Log File Size
|
### Database and Log File Size
|
||||||
|
|
||||||
A large database or oversized log files can slow down performance. You can check database and table sizes on the **Maintenance** page.
|
A large database or oversized log files can impact performance. You can check database and table sizes on the **Maintenance** page.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> - For **~100 devices**, the database should be around **50MB**.
|
>
|
||||||
> - No table should exceed **10,000 rows** in a healthy system.
|
> * For **~100 devices**, the database should be around **50 MB**.
|
||||||
> - These numbers vary based on network activity and settings.
|
> * No table should exceed **10,000 rows** in a healthy system.
|
||||||
|
> * Actual values vary based on network activity and plugin settings.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Maintenance Plugins
|
## Maintenance Plugins
|
||||||
|
|
||||||
Two plugins help maintain the application’s performance:
|
Two plugins help maintain the system’s performance:
|
||||||
|
|
||||||
### **1. Database Cleanup (DBCLNP)**
|
### **1. Database Cleanup (DBCLNP)**
|
||||||
- Responsible for database maintenance.
|
|
||||||
- Check settings in the [DB Cleanup Plugin Docs](/front/plugins/db_cleanup/README.md).
|
* Handles database maintenance and cleanup.
|
||||||
- Ensure it’s not failing by checking logs.
|
* See the [DB Cleanup Plugin Docs](/front/plugins/db_cleanup/README.md).
|
||||||
- Adjust the schedule (`DBCLNP_RUN_SCHD`) and timeout (`DBCLNP_RUN_TIMEOUT`) if needed.
|
* Ensure it’s not failing by checking logs.
|
||||||
|
* Adjust the schedule (`DBCLNP_RUN_SCHD`) and timeout (`DBCLNP_RUN_TIMEOUT`) if necessary.
|
||||||
|
|
||||||
### **2. Maintenance (MAINT)**
|
### **2. Maintenance (MAINT)**
|
||||||
- Handles log cleanup and other maintenance tasks.
|
|
||||||
- Check settings in the [Maintenance Plugin Docs](/front/plugins/maintenance/README.md).
|
* Cleans logs and performs general maintenance tasks.
|
||||||
- Ensure it’s running correctly by checking logs.
|
* See the [Maintenance Plugin Docs](/front/plugins/maintenance/README.md).
|
||||||
- Adjust the schedule (`MAINT_RUN_SCHD`) and timeout (`MAINT_RUN_TIMEOUT`) if needed.
|
* Verify proper operation via logs.
|
||||||
|
* Adjust the schedule (`MAINT_RUN_SCHD`) and timeout (`MAINT_RUN_TIMEOUT`) if needed.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -50,47 +53,56 @@ Two plugins help maintain the application’s performance:
|
|||||||
Frequent scans increase resource usage, network traffic, and database read/write cycles.
|
Frequent scans increase resource usage, network traffic, and database read/write cycles.
|
||||||
|
|
||||||
### **Optimizations**
|
### **Optimizations**
|
||||||
- **Increase scan intervals** (`<PLUGIN>_RUN_SCHD`) on busy networks or low-end hardware.
|
|
||||||
- **Extend scan timeouts** (`<PLUGIN>_RUN_TIMEOUT`) to prevent failures.
|
|
||||||
- **Reduce the subnet size** – e.g., from `/16` to `/24` to lower scan loads.
|
|
||||||
|
|
||||||
Some plugins have additional options to limit the number of scanned devices. If certain plugins take too long to complete, check if you can optimize scan times by selecting a scan range.
|
* **Increase scan intervals** (`<PLUGIN>_RUN_SCHD`) on busy networks or low-end hardware.
|
||||||
|
* **Increase timeouts** (`<PLUGIN>_RUN_TIMEOUT`) to avoid plugin failures.
|
||||||
|
* **Reduce subnet size** – e.g., use `/24` instead of `/16` to reduce scan load.
|
||||||
|
|
||||||
For example, the **ICMP plugin** allows you to specify a regular expression to scan only IPs that match a specific pattern.
|
Some plugins also include options to limit which devices are scanned. If certain plugins consistently run long, consider narrowing their scope.
|
||||||
|
|
||||||
|
For example, the **ICMP plugin** allows scanning only IPs that match a specific regular expression.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Storing Temporary Files in Memory
|
## Storing Temporary Files in Memory
|
||||||
|
|
||||||
On systems with slower I/O speeds, you can optimize performance by storing temporary files in memory. This primarily applies to the `/app/api` and `/app/log` folders.
|
On devices with slower I/O, you can improve performance by storing temporary files (and optionally the database) in memory using `tmpfs`.
|
||||||
|
|
||||||
Using `tmpfs` reduces disk writes and improves performance. However, it should be **disabled** if persistent logs or API data storage are required.
|
> [!WARNING]
|
||||||
|
> Storing the **database** in `tmpfs` is generally discouraged. Use this only if device data and historical records are not required to persist. If needed, you can pair this setup with the `SYNC` plugin to store important persistent data on another node. See the [Plugins docs](./PLUGINS.md) for details.
|
||||||
|
|
||||||
Below is an optimized `docker-compose.yml` snippet:
|
Using `tmpfs` reduces disk writes and speeds up I/O, but **all data stored in memory will be lost on restart**.
|
||||||
|
|
||||||
|
Below is an optimized `docker-compose.yml` snippet using non-persistent logs, API data, and DB:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: "3"
|
|
||||||
services:
|
services:
|
||||||
netalertx:
|
netalertx:
|
||||||
container_name: netalertx
|
container_name: netalertx
|
||||||
# Uncomment the line below to test the latest dev image
|
# Use this line for the stable release
|
||||||
# image: "ghcr.io/jokob-sk/netalertx-dev:latest"
|
|
||||||
image: "ghcr.io/jokob-sk/netalertx:latest"
|
image: "ghcr.io/jokob-sk/netalertx:latest"
|
||||||
|
# Or use this line for the latest development build
|
||||||
|
# image: "ghcr.io/jokob-sk/netalertx-dev:latest"
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
|
||||||
- local/path/config:/app/config
|
|
||||||
- local/path/db:/app/db
|
|
||||||
# (Optional) Useful for debugging setup issues
|
|
||||||
- local/path/logs:/app/log
|
|
||||||
# (API: OPTION 1) Store temporary files in memory (recommended for performance)
|
|
||||||
- type: tmpfs # ◀ 🔺
|
|
||||||
target: /app/api # ◀ 🔺
|
|
||||||
# (API: OPTION 2) Store API data on disk (useful for debugging)
|
|
||||||
# - local/path/api:/app/api
|
|
||||||
environment:
|
|
||||||
- TZ=Europe/Berlin
|
|
||||||
- PORT=20211
|
|
||||||
|
|
||||||
|
cap_drop: # Drop all capabilities for enhanced security
|
||||||
|
- ALL
|
||||||
|
cap_add: # Re-add necessary capabilities
|
||||||
|
- NET_RAW
|
||||||
|
- NET_ADMIN
|
||||||
|
- NET_BIND_SERVICE
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- ${APP_FOLDER}/netalertx/config:/data/config
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
|
||||||
|
tmpfs:
|
||||||
|
# All writable runtime state resides under /tmp; comment out to persist logs between restarts
|
||||||
|
- "/tmp:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,async,noatime,nodiratime"
|
||||||
|
- "/data/db:uid=20211,gid=20211,mode=1700" # ⚠ You will lose historical data on restart
|
||||||
|
|
||||||
|
environment:
|
||||||
|
- PORT=${PORT}
|
||||||
|
- APP_CONF_OVERRIDE=${APP_CONF_OVERRIDE}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,8 +1,29 @@
|
|||||||
# Integration with PiHole
|
# Integration with PiHole
|
||||||
|
|
||||||
NetAlertX comes with 2 plugins suitable for integarting with your existing PiHole instace. One plugin is using a direct SQLite DB connection, the other leverages the DHCP.leases file generated by PiHole. You can combine both approaches and also supplement it with other [plugins](/docs/PLUGINS.md).
|
NetAlertX comes with 3 plugins suitable for integrating with your existing PiHole instance. The first plugin uses the v6 API, the second plugin is using a direct SQLite DB connection, the other leverages the `DHCP.leases` file generated by PiHole. You can combine multiple approaches and also supplement scans with other [plugins](/docs/PLUGINS.md).
|
||||||
|
|
||||||
## Approach 1: `DHCPLSS` Plugin - Import devices from the PiHole DHCP leases file
|
## Approach 1: `PIHOLEAPI` Plugin - Import devices directly from PiHole v6 API
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
To use this approach make sure the Web UI password in **Pi-hole** is set.
|
||||||
|
|
||||||
|
| Setting | Description | Recommended value |
|
||||||
|
| :------------- | :------------- | :-------------|
|
||||||
|
| `PIHOLEAPI_URL` | Your Pi-hole base URL including port. | `http://192.168.1.82:9880/` |
|
||||||
|
| `PIHOLEAPI_RUN_SCHD` | If you run multiple device scanner plugins, align the schedules of all plugins to the same value. | `*/5 * * * *` |
|
||||||
|
| `PIHOLEAPI_PASSWORD` | The Web UI base64 encoded (en-/decoding handled by the app) admin password. | `passw0rd` |
|
||||||
|
| `PIHOLEAPI_SSL_VERIFY` | Whether to verify HTTPS certificates. Disable only for self-signed certificates. | `False` |
|
||||||
|
| `PIHOLEAPI_API_MAXCLIENTS` | Maximum number of devices to request from Pi-hole. Defaults are usually fine. | `500` |
|
||||||
|
| `PIHOLEAPI_FAKE_MAC` | Generate FAKE MAC from IP. | `False` |
|
||||||
|
|
||||||
|
Check the [PiHole API plugin readme](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/pihole_api_scan/) for details and troubleshooting.
|
||||||
|
|
||||||
|
### docker-compose changes
|
||||||
|
|
||||||
|
No changes needed
|
||||||
|
|
||||||
|
## Approach 2: `DHCPLSS` Plugin - Import devices from the PiHole DHCP leases file
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -23,7 +44,7 @@ Check the [DHCPLSS plugin readme](https://github.com/jokob-sk/NetAlertX/tree/mai
|
|||||||
| `:/etc/pihole/dhcp.leases` | PiHole's `dhcp.leases` file. Required if you want to use PiHole `dhcp.leases` file. This has to be matched with a corresponding `DHCPLSS_paths_to_check` setting entry (the path in the container must contain `pihole`) |
|
| `:/etc/pihole/dhcp.leases` | PiHole's `dhcp.leases` file. Required if you want to use PiHole `dhcp.leases` file. This has to be matched with a corresponding `DHCPLSS_paths_to_check` setting entry (the path in the container must contain `pihole`) |
|
||||||
|
|
||||||
|
|
||||||
## Approach 2: `PIHOLE` Plugin - Import devices directly from the PiHole database
|
## Approach 3: `PIHOLE` Plugin - Import devices directly from the PiHole database
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ Device-detecting plugins insert values into the `CurrentScan` database table. T
|
|||||||
| `LUCIRPC` | [luci_import](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/luci_import/) | 🔍 | Import connected devices from OpenWRT | | |
|
| `LUCIRPC` | [luci_import](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/luci_import/) | 🔍 | Import connected devices from OpenWRT | | |
|
||||||
| `MAINT` | [maintenance](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/maintenance/) | ⚙ | Maintenance of logs, etc. | | |
|
| `MAINT` | [maintenance](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/maintenance/) | ⚙ | Maintenance of logs, etc. | | |
|
||||||
| `MQTT` | [_publisher_mqtt](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/_publisher_mqtt/) | ▶️ | MQTT for synching to Home Assistant | | |
|
| `MQTT` | [_publisher_mqtt](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/_publisher_mqtt/) | ▶️ | MQTT for synching to Home Assistant | | |
|
||||||
|
| `MTSCAN` | [mikrotik_scan](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/mikrotik_scan/) | 🔍 | Mikrotik device import & sync | | |
|
||||||
| `NBTSCAN` | [nbtscan_scan](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/nbtscan_scan/) | 🆎 | Nbtscan (NetBIOS-based) name resolution | | |
|
| `NBTSCAN` | [nbtscan_scan](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/nbtscan_scan/) | 🆎 | Nbtscan (NetBIOS-based) name resolution | | |
|
||||||
| `NEWDEV` | [newdev_template](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/newdev_template/) | ⚙ | New device template | | Yes |
|
| `NEWDEV` | [newdev_template](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/newdev_template/) | ⚙ | New device template | | Yes |
|
||||||
| `NMAP` | [nmap_scan](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/nmap_scan/) | ♻ | Nmap port scanning & discovery | | |
|
| `NMAP` | [nmap_scan](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/nmap_scan/) | ♻ | Nmap port scanning & discovery | | |
|
||||||
@@ -74,6 +75,7 @@ Device-detecting plugins insert values into the `CurrentScan` database table. T
|
|||||||
| `OMDSDN` | [omada_sdn_imp](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/omada_sdn_imp/) | 📥/🆎 ❌ | UNMAINTAINED use `OMDSDNOPENAPI` | 🖧 🔄 | |
|
| `OMDSDN` | [omada_sdn_imp](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/omada_sdn_imp/) | 📥/🆎 ❌ | UNMAINTAINED use `OMDSDNOPENAPI` | 🖧 🔄 | |
|
||||||
| `OMDSDNOPENAPI` | [omada_sdn_openapi](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/omada_sdn_openapi/) | 📥/🆎 | OMADA TP-Link import via OpenAPI | 🖧 | |
|
| `OMDSDNOPENAPI` | [omada_sdn_openapi](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/omada_sdn_openapi/) | 📥/🆎 | OMADA TP-Link import via OpenAPI | 🖧 | |
|
||||||
| `PIHOLE` | [pihole_scan](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/pihole_scan/) | 🔍/🆎/📥 | Pi-hole device import & sync | | |
|
| `PIHOLE` | [pihole_scan](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/pihole_scan/) | 🔍/🆎/📥 | Pi-hole device import & sync | | |
|
||||||
|
| `PIHOLEAPI` | [pihole_api_scan](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/pihole_api_scan/) | 🔍/🆎/📥 | Pi-hole device import & sync via API v6+ | | |
|
||||||
| `PUSHSAFER` | [_publisher_pushsafer](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/_publisher_pushsafer/) | ▶️ | Pushsafer notifications | | |
|
| `PUSHSAFER` | [_publisher_pushsafer](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/_publisher_pushsafer/) | ▶️ | Pushsafer notifications | | |
|
||||||
| `PUSHOVER` | [_publisher_pushover](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/_publisher_pushover/) | ▶️ | Pushover notifications | | |
|
| `PUSHOVER` | [_publisher_pushover](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/_publisher_pushover/) | ▶️ | Pushover notifications | | |
|
||||||
| `SETPWD` | [set_password](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/set_password/) | ⚙ | Set password | | Yes |
|
| `SETPWD` | [set_password](https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/set_password/) | ⚙ | Set password | | Yes |
|
||||||
|
|||||||
@@ -1,146 +1,192 @@
|
|||||||
## config.json Lifecycle in NetAlertX
|
# Plugins Implementation Details
|
||||||
|
|
||||||
This document describes on a high level how `config.json` is read, processed, and used by the NetAlertX core and plugins. It also outlines the plugin output contract and the main plugin types.
|
Plugins provide data to the NetAlertX core, which processes it to detect changes, discover new devices, raise alerts, and apply heuristics.
|
||||||
|
|
||||||
> [!NOTE]
|
---
|
||||||
> For a deep-dive on the specific configuration options and sections of the `config.json` plugin manifest, consult the [Plugins Development Guide](PLUGINS_DEV.md).
|
|
||||||
|
## Overview: Plugin Data Flow
|
||||||
|
|
||||||
|
1. Each plugin runs on a defined schedule.
|
||||||
|
2. Aligning all plugin schedules is recommended so they execute in the same loop.
|
||||||
|
3. During execution, all plugins write their collected data into the **`CurrentScan`** table.
|
||||||
|
4. After all plugins complete, the `CurrentScan` table is evaluated to detect **new devices**, **changes**, and **triggers**.
|
||||||
|
|
||||||
|
Although plugins run independently, they contribute to the shared `CurrentScan` table.
|
||||||
|
To inspect its contents, set `LOG_LEVEL=trace` and check for the log section:
|
||||||
|
|
||||||
|
```
|
||||||
|
================ CurrentScan table content ================
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## `config.json` Lifecycle
|
||||||
|
|
||||||
|
This section outlines how each plugin’s `config.json` manifest is read, validated, and used by the core and plugins.
|
||||||
|
It also describes plugin output expectations and the main plugin categories.
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> For detailed schema and examples, see the [Plugin Development Guide](PLUGINS_DEV.md).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 1. Loading
|
### 1. Loading
|
||||||
|
|
||||||
* On startup, the app core loads `config.json` for each plugin.
|
* On startup, the core loads `config.json` for each plugin.
|
||||||
* The `config.json` represents a plugin manifest, that contains metadata and runtime settings.
|
* The file acts as a **plugin manifest**, defining metadata, runtime configuration, and database mappings.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 2. Validation
|
### 2. Validation
|
||||||
|
|
||||||
* The core checks that each required settings key (such as `RUN`) for a plugin exists.
|
* The core validates required keys (for example, `RUN`).
|
||||||
* Invalid or missing values may be replaced with defaults, or the plugin may be disabled.
|
* Missing or invalid entries may be replaced with defaults or cause the plugin to be disabled.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 3. Preparation
|
### 3. Preparation
|
||||||
|
|
||||||
* The plugin’s settings (paths, commands, parameters) are prepared.
|
* Plugin parameters (paths, commands, and options) are prepared for execution.
|
||||||
* Database mappings (`mapped_to_table`, `database_column_definitions`) for data ingestion into the core app are parsed.
|
* Database mappings (`mapped_to_table`, `database_column_definitions`) are parsed to define how data integrates with the main app.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 4. Execution
|
### 4. Execution
|
||||||
|
|
||||||
* Plugins can be run at different core app execution points, such as on schedule, once on start, after a notification, etc.
|
* Plugins may run:
|
||||||
* At runtime, the scheduler triggers plugins according to their `interval`.
|
|
||||||
* The plugin executes its command or script.
|
* On a fixed schedule.
|
||||||
|
* Once at startup.
|
||||||
|
* After a notification or other trigger.
|
||||||
|
* The scheduler executes plugins according to their `interval`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 5. Parsing
|
### 5. Parsing
|
||||||
|
|
||||||
* Plugin output is expected in **pipe (`|`)-delimited format**.
|
* Plugin output must be **pipe-delimited (`|`)**.
|
||||||
* The core parses lines into fields, matching the **plugin interface contract**.
|
* The core parses each output line following the **Plugin Interface Contract**, splitting and mapping fields accordingly.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 6. Mapping
|
### 6. Mapping
|
||||||
|
|
||||||
* Each parsed field is moved into the `Plugins_` database tables and can be mapped into a configured database table.
|
* Parsed fields are inserted into the plugin’s `Plugins_*` table.
|
||||||
* Controlled by `database_column_definitions` and `mapped_to_table`.
|
* Data can be mapped into other tables (e.g., `Devices`, `CurrentScan`) as defined by:
|
||||||
* Example: `Object_PrimaryID → Devices.MAC`.
|
|
||||||
|
* `database_column_definitions`
|
||||||
|
* `mapped_to_table`
|
||||||
|
|
||||||
|
**Example:** `Object_PrimaryID → devMAC`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 6a. Plugin Output Contract
|
### 6a. Plugin Output Contract
|
||||||
|
|
||||||
Each plugin must output results in the **plugin interface contract format**, pipe (`|`)-delimited values, in the column order described under [Plugin Interface Contract](PLUGINS_DEV.md)
|
All plugins must follow the **Plugin Interface Contract** defined in `PLUGINS_DEV.md`.
|
||||||
|
Output values are pipe-delimited in a fixed order.
|
||||||
|
|
||||||
#### IDs
|
#### Identifiers
|
||||||
|
|
||||||
* `Object_PrimaryID` and `Object_SecondaryID` identify the record (e.g. `MAC|IP`).
|
* `Object_PrimaryID` and `Object_SecondaryID` uniquely identify records (for example, `MAC|IP`).
|
||||||
|
|
||||||
#### **Watched values (`Watched_Value1–4`)**
|
#### Watched Values (`Watched_Value1–4`)
|
||||||
|
|
||||||
* Used by the core to detect changes between runs.
|
* Used by the core to detect changes between runs.
|
||||||
* Changes here can trigger **notifications**.
|
* Changes in these fields can trigger notifications.
|
||||||
|
|
||||||
#### **Extra value (`Extra`)**
|
#### Extra Field (`Extra`)
|
||||||
|
|
||||||
* Optional, extra field.
|
* Optional additional value.
|
||||||
* Stored in the database but **not used for alerts**.
|
* Stored in the database but not used for alerts.
|
||||||
|
|
||||||
#### **Helper values (`Helper_Value1–3`)**
|
#### Helper Values (`Helper_Value1–3`)
|
||||||
|
|
||||||
* Added for cases where more than IDs + watched + extra are needed.
|
* Optional auxiliary data (for display or plugin logic).
|
||||||
* Can be made visible in the UI.
|
* Stored but not alert-triggering.
|
||||||
* Stored in the database but **not used for alerts**.
|
|
||||||
|
|
||||||
#### **Mapping matters**
|
#### Mapping
|
||||||
|
|
||||||
* While the plugin output is free-form, the `database_column_definitions` and `mapped_to_table` settings in `config.json` determine the **target columns and data types** in NetAlertX.
|
* While the output format is flexible, the plugin’s manifest determines the destination and type of each field.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 7. Persistence
|
### 7. Persistence
|
||||||
|
|
||||||
* Data is upserted into the database.
|
* Parsed data is **upserted** into the database.
|
||||||
* Conflicts are resolved using `Object_PrimaryID` + `Object_SecondaryID`.
|
* Conflicts are resolved using the combined key: `Object_PrimaryID + Object_SecondaryID`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 8. Plugin Types and Expected Outputs
|
## Plugin Categories
|
||||||
|
|
||||||
Beyond the `data_source` setting, plugins fall into functional categories. Each has its own input requirements and output expectations:
|
Plugins fall into several functional categories depending on their purpose and expected outputs.
|
||||||
|
|
||||||
#### **Device discovery plugins**
|
### 1. Device Discovery Plugins
|
||||||
|
|
||||||
* **Inputs:** `N/A`, subnet, or API for discovery service, or similar.
|
* **Inputs:** None, subnet, or discovery API.
|
||||||
* **Outputs:** At minimum `MAC` and `IP` that results in a new or updated device records in the `Devices` table.
|
* **Outputs:** `MAC` and `IP` for new or updated device records in `Devices`.
|
||||||
* **Mapping:** Must be mapped to the `CurrentScan` table via `database_column_definitions` and `data_filters`.
|
* **Mapping:** Required – usually into `CurrentScan`.
|
||||||
* **Examples:** ARP-scan, NMAP device discovery (e.g., `ARPSCAN`, `NMAPDEV`).
|
* **Examples:** `ARPSCAN`, `NMAPDEV`.
|
||||||
|
|
||||||
#### **Device-data enrichment plugins**
|
|
||||||
|
|
||||||
* **Inputs:** Device identifier (usually `MAC`, `IP`).
|
|
||||||
* **Outputs:** Additional data for that device (e.g. open ports).
|
|
||||||
* **Mapping:** Controlled via `database_column_definitions` and `data_filters`.
|
|
||||||
* **Examples:** Ports, MQTT messages (e.g., `NMAP`, `MQTT`)
|
|
||||||
|
|
||||||
#### **Name resolver plugins**
|
|
||||||
|
|
||||||
* **Inputs:** Device identifiers (MAC, IP, or hostname).
|
|
||||||
* **Outputs:** Updated `devName` and `devFQDN` fields.
|
|
||||||
* **Mapping:** Not expected.
|
|
||||||
* **Note:** Currently requires **core app modification** to add new plugins, not fully driven by the plugins’ `config.json`.
|
|
||||||
* **Examples:** Avahiscan (e.g., `NBTSCAN`, `NSLOOKUP`).
|
|
||||||
|
|
||||||
#### **Generic plugins**
|
|
||||||
|
|
||||||
* **Inputs:** Whatever the script or query provides.
|
|
||||||
* **Outputs:** Data shown only in **Integrations → Plugins**, not tied to devices.
|
|
||||||
* **Mapping:** Not expected.
|
|
||||||
* **Examples:** External monitoring data (e.g., `INTRSPD`)
|
|
||||||
|
|
||||||
#### **Configuration-only plugins**
|
|
||||||
|
|
||||||
* **Inputs/Outputs:** None at runtime.
|
|
||||||
* **Mapping:** Not expected.
|
|
||||||
* **Examples:** Used to provide additional settings or execute scripts (e.g., `MAINT`, `CSVBCKP`).
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 9. Post-Processing
|
### 2. Device Data Enrichment Plugins
|
||||||
|
|
||||||
* Notifications are generated if watched values change.
|
* **Inputs:** Device identifiers (`MAC`, `IP`).
|
||||||
* UI is updated with new or updated records.
|
* **Outputs:** Additional metadata (for example, open ports or sensors).
|
||||||
* All values that are configured to be shown in teh UI appear in the Plugins section.
|
* **Mapping:** Controlled via manifest definitions.
|
||||||
|
* **Examples:** `NMAP`, `MQTT`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 10. Summary
|
### 3. Name Resolver Plugins
|
||||||
|
|
||||||
The lifecycle of `config.json` entries is:
|
* **Inputs:** Device identifiers (`MAC`, `IP`, hostname`).
|
||||||
|
* **Outputs:** Updated `devName` and `devFQDN`.
|
||||||
|
* **Mapping:** Typically none.
|
||||||
|
* **Note:** Adding new resolvers currently requires a core change.
|
||||||
|
* **Examples:** `NBTSCAN`, `NSLOOKUP`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4. Generic Plugins
|
||||||
|
|
||||||
|
* **Inputs:** Custom, based on the plugin logic or script.
|
||||||
|
* **Outputs:** Data displayed under **Integrations → Plugins** only.
|
||||||
|
* **Mapping:** Not required.
|
||||||
|
* **Examples:** `INTRSPD`, custom monitoring scripts.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 5. Configuration-Only Plugins
|
||||||
|
|
||||||
|
* **Inputs/Outputs:** None at runtime.
|
||||||
|
* **Purpose:** Used for configuration or maintenance tasks.
|
||||||
|
* **Examples:** `MAINT`, `CSVBCKP`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Post-Processing
|
||||||
|
|
||||||
|
After persistence:
|
||||||
|
|
||||||
|
* The core generates notifications for any watched value changes.
|
||||||
|
* The UI updates with new or modified data.
|
||||||
|
* Plugins with UI-enabled data display under **Integrations → Plugins**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
The lifecycle of a plugin configuration is:
|
||||||
|
|
||||||
**Load → Validate → Prepare → Execute → Parse → Map → Persist → Post-process**
|
**Load → Validate → Prepare → Execute → Parse → Map → Persist → Post-process**
|
||||||
|
|
||||||
Plugins must follow the **output contract**, and their category (discovery, specific, resolver, generic, config-only) defines what inputs they require and what outputs are expected.
|
Each plugin must:
|
||||||
|
|
||||||
|
* Follow the **output contract**.
|
||||||
|
* Declare its type and expected output structure.
|
||||||
|
* Define mappings and watched values clearly in `config.json`.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ There is also an in-app Help / FAQ section that should be answering frequently a
|
|||||||
|
|
||||||
#### 🐳 Docker (Fully supported)
|
#### 🐳 Docker (Fully supported)
|
||||||
|
|
||||||
- The main installation method is as a [docker container - follow these instructions here](https://github.com/jokob-sk/NetAlertX/blob/main/dockerfiles/README.md).
|
- The main installation method is as a [docker container - follow these instructions here](./DOCKER_INSTALLATION.md).
|
||||||
|
|
||||||
#### 💻 Bare-metal / On-server (Experimental/community supported 🧪)
|
#### 💻 Bare-metal / On-server (Experimental/community supported 🧪)
|
||||||
|
|
||||||
@@ -63,7 +63,6 @@ There is also an in-app Help / FAQ section that should be answering frequently a
|
|||||||
|
|
||||||
#### ♻ Misc
|
#### ♻ Misc
|
||||||
|
|
||||||
- [Version history (legacy)](./VERSIONS_HISTORY.md)
|
|
||||||
- [Reverse proxy (Nginx, Apache, SWAG)](./REVERSE_PROXY.md)
|
- [Reverse proxy (Nginx, Apache, SWAG)](./REVERSE_PROXY.md)
|
||||||
- [Installing Updates](./UPDATES.md)
|
- [Installing Updates](./UPDATES.md)
|
||||||
- [Setting up Authelia](./AUTHELIA.md) (DRAFT)
|
- [Setting up Authelia](./AUTHELIA.md) (DRAFT)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
If you are running a DNS server, such as **AdGuard**, set up **Private reverse DNS servers** for a better name resolution on your network. Enabling this setting will enable NetAlertX to execute dig and nslookup commands to automatically resolve device names based on their IP addresses.
|
If you are running a DNS server, such as **AdGuard**, set up **Private reverse DNS servers** for a better name resolution on your network. Enabling this setting will enable NetAlertX to execute dig and nslookup commands to automatically resolve device names based on their IP addresses.
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
> Before proceeding, ensure that [name resolution plugins](./NAME_RESOLUTION.md) are enabled.
|
> Before proceeding, ensure that [name resolution plugins](/local_data_dir/NAME_RESOLUTION.md) are enabled.
|
||||||
> You can customize how names are cleaned using the `NEWDEV_NAME_CLEANUP_REGEX` setting.
|
> You can customize how names are cleaned using the `NEWDEV_NAME_CLEANUP_REGEX` setting.
|
||||||
> To auto-update Fully Qualified Domain Names (FQDN), enable the `REFRESH_FQDN` setting.
|
> To auto-update Fully Qualified Domain Names (FQDN), enable the `REFRESH_FQDN` setting.
|
||||||
|
|
||||||
@@ -40,15 +40,7 @@ services:
|
|||||||
netalertx:
|
netalertx:
|
||||||
container_name: netalertx
|
container_name: netalertx
|
||||||
image: "ghcr.io/jokob-sk/netalertx:latest"
|
image: "ghcr.io/jokob-sk/netalertx:latest"
|
||||||
restart: unless-stopped
|
...
|
||||||
volumes:
|
|
||||||
- /home/netalertx/config:/app/config
|
|
||||||
- /home/netalertx/db:/app/db
|
|
||||||
- /home/netalertx/log:/app/log
|
|
||||||
environment:
|
|
||||||
- TZ=Europe/Berlin
|
|
||||||
- PORT=20211
|
|
||||||
network_mode: host
|
|
||||||
dns: # specifying the DNS servers used for the container
|
dns: # specifying the DNS servers used for the container
|
||||||
- 10.8.0.1
|
- 10.8.0.1
|
||||||
- 10.8.0.17
|
- 10.8.0.17
|
||||||
@@ -61,26 +53,16 @@ You can configure a custom **/etc/resolv.conf** file in **docker-compose.yml** a
|
|||||||
#### docker-compose.yml:
|
#### docker-compose.yml:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: "3"
|
|
||||||
services:
|
services:
|
||||||
netalertx:
|
netalertx:
|
||||||
container_name: netalertx
|
container_name: netalertx
|
||||||
image: "ghcr.io/jokob-sk/netalertx:latest"
|
|
||||||
restart: unless-stopped
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./config/app.conf:/app/config/app.conf
|
...
|
||||||
- ./db:/app/db
|
- /local_data_dir/config/resolv.conf:/etc/resolv.conf # ⚠ Mapping the /resolv.conf file for better name resolution
|
||||||
- ./log:/app/log
|
...
|
||||||
- ./config/resolv.conf:/etc/resolv.conf # Mapping the /resolv.conf file for better name resolution
|
|
||||||
environment:
|
|
||||||
- TZ=Europe/Berlin
|
|
||||||
- PORT=20211
|
|
||||||
ports:
|
|
||||||
- "20211:20211"
|
|
||||||
network_mode: host
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### ./config/resolv.conf:
|
#### /local_data_dir/config/resolv.conf:
|
||||||
|
|
||||||
The most important below is the `nameserver` entry (you can add multiple):
|
The most important below is the `nameserver` entry (you can add multiple):
|
||||||
|
|
||||||
|
|||||||
@@ -496,14 +496,9 @@ server {
|
|||||||
Mapping the updated file (on the local filesystem at `/appl/docker/netalertx/default`) into the docker container:
|
Mapping the updated file (on the local filesystem at `/appl/docker/netalertx/default`) into the docker container:
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```yaml
|
||||||
docker run -d --rm --network=host \
|
...
|
||||||
--name=netalertx \
|
volumes:
|
||||||
-v /appl/docker/netalertx/config:/app/config \
|
- /appl/docker/netalertx/default:/etc/nginx/sites-available/default
|
||||||
-v /appl/docker/netalertx/db:/app/db \
|
...
|
||||||
-v /appl/docker/netalertx/default:/etc/nginx/sites-available/default \
|
|
||||||
-e TZ=Europe/Amsterdam \
|
|
||||||
-e PORT=20211 \
|
|
||||||
ghcr.io/jokob-sk/netalertx:latest
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
85
docs/SECURITY_FEATURES.md
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
# NetAlertX Security: A Layered Defense
|
||||||
|
|
||||||
|
Your network security monitor has the "keys to the kingdom," making it a prime target for attackers. If it gets compromised, the game is over.
|
||||||
|
|
||||||
|
NetAlertX is engineered from the ground up to prevent this. It's not just an app; it's a purpose-built **security appliance.** Its core design is built on a **zero-trust** philosophy, which is a modern way of saying we **assume a breach will happen** and plan for it. This isn't a single "lock on the door"; it's a **"defense-in-depth"** strategy, more like a medieval castle with a moat, high walls, and guards at every door.
|
||||||
|
|
||||||
|
Here’s a breakdown of the defensive layers you get, right out of the box using the default configuration.
|
||||||
|
|
||||||
|
## Feature 1: The "Digital Concrete" Filesystem
|
||||||
|
|
||||||
|
**Methodology:** The core application and its system files are treated as immutable. Once built, the app's code is "set in concrete," preventing attackers from modifying it or planting malware.
|
||||||
|
|
||||||
|
* **Immutable Filesystem:** At runtime, the container's entire filesystem is set to `read_only: true`. The application code, system libraries, and all other files are literally frozen. This single control neutralizes a massive range of common attacks.
|
||||||
|
|
||||||
|
* **"Ownership-as-a-Lock" Pattern:** During the build, all system files are assigned to a special `readonly` user. This user has no login shell and no power to write to *any* files, even its own. It’s a clever, defense-in-depth locking mechanism.
|
||||||
|
|
||||||
|
* **Data Segregation:** All user-specific data (like configurations and the device database) is stored completely outside the container in Docker volumes. The application is disposable; the data is persistent.
|
||||||
|
|
||||||
|
**What's this mean to you:** Even if an attacker gets in, they **cannot modify the application code or plant malware.** It's like the app is set in digital concrete.
|
||||||
|
|
||||||
|
## Feature 2: Surgical, "Keycard-Only" Access
|
||||||
|
|
||||||
|
**Methodology:** The principle of least privilege is strictly enforced. Every process gets only the absolute minimum set of permissions needed for its specific job.
|
||||||
|
|
||||||
|
* **Non-Privileged Execution:** The entire NetAlertX stack runs as a dedicated, low-power, non-root user (`netalertx`). No "god mode" privileges are available to the application.
|
||||||
|
|
||||||
|
* **Kernel-Level Capability Revocation:** The container is launched with `cap_drop: - ALL`, which tells the Linux kernel to revoke *all* "root-like" special powers.
|
||||||
|
|
||||||
|
* **Binary-Specific Privileges (setcap):** This is the "keycard" metaphor in action. After revoking all powers, the system uses `setcap` to grant specific, necessary permissions *only* to the binaries that absolutely require them (like `nmap` and `arp-scan`). This means that even if an attacker compromises the web server, they can't start scanning the network. The web server's "keycard" doesn't open the "scanning" door.
|
||||||
|
|
||||||
|
**What's this mean to you:** A security breach is **firewalled.** An attacker who gets into the web UI **does not have the "keycard"** to start scanning your network or take over the system. The breach is contained.
|
||||||
|
|
||||||
|
## Feature 3: Attack Surface "Amputation"
|
||||||
|
|
||||||
|
**Methodology:** The potential attack surface is aggressively minimized by removing every non-essential tool an attacker would want to use.
|
||||||
|
|
||||||
|
* **Package Manager Removal:** The `hardened` build stage explicitly deletes the Alpine package manager (`apk del apk-tools`). This makes it impossible for an attacker to simply `apk add` their malicious toolkit.
|
||||||
|
|
||||||
|
* **`sudo` Neutralization:** All `sudo` configurations are removed, and the `/usr/bin/sudo` command is replaced with a non-functional shim. Any attempt to escalate privileges this way will fail.
|
||||||
|
|
||||||
|
* **Build Toolchain Elimination:** The `Dockerfile` uses a multi-stage build. The initial "builder" stage, which contains all the powerful compilers (`gcc`) and development tools, is completely discarded. The final production image is lean and contains no build tools.
|
||||||
|
|
||||||
|
* **Minimal User & Group Files:** The `hardened` stage scrubs the system's `passwd` and `group` files, removing all default system users to minimize potential avenues for privilege escalation.
|
||||||
|
|
||||||
|
**What's this mean to you:** An attacker who breaks in finds themselves in an **empty room with no tools.** They have no `sudo` to get more power, no package manager to download weapons, and no compilers to build new ones.
|
||||||
|
|
||||||
|
## Feature 4: "Self-Cleaning" Writable Areas
|
||||||
|
|
||||||
|
**Methodology:** All writable locations are treated as untrusted, temporary, and non-executable by default.
|
||||||
|
|
||||||
|
* **In-Memory Volatile Storage:** The `docker-compose.yml` configuration maps all temporary directories (e.g., `/tmp/log`, `/tmp/api`, `/tmp`) to in-memory `tmpfs` filesystems. They do not exist on the host's disk.
|
||||||
|
|
||||||
|
* **Volatile Data:** Because these locations exist only in RAM, their contents are **instantly and irrevocably erased** when the container is stopped. This provides a "self-cleaning" mechanism that purges any attacker-dropped files or payloads on every single restart.
|
||||||
|
|
||||||
|
* **Secure Mount Flags:** These in-memory mounts are configured with the `noexec` flag. This is a critical security control: it **prohibits the execution of any binary or script** from a location that is writable.
|
||||||
|
|
||||||
|
**What's this mean to you:** Any malicious file an attacker *does* manage to drop is **written in invisible, non-permanent ink.** The file is written to RAM, not disk, so it **vaporizes the instant you restart** the container. Even worse for them, the `noexec` flag means they **can't even run the file** in the first place.
|
||||||
|
|
||||||
|
## Feature 5: Built-in Resource Guardrails
|
||||||
|
|
||||||
|
**Methodology:** The container is constrained by resource limits to function as a "good citizen" on the host system. This prevents a compromised or runaway process from consuming excessive resources, a common vector for Denial of Service (DoS) attacks.
|
||||||
|
|
||||||
|
* **Process Limiting:** The `docker-compose.yml` defines a `pids_limit: 512`. This directly mitigates "fork bomb" attacks, where a process attempts to crash the host by recursively spawning thousands of new processes.
|
||||||
|
|
||||||
|
* **Memory & CPU Limits:** The configuration file defines strict resource limits to prevent any single process from exhausting the host's available system resources.
|
||||||
|
|
||||||
|
**What's this mean to you:** NetAlertX is a "good neighbor" and **can't be used to crash your host machine.** Even if a process is compromised, it's in a digital straitjacket and **cannot** pull a "denial of service" attack by hogging all your CPU or memory.
|
||||||
|
|
||||||
|
## Feature 6: The "Pre-Flight" Self-Check
|
||||||
|
|
||||||
|
**Methodology:** Before any services start, NetAlertX runs a comprehensive "pre-flight" check to ensure its own security and configuration are sound. It's like a built-in auditor who verifies its own defenses.
|
||||||
|
|
||||||
|
* **Active Self-Diagnosis:** On every single boot, NetAlertX runs a series of startup pre-checks—and it's fast. The entire self-check process typically completes in less than a second, letting you get to the web UI in about three seconds from startup.
|
||||||
|
|
||||||
|
* **Validates Its Own Security:** These checks actively inspect the other security features. For example, `check-0-permissions.sh` validates that all the "Digital Concrete" files are locked down and all the "Self-Cleaning" areas are writable, just as they should be. It also checks that the correct `netalertx` user is running the show, not `root`.
|
||||||
|
|
||||||
|
* **Catches Misconfigurations:** This system acts as a "safety inspector" that catches misconfigurations *before* they can become security holes. If you've made a mistake in your configuration (like a bad folder permission or incorrect network mode), NetAlertX will tell you in the logs *why* it can't start, rather than just failing silently.
|
||||||
|
|
||||||
|
**What's this mean to you:** The system is **self-aware and checks its own work.** You get instant feedback if a setting is wrong, and you get peace of mind on every single boot knowing all these security layers are **active and verified,** all in about one second.
|
||||||
|
|
||||||
|
## Conclusion: Security by Default
|
||||||
|
|
||||||
|
No single security control is a silver bullet. The robust security posture of NetAlertX is achieved through **defense in depth**, layering these methodologies.
|
||||||
|
|
||||||
|
An adversary must not only gain initial access but must also find a way to write a payload to a non-executable, in-memory location, without access to any standard system tools, `sudo`, or a package manager. And they must do this while operating as an unprivileged user in a resource-limited environment where the application code is immutable and *actively checks its own integrity on every boot*.
|
||||||
@@ -1,62 +1,64 @@
|
|||||||
# Sessions Section in Device View
|
# Sessions Section – Device View
|
||||||
|
|
||||||
The **Sessions Section** provides details about a device's connection history. This data is automatically detected and cannot be edited by the user.
|
The **Sessions Section** shows a device’s connection history. All data is automatically detected and **cannot be edited**.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Key Fields
|
## Key Fields
|
||||||
|
|
||||||
1. **Date and Time of First Connection**
|
| Field | Description | Editable? |
|
||||||
- **Description:** Displays the first detected connection time for the device.
|
| ------------------------------ | ------------------------------------------------------------------------------------------------ | --------------- |
|
||||||
- **Editability:** Uneditable (auto-detected).
|
| **First Connection** | The first time the device was detected on the network. | ❌ Auto-detected |
|
||||||
- **Source:** Automatically captured when the device is first added to the system.
|
| **Last Connection** | The most recent time the device was online. | ❌ Auto-detected |
|
||||||
|
|
||||||
2. **Date and Time of Last Connection**
|
|
||||||
- **Description:** Shows the most recent time the device was online.
|
|
||||||
- **Editability:** Uneditable (auto-detected).
|
|
||||||
- **Source:** Updated with every new connection event.
|
|
||||||
|
|
||||||
3. **Offline Devices with Missing or Conflicting Data**
|
|
||||||
- **Description:** Handles cases where a device is offline but has incomplete or conflicting session data (e.g., missing start times).
|
|
||||||
- **Handling:** The system flags these cases for review and attempts to infer missing details.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## How Sessions are Discovered and Calculated
|
## How Session Information Works
|
||||||
|
|
||||||
### 1. Detecting New Devices
|
### 1. Detecting New Devices
|
||||||
When a device is first detected in the network, the system logs it in the events table:
|
|
||||||
|
|
||||||
`INSERT INTO Events (eve_MAC, eve_IP, eve_DateTime, eve_EventType, eve_AdditionalInfo, eve_PendingAlertEmail) SELECT cur_MAC, cur_IP, '{startTime}', 'New Device', cur_Vendor, 1 FROM CurrentScan WHERE NOT EXISTS (SELECT 1 FROM Devices WHERE devMac = cur_MAC)`
|
* New devices are automatically detected when they first appear on the network.
|
||||||
|
* A **New Device** record is created, capturing the MAC, IP, vendor, and detection time.
|
||||||
|
|
||||||
- Devices scanned in the current cycle (**CurrentScan**) are checked against the **Devices** table.
|
### 2. Recording Connection Sessions
|
||||||
- If a device is new:
|
|
||||||
- A **New Device** event is logged.
|
|
||||||
- The device’s MAC, IP, vendor, and detection time are recorded.
|
|
||||||
|
|
||||||
### 2. Logging Connection Sessions
|
* Every time a device connects, a session entry is created.
|
||||||
When a new connection is detected, the system creates a session record:
|
* Captured details include:
|
||||||
|
|
||||||
`INSERT INTO Sessions (ses_MAC, ses_IP, ses_EventTypeConnection, ses_DateTimeConnection, ses_EventTypeDisconnection, ses_DateTimeDisconnection, ses_StillConnected, ses_AdditionalInfo) SELECT cur_MAC, cur_IP, 'Connected', '{startTime}', NULL, NULL, 1, cur_Vendor FROM CurrentScan WHERE NOT EXISTS (SELECT 1 FROM Sessions WHERE ses_MAC = cur_MAC)`
|
* Connection type (wired or wireless)
|
||||||
|
* Connection time
|
||||||
- A new session is logged in the **Sessions** table if no prior session exists.
|
* Device details (MAC, IP, vendor)
|
||||||
- Fields like `MAC`, `IP`, `Connection Type`, and `Connection Time` are populated.
|
|
||||||
- The `Still Connected` flag is set to `1` (active connection).
|
|
||||||
|
|
||||||
### 3. Handling Missing or Conflicting Data
|
### 3. Handling Missing or Conflicting Data
|
||||||
- Devices with incomplete or conflicting session data (e.g., missing start times) are detected.
|
|
||||||
- The system flags these records and attempts corrections by inferring details from available data.
|
* **Triggers:**
|
||||||
|
Devices are flagged when session data is incomplete, inconsistent, or conflicting. Examples include:
|
||||||
|
|
||||||
|
* Missing first or last connection timestamps
|
||||||
|
* Overlapping session records
|
||||||
|
* Sessions showing a device as connected and disconnected at the same time
|
||||||
|
|
||||||
|
* **System response:**
|
||||||
|
|
||||||
|
* Automatically highlights affected devices in the **Sessions Section**.
|
||||||
|
* Attempts to **infer missing information** from available data, such as:
|
||||||
|
|
||||||
|
* Estimating first or last connection times from nearby session events
|
||||||
|
* Correcting overlapping session periods
|
||||||
|
* Reconciling conflicting connection statuses
|
||||||
|
|
||||||
|
* **User impact:**
|
||||||
|
|
||||||
|
* Users do **not** need to manually fix session data.
|
||||||
|
* The system ensures the device’s connection history remains as accurate as possible for monitoring and reporting.
|
||||||
|
|
||||||
### 4. Updating Sessions
|
### 4. Updating Sessions
|
||||||
- When a device reconnects, its session is updated with a new connection timestamp.
|
|
||||||
- When a device disconnects:
|
|
||||||
- The **Disconnection Time** is recorded.
|
|
||||||
- The `Still Connected` flag is set to `0`.
|
|
||||||
|
|
||||||
The session information is then used to display the device presence under **Monitoring** -> **Presence**.
|
* **Reconnect:** Updates session with the new connection timestamp.
|
||||||
|
* **Disconnect:** Records disconnection time and marks the device as offline.
|
||||||
|
|
||||||
|
This session information feeds directly into **Monitoring → Presence**, providing a live view of which devices are currently online.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,28 +9,30 @@ The folders you are creating below will contain the configuration and the databa
|
|||||||
1. Create a parent folder named `netalertx`
|
1. Create a parent folder named `netalertx`
|
||||||
2. Create a `db` sub-folder
|
2. Create a `db` sub-folder
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
3. Create a `config` sub-folder
|
3. Create a `config` sub-folder
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
4. Note down the folders Locations:
|
4. Note down the folders Locations:
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
5. Open **Container manager** -> **Project** and click **Create**.
|
## Creating the Project
|
||||||
6. Fill in the details:
|
|
||||||
|
1. Open **Container manager** -> **Project** and click **Create**.
|
||||||
|
2. Fill in the details:
|
||||||
|
|
||||||
- Project name: `netalertx`
|
- Project name: `netalertx`
|
||||||
- Path: `/app_storage/netalertx` (will differ from yours)
|
- Path: `/app_storage/netalertx` (will differ from yours)
|
||||||
- Paste in the following template:
|
- Paste in the following template:
|
||||||
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: "3"
|
|
||||||
services:
|
services:
|
||||||
netalertx:
|
netalertx:
|
||||||
container_name: netalertx
|
container_name: netalertx
|
||||||
@@ -39,36 +41,82 @@ services:
|
|||||||
image: "ghcr.io/jokob-sk/netalertx:latest"
|
image: "ghcr.io/jokob-sk/netalertx:latest"
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
cap_drop: # Drop all capabilities for enhanced security
|
||||||
|
- ALL
|
||||||
|
cap_add: # Re-add necessary capabilities
|
||||||
|
- NET_RAW
|
||||||
|
- NET_ADMIN
|
||||||
|
- NET_BIND_SERVICE
|
||||||
volumes:
|
volumes:
|
||||||
- local/path/config:/app/config
|
- /app_storage/netalertx:/data
|
||||||
- local/path/db:/app/db
|
# to sync with system time
|
||||||
# (optional) useful for debugging if you have issues setting up the container
|
- /etc/localtime:/etc/localtime:ro
|
||||||
- local/path/logs:/app/log
|
tmpfs:
|
||||||
|
# All writable runtime state resides under /tmp; comment out to persist logs between restarts
|
||||||
|
- "/tmp:uid=20211,gid=20211,mode=1700,rw,noexec,nosuid,nodev,async,noatime,nodiratime"
|
||||||
environment:
|
environment:
|
||||||
- TZ=Europe/Berlin
|
|
||||||
- PORT=20211
|
- PORT=20211
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
7. Replace the paths to your volume and comment out unnecessary line(s):
|
3. Replace the paths to your volume and comment out unnecessary line(s).
|
||||||
|
|
||||||
- This is only an example, your paths will differ.
|
> This is only an example, your paths will differ.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
volumes:
|
volumes:
|
||||||
- /volume1/app_storage/netalertx/config:/app/config
|
- /volume1/app_storage/netalertx:/data
|
||||||
- /volume1/app_storage/netalertx/db:/app/db
|
|
||||||
# (optional) useful for debugging if you have issues setting up the container
|
|
||||||
# - local/path/logs:/app/log <- commented out with # ⚠
|
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
8. (optional) Change the port number from `20211` to an unused port if this port is already used.
|
4. (optional) Change the port number from `20211` to an unused port if this port is already used.
|
||||||
9. Build the project:
|
5. Build the project:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
10. Navigate to `<Synology URL>:20211` (or your custom port).
|
10. Navigate to `<Synology URL>:20211` (or your custom port).
|
||||||
11. Read the [Subnets](./SUBNETS.md) and [Plugins](/docs/PLUGINS.md) docs to complete your setup.
|
11. Read the [Subnets](./SUBNETS.md) and [Plugins](/docs/PLUGINS.md) docs to complete your setup.
|
||||||
|
|
||||||
|
## Solving permission issues
|
||||||
|
|
||||||
|
See also the [Permission overview guide](./FILE_PERMISSIONS.md).
|
||||||
|
|
||||||
|
### Configuring the permissions via SSH
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> If you are facing permissions issues run the following commands on your server. This will change the owner and assure sufficient access to the database and config files that are stored in the `/local_data_dir/db` and `/local_data_dir/config` folders (replace `local_data_dir` with the location where your `/db` and `/config` folders are located).
|
||||||
|
>
|
||||||
|
> `sudo chown -R 20211:20211 /local_data_dir`
|
||||||
|
>
|
||||||
|
> `sudo chmod -R a+rwx /local_data_dir`
|
||||||
|
>
|
||||||
|
|
||||||
|
### Configuring the permissions via the Synology UI
|
||||||
|
|
||||||
|
You can also execute the above bash commands via the UI by creating a one-off scheduled task.
|
||||||
|
|
||||||
|
1. Control panel -> Task Scheduler
|
||||||
|
2. Create -> Scheduled Task -> User-defined Script
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
3. Give your task a name.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
4. Specify one-off execution time (e.g. 5 minutes from now).
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
5. Paste the commands from the above SSH section and replace the `/local_data_dir` with the parent fodler of your `/db` and `/config` folders.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
6. Wait until the execution time passes and verify the new ownership.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
In case of issues, double-check the [Permission overview guide](./FILE_PERMISSIONS.md).
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
> [!WARNING]
|
> [!WARNING]
|
||||||
> For versions prior to `v25.6.7` upgrade to version `v25.5.24` first (`docker pull ghcr.io/jokob-sk/netalertx:25.5.24`) as later versions don't support a full upgrade. Alternatively, devices and settings can be migrated manually, e.g. via [CSV import](./DEVICES_BULK_EDITING.md).
|
> For versions prior to `v25.6.7` upgrade to version `v25.5.24` first (`docker pull ghcr.io/jokob-sk/netalertx:25.5.24`) as later versions don't support a full upgrade. Alternatively, devices and settings can be migrated manually, e.g. via [CSV import](./DEVICES_BULK_EDITING.md).
|
||||||
|
> See the [Migration guide](./MIGRATION.md) for details.
|
||||||
|
|
||||||
This guide outlines approaches for updating Docker containers, usually when upgrading to a newer version of NetAlertX. Each method offers different benefits depending on the situation. Here are the methods:
|
This guide outlines approaches for updating Docker containers, usually when upgrading to a newer version of NetAlertX. Each method offers different benefits depending on the situation. Here are the methods:
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ The **Web UI** is served by an **nginx** server, while the **API backend** runs
|
|||||||
APP_CONF_OVERRIDE={"GRAPHQL_PORT":"20212"}
|
APP_CONF_OVERRIDE={"GRAPHQL_PORT":"20212"}
|
||||||
```
|
```
|
||||||
|
|
||||||
For more information, check the [Docker installation guide](https://github.com/jokob-sk/NetAlertX/blob/main/dockerfiles/README.md).
|
For more information, check the [Docker installation guide](./DOCKER_INSTALLATION.md).
|
||||||
|
|
||||||
## Possible issues and troubleshooting
|
## Possible issues and troubleshooting
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ Follow all of the below in order to disqualify potential causes of issues and to
|
|||||||
|
|
||||||
When opening an issue or debugging:
|
When opening an issue or debugging:
|
||||||
|
|
||||||
1. Include a screenshot of what you see when accessing `HTTP://<your rpi IP>/20211` (or your custom port)
|
1. Include a screenshot of what you see when accessing `HTTP://<your_server>:20211` (or your custom port)
|
||||||
1. [Follow steps 1, 2, 3, 4 on this page](./DEBUG_TIPS.md)
|
1. [Follow steps 1, 2, 3, 4 on this page](./DEBUG_TIPS.md)
|
||||||
1. Execute the following in the container to see the processes and their ports and submit a screenshot of the result:
|
1. Execute the following in the container to see the processes and their ports and submit a screenshot of the result:
|
||||||
- `sudo apk add lsof`
|
- `sudo apk add lsof`
|
||||||
@@ -62,11 +62,11 @@ In the container execute and investigate:
|
|||||||
|
|
||||||
`cat /var/log/nginx/error.log`
|
`cat /var/log/nginx/error.log`
|
||||||
|
|
||||||
`cat /app/log/app.php_errors.log`
|
`cat /tmp/log/app.php_errors.log`
|
||||||
|
|
||||||
### 8. Make sure permissions are correct
|
### 8. Make sure permissions are correct
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
> You can try to start the container without mapping the `/app/config` and `/app/db` dirs and if the UI shows up then the issue is most likely related to your file system permissions or file ownership.
|
> You can try to start the container without mapping the `/data/config` and `/data/db` dirs and if the UI shows up then the issue is most likely related to your file system permissions or file ownership.
|
||||||
|
|
||||||
Please read the [Permissions troubleshooting guide](./FILE_PERMISSIONS.md) and provide a screesnhot of the permissions and ownership in the `/app/db` and `app/config` directories.
|
Please read the [Permissions troubleshooting guide](./FILE_PERMISSIONS.md) and provide a screesnhot of the permissions and ownership in the `/data/db` and `app/config` directories.
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# Workflows debugging and troubleshooting
|
# Workflows debugging and troubleshooting
|
||||||
|
|
||||||
> [!TIP]
|
> [!TIP]
|
||||||
> Before troubleshooting, please ensure you have [Debugging enabled](./DEBUG_TIPS.md).
|
> Before troubleshooting, please ensure you have the right [Debugging and LOG_LEVEL set](./DEBUG_TIPS.md).
|
||||||
|
|
||||||
Workflows are triggered by various events. These events are captured and listed in the _Integrations -> App Events_ section of the application.
|
Workflows are triggered by various events. These events are captured and listed in the _Integrations -> App Events_ section of the application.
|
||||||
|
|
||||||
|
|||||||
32
docs/docker-troubleshooting/excessive-capabilities.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Excessive Capabilities
|
||||||
|
|
||||||
|
## Issue Description
|
||||||
|
|
||||||
|
Excessive Linux capabilities are detected beyond the necessary NET_ADMIN, NET_BIND_SERVICE, and NET_RAW. This may indicate overly permissive container configuration.
|
||||||
|
|
||||||
|
## Security Ramifications
|
||||||
|
|
||||||
|
While the detected capabilities might not directly harm operation, running with more privileges than necessary increases the attack surface. If the container is compromised, additional capabilities could allow broader system access or privilege escalation.
|
||||||
|
|
||||||
|
## Why You're Seeing This Issue
|
||||||
|
|
||||||
|
This occurs when your Docker configuration grants more capabilities than required for network monitoring. The application only needs specific network-related capabilities for proper function.
|
||||||
|
|
||||||
|
## How to Correct the Issue
|
||||||
|
|
||||||
|
Limit capabilities to only those required:
|
||||||
|
|
||||||
|
- In docker-compose.yml, specify only needed caps:
|
||||||
|
```yaml
|
||||||
|
cap_add:
|
||||||
|
- NET_RAW
|
||||||
|
- NET_ADMIN
|
||||||
|
- NET_BIND_SERVICE
|
||||||
|
```
|
||||||
|
- Remove any unnecessary `--cap-add` or `--privileged` flags from docker run commands
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
Docker Compose setup can be complex. We recommend starting with the default docker-compose.yml as a base and modifying it incrementally.
|
||||||
|
|
||||||
|
For detailed Docker Compose configuration guidance, see: [DOCKER_COMPOSE.md](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DOCKER_COMPOSE.md)
|
||||||
27
docs/docker-troubleshooting/file-permissions.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# File Permission Issues
|
||||||
|
|
||||||
|
## Issue Description
|
||||||
|
|
||||||
|
NetAlertX cannot read from or write to critical configuration and database files. This prevents the application from saving data, logs, or configuration changes.
|
||||||
|
|
||||||
|
## Security Ramifications
|
||||||
|
|
||||||
|
Incorrect file permissions can expose sensitive configuration data or database contents to unauthorized access. Network monitoring tools handle sensitive information about devices on your network, and improper permissions could lead to information disclosure.
|
||||||
|
|
||||||
|
## Why You're Seeing This Issue
|
||||||
|
|
||||||
|
This occurs when the mounted volumes for configuration and database files don't have proper ownership or permissions set for the netalertx user (UID 20211). The container expects these files to be accessible by the service account, not root or other users.
|
||||||
|
|
||||||
|
## How to Correct the Issue
|
||||||
|
|
||||||
|
Fix permissions on the host system for the mounted directories:
|
||||||
|
|
||||||
|
- Ensure the config and database directories are owned by the netalertx user: `chown -R 20211:20211 /path/to/config /path/to/db`
|
||||||
|
- Set appropriate permissions: `chmod -R 755 /path/to/config /path/to/db` for directories, `chmod 644` for files
|
||||||
|
- Alternatively, restart the container with root privileges temporarily to allow automatic permission fixing, then switch back to the default user
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
Docker Compose setup can be complex. We recommend starting with the default docker-compose.yml as a base and modifying it incrementally.
|
||||||
|
|
||||||
|
For detailed Docker Compose configuration guidance, see: [DOCKER_COMPOSE.md](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DOCKER_COMPOSE.md)
|
||||||
28
docs/docker-troubleshooting/incorrect-user.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Incorrect Container User
|
||||||
|
|
||||||
|
## Issue Description
|
||||||
|
|
||||||
|
NetAlertX is running as UID:GID other than the expected 20211:20211. This bypasses hardened permissions, file ownership, and runtime isolation safeguards.
|
||||||
|
|
||||||
|
## Security Ramifications
|
||||||
|
|
||||||
|
The application is designed with security hardening that depends on running under a dedicated, non-privileged service account. Using a different user account can silently fail future upgrades and removes crucial isolation between the container and host system.
|
||||||
|
|
||||||
|
## Why You're Seeing This Issue
|
||||||
|
|
||||||
|
This occurs when you override the container's default user with custom `user:` directives in docker-compose.yml or `--user` flags in docker run commands. The container expects to run as the netalertx user for proper security isolation.
|
||||||
|
|
||||||
|
## How to Correct the Issue
|
||||||
|
|
||||||
|
Restore the container to the default user:
|
||||||
|
|
||||||
|
- Remove any `user:` overrides from docker-compose.yml
|
||||||
|
- Avoid `--user` flags in docker run commands
|
||||||
|
- Allow the container to run with its default UID:GID 20211:20211
|
||||||
|
- Recreate the container so volume ownership is reset automatically
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
Docker Compose setup can be complex. We recommend starting with the default docker-compose.yml as a base and modifying it incrementally.
|
||||||
|
|
||||||
|
For detailed Docker Compose configuration guidance, see: [DOCKER_COMPOSE.md](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DOCKER_COMPOSE.md)
|
||||||
32
docs/docker-troubleshooting/missing-capabilities.md
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Missing Network Capabilities
|
||||||
|
|
||||||
|
## Issue Description
|
||||||
|
|
||||||
|
Raw network capabilities (NET_RAW, NET_ADMIN, NET_BIND_SERVICE) are missing. Tools that rely on these capabilities (e.g., nmap -sS, arp-scan, nbtscan) will not function.
|
||||||
|
|
||||||
|
## Security Ramifications
|
||||||
|
|
||||||
|
Network scanning and monitoring requires low-level network access that these capabilities provide. Without them, the application cannot perform essential functions like ARP scanning, port scanning, or passive network discovery, severely limiting its effectiveness.
|
||||||
|
|
||||||
|
## Why You're Seeing This Issue
|
||||||
|
|
||||||
|
This occurs when the container doesn't have the necessary Linux capabilities granted. Docker containers run with limited capabilities by default, and network monitoring tools need elevated network privileges.
|
||||||
|
|
||||||
|
## How to Correct the Issue
|
||||||
|
|
||||||
|
Add the required capabilities to your container:
|
||||||
|
|
||||||
|
- In docker-compose.yml:
|
||||||
|
```yaml
|
||||||
|
cap_add:
|
||||||
|
- NET_RAW
|
||||||
|
- NET_ADMIN
|
||||||
|
- NET_BIND_SERVICE
|
||||||
|
```
|
||||||
|
- For docker run: `--cap-add=NET_RAW --cap-add=NET_ADMIN --cap-add=NET_BIND_SERVICE`
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
Docker Compose setup can be complex. We recommend starting with the default docker-compose.yml as a base and modifying it incrementally.
|
||||||
|
|
||||||
|
For detailed Docker Compose configuration guidance, see: [DOCKER_COMPOSE.md](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DOCKER_COMPOSE.md)
|
||||||
36
docs/docker-troubleshooting/mount-configuration-issues.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# Mount Configuration Issues
|
||||||
|
|
||||||
|
## Issue Description
|
||||||
|
|
||||||
|
NetAlertX has detected configuration issues with your Docker volume mounts. These may include write permission problems, data loss risks, or performance concerns marked with ❌ in the table.
|
||||||
|
|
||||||
|
## Security Ramifications
|
||||||
|
|
||||||
|
Improper mount configurations can lead to data loss, performance degradation, or security vulnerabilities. For persistent data (database and configuration), using non-persistent storage like tmpfs can result in complete data loss on container restart. For temporary data, using persistent storage may unnecessarily expose sensitive logs or cache data.
|
||||||
|
|
||||||
|
## Why You're Seeing This Issue
|
||||||
|
|
||||||
|
This occurs when your Docker Compose or run configuration doesn't properly map host directories to container paths, or when the mounted volumes have incorrect permissions. The application requires specific paths to be writable for operation, and some paths should use persistent storage while others should be temporary.
|
||||||
|
|
||||||
|
## How to Correct the Issue
|
||||||
|
|
||||||
|
Review and correct your volume mounts in docker-compose.yml:
|
||||||
|
|
||||||
|
- Ensure `${NETALERTX_DB}` and `${NETALERTX_CONFIG}` use persistent host directories
|
||||||
|
- Ensure `${NETALERTX_API}`, `${NETALERTX_LOG}` have appropriate permissions
|
||||||
|
- Avoid mounting sensitive paths to non-persistent filesystems like tmpfs for critical data
|
||||||
|
- Use bind mounts with proper ownership (netalertx user: 20211:20211)
|
||||||
|
|
||||||
|
Example volume configuration:
|
||||||
|
```yaml
|
||||||
|
volumes:
|
||||||
|
- ./data/db:/data/db
|
||||||
|
- ./data/config:/data/config
|
||||||
|
- ./data/log:/tmp/log
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
Docker Compose setup can be complex. We recommend starting with the default docker-compose.yml as a base and modifying it incrementally.
|
||||||
|
|
||||||
|
For detailed Docker Compose configuration guidance, see: [DOCKER_COMPOSE.md](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DOCKER_COMPOSE.md)
|
||||||
27
docs/docker-troubleshooting/network-mode.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Network Mode Configuration
|
||||||
|
|
||||||
|
## Issue Description
|
||||||
|
|
||||||
|
NetAlertX is not running with `--network=host`. Bridge networking blocks passive discovery (ARP, NBNS, mDNS) and active scanning accuracy.
|
||||||
|
|
||||||
|
## Security Ramifications
|
||||||
|
|
||||||
|
Host networking is required for comprehensive network monitoring. Bridge mode isolates the container from raw network access needed for ARP scanning, passive discovery protocols, and accurate device detection. Without host networking, the application cannot fully monitor your network.
|
||||||
|
|
||||||
|
## Why You're Seeing This Issue
|
||||||
|
|
||||||
|
This occurs when your Docker configuration uses bridge networking instead of host networking. Network monitoring requires direct access to the host's network interfaces to perform passive discovery and active scanning.
|
||||||
|
|
||||||
|
## How to Correct the Issue
|
||||||
|
|
||||||
|
Enable host networking mode:
|
||||||
|
|
||||||
|
- In docker-compose.yml, add: `network_mode: host`
|
||||||
|
- For docker run, use: `--network=host`
|
||||||
|
- Ensure the container has required capabilities: `--cap-add=NET_RAW --cap-add=NET_ADMIN --cap-add=NET_BIND_SERVICE`
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
Docker Compose setup can be complex. We recommend starting with the default docker-compose.yml as a base and modifying it incrementally.
|
||||||
|
|
||||||
|
For detailed Docker Compose configuration guidance, see: [DOCKER_COMPOSE.md](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DOCKER_COMPOSE.md)
|
||||||
36
docs/docker-troubleshooting/nginx-configuration-mount.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# Nginx Configuration Mount Issues
|
||||||
|
|
||||||
|
## Issue Description
|
||||||
|
|
||||||
|
You've configured a custom port for NetAlertX, but the required nginx configuration mount is missing or not writable. Without this mount, the container cannot apply your port changes and will fall back to the default port 20211.
|
||||||
|
|
||||||
|
## Security Ramifications
|
||||||
|
|
||||||
|
Running in read-only mode (as recommended) prevents the container from modifying its own nginx configuration. Without a writable mount, custom port configurations cannot be applied, potentially exposing the service on unintended ports or requiring fallback to defaults.
|
||||||
|
|
||||||
|
## Why You're Seeing This Issue
|
||||||
|
|
||||||
|
This occurs when you set a custom PORT environment variable (other than 20211) but haven't provided a writable mount for nginx configuration. The container needs to write custom nginx config files when running in read-only mode.
|
||||||
|
|
||||||
|
## How to Correct the Issue
|
||||||
|
|
||||||
|
If you want to use a custom port, create a bind mount for the nginx configuration:
|
||||||
|
|
||||||
|
- Create a directory on your host: `mkdir -p /path/to/nginx-config`
|
||||||
|
- Add to your docker-compose.yml:
|
||||||
|
```yaml
|
||||||
|
volumes:
|
||||||
|
- /path/to/nginx-config:/tmp/nginx/active-config
|
||||||
|
environment:
|
||||||
|
- PORT=your_custom_port
|
||||||
|
```
|
||||||
|
- Ensure it's owned by the netalertx user: `chown -R 20211:20211 /path/to/nginx-config`
|
||||||
|
- Set permissions: `chmod -R 700 /path/to/nginx-config`
|
||||||
|
|
||||||
|
If you don't need a custom port, simply omit the PORT environment variable and the container will use 20211 by default.
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
Docker Compose setup can be complex. We recommend starting with the default docker-compose.yml as a base and modifying it incrementally.
|
||||||
|
|
||||||
|
For detailed Docker Compose configuration guidance, see: [DOCKER_COMPOSE.md](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DOCKER_COMPOSE.md)
|
||||||
86
docs/docker-troubleshooting/port-conflicts.md
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
# Port Conflicts
|
||||||
|
|
||||||
|
## Issue Description
|
||||||
|
|
||||||
|
The configured application port (default 20211) or GraphQL API port (default 20212) is already in use by another service. This commonly occurs when you already have another NetAlertX instance running.
|
||||||
|
|
||||||
|
## Security Ramifications
|
||||||
|
|
||||||
|
Port conflicts prevent the application from starting properly, leaving network monitoring services unavailable. Running multiple instances on the same ports can also create configuration confusion and potential security issues if services are inadvertently exposed.
|
||||||
|
|
||||||
|
## Why You're Seeing This Issue
|
||||||
|
|
||||||
|
This error typically occurs when:
|
||||||
|
|
||||||
|
- **You already have NetAlertX running** - Another Docker container or devcontainer instance is using the default ports 20211 and 20212
|
||||||
|
- **Port conflicts with other services** - Other applications on your system are using these ports
|
||||||
|
- **Configuration error** - Both PORT and GRAPHQL_PORT environment variables are set to the same value
|
||||||
|
|
||||||
|
## How to Correct the Issue
|
||||||
|
|
||||||
|
### Check for Existing NetAlertX Instances
|
||||||
|
|
||||||
|
First, check if you already have NetAlertX running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Check for running NetAlertX containers
|
||||||
|
docker ps | grep netalertx
|
||||||
|
|
||||||
|
# Check for devcontainer processes
|
||||||
|
ps aux | grep netalertx
|
||||||
|
|
||||||
|
# Check what services are using the ports
|
||||||
|
netstat -tlnp | grep :20211
|
||||||
|
netstat -tlnp | grep :20212
|
||||||
|
```
|
||||||
|
|
||||||
|
### Stop Conflicting Instances
|
||||||
|
|
||||||
|
If you find another NetAlertX instance:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Stop specific container
|
||||||
|
docker stop <container_name>
|
||||||
|
|
||||||
|
# Stop all NetAlertX containers
|
||||||
|
docker stop $(docker ps -q --filter ancestor=jokob-sk/netalertx)
|
||||||
|
|
||||||
|
# Stop devcontainer services
|
||||||
|
# Use VS Code command palette: "Dev Containers: Rebuild Container"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configure Different Ports
|
||||||
|
|
||||||
|
If you need multiple instances, configure unique ports:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
environment:
|
||||||
|
- PORT=20211 # Main application port
|
||||||
|
- GRAPHQL_PORT=20212 # GraphQL API port
|
||||||
|
```
|
||||||
|
|
||||||
|
For a second instance, use different ports:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
environment:
|
||||||
|
- PORT=20213 # Different main port
|
||||||
|
- GRAPHQL_PORT=20214 # Different API port
|
||||||
|
```
|
||||||
|
|
||||||
|
### Alternative: Use Different Container Names
|
||||||
|
|
||||||
|
When running multiple instances, use unique container names:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
netalertx-primary:
|
||||||
|
# ... existing config
|
||||||
|
netalertx-secondary:
|
||||||
|
# ... config with different ports
|
||||||
|
```
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
Docker Compose setup can be complex. We recommend starting with the default docker-compose.yml as a base and modifying it incrementally.
|
||||||
|
|
||||||
|
For detailed Docker Compose configuration guidance, see: [DOCKER_COMPOSE.md](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DOCKER_COMPOSE.md)
|
||||||
27
docs/docker-troubleshooting/read-only-filesystem.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# Read-Only Filesystem Mode
|
||||||
|
|
||||||
|
## Issue Description
|
||||||
|
|
||||||
|
The container is running as read-write instead of read-only mode. This reduces the security hardening of the appliance.
|
||||||
|
|
||||||
|
## Security Ramifications
|
||||||
|
|
||||||
|
Read-only root filesystem is a security best practice that prevents malicious modifications to the container's filesystem. Running read-write allows potential attackers to modify system files or persist malware within the container.
|
||||||
|
|
||||||
|
## Why You're Seeing This Issue
|
||||||
|
|
||||||
|
This occurs when the Docker configuration doesn't mount the root filesystem as read-only. The application is designed as a security appliance that should prevent filesystem modifications.
|
||||||
|
|
||||||
|
## How to Correct the Issue
|
||||||
|
|
||||||
|
Enable read-only mode:
|
||||||
|
|
||||||
|
- In docker-compose.yml, add: `read_only: true`
|
||||||
|
- For docker run, use: `--read-only`
|
||||||
|
- Ensure necessary directories are mounted as writable volumes (tmp, logs, etc.)
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
Docker Compose setup can be complex. We recommend starting with the default docker-compose.yml as a base and modifying it incrementally.
|
||||||
|
|
||||||
|
For detailed Docker Compose configuration guidance, see: [DOCKER_COMPOSE.md](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DOCKER_COMPOSE.md)
|
||||||
29
docs/docker-troubleshooting/running-as-root.md
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# Running as Root User
|
||||||
|
|
||||||
|
## Issue Description
|
||||||
|
|
||||||
|
NetAlertX has detected that the container is running with root privileges (UID 0). This configuration bypasses all built-in security hardening measures designed to protect your system.
|
||||||
|
|
||||||
|
## Security Ramifications
|
||||||
|
|
||||||
|
Running security-critical applications like network monitoring tools as root grants unrestricted access to your host system. A successful compromise here could jeopardize your entire infrastructure, including other containers, host services, and potentially your network.
|
||||||
|
|
||||||
|
## Why You're Seeing This Issue
|
||||||
|
|
||||||
|
This typically occurs when you've explicitly overridden the container's default user in your Docker configuration, such as using `user: root` or `--user 0:0` in docker-compose.yml or docker run commands. The application is designed to run under a dedicated, non-privileged service account for security.
|
||||||
|
|
||||||
|
## How to Correct the Issue
|
||||||
|
|
||||||
|
Switch to the dedicated 'netalertx' user by removing any custom user directives:
|
||||||
|
|
||||||
|
- Remove `user:` entries from your docker-compose.yml
|
||||||
|
- Avoid `--user` flags in docker run commands
|
||||||
|
- Ensure the container runs with the default UID 20211:20211
|
||||||
|
|
||||||
|
After making these changes, restart the container. The application will automatically adjust ownership of required directories.
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
Docker Compose setup can be complex. We recommend starting with the default docker-compose.yml as a base and modifying it incrementally.
|
||||||
|
|
||||||
|
For detailed Docker Compose configuration guidance, see: [DOCKER_COMPOSE.md](https://github.com/jokob-sk/NetAlertX/blob/main/docs/DOCKER_COMPOSE.md)
|
||||||
0
install/production-filesystem/app/log/IP_changes.log → docs/docker-troubleshooting/troubleshooting.md
Executable file → Normal file
BIN
docs/img/BUILDS/build_images_options_tradeoffs.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
0
docs/img/DEBUG_GRAPHQL/Init_check.png → docs/img/DEBUG_API_SERVER/Init_check.png
Executable file → Normal file
|
Before Width: | Height: | Size: 135 KiB After Width: | Height: | Size: 135 KiB |
0
docs/img/DEBUG_GRAPHQL/app_conf_graphql_port.png → docs/img/DEBUG_API_SERVER/app_conf_graphql_port.png
Executable file → Normal file
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
0
docs/img/DEBUG_GRAPHQL/dev_console_graphql_json.png → docs/img/DEBUG_API_SERVER/dev_console_graphql_json.png
Executable file → Normal file
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
0
docs/img/DEBUG_GRAPHQL/graphql_running_logs.png → docs/img/DEBUG_API_SERVER/graphql_running_logs.png
Executable file → Normal file
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
0
docs/img/DEBUG_GRAPHQL/graphql_settings_port_token.png → docs/img/DEBUG_API_SERVER/graphql_settings_port_token.png
Executable file → Normal file
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
0
docs/img/DEBUG_GRAPHQL/network_graphql.png → docs/img/DEBUG_API_SERVER/network_graphql.png
Executable file → Normal file
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
BIN
docs/img/PIHOLE_GUIDE/PIHOLEAPI_settings.png
Normal file
|
After Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 23 KiB |
BIN
docs/img/SYNOLOGY/10_permissions_before.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
docs/img/SYNOLOGY/11_permissions_create_scheduled_task.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
docs/img/SYNOLOGY/12_permissions_task_general.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
docs/img/SYNOLOGY/13_permissions_task_schedule.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
docs/img/SYNOLOGY/14_permissions_task_settings.png
Normal file
|
After Width: | Height: | Size: 27 KiB |