mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-13 13:41:37 -07:00
Dockerfile.debian building and running
This commit is contained in:
@@ -1,2 +1,4 @@
|
||||
# Schedule cron jobs
|
||||
* * * * * /app/back/cron_script.sh
|
||||
# Every minute check for cron jobs
|
||||
* * * * * /services/cron_script.sh
|
||||
# Update vendors 4x/d
|
||||
0 */6 * * * /services/update_vendors.sh
|
||||
|
||||
15
install/production-filesystem/services/cron_script.sh
Executable file
15
install/production-filesystem/services/cron_script.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
export INSTALL_DIR=/app
|
||||
|
||||
|
||||
|
||||
# Check if there are any entries with cron_restart_backend
|
||||
if grep -q "cron_restart_backend" "${LOG_EXECUTION_QUEUE}"; then
|
||||
# Restart python application using s6
|
||||
killall python3
|
||||
/services/start-backend.sh &
|
||||
echo 'done'
|
||||
|
||||
# Remove all lines containing cron_restart_backend from the log file
|
||||
sed -i '/cron_restart_backend/d' "${LOG_EXECUTION_QUEUE}"
|
||||
fi
|
||||
@@ -32,8 +32,12 @@ while $(ps ax | grep -v -e "grep" -e "nginx.sh" | grep nginx >/dev/null); do
|
||||
sleep 0.2
|
||||
done
|
||||
|
||||
if ! envsubst '${LISTEN_ADDR} ${PORT}'< "${SYSTEM_NGINX_CONFIG_TEMPLATE}" > "${SYSTEM_NGINX_CONFIG_FILE}" 2>/dev/null; then
|
||||
echo "Note: Unable to write to ${SYSTEM_NGINX_CONFIG_FILE}. Using default configuration."
|
||||
TEMP_CONFIG_FILE=$(mktemp "${TMP_DIR}/netalertx.conf.XXXXXX")
|
||||
if envsubst '${LISTEN_ADDR} ${PORT}' < "${SYSTEM_NGINX_CONFIG_TEMPLATE}" > "${TEMP_CONFIG_FILE}" 2>/dev/null; then
|
||||
mv "${TEMP_CONFIG_FILE}" "${SYSTEM_NGINX_CONFIG_FILE}"
|
||||
else
|
||||
echo "Note: Unable to write to ${SYSTEM_NGINX_CONFIG_FILE}. Using default configuration."
|
||||
rm -f "${TEMP_CONFIG_FILE}"
|
||||
fi
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
26
install/production-filesystem/services/update_vendors.sh
Executable file
26
install/production-filesystem/services/update_vendors.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# NetAlertX
|
||||
# Open Source Network Guard / WIFI & LAN intrusion detector
|
||||
#
|
||||
# update_vendors.sh - Back module. IEEE Vendors db update
|
||||
# ------------------------------------------------------------------------------
|
||||
# Puche 2021 / 2022+ jokob jokob@duck.com GNU GPLv3
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Main directories to update:
|
||||
# /usr/share/arp-scan
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# Download the file using wget to stdout and process it
|
||||
wget -q "http://standards-oui.ieee.org/oui/oui.txt" -O /dev/stdout | \
|
||||
sed -E 's/ *\(base 16\)//' | \
|
||||
awk -F' ' '{printf "%s\t%s\n", $1, substr($0, index($0, $2))}' | \
|
||||
sort | \
|
||||
awk '{$1=$1; print}' | \
|
||||
sort -u | \
|
||||
awk -F' ' '{printf "%s\t%s\n", $1, substr($0, index($0, $2))}' \
|
||||
> /services/run/tmp/ieee-oui.txt
|
||||
|
||||
Reference in New Issue
Block a user