Scanning Operational with monitoring

This commit is contained in:
Adam Outler
2025-09-30 22:01:03 -04:00
parent 044035ef62
commit 0cd1dc8987
15 changed files with 739 additions and 116 deletions

View File

@@ -33,6 +33,7 @@ ENV NETALERTX_FRONT=${NETALERTX_APP}/front
ENV NETALERTX_SERVER=${NETALERTX_APP}/server
ENV NETALERTX_API=${NETALERTX_APP}/api
ENV NETALERTX_DB=${NETALERTX_APP}/db
ENV NETALERTX_DB_FILE=${NETALERTX_DB}/app.db
ENV NETALERTX_BACK=${NETALERTX_APP}/back
ENV NETALERTX_LOG=${NETALERTX_APP}/log
ENV NETALERTX_PLUGINS_LOG=${NETALERTX_LOG}/plugins
@@ -55,13 +56,14 @@ ENV LOG_CROND=${NETALERTX_LOG}/crond.log
ENV SYSTEM_SERVICES=/services
ENV SYSTEM_SERVICES_CONFIG=${SYSTEM_SERVICES}/config
ENV SYSTEM_NGINIX_CONFIG=${SYSTEM_SERVICES_CONFIG}/nginx
ENV NGINX_CONFIG_FILE=${SYSTEM_NGINIX_CONFIG}/nginx.conf
ENV SYSTEM_NGINX_CONFIG_FILE=${SYSTEM_NGINIX_CONFIG}/nginx.conf
ENV NETALERTX_CONFIG_FILE=${NETALERTX_CONFIG}/app.conf
ENV NETALERTX_DB_FILE=${NETALERTX_DB}/app.db
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_CROND=${SYSTEM_SERVICES_CONFIG}/crond
ENV SYSTEM_SERVICES_PHP_RUN=${SYSTEM_SERVICES}/run
ENV SYSTEM_SERVICES_RUN=${SYSTEM_SERVICES}/run
ENV SYSTEM_SERVICES_RUN_TMP=${SYSTEM_SERVICES_RUN}/tmp
ENV SYSTEM_SERVICES_RUN_LOG=${SYSTEM_SERVICES_RUN}/logs
ENV PHP_FPM_CONFIG_FILE=${SYSTEM_SERVICES_PHP_FOLDER}/php-fpm.conf
ENV PYTHONPATH=${NETALERTX_SERVER}
@@ -69,15 +71,16 @@ ENV PYTHONPATH=${NETALERTX_SERVER}
RUN apk add --no-cache bash mtr libbsd zip lsblk sudo tzdata curl arp-scan iproute2 \
iproute2-ss nmap 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 \
nginx sudo libcap shadow && \
rm -rf /var/cache/apk/* && \
rm -f /etc/nginx/http.d/default.conf
iproute2-ss nmap 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 \
nginx sudo shadow && \
rm -Rf /var/cache/apk/* && \
rm -Rf /etc/nginx && \
addgroup -g 20211 netalertx && \
adduser -u 20211 -D -h ${NETALERTX_APP} -G netalertx netalertx && \
apk del shadow
#Create netalertx user and group
RUN addgroup -g 20211 netalertx && \
adduser -u 20211 -D -h ${NETALERTX_APP} -G netalertx netalertx
# Install application, copy files, set permissions
COPY --from=builder --chown=20212:20212 /opt/venv /opt/venv
@@ -86,33 +89,36 @@ COPY --chown=netalertx:netalertx install/production-filesystem/ /
COPY --chown=netalertx:netalertx --chmod=755 back ${NETALERTX_BACK}
COPY --chown=netalertx:netalertx --chmod=755 front ${NETALERTX_FRONT}
COPY --chown=netalertx:netalertx --chmod=755 server ${NETALERTX_SERVER}
RUN install -d -o netalertx -g netalertx -m 755 ${NETALERTX_API} ${NETALERTX_LOG} ${SYSTEM_SERVICES_PHP_RUN} && \
RUN install -d -o netalertx -g netalertx -m 755 ${NETALERTX_API} \
${NETALERTX_LOG} ${SYSTEM_SERVICES_RUN_TMP} ${SYSTEM_SERVICES_RUN_LOG} && \
sh -c "find ${NETALERTX_APP} -type f \( -name '*.sh' -o -name 'speedtest-cli' \) \
-exec chmod 750 {} \;"
# setcap to allow network tools with raw packet access to run without root
RUN 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/traceroute && \
setcap cap_net_raw,cap_net_admin+eip /opt/venv/bin/scapy
#initialize each service with the dockerfiles/init-*.sh scripts, once.
RUN /bin/sh /build/init-nginx.sh && \
RUN apk add libcap && \
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/traceroute && \
setcap cap_net_raw,cap_net_admin+eip /opt/venv/bin/scapy && \
/bin/sh /build/init-nginx.sh && \
/bin/sh /build/init-php-fpm.sh && \
/bin/sh /build/init-crond.sh && \
/bin/sh /build/init-backend.sh && \
rm -rf /build
rm -rf /build && \
apk del libcap
# set netalertx to allow sudoers for any command, no password
RUN echo "netalertx ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
ENTRYPOINT ["/bin/sh","-c","sleep infinity"]
# Final hardened stage to improve security by setting correct permissions and removing sudo access
# Final hardened stage to improve security by setting least possible permissions and removing sudo access.
# When complete, if the image is compromised, there's not much that can be done with it.
# This stage is separate from Runner stage so that devcontainer can use the Runner stage.
FROM runner AS hardened
# create readonly user and group with no shell access. Readonly user marks folders that are created by NetAlertX, but should not be modified.
# create readonly user and group with no shell access.
# Readonly user marks folders that are created by NetAlertX, but should not be modified.
RUN addgroup -g 20212 readonly && \
adduser -u 20212 -G readonly -D -h /app readonly && \
usermod -s /sbin/nologin readonly
@@ -126,15 +132,15 @@ RUN chown -R readonly:readonly ${NETALERTX_BACK} ${NETALERTX_FRONT} ${NETALERTX_
chmod -R 005 ${SYSTEM_SERVICES} ${SYSTEM_SERVICES}/* && \
chown -R netalertx:netalertx ${NETALERTX_CONFIG} ${NETALERTX_DB} ${NETALERTX_API} ${NETALERTX_LOG} && \
chmod -R 600 ${NETALERTX_CONFIG} ${NETALERTX_DB} ${NETALERTX_API} ${NETALERTX_LOG} && \
chmod 700 ${NETALERTX_CONFIG} ${NETALERTX_DB} ${NETALERTX_API} ${NETALERTX_LOG} ${NETALERTX_PLUGINS_LOG} SYSTEM_SERVICES_PHP_RUN&& \
chmod 700 ${NETALERTX_CONFIG} ${NETALERTX_DB} ${NETALERTX_API} ${NETALERTX_LOG} ${NETALERTX_PLUGINS_LOG} ${SYSTEM_SERVICES_RUN_TMP} && \
chown readonly:readonly /entrypoint.sh && \
install -d -o netalertx -g netalertx -m 700 /services/run && \
install -d -o netalertx -g netalertx -m 700 ${SYSTEM_SERVICES_RUN} ${SYSTEM_SERVICES_RUN_TMP} ${SYSTEM_SERVICES_RUN_LOG} && \
chmod 005 /entrypoint.sh
#
# remove sudo and alpine installers pacakges
RUN apk del sudo libcap apk-tools && \
rm -rf /var/cache/apk/*
RUN apk del sudo apk-tools && \
rm -rf /var/cache/apk/*
# remove all users and groups except readonly and netalertx & remove all sudoers
RUN rm -Rf /etc/sudoers.d/* /etc/shadow /etc/gshadow /etc/sudoers \
/lib/apk /lib/firmware /lib/modules-load.d /lib/sysctl.d /mnt /home/ /root \
@@ -165,15 +171,18 @@ ENTRYPOINT [ "/bin/sh", "/entrypoint.sh" ]
FROM runner AS netalertx-devcontainer
ENV INSTALL_DIR=/app
ENV PYTHONPATH=/workspaces/NetAlertX/test:/workspaces/NetAlertX/server:/app:/app/server:/opt/venv/lib/python3.12/site-packages
ENV PATH=/services:${PATH}
COPY .devcontainer/resources/devcontainer-overlay/ /
# 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
# Install debugpy in the virtualenv if present, otherwise into system python3
RUN /bin/sh -c '(/opt/venv/bin/python3 -m pip install --no-cache-dir debugpy) || (python3 -m pip install --no-cache-dir debugpy) || true'
RUN python -m pip install -U pytest pytest-cov
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
ENTRYPOINT ["/bin/sh","-c","sleep infinity"]

View File

@@ -7,15 +7,18 @@
FROM runner AS netalertx-devcontainer
ENV INSTALL_DIR=/app
ENV PYTHONPATH=/workspaces/NetAlertX/test:/workspaces/NetAlertX/server:/app:/app/server:/opt/venv/lib/python3.12/site-packages
ENV PATH=/services:${PATH}
COPY .devcontainer/resources/devcontainer-overlay/ /
# 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
# Install debugpy in the virtualenv if present, otherwise into system python3
RUN /bin/sh -c '(/opt/venv/bin/python3 -m pip install --no-cache-dir debugpy) || (python3 -m pip install --no-cache-dir debugpy) || true'
RUN python -m pip install -U pytest pytest-cov
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
ENTRYPOINT ["/bin/sh","-c","sleep infinity"]

View File

@@ -0,0 +1 @@
-m debugpy --listen 0.0.0.0:5678

View File

@@ -0,0 +1,358 @@
Starting backend...
* Tip: There are .env files present. Install python-dotenv to use them.
22:58:42 ['[Settings] ⚠ File not found: /app/api/table_settings.json']
22:58:42 ['[Settings] ⚠ File not found: /app/api/table_settings.json']
22:58:42 ['[Settings] ⚠ File not found: /app/api/table_settings.json']
22:58:42 ['[Settings] ⚠ File not found: /app/api/table_settings.json']
22:58:42 ['[Settings] ⚠ File not found: /app/api/table_settings.json']
22:58:42 ['[Settings] ⚠ File not found: /app/api/table_settings.json']
22:58:42 ['[MAIN] Setting up ...']
22:58:42 ['[conf.tz] Setting up ...']
22:58:42 ['\n']
22:58:42 ['The backend restarted (started). If this is unexpected check https://bit.ly/NetAlertX_debug for troubleshooting tips.']
22:58:42 ['\n']
22:58:42 ['Permissions check (All should be True)']
22:58:42 ['------------------------------------------------']
22:58:42 [' ', '/config/app.conf', ' | ', ' READ | ', True]
22:58:42 [' ', '/config/app.conf', ' | ', ' WRITE | ', True]
22:58:42 [' ', '/db/app.db', ' | ', ' READ | ', True]
22:58:42 [' ', '/db/app.db', ' | ', ' WRITE | ', True]
22:58:42 ['------------------------------------------------']
22:58:42 ['[Version check] Running the latest version.']
22:58:42 [Database] Opening DB
22:58:42 ['[db_upgrade] Re-creating Settings table']
22:58:42 ['[db_upgrade] Re-creating Parameters table']
22:58:42 ['[WF] Failed to load workflows.json']
22:58:42 [Config] reading config file
22:58:43 ['[Config] Plugins: Number of all plugins (including not loaded): ', 45]
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'Arp-Scan (Network scan)']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'This plugin is to execute an arp-scan on the local network']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'AVAHISCAN (Name discovery)']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'A plugin to discover device names via mDNS.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'Internet-Check']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'A plugin to check your internet connectivity and IP.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'NBTSCAN (Name discovery)']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'A plugin to discover device names via NetBIOS.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'NSLOOKUP (Name discovery)']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'A plugin to discover device names.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'Dig (Name resolution)']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'A plugin to resolve device names via Dig.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'Email publisher (SMTP)']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'A plugin to publish a notification via Email (SMTP) gateway.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'CSV backup']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'A plugin to auto-generate devices.csv backups.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'Custom properties']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'Settings related to the custom properties functionality on a device.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'DB cleanup']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'A plugin to schedule database cleanup & upkeep tasks.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'Maintenance']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'A plugin for maintenance tasks.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'New Devices']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'The template used for new devices.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'Notification Processing']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'A plugin to for advanced notification processing.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'Set password']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'A simple plugin to set the web ui password on app start.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'Sync Hub']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'Plugin to synchronize multiple NetAlertX instances.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'UI settings']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'Plugin to adjust UI settings.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'Vendor update']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'A plugin to schedule vendor database updates for mac based vendor resolution.']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'Workflows']
22:58:43 ['[Plugin utils] ', 'description', ': ', 'A plugin to adjust behavior of workflows.']
22:58:43 ['[Config] ⛔ Unloading WEBMON']
22:58:43 ['[Config] ⛔ Unloading INTRSPD']
22:58:43 ['[Config] ⛔ Unloading DDNS']
22:58:43 ['[Config] ⛔ Unloading WEBHOOK']
22:58:43 ['[Config] ⛔ Unloading TELEGRAM']
22:58:43 ['[Config] ⛔ Unloading PUSHSAFER']
22:58:43 ['[Config] ⛔ Unloading PUSHOVER']
22:58:43 ['[Config] ⛔ Unloading NTFY']
22:58:43 ['[Config] ⛔ Unloading MQTT']
22:58:43 ['[Config] ⛔ Unloading APPRISE']
22:58:43 ['[Config] ⛔ Unloading NMAP']
22:58:43 ['[Config] ⛔ Unloading ICMP']
22:58:43 ['[Config] ⛔ Unloading NMAPDEV']
22:58:43 ['[Config] ⛔ Unloading DHCPSRVS']
22:58:43 ['[Config] ⛔ Unloading DHCPLSS']
22:58:43 ['[Config] ⛔ Unloading PIHOLE']
22:58:43 ['[Config] ⛔ Unloading UNFIMP']
22:58:43 ['[Config] ⛔ Unloading SNMPDSC']
22:58:43 ['[Config] ⛔ Unloading MTSCAN']
22:58:43 ['[Config] ⛔ Unloading LUCIRPC']
22:58:43 ['[Config] ⛔ Unloading ASUSWRT']
22:58:43 ['[Config] ⛔ Unloading WOL']
22:58:43 ['[Config] ⛔ Unloading UNIFIAPI']
22:58:43 ['[Config] ⛔ Unloading OMDSDNOPENAPI']
22:58:43 ['[Config] ⛔ Unloading OMDSDN']
22:58:43 ['[Config] ⛔ Unloading IPNEIGH']
22:58:43 ['[Config] ⛔ Unloading FREEBOX']
22:58:43 ['[Config] Number of Plugins to load: ', 18]
22:58:43 ['[Config] Plugins to load: ', ['ARPSCAN', 'AVAHISCAN', 'INTRNT', 'NBTSCAN', 'NSLOOKUP', 'DIGSCAN', 'SMTP', 'CSVBCKP', 'CUSTPROP', 'DBCLNP', 'MAINT', 'NEWDEV', 'NTFPRCS', 'SETPWD', 'SYNC', 'UI', 'VNDRPDT', 'WORKFLOWS']]
22:58:43 ['[Config] App upgraded 🚀']
22:58:43 ['[graphql endpoint] Starting on port: 20212']
22:58:43 [Config] Imported new settings config
* Serving Flask app 'api_server.api_server_start'
* Debug mode: on
22:58:43 [Scheduler] run for ARPSCAN: NO
22:58:43 [Scheduler] run for INTRNT: NO
22:58:43 [Scheduler] run for CSVBCKP: NO
22:58:43 [Scheduler] run for DBCLNP: NO
22:58:43 [Scheduler] run for MAINT: NO
22:58:43 [Scheduler] run for VNDRPDT: NO
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'AVAHISCAN (Name discovery)']
22:58:43 ['[Plugins] Executing: ', 'python3 /app/front/plugins/avahi_scan/avahi_scan.py']
22:58:43 ['[Plugins] Output: [plugin_helper] reading config file\n22:58:43 [\'[AVAHISCAN] In script\']\n22:58:43 [Database] Opening DB\n22:58:43 [\'[AVAHISCAN] REFRESH_FQDN is false, getting devices with unknown hostnames.\']\n22:58:43 [\'[AVAHISCAN] Devices to scan: 6\']\n22:58:43 ["[AVAHISCAN] IPs to be scanned: [\'73.49.179.94\', \'172.17.0.2\', \'172.17.0.3\', \'172.17.0.3\', \'172.17.0.2\', \'172.17.0.2\']"]\n22:58:43 [\'[AVAHISCAN] Error resolving 73.49.179.94: The DNS query name does not exist: 94.179.49.73.in-addr.arpa.\']\n22:58:43 [\'[AVAHISCAN] Error resolving 172.17.0.2: The DNS query name does not exist: 2.0.17.172.in-addr.arpa.\']\n22:58:43 [\'[AVAHISCAN] Error resolving 172.17.0.3: The DNS query name does not exist: 3.0.17.172.in-addr.arpa.\']\n22:58:43 [\'[AVAHISCAN] Error resolving 172.17.0.3: The DNS query name does not exist: 3.0.17.172.in-addr.arpa.\']\n22:58:43 [\'[AVAHISCAN] Error resolving 172.17.0.2: The DNS query name does not exist: 2.0.17.172.in-addr.arpa.\']\n22:58:43 [\'[AVAHISCAN] Error resolving 172.17.0.2: The DNS query name does not exist: 2.0.17.172.in-addr.arpa.\']\n22:58:43 [\'[AVAHISCAN] Active resolution finished. Found 0 hosts.\']\n22:58:43 [\'[AVAHISCAN] Script finished\']\n']
22:58:43 ['[HELPER] ⚠ ERROR not processed set_type: {"dataType":"array","elements":[{"elementType":"select","elementOptions":[{"multiple":"true","ordeable":"true"}],"transformers":[]},{"elementType":"button","elementOptions":[{"sourceSuffixes":[]},{"separator":""},{"cssClasses":"col-xs-12"},{"onClick":"selectChange(this)"},{"getStringKey":"Gen_Change"}],"transformers":[]}]} ']
22:58:43 ["[HELPER] ⚠ ERROR not processed set_value: ['ARPSCAN', 'AVAHISCAN', 'CSVBCKP', 'DBCLNP', 'DIGSCAN', 'INTRNT', 'MAINT', 'NEWDEV', 'NBTSCAN', 'NSLOOKUP', 'NTFPRCS', 'SETPWD', 'SMTP', 'SYNC', 'VNDRPDT', 'WORKFLOWS', 'UI', 'CUSTPROP'] "]
22:58:43 ['[Plugins] Processed and deleted file: /app/log/plugins/last_result.AVAHISCAN.log ']
22:58:43 ['[Plugins] No output received from the plugin "AVAHISCAN"']
22:58:43 ['[Plugin utils] ---------------------------------------------']
22:58:43 ['[Plugin utils] ', 'display_name', ': ', 'NBTSCAN (Name discovery)']
22:58:43 ['[Plugins] Executing: ', 'python3 /app/front/plugins/nbtscan_scan/nbtscan.py']
22:58:49 ["[Plugins] Output: [plugin_helper] reading config file\n22:58:43 ['[NBTSCAN] In script']\n22:58:43 [Database] Opening DB\n22:58:43 ['[NBTSCAN] Devices count: 6']\n22:58:43 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '73.49.179.94']]\n22:58:44 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 73.49.179.94\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n22:58:44 ['[NBTSCAN] Domain Name: ']\n22:58:44 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.2']]\n22:58:45 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.2\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n22:58:45 ['[NBTSCAN] Domain Name: ']\n22:58:45 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.3']]\n22:58:46 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.3\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n22:58:46 ['[NBTSCAN] Domain Name: ']\n22:58:46 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.3']]\n22:58:47 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.3\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n22:58:47 ['[NBTSCAN] Domain Name: ']\n22:58:47 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.2']]\n22:58:48 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.2\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n22:58:48 ['[NBTSCAN] Domain Name: ']\n22:58:48 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.2']]\n22:58:49 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.2\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n22:58:49 ['[NBTSCAN] Domain Name: ']\n22:58:49 ['[NBTSCAN] Script finished']\n"]
22:58:49 ['[Plugins] Processed and deleted file: /app/log/plugins/last_result.NBTSCAN.log ']
22:58:49 ['[Plugins] No output received from the plugin "NBTSCAN"']
22:58:49 ['[Plugin utils] ---------------------------------------------']
22:58:49 ['[Plugin utils] ', 'display_name', ': ', 'NSLOOKUP (Name discovery)']
22:58:49 ['[Plugins] Executing: ', 'python3 /app/front/plugins/nslookup_scan/nslookup.py']
22:58:49 ["[Plugins] Output: [plugin_helper] reading config file\n22:58:49 ['[NSLOOKUP] In script']\n22:58:49 [Database] Opening DB\n22:58:49 ['[NSLOOKUP] Devices count: 6']\n22:58:49 ['[NSLOOKUP]', 'No PTR record found for IP: 73.49.179.94']\n22:58:49 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.2']\n22:58:49 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.3']\n22:58:49 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.3']\n22:58:49 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.2']\n22:58:49 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.2']\n22:58:49 ['[NSLOOKUP] Script finished']\n"]
22:58:49 ['[Plugins] Processed and deleted file: /app/log/plugins/last_result.NSLOOKUP.log ']
22:58:49 ['[Plugins] No output received from the plugin "NSLOOKUP"']
22:58:49 ['[Plugin utils] ---------------------------------------------']
22:58:49 ['[Plugin utils] ', 'display_name', ': ', 'Dig (Name resolution)']
22:58:49 ['[Plugins] Executing: ', 'python3 /app/front/plugins/dig_scan/digscan.py']
22:58:49 ["[Plugins] Output: [plugin_helper] reading config file\n22:58:49 ['[DIGSCAN] In script']\n22:58:49 [Database] Opening DB\n22:58:49 ['[DIGSCAN] Devices count: 6']\n22:58:49 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '73.49.179.94']]\n22:58:49 ['[DIGSCAN] DEBUG OUTPUT : ']\n22:58:49 ['[DIGSCAN] Domain Name: ']\n22:58:49 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.2']]\n22:58:49 ['[DIGSCAN] DEBUG OUTPUT : ']\n22:58:49 ['[DIGSCAN] Domain Name: ']\n22:58:49 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.3']]\n22:58:49 ['[DIGSCAN] DEBUG OUTPUT : ']\n22:58:49 ['[DIGSCAN] Domain Name: ']\n22:58:49 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.3']]\n22:58:49 ['[DIGSCAN] DEBUG OUTPUT : ']\n22:58:49 ['[DIGSCAN] Domain Name: ']\n22:58:49 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.2']]\n22:58:49 ['[DIGSCAN] DEBUG OUTPUT : ']\n22:58:49 ['[DIGSCAN] Domain Name: ']\n22:58:49 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.2']]\n22:58:49 ['[DIGSCAN] DEBUG OUTPUT : ']\n22:58:49 ['[DIGSCAN] Domain Name: ']\n22:58:49 ['[DIGSCAN] Script finished']\n"]
22:58:49 ['[Plugins] Processed and deleted file: /app/log/plugins/last_result.DIGSCAN.log ']
22:58:49 ['[Plugins] No output received from the plugin "DIGSCAN"']
22:58:49 [Update Device Name] Trying to resolve devices without name. Unknown devices count: 6
22:58:49 [Update Device Name] Names Found (DiG/mDNS/NSLOOKUP/NBTSCAN): 0 (0/0/0/0)
22:58:49 [Update Device Name] Names Not Found : 6
22:58:49 ['[Notification] Check if something to report']
22:58:49 ['[Notification] Included sections: ', ['new_devices', 'down_devices', 'events']]
22:58:49 ['[Notification] No changes to report']
22:58:49 ['[MAIN] Process: Idle']
22:58:49 ['[WF] get_new_app_events - new events count: 0']
22:58:55 ['[WF] get_new_app_events - new events count: 0']
22:59:00 ['[WF] get_new_app_events - new events count: 0']
22:59:05 ['[WF] get_new_app_events - new events count: 0']
22:59:10 ['[WF] get_new_app_events - new events count: 0']
22:59:15 ['[WF] get_new_app_events - new events count: 0']
22:59:20 ['[WF] get_new_app_events - new events count: 0']
22:59:25 ['[WF] get_new_app_events - new events count: 0']
22:59:30 ['[WF] get_new_app_events - new events count: 0']
22:59:35 ['[WF] get_new_app_events - new events count: 0']
22:59:40 ['[WF] get_new_app_events - new events count: 0']
22:59:45 [Scheduler] run for ARPSCAN: NO
22:59:45 [Scheduler] run for INTRNT: NO
22:59:45 [Scheduler] run for CSVBCKP: NO
22:59:45 [Scheduler] run for DBCLNP: NO
22:59:45 [Scheduler] run for MAINT: NO
22:59:45 [Scheduler] run for VNDRPDT: NO
22:59:45 ['[Plugin utils] ---------------------------------------------']
22:59:45 ['[Plugin utils] ', 'display_name', ': ', 'AVAHISCAN (Name discovery)']
22:59:45 ['[Plugins] Executing: ', 'python3 /app/front/plugins/avahi_scan/avahi_scan.py']
22:59:45 ['[Plugins] Output: [plugin_helper] reading config file\n22:59:45 [\'[AVAHISCAN] In script\']\n22:59:45 [Database] Opening DB\n22:59:45 [\'[AVAHISCAN] REFRESH_FQDN is false, getting devices with unknown hostnames.\']\n22:59:45 [\'[AVAHISCAN] Devices to scan: 6\']\n22:59:45 ["[AVAHISCAN] IPs to be scanned: [\'73.49.179.94\', \'172.17.0.2\', \'172.17.0.3\', \'172.17.0.3\', \'172.17.0.2\', \'172.17.0.2\']"]\n22:59:45 [\'[AVAHISCAN] Error resolving 73.49.179.94: The DNS query name does not exist: 94.179.49.73.in-addr.arpa.\']\n22:59:45 [\'[AVAHISCAN] Error resolving 172.17.0.2: The DNS query name does not exist: 2.0.17.172.in-addr.arpa.\']\n22:59:45 [\'[AVAHISCAN] Error resolving 172.17.0.3: The DNS query name does not exist: 3.0.17.172.in-addr.arpa.\']\n22:59:45 [\'[AVAHISCAN] Error resolving 172.17.0.3: The DNS query name does not exist: 3.0.17.172.in-addr.arpa.\']\n22:59:45 [\'[AVAHISCAN] Error resolving 172.17.0.2: The DNS query name does not exist: 2.0.17.172.in-addr.arpa.\']\n22:59:45 [\'[AVAHISCAN] Error resolving 172.17.0.2: The DNS query name does not exist: 2.0.17.172.in-addr.arpa.\']\n22:59:45 [\'[AVAHISCAN] Active resolution finished. Found 0 hosts.\']\n22:59:45 [\'[AVAHISCAN] Script finished\']\n']
22:59:45 ['[Plugins] Processed and deleted file: /app/log/plugins/last_result.AVAHISCAN.log ']
22:59:45 ['[Plugins] No output received from the plugin "AVAHISCAN"']
22:59:45 ['[Plugin utils] ---------------------------------------------']
22:59:45 ['[Plugin utils] ', 'display_name', ': ', 'NBTSCAN (Name discovery)']
22:59:45 ['[Plugins] Executing: ', 'python3 /app/front/plugins/nbtscan_scan/nbtscan.py']
22:59:51 ["[Plugins] Output: [plugin_helper] reading config file\n22:59:45 ['[NBTSCAN] In script']\n22:59:45 [Database] Opening DB\n22:59:45 ['[NBTSCAN] Devices count: 6']\n22:59:45 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '73.49.179.94']]\n22:59:46 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 73.49.179.94\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n22:59:46 ['[NBTSCAN] Domain Name: ']\n22:59:46 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.2']]\n22:59:47 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.2\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n22:59:47 ['[NBTSCAN] Domain Name: ']\n22:59:47 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.3']]\n22:59:48 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.3\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n22:59:48 ['[NBTSCAN] Domain Name: ']\n22:59:48 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.3']]\n22:59:49 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.3\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n22:59:49 ['[NBTSCAN] Domain Name: ']\n22:59:49 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.2']]\n22:59:50 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.2\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n22:59:50 ['[NBTSCAN] Domain Name: ']\n22:59:50 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.2']]\n22:59:51 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.2\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n22:59:51 ['[NBTSCAN] Domain Name: ']\n22:59:51 ['[NBTSCAN] Script finished']\n"]
22:59:51 ['[Plugins] Processed and deleted file: /app/log/plugins/last_result.NBTSCAN.log ']
22:59:51 ['[Plugins] No output received from the plugin "NBTSCAN"']
22:59:51 ['[Plugin utils] ---------------------------------------------']
22:59:51 ['[Plugin utils] ', 'display_name', ': ', 'NSLOOKUP (Name discovery)']
22:59:51 ['[Plugins] Executing: ', 'python3 /app/front/plugins/nslookup_scan/nslookup.py']
22:59:51 ["[Plugins] Output: [plugin_helper] reading config file\n22:59:51 ['[NSLOOKUP] In script']\n22:59:51 [Database] Opening DB\n22:59:51 ['[NSLOOKUP] Devices count: 6']\n22:59:51 ['[NSLOOKUP]', 'No PTR record found for IP: 73.49.179.94']\n22:59:51 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.2']\n22:59:51 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.3']\n22:59:51 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.3']\n22:59:51 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.2']\n22:59:51 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.2']\n22:59:51 ['[NSLOOKUP] Script finished']\n"]
22:59:51 ['[Plugins] Processed and deleted file: /app/log/plugins/last_result.NSLOOKUP.log ']
22:59:51 ['[Plugins] No output received from the plugin "NSLOOKUP"']
22:59:51 ['[Plugin utils] ---------------------------------------------']
22:59:51 ['[Plugin utils] ', 'display_name', ': ', 'Dig (Name resolution)']
22:59:51 ['[Plugins] Executing: ', 'python3 /app/front/plugins/dig_scan/digscan.py']
22:59:52 ["[Plugins] Output: [plugin_helper] reading config file\n22:59:52 ['[DIGSCAN] In script']\n22:59:52 [Database] Opening DB\n22:59:52 ['[DIGSCAN] Devices count: 6']\n22:59:52 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '73.49.179.94']]\n22:59:52 ['[DIGSCAN] DEBUG OUTPUT : ']\n22:59:52 ['[DIGSCAN] Domain Name: ']\n22:59:52 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.2']]\n22:59:52 ['[DIGSCAN] DEBUG OUTPUT : ']\n22:59:52 ['[DIGSCAN] Domain Name: ']\n22:59:52 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.3']]\n22:59:52 ['[DIGSCAN] DEBUG OUTPUT : ']\n22:59:52 ['[DIGSCAN] Domain Name: ']\n22:59:52 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.3']]\n22:59:52 ['[DIGSCAN] DEBUG OUTPUT : ']\n22:59:52 ['[DIGSCAN] Domain Name: ']\n22:59:52 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.2']]\n22:59:52 ['[DIGSCAN] DEBUG OUTPUT : ']\n22:59:52 ['[DIGSCAN] Domain Name: ']\n22:59:52 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.2']]\n22:59:52 ['[DIGSCAN] DEBUG OUTPUT : ']\n22:59:52 ['[DIGSCAN] Domain Name: ']\n22:59:52 ['[DIGSCAN] Script finished']\n"]
22:59:52 ['[Plugins] Processed and deleted file: /app/log/plugins/last_result.DIGSCAN.log ']
22:59:52 ['[Plugins] No output received from the plugin "DIGSCAN"']
22:59:52 [Update Device Name] Trying to resolve devices without name. Unknown devices count: 6
22:59:52 [Update Device Name] Names Found (DiG/mDNS/NSLOOKUP/NBTSCAN): 0 (0/0/0/0)
22:59:52 [Update Device Name] Names Not Found : 6
22:59:52 ['[Notification] Check if something to report']
22:59:52 ['[Notification] Included sections: ', ['new_devices', 'down_devices', 'events']]
22:59:52 ['[Notification] No changes to report']
22:59:52 ['[MAIN] Process: Idle']
22:59:52 ['[WF] get_new_app_events - new events count: 0']
22:59:57 ['[WF] get_new_app_events - new events count: 0']
23:00:02 ['[WF] get_new_app_events - new events count: 0']
23:00:07 ['[WF] get_new_app_events - new events count: 0']
23:00:12 ['[WF] get_new_app_events - new events count: 0']
23:00:17 ['[WF] get_new_app_events - new events count: 0']
23:00:22 ['[WF] get_new_app_events - new events count: 0']
23:00:27 ['[WF] get_new_app_events - new events count: 0']
23:00:32 ['[WF] get_new_app_events - new events count: 0']
23:00:37 ['[WF] get_new_app_events - new events count: 0']
23:00:42 ['[WF] get_new_app_events - new events count: 0']
23:00:47 [Scheduler] run for ARPSCAN: YES
23:00:47 ['[Plugin utils] ---------------------------------------------']
23:00:47 ['[Plugin utils] ', 'display_name', ': ', 'Arp-Scan (Network scan)']
23:00:47 ['[Plugins] Executing: ', 'python3 /app/front/plugins/arp_scan/script.py userSubnets={subnets}']
23:05:47 ['[Plugins] ⚠ ERROR - TIMEOUT - the plugin ARPSCAN forcefully terminated as timeout reached. Increase TIMEOUT setting and scan interval.']
23:05:47 ['[HELPER] ⚠ ERROR not processed set_type: {"dataType":"array","elements":[{"elementType":"select","elementOptions":[{"multiple":"true","ordeable":"true"}],"transformers":[]},{"elementType":"button","elementOptions":[{"sourceSuffixes":[]},{"separator":""},{"cssClasses":"col-xs-12"},{"onClick":"selectChange(this)"},{"getStringKey":"Gen_Change"}],"transformers":[]}]} ']
23:05:47 ["[HELPER] ⚠ ERROR not processed set_value: ['ARPSCAN', 'AVAHISCAN', 'CSVBCKP', 'DBCLNP', 'DIGSCAN', 'INTRNT', 'MAINT', 'NEWDEV', 'NBTSCAN', 'NSLOOKUP', 'NTFPRCS', 'SETPWD', 'SMTP', 'SYNC', 'VNDRPDT', 'WORKFLOWS', 'UI', 'CUSTPROP'] "]
23:05:47 ['[Plugins] No output received from the plugin "ARPSCAN"']
23:05:47 [Scheduler] run for INTRNT: YES
23:05:47 ['[Plugin utils] ---------------------------------------------']
23:05:47 ['[Plugin utils] ', 'display_name', ': ', 'Internet-Check']
23:05:47 ['[Plugins] Executing: ', 'python3 /app/front/plugins/internet_ip/script.py prev_ip={prev_ip} INTRNT_DIG_GET_IP_ARG={INTRNT_DIG_GET_IP_ARG}']
23:05:47 ["[Plugins] Output: [plugin_helper] reading config file\n23:05:47 ['[INTRNT] In script']\n23:05:47 ['[INTRNT] INTRNT_DIG_GET_IP_ARG: ', '-4 myip.opendns.com @resolver1.opendns.com']\n23:05:47 ['[INTRNT] - Retrieving Internet IP']\n23:05:47 ['[INTRNT] DIG result : 73.49.179.94\\n']\n23:05:47 ['[INTRNT] Current internet_IP : 73.49.179.94']\n23:05:47 ['[INTRNT] previous_IP : 73.49.179.94']\n23:05:47 ['[INTRNT] Finished ']\n"]
23:05:47 ['[Plugins] Processed and deleted file: /app/log/plugins/last_result.INTRNT.log ']
23:05:47 ['[Plugins] SUCCESS for INTRNT received 1 entries']
23:05:47 ['[Plugins] Processing : ', 'INTRNT']
23:05:47 ['[Plugins] Should I update API (userUpdatedDevices): False']
23:05:47 [Scheduler] run for CSVBCKP: NO
23:05:47 [Scheduler] run for DBCLNP: YES
23:05:47 ['[Plugin utils] ---------------------------------------------']
23:05:47 ['[Plugin utils] ', 'display_name', ': ', 'DB cleanup']
23:05:47 ['[Plugins] Executing: ', 'python3 /app/front/plugins/db_cleanup/script.py']
23:05:47 ["[Plugins] Output: [plugin_helper] reading config file\n23:05:47 ['[DBCLNP] In script']\n23:05:47 ['[DBCLNP] Upkeep Database:']\n23:05:47 ['[DBCLNP] Online_History: Delete all but keep latest 150 entries']\n23:05:47 ['[DBCLNP] Events: Delete all older than 90 days (DAYS_TO_KEEP_EVENTS setting)']\n23:05:47 ['[DBCLNP] Plugins_History: Trim Plugins_History entries to less than 250 per Plugin (PLUGINS_KEEP_HIST setting)']\n23:05:47 ['[DBCLNP] Plugins_History: Trim Notifications entries to less than 100']\n23:05:47 ['[DBCLNP] Trim AppEvents to less than 100']\n23:05:47 ['[DBCLNP] Plugins_Objects: Delete all duplicates']\n23:05:47 ['[DBCLNP] WAL checkpoint executed to truncate file.']\n23:05:47 ['[DBCLNP] Shrink Database']\n23:05:47 ['[DBCLNP] Cleanup complete']\n"]
23:05:47 ['[Plugins] No output received from the plugin "DBCLNP"']
23:05:47 [Scheduler] run for MAINT: NO
23:05:47 [Scheduler] run for VNDRPDT: NO
23:05:47 [Process Scan] Exclude ignored devices
23:05:47 [Process Scan] Processing scan results
23:05:47 [Process Scan] Print Stats
23:05:47 [Scan Stats] Devices Detected.......: 2
23:05:47 [Scan Stats] New Devices............: 1
23:05:47 [Scan Stats] Down Alerts............: 0
23:05:47 [Scan Stats] New Down Alerts........: 0
23:05:47 [Scan Stats] New Connections........: 5
23:05:47 [Scan Stats] Disconnections.........: 1
23:05:47 [Scan Stats] IP Changes.............: 0
23:05:47 [Scan Stats] Scan Method Statistics:
23:05:47 INTRNT: 1
23:05:47 local_MAC: 1
23:05:47 [Process Scan] Stats end
23:05:47 [Process Scan] Sessions Events (connect / disconnect)
23:05:47 [Process Scan] Creating new devices
23:05:47 ['[setting_value_to_python_type] Error decoding JSON object: Expecting value: line 1 column 1 (char 0)']
23:05:47 ['default']
23:05:47 [Process Scan] Updating Devices Info
23:05:47 [Process Scan] Pairing session events (connection / disconnection)
23:05:47 [Process Scan] Creating sessions snapshot
23:05:47 [Process Scan] Inserting scan results into Online_History
23:05:47 [Process Scan] Skipping repeated notifications
23:05:47 [Skip Repeated Notifications] Skip Repeated
23:05:47 ['[Plugin utils] ---------------------------------------------']
23:05:47 ['[Plugin utils] ', 'display_name', ': ', 'AVAHISCAN (Name discovery)']
23:05:47 ['[Plugins] Executing: ', 'python3 /app/front/plugins/avahi_scan/avahi_scan.py']
23:05:48 ['[Plugins] Output: [plugin_helper] reading config file\n23:05:48 [\'[AVAHISCAN] In script\']\n23:05:48 [Database] Opening DB\n23:05:48 [\'[AVAHISCAN] REFRESH_FQDN is false, getting devices with unknown hostnames.\']\n23:05:48 [\'[AVAHISCAN] Devices to scan: 7\']\n23:05:48 ["[AVAHISCAN] IPs to be scanned: [\'73.49.179.94\', \'172.17.0.2\', \'172.17.0.3\', \'172.17.0.3\', \'172.17.0.2\', \'172.17.0.2\', \'172.17.0.2\']"]\n23:05:48 [\'[AVAHISCAN] Error resolving 73.49.179.94: The DNS query name does not exist: 94.179.49.73.in-addr.arpa.\']\n23:05:48 [\'[AVAHISCAN] Error resolving 172.17.0.2: The DNS query name does not exist: 2.0.17.172.in-addr.arpa.\']\n23:05:48 [\'[AVAHISCAN] Error resolving 172.17.0.3: The DNS query name does not exist: 3.0.17.172.in-addr.arpa.\']\n23:05:48 [\'[AVAHISCAN] Error resolving 172.17.0.3: The DNS query name does not exist: 3.0.17.172.in-addr.arpa.\']\n23:05:48 [\'[AVAHISCAN] Error resolving 172.17.0.2: The DNS query name does not exist: 2.0.17.172.in-addr.arpa.\']\n23:05:48 [\'[AVAHISCAN] Error resolving 172.17.0.2: The DNS query name does not exist: 2.0.17.172.in-addr.arpa.\']\n23:05:48 [\'[AVAHISCAN] Error resolving 172.17.0.2: The DNS query name does not exist: 2.0.17.172.in-addr.arpa.\']\n23:05:48 [\'[AVAHISCAN] Active resolution finished. Found 0 hosts.\']\n23:05:48 [\'[AVAHISCAN] Script finished\']\n']
23:05:48 ['[Plugins] Processed and deleted file: /app/log/plugins/last_result.AVAHISCAN.log ']
23:05:48 ['[Plugins] No output received from the plugin "AVAHISCAN"']
23:05:48 ['[Plugin utils] ---------------------------------------------']
23:05:48 ['[Plugin utils] ', 'display_name', ': ', 'NBTSCAN (Name discovery)']
23:05:48 ['[Plugins] Executing: ', 'python3 /app/front/plugins/nbtscan_scan/nbtscan.py']
23:05:55 ["[Plugins] Output: [plugin_helper] reading config file\n23:05:48 ['[NBTSCAN] In script']\n23:05:48 [Database] Opening DB\n23:05:48 ['[NBTSCAN] Devices count: 7']\n23:05:48 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '73.49.179.94']]\n23:05:49 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 73.49.179.94\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n23:05:49 ['[NBTSCAN] Domain Name: ']\n23:05:49 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.2']]\n23:05:50 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.2\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n23:05:50 ['[NBTSCAN] Domain Name: ']\n23:05:50 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.3']]\n23:05:51 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.3\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n23:05:51 ['[NBTSCAN] Domain Name: ']\n23:05:51 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.3']]\n23:05:52 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.3\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n23:05:52 ['[NBTSCAN] Domain Name: ']\n23:05:52 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.2']]\n23:05:53 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.2\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n23:05:53 ['[NBTSCAN] Domain Name: ']\n23:05:53 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.2']]\n23:05:54 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.2\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n23:05:54 ['[NBTSCAN] Domain Name: ']\n23:05:54 ['[NBTSCAN] DEBUG CMD :', ['nbtscan', '172.17.0.2']]\n23:05:55 ['[NBTSCAN] DEBUG OUTPUT : Doing NBT name scan for addresses from 172.17.0.2\\n\\nIP address NetBIOS Name Server User MAC address \\n------------------------------------------------------------------------------\\n']\n23:05:55 ['[NBTSCAN] Domain Name: ']\n23:05:55 ['[NBTSCAN] Script finished']\n"]
23:05:55 ['[Plugins] Processed and deleted file: /app/log/plugins/last_result.NBTSCAN.log ']
23:05:55 ['[Plugins] No output received from the plugin "NBTSCAN"']
23:05:55 ['[Plugin utils] ---------------------------------------------']
23:05:55 ['[Plugin utils] ', 'display_name', ': ', 'NSLOOKUP (Name discovery)']
23:05:55 ['[Plugins] Executing: ', 'python3 /app/front/plugins/nslookup_scan/nslookup.py']
23:05:55 ["[Plugins] Output: [plugin_helper] reading config file\n23:05:55 ['[NSLOOKUP] In script']\n23:05:55 [Database] Opening DB\n23:05:55 ['[NSLOOKUP] Devices count: 7']\n23:05:55 ['[NSLOOKUP]', 'No PTR record found for IP: 73.49.179.94']\n23:05:55 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.2']\n23:05:55 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.3']\n23:05:55 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.3']\n23:05:55 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.2']\n23:05:55 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.2']\n23:05:55 ['[NSLOOKUP]', 'No PTR record found for IP: 172.17.0.2']\n23:05:55 ['[NSLOOKUP] Script finished']\n"]
23:05:55 ['[Plugins] Processed and deleted file: /app/log/plugins/last_result.NSLOOKUP.log ']
23:05:55 ['[Plugins] No output received from the plugin "NSLOOKUP"']
23:05:55 ['[Plugin utils] ---------------------------------------------']
23:05:55 ['[Plugin utils] ', 'display_name', ': ', 'Dig (Name resolution)']
23:05:55 ['[Plugins] Executing: ', 'python3 /app/front/plugins/dig_scan/digscan.py']
23:05:55 ["[Plugins] Output: [plugin_helper] reading config file\n23:05:55 ['[DIGSCAN] In script']\n23:05:55 [Database] Opening DB\n23:05:55 ['[DIGSCAN] Devices count: 7']\n23:05:55 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '73.49.179.94']]\n23:05:55 ['[DIGSCAN] DEBUG OUTPUT : ']\n23:05:55 ['[DIGSCAN] Domain Name: ']\n23:05:55 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.2']]\n23:05:55 ['[DIGSCAN] DEBUG OUTPUT : ']\n23:05:55 ['[DIGSCAN] Domain Name: ']\n23:05:55 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.3']]\n23:05:55 ['[DIGSCAN] DEBUG OUTPUT : ']\n23:05:55 ['[DIGSCAN] Domain Name: ']\n23:05:55 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.3']]\n23:05:55 ['[DIGSCAN] DEBUG OUTPUT : ']\n23:05:55 ['[DIGSCAN] Domain Name: ']\n23:05:55 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.2']]\n23:05:55 ['[DIGSCAN] DEBUG OUTPUT : ']\n23:05:55 ['[DIGSCAN] Domain Name: ']\n23:05:55 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.2']]\n23:05:55 ['[DIGSCAN] DEBUG OUTPUT : ']\n23:05:55 ['[DIGSCAN] Domain Name: ']\n23:05:55 ['[DIGSCAN] DEBUG CMD :', ['dig', '+short', '-x', '172.17.0.2']]\n23:05:55 ['[DIGSCAN] DEBUG OUTPUT : ']\n23:05:55 ['[DIGSCAN] Domain Name: ']\n23:05:55 ['[DIGSCAN] Script finished']\n"]
23:05:55 ['[Plugins] Processed and deleted file: /app/log/plugins/last_result.DIGSCAN.log ']
23:05:55 ['[Plugins] No output received from the plugin "DIGSCAN"']
23:05:55 [Update Device Name] Trying to resolve devices without name. Unknown devices count: 7
23:05:55 [Update Device Name] Names Found (DiG/mDNS/NSLOOKUP/NBTSCAN): 0 (0/0/0/0)
23:05:55 [Update Device Name] Names Not Found : 7
23:05:55 ['[Notification] Check if something to report']
23:05:55 ['[Notification] Included sections: ', ['new_devices', 'down_devices', 'events']]
23:05:55 ['[Notification] Open text Template']
23:05:55 ['[Notification] Open html Template']
23:05:55 ['[Notification] New Devices sections done.']
23:05:55 ['[Notification] Down Devices sections done.']
23:05:55 ['[Notification] Reconnected Down Devices sections done.']
23:05:55 ['[Notification] Events sections done.']
23:05:55 ['[Notification] Plugins sections done.']
23:05:55 ['[Send API] Updating notification_* files in ', '/app/api/']
23:05:55 ['[Notification] Udating API files']
23:05:55 ['[Notification] Notifications changes: ', 0]
23:05:55 ['[MAIN] Process: Idle']
23:05:55 ['[WF] get_new_app_events - new events count: 9']
23:05:55 ['[WF] Processing event with GUID c7a11985-beba-46b0-98fb-b1e771914dce']
23:05:55 ['[WF] Processing event with GUID 6c3931b1-c41b-40f3-acd2-46b051223ad3']
23:05:55 ['[WF] Processing event with GUID 647bf670-e9c2-45e0-aaf8-aae5c8c5530d']
23:05:55 ['[WF] Processing event with GUID 4de08a4e-49a4-45ae-b6bc-4f90b465aa81']
23:05:55 ['[WF] Processing event with GUID e680ea03-b160-4766-80d6-820605811e25']
23:05:55 ['[WF] Processing event with GUID b694bd46-385a-4f18-a32b-e11c80c1cc6d']
23:05:55 ['[WF] Processing event with GUID b178294e-98fd-4d88-a60b-327c54dba22d']
23:05:55 ['[WF] Processing event with GUID 2d2600b8-37be-42e4-92ff-d16f6ef8c64b']
23:05:55 ['[WF] Processing event with GUID 0d1709f0-8758-4c5b-bba2-d8a230502cde']
23:06:00 [Scheduler] run for ARPSCAN: YES
23:06:00 ['[Plugin utils] ---------------------------------------------']
23:06:00 ['[Plugin utils] ', 'display_name', ': ', 'Arp-Scan (Network scan)']
23:06:00 ['[Plugins] Executing: ', 'python3 /app/front/plugins/arp_scan/script.py userSubnets={subnets}']
23:11:00 ['[Plugins] ⚠ ERROR - TIMEOUT - the plugin ARPSCAN forcefully terminated as timeout reached. Increase TIMEOUT setting and scan interval.']
23:11:00 ['[Plugins] No output received from the plugin "ARPSCAN"']
23:11:00 [Scheduler] run for INTRNT: YES
23:11:00 ['[Plugin utils] ---------------------------------------------']
23:11:00 ['[Plugin utils] ', 'display_name', ': ', 'Internet-Check']
23:11:00 ['[Plugins] Executing: ', 'python3 /app/front/plugins/internet_ip/script.py prev_ip={prev_ip} INTRNT_DIG_GET_IP_ARG={INTRNT_DIG_GET_IP_ARG}']
23:11:01 ["[Plugins] Output: [plugin_helper] reading config file\n23:11:01 ['[INTRNT] In script']\n23:11:01 ['[INTRNT] INTRNT_DIG_GET_IP_ARG: ', '-4 myip.opendns.com @resolver1.opendns.com']\n23:11:01 ['[INTRNT] - Retrieving Internet IP']\n23:11:01 ['[INTRNT] DIG result : 73.49.179.94\\n']\n23:11:01 ['[INTRNT] Current internet_IP : 73.49.179.94']\n23:11:01 ['[INTRNT] previous_IP : 73.49.179.94']\n23:11:01 ['[INTRNT] Finished ']\n"]
23:11:01 ['[Plugins] Processed and deleted file: /app/log/plugins/last_result.INTRNT.log ']
23:11:01 ['[Plugins] SUCCESS for INTRNT received 1 entries']
23:11:01 ['[Plugins] Processing : ', 'INTRNT']
23:11:01 ['[Plugins] Should I update API (userUpdatedDevices): False']
23:11:01 [Scheduler] run for CSVBCKP: NO
23:11:01 [Scheduler] run for DBCLNP: NO
23:11:01 [Scheduler] run for MAINT: NO
23:11:01 [Scheduler] run for VNDRPDT: NO
23:11:01 [Process Scan] Exclude ignored devices
23:11:01 [Process Scan] Processing scan results
23:11:01 [Process Scan] Print Stats
23:11:01 [Scan Stats] Devices Detected.......: 2
23:11:01 [Scan Stats] New Devices............: 0
23:11:01 [Scan Stats] Down Alerts............: 0
23:11:01 [Scan Stats] New Down Alerts........: 0
23:11:01 [Scan Stats] New Connections........: 6
23:11:01 [Scan Stats] Disconnections.........: 0
23:11:01 [Scan Stats] IP Changes.............: 0
23:11:01 [Scan Stats] Scan Method Statistics:
23:11:01 INTRNT: 1
23:11:01 local_MAC: 1
23:11:01 [Process Scan] Stats end
23:11:01 [Process Scan] Sessions Events (connect / disconnect)
23:11:01 [Process Scan] Creating new devices
23:11:01 [Process Scan] Updating Devices Info
23:11:01 [Process Scan] Pairing session events (connection / disconnection)
23:11:01 [Process Scan] Creating sessions snapshot
23:11:01 [Process Scan] Inserting scan results into Online_History
23:11:01 [Process Scan] Skipping repeated notifications
23:11:01 [Skip Repeated Notifications] Skip Repeated
23:11:01 ['[Plugin utils] ---------------------------------------------']
23:11:01 ['[Plugin utils] ', 'display_name', ': ', 'AVAHISCAN (Name discovery)']
23:11:01 ['[Plugins] Executing: ', 'python3 /app/front/plugins/avahi_scan/avahi_scan.py']
23:11:01 ['[Plugins] Output: [plugin_helper] reading config file\n23:11:01 [\'[AVAHISCAN] In script\']\n23:11:01 [Database] Opening DB\n23:11:01 [\'[AVAHISCAN] REFRESH_FQDN is false, getting devices with unknown hostnames.\']\n23:11:01 [\'[AVAHISCAN] Devices to scan: 7\']\n23:11:01 ["[AVAHISCAN] IPs to be scanned: [\'73.49.179.94\', \'172.17.0.2\', \'172.17.0.3\', \'172.17.0.3\', \'172.17.0.2\', \'172.17.0.2\', \'172.17.0.2\']"]\n23:11:01 [\'[AVAHISCAN] Error resolving 73.49.179.94: The DNS query name does not exist: 94.179.49.73.in-addr.arpa.\']\n23:11:01 [\'[AVAHISCAN] Error resolving 172.17.0.2: The DNS query name does not exist: 2.0.17.172.in-addr.arpa.\']\n23:11:01 [\'[AVAHISCAN] Error resolving 172.17.0.3: The DNS query name does not exist: 3.0.17.172.in-addr.arpa.\']\n23:11:01 [\'[AVAHISCAN] Error resolving 172.17.0.3: The DNS query name does not exist: 3.0.17.172.in-addr.arpa.\']\n23:11:01 [\'[AVAHISCAN] Error resolving 172.17.0.2: The DNS query name does not exist: 2.0.17.172.in-addr.arpa.\']\n23:11:01 [\'[AVAHISCAN] Error resolving 172.17.0.2: The DNS query name does not exist: 2.0.17.172.in-addr.arpa.\']\n23:11:01 [\'[AVAHISCAN] Error resolving 172.17.0.2: The DNS query name does not exist: 2.0.17.172.in-addr.arpa.\']\n23:11:01 [\'[AVAHISCAN] Active resolution finished. Found 0 hosts.\']\n23:11:01 [\'[AVAHISCAN] Script finished\']\n']

View File

@@ -15,14 +15,10 @@ export CROND_BIN="/usr/sbin/crond -f"
export ALWAYS_FRESH_INSTALL=false
export INSTALL_DIR=/app
export APP_DATA_LOCATION=/app/config
export APP_CONFIG_LOCATION=/app/config
export LOGS_LOCATION=/app/logs
export CONF_FILE="app.conf"
export NGINX_CONF_FILE=netalertx.conf
export DB_FILE="app.db"
export FULL_FILEDB_PATH="${INSTALL_DIR}/db/${DB_FILE}"
export NGINX_CONFIG_FILE="/etc/nginx/http.d/${NGINX_CONF_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
@@ -63,17 +59,20 @@ isRamDisk() {
# Setup source directory
configure_source() {
echo "[1/3] Configuring 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"
sudo umount "${NETALERTX_LOG}" 2>/dev/null || true
sudo umount "${NETALERTX_API}" 2>/dev/null || true
sudo rm -Rf ${NETALERTX_APP}/
ls -al /app
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}"
@@ -81,6 +80,7 @@ configure_source() {
mkdir -p ${NETALERTX_PLUGINS_LOG}
touch ${NETALERTX_PLUGINS_LOG}/.git-placeholder ${NETALERTX_API}/.git-placeholder
# mount tmpfs with root:root ownership and 755 permissions
touch /app/log/nginx_error.log
echo " -> Empty log"|tee ${INSTALL_DIR}/log/app.log \
@@ -100,14 +100,14 @@ configure_source() {
# configure_php: configure PHP-FPM and enable dev debug options
configure_php() {
echo "[2/3] Configuring PHP-FPM..."
echo "[3/4] Configuring PHP-FPM..."
sudo chown netalertx:netalertx ${SYSTEM_SERVICES_PHP_RUN} 2>/dev/null || true
}
# start_services: start crond, PHP-FPM, nginx and the application
start_services() {
echo "[3/3] Starting services..."
echo "[4/4] Starting services..."
echo " -> Starting CronD"
setsid nohup /services/start-crond.sh &>/dev/null &
@@ -115,7 +115,6 @@ start_services() {
echo " -> Starting PHP-FPM"
setsid nohup /services/start-php-fpm.sh &>/dev/null &
sudo killall nginx &>/dev/null || true
# Wait for the previous nginx processes to exit and for the port to free up
tries=0
while ss -ltn | grep -q ":${PORT}[[:space:]]" && [ $tries -lt 10 ]; do
@@ -123,11 +122,11 @@ start_services() {
sleep 0.2
tries=$((tries+1))
done
sleep 0.2
sleep 1
echo " -> Starting Nginx"
setsid nohup /services/start-nginx.sh &>/dev/null &
/services/start-nginx.sh
echo " -> Starting Backend ${APP_DIR}/server..."
/services/start-backend.sh &
setsid nohup /services/start-backend.sh &
sleep 2
}

View File

@@ -30,6 +30,7 @@ ENV NETALERTX_FRONT=${NETALERTX_APP}/front
ENV NETALERTX_SERVER=${NETALERTX_APP}/server
ENV NETALERTX_API=${NETALERTX_APP}/api
ENV NETALERTX_DB=${NETALERTX_APP}/db
ENV NETALERTX_DB_FILE=${NETALERTX_DB}/app.db
ENV NETALERTX_BACK=${NETALERTX_APP}/back
ENV NETALERTX_LOG=${NETALERTX_APP}/log
ENV NETALERTX_PLUGINS_LOG=${NETALERTX_LOG}/plugins
@@ -52,30 +53,31 @@ ENV LOG_CROND=${NETALERTX_LOG}/crond.log
ENV SYSTEM_SERVICES=/services
ENV SYSTEM_SERVICES_CONFIG=${SYSTEM_SERVICES}/config
ENV SYSTEM_NGINIX_CONFIG=${SYSTEM_SERVICES_CONFIG}/nginx
ENV NGINX_CONFIG_FILE=${SYSTEM_NGINIX_CONFIG}/nginx.conf
ENV SYSTEM_NGINX_CONFIG_FILE=${SYSTEM_NGINIX_CONFIG}/nginx.conf
ENV NETALERTX_CONFIG_FILE=${NETALERTX_CONFIG}/app.conf
ENV NETALERTX_DB_FILE=${NETALERTX_DB}/app.db
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_CROND=${SYSTEM_SERVICES_CONFIG}/crond
ENV SYSTEM_SERVICES_RUN=${SYSTEM_SERVICES}/run
ENV SYSTEM_SERVICES_RUN_TMP=${SYSTEM_SERVICES_RUN}/tmp
ENV SYSTEM_SERVICES_RUN_LOG=${SYSTEM_SERVICES_RUN}/logs
ENV PHP_FPM_CONFIG_FILE=${SYSTEM_SERVICES_PHP_FOLDER}/php-fpm.conf
ENV PYTHONPATH=${NETALERTX_SERVER}
ENV PYTHONUNBUFFERED=1
RUN apk add --no-cache bash mtr libbsd zip lsblk sudo tzdata curl arp-scan iproute2 \
iproute2-ss nmap 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 \
nginx sudo libcap shadow && \
rm -rf /var/cache/apk/* && \
rm -f /etc/nginx/http.d/default.conf
iproute2-ss nmap 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 \
nginx sudo shadow && \
rm -Rf /var/cache/apk/* && \
rm -Rf /etc/nginx && \
addgroup -g 20211 netalertx && \
adduser -u 20211 -D -h ${NETALERTX_APP} -G netalertx netalertx && \
apk del shadow
#Create netalertx user and group
RUN addgroup -g 20211 netalertx && \
adduser -u 20211 -D -h ${NETALERTX_APP} -G netalertx netalertx
# Install application, copy files, set permissions
COPY --from=builder --chown=20212:20212 /opt/venv /opt/venv
@@ -84,33 +86,37 @@ COPY --chown=netalertx:netalertx install/production-filesystem/ /
COPY --chown=netalertx:netalertx --chmod=755 back ${NETALERTX_BACK}
COPY --chown=netalertx:netalertx --chmod=755 front ${NETALERTX_FRONT}
COPY --chown=netalertx:netalertx --chmod=755 server ${NETALERTX_SERVER}
RUN install -d -o netalertx -g netalertx -m 755 ${NETALERTX_API} ${NETALERTX_LOG} ${SYSTEM_SERVICES_RUN_TMP} && \
RUN install -d -o netalertx -g netalertx -m 755 ${NETALERTX_API} \
${NETALERTX_LOG} ${SYSTEM_SERVICES_RUN_TMP} ${SYSTEM_SERVICES_RUN_LOG} && \
sh -c "find ${NETALERTX_APP} -type f \( -name '*.sh' -o -name 'speedtest-cli' \) \
-exec chmod 750 {} \;"
# setcap to allow network tools with raw packet access to run without root
RUN 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/traceroute && \
setcap cap_net_raw,cap_net_admin+eip /opt/venv/bin/scapy
#initialize each service with the dockerfiles/init-*.sh scripts, once.
RUN /bin/sh /build/init-nginx.sh && \
RUN apk add libcap && \
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/traceroute && \
setcap cap_net_raw,cap_net_admin+eip /opt/venv/bin/scapy && \
/bin/sh /build/init-nginx.sh && \
/bin/sh /build/init-php-fpm.sh && \
/bin/sh /build/init-crond.sh && \
/bin/sh /build/init-backend.sh && \
rm -rf /build
chmod 755 ${NETALERTX_BACK}/update_vendors.sh ${NETALERTX_BACK}/cron_script.sh ${NETALERTX_BACK}/speedtest-cli && \
rm -rf /build && \
apk del libcap
# set netalertx to allow sudoers for any command, no password
RUN echo "netalertx ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
ENTRYPOINT ["/bin/sh","-c","sleep infinity"]
# Final hardened stage to improve security by setting correct permissions and removing sudo access
# Final hardened stage to improve security by setting least possible permissions and removing sudo access.
# When complete, if the image is compromised, there's not much that can be done with it.
# This stage is separate from Runner stage so that devcontainer can use the Runner stage.
FROM runner AS hardened
# create readonly user and group with no shell access. Readonly user marks folders that are created by NetAlertX, but should not be modified.
# create readonly user and group with no shell access.
# Readonly user marks folders that are created by NetAlertX, but should not be modified.
RUN addgroup -g 20212 readonly && \
adduser -u 20212 -G readonly -D -h /app readonly && \
usermod -s /sbin/nologin readonly
@@ -126,13 +132,13 @@ RUN chown -R readonly:readonly ${NETALERTX_BACK} ${NETALERTX_FRONT} ${NETALERTX_
chmod -R 600 ${NETALERTX_CONFIG} ${NETALERTX_DB} ${NETALERTX_API} ${NETALERTX_LOG} && \
chmod 700 ${NETALERTX_CONFIG} ${NETALERTX_DB} ${NETALERTX_API} ${NETALERTX_LOG} ${NETALERTX_PLUGINS_LOG} ${SYSTEM_SERVICES_RUN_TMP} && \
chown readonly:readonly /entrypoint.sh && \
install -d -o netalertx -g netalertx -m 700 ${SYSTEM_SERVICES_RUN} ${SYSTEM_SERVICES_RUN_TMP} && \
chmod 005 /entrypoint.sh
install -d -o netalertx -g netalertx -m 700 ${SYSTEM_SERVICES_RUN} ${SYSTEM_SERVICES_RUN_TMP} ${SYSTEM_SERVICES_RUN_LOG} && \
chmod 005 /entrypoint.sh ${NETALERTX_BACK}/update_vendors.sh ${NETALERTX_BACK}/cron_script.sh ${NETALERTX_BACK}/speedtest-cli
#
# remove sudo and alpine installers pacakges
RUN apk del sudo libcap apk-tools && \
rm -rf /var/cache/apk/*
RUN apk del sudo apk-tools && \
rm -rf /var/cache/apk/*
# remove all users and groups except readonly and netalertx & remove all sudoers
RUN rm -Rf /etc/sudoers.d/* /etc/shadow /etc/gshadow /etc/sudoers \
/lib/apk /lib/firmware /lib/modules-load.d /lib/sysctl.d /mnt /home/ /root \

View File

@@ -1,4 +1,4 @@
#!/bin/bash
echo "Initializing nginx..."
#Future crond initializations can go here.
install -d -o netalertx -g netalertx -m 700 /app/run/tmp/client_body;
echo "nginx initialized."

View File

@@ -1,28 +1,88 @@
#!/bin/bash
#!/bin/sh
set -u
# verify container capabilities at startup
/services/capcheck.sh
# Function to clean up background processes
cleanup() {
echo "Caught signal, shutting down services..."
# Kill all background jobs
kill $(jobs -p)
wait
echo "All services stopped."
exit 0
SERVICES=""
FAILED_NAME=""
FAILED_STATUS=0
add_service() {
script="$1"
name="$2"
"$script" &
pid=$!
SERVICES="${SERVICES} ${pid}:${name}"
}
# Trap SIGINT (Ctrl+C) and SIGTERM (docker stop)
trap cleanup SIGINT SIGTERM
remove_service() {
target_pid="$1"
updated=""
for entry in ${SERVICES}; do
pid="${entry%%:*}"
[ -z "${pid}" ] && continue
[ "${pid}" = "${target_pid}" ] && continue
updated="${updated} ${entry}"
done
SERVICES="${updated}"
}
# Start all necessary services for NetAlertX in the background
/services/start-crond.sh &
/services/start-php-fpm.sh &
/services/start-nginx.sh &
/services/start-backend.sh &
shutdown_services() {
for entry in ${SERVICES}; do
pid="${entry%%:*}"
[ -z "${pid}" ] && continue
if kill -0 "${pid}" 2>/dev/null; then
kill "${pid}" 2>/dev/null || true
fi
done
for entry in ${SERVICES}; do
pid="${entry%%:*}"
[ -z "${pid}" ] && continue
wait "${pid}" 2>/dev/null || true
done
echo "All services stopped."
}
# Wait for any background process to exit
wait -n
# Trigger cleanup if any process exits
cleanup
handle_exit() {
if [ -n "${FAILED_NAME}" ]; then
echo "Service ${FAILED_NAME} exited with status ${FAILED_STATUS}."
fi
shutdown_services
exit "${FAILED_STATUS}"
}
on_signal() {
echo "Caught signal, shutting down services..."
FAILED_NAME="signal"
FAILED_STATUS=143
handle_exit
}
trap on_signal INT TERM
[ ! -d "${NETALERTX_PLUGINS_LOG}" ] && mkdir -p "${NETALERTX_PLUGINS_LOG}"
[ ! -f "${LOG_DB_IS_LOCKED}" ] && touch "${LOG_DB_IS_LOCKED}"
[ ! -f "${LOG_EXECUTION_QUEUE}" ] && touch "${LOG_EXECUTION_QUEUE}"
add_service "/services/start-crond.sh" "crond"
add_service "/services/start-php-fpm.sh" "php-fpm"
add_service "/services/start-nginx.sh" "nginx"
add_service "/services/start-backend.sh" "backend"
while [ -n "${SERVICES}" ]; do
for entry in ${SERVICES}; do
pid="${entry%%:*}"
name="${entry#*:}"
[ -z "${pid}" ] && continue
if ! kill -0 "${pid}" 2>/dev/null; then
wait "${pid}" 2>/dev/null
status=$?
FAILED_STATUS=$status
FAILED_NAME="${name}"
remove_service "${pid}"
handle_exit
fi
done
sleep 1
done

View File

@@ -0,0 +1,98 @@
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/avif avif;
image/png png;
image/svg+xml svg svgz;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/webp webp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
font/woff woff;
font/woff2 woff2;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.oasis.opendocument.graphics odg;
application/vnd.oasis.opendocument.presentation odp;
application/vnd.oasis.opendocument.spreadsheet ods;
application/vnd.oasis.opendocument.text odt;
application/vnd.openxmlformats-officedocument.presentationml.presentation
pptx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xlsx;
application/vnd.openxmlformats-officedocument.wordprocessingml.document
docx;
application/vnd.wap.wmlc wmlc;
application/wasm wasm;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}

View File

@@ -1,5 +1,3 @@
pid /services/run/nginx.pid;
# Set number of worker processes automatically based on number of CPU cores.
worker_processes auto;
@@ -9,9 +7,6 @@ pcre_jit on;
# Configures default error logger.
error_log /app/log/nginx-error.log warn;
# Includes files with directives to load dynamic modules.
include /etc/nginx/modules/*.conf;
events {
# The maximum number of simultaneous connections that can be opened by
# a worker process.
@@ -19,9 +14,15 @@ events {
}
http {
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 /etc/nginx/mime.types;
include /services/config/nginx/mime.types;
default_type application/octet-stream;
# Name servers used to resolve names of upstream servers into addresses.

View File

@@ -1,6 +1,8 @@
#!/bin/bash
set -euo pipefail
echo "Starting backend..."
cd "${NETALERTX_APP}" || exit
cd "${NETALERTX_APP}" || exit 1
# Change user to netalertx
export PYTHONPATH="${NETALERTX_SERVER}:${NETALERTX_APP}"
@@ -9,5 +11,25 @@ if [ -f /services/config/python/backend-extra-launch-parameters ]; then
EXTRA_PARAMS=$(cat /services/config/python/backend-extra-launch-parameters)
fi
backend_pid=""
cleanup() {
status=$?
echo "Backend stopped! (exit ${status})"
}
forward_signal() {
if [[ -n "${backend_pid}" ]]; then
kill -TERM "${backend_pid}" 2>/dev/null || true
fi
}
trap cleanup EXIT
trap forward_signal INT TERM
# Start the backend, teeing stdout and stderr to log files and the container's console
python3 ${EXTRA_PARAMS} -m server > >(tee /app/log/stdout.log) 2> >(tee /app/log/stderr.log >&2)
python3 ${EXTRA_PARAMS} -m server > >(tee /app/log/stdout.log) 2> >(tee /app/log/stderr.log >&2) &
backend_pid=$!
wait "${backend_pid}"
exit $?

View File

@@ -1,3 +1,26 @@
#!/bin/bash
set -euo pipefail
echo "Starting crond..."
exec /usr/sbin/crond -c ${SYSTEM_SERVICES_CROND} -f -L "${LOG_CROND}"
crond_pid=""
cleanup() {
status=$?
echo "Crond stopped! (exit ${status})"
}
forward_signal() {
if [[ -n "${crond_pid}" ]]; then
kill -TERM "${crond_pid}" 2>/dev/null || true
fi
}
trap cleanup EXIT
trap forward_signal INT TERM
/usr/sbin/crond -c "${SYSTEM_SERVICES_CROND}" -f -L "${LOG_CROND}" >> "${LOG_CROND}" 2>&1 &
crond_pid=$!
wait "${crond_pid}"
exit $?

View File

@@ -1,14 +1,37 @@
#!/bin/bash
set -euo pipefail
LOG_DIR=${NETALERTX_APP}
RUN_DIR=${SYSTEM_SERVICES_RUN}
TMP_DIR=${SYSTEM_SERVICES_RUN_TMP}
NGINX_CONFIG_FILE=${NGINX_CONFIG_FILE}
# Create directories if they don't exist
mkdir -p "${LOG_DIR}" "${RUN_DIR}" "${TMP_DIR}"
echo "Starting nginx..."
nginx_pid=""
cleanup() {
status=$?
echo "nginx stopped! (exit ${status})"
}
forward_signal() {
if [[ -n "${nginx_pid}" ]]; then
kill -TERM "${nginx_pid}" 2>/dev/null || true
fi
}
trap cleanup EXIT
trap forward_signal INT TERM
# Execute nginx with overrides
exec nginx \
nginx \
-p "${RUN_DIR}/" \
-c "${NGINX_CONFIG_FILE}" \
-g "error_log ${LOG_DIR}/nginx.error.log; pid ${RUN_DIR}/nginx.pid; daemon off;"
-c "${SYSTEM_NGINX_CONFIG_FILE}" \
-g "error_log ${NETALERTX_LOG}/nginx-error.log; pid ${RUN_DIR}/nginx.pid; daemon off;" &
nginx_pid=$!
wait "${nginx_pid}"
exit $?

View File

@@ -1,3 +1,26 @@
#!/bin/bash
set -euo pipefail
echo "Starting php-fpm..."
exec /usr/sbin/php-fpm83 -y ${PHP_FPM_CONFIG_FILE} -F >> "${LOG_APP_PHP_ERRORS}" 2>&1
php_fpm_pid=""
cleanup() {
status=$?
echo "php-fpm stopped! (exit ${status})"
}
forward_signal() {
if [[ -n "${php_fpm_pid}" ]]; then
kill -TERM "${php_fpm_pid}" 2>/dev/null || true
fi
}
trap cleanup EXIT
trap forward_signal INT TERM
/usr/sbin/php-fpm83 -y "${PHP_FPM_CONFIG_FILE}" -F >> "${LOG_APP_PHP_ERRORS}" 2>&1 &
php_fpm_pid=$!
wait "${php_fpm_pid}"
exit $?

View File

@@ -1,3 +0,0 @@
nohup: can't execute 'services/start-php-fpm.sh': No such file or directory
Starting php-fpm...
Starting nginx...