diff --git a/.github/workflows/docker_dev.yml b/.github/workflows/docker_dev.yml index d5d19223..40e74449 100755 --- a/.github/workflows/docker_dev.yml +++ b/.github/workflows/docker_dev.yml @@ -48,7 +48,6 @@ jobs: with: # list of Docker images to use as base name for tags images: | - jokobsk/pi.alert_dev jokobsk/netalertx-dev # generate Docker tags based on the following events/attributes tags: | diff --git a/dockerfiles/README.md b/dockerfiles/README.md index 64e07c4c..3b6d639e 100755 --- a/dockerfiles/README.md +++ b/dockerfiles/README.md @@ -38,7 +38,7 @@ docker run -d --rm --network=host \ | `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` | |`TZ` |Time zone to display stats correctly. Find your time zone [here](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) | `Europe/Berlin` | -|`ALWAYS_FRESH_INSTALL` | Setting `ALWAYS_FRESH_INSTALL=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`/`-dev` image. | `N/A` | +|`ALWAYS_FRESH_INSTALL` | Setting to `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`/`-dev` image. | `N/A` | ### Docker paths diff --git a/docs/DEV_ENV_SETUP.md b/docs/DEV_ENV_SETUP.md new file mode 100755 index 00000000..ec15a037 --- /dev/null +++ b/docs/DEV_ENV_SETUP.md @@ -0,0 +1,64 @@ +## Development environemnt set up + +>[!NOTE] +> Replace `/development` with the path where your code files will be stored. The default container name is `netalertx` so there might be a conflict with your running containers. + +## 1. Download the code: + +- `mkdir /development` +- `cd /development && git clone https://github.com/jokob-sk/NetAlertX.git` + +## 2. Create a DEV .env_dev file + +`touch /development/.env_dev && sudo nano /development/.env_dev` + +The file content should be following, with your custom values. + +```yaml +#-------------------------------- +#NETALERTX +#-------------------------------- +TZ=Europe/Berlin +PORT=22222 # make sure this port is unique on your whole network +DEV_LOCATION=/development/NetAlertX +APP_DATA_LOCATION=/volume/docker_appdata +# ALWAYS_FRESH_INSTALL=true # uncommenting this will always delete the content of /config and /db dirs on boot to simulate a fresh install +``` + +## 3. Create /db and /config dirs + +Create a folder `netalertx` in the `APP_DATA_LOCATION` (in this example in `/volume/docker_appdata`) with 2 subfolders `db` and `config`. + +- `mkdir /volume/docker_appdata/netalertx` +- `mkdir /volume/docker_appdata/netalertx/db` +- `mkdir /volume/docker_appdata/netalertx/config` + +## 4. Run the container + +- `cd /development/NetAlertX && sudo docker-compose --env-file ../.env_dev ` + +You can then modify the python script without restarting/rebuilding the container every time. Additionally, you can trigger a plugin run via the UI: + +![image](https://github.com/jokob-sk/NetAlertX/assets/96159884/3cbf2748-03c8-49e7-b801-f38c7755246b) + + +## 💡 Tips + +A quick cheat sheet of useful commands. + +### Removing the container and image + +A command to stop, remove the container and the image (replace `netalertx` and `netalertx-netalertx` with the appropriate values) + +- `sudo docker container stop netalertx ; sudo docker container rm netalertx ; sudo docker image rm netalertx-netalertx` + +### Restart hanging python script + +SSH into the container and kill & restart the main script loop + +- `sudo docker exec -it netalertx /bin/bash` +- `pkill -f "python /app/server" && python /app/server & ` + + + + diff --git a/docs/NOTIFICATIONS.md b/docs/NOTIFICATIONS.md index 3c7efa17..c3bdc68a 100755 --- a/docs/NOTIFICATIONS.md +++ b/docs/NOTIFICATIONS.md @@ -52,4 +52,4 @@ In Notification Processing settings, you can specify blanket rules. These allow You can completely ignore detected devices globally. This could be because your instance detects docker containers, you want to ignore devices from a specific manufacturer via MAC rules or you want to ignore devices on a specific IP range. 1. Ignored MACs (`NEWDEV_ignored_MACs`) - List of MACs to ignore. -2. Ignored IPs (`NEWDEV_ignored_MACs`) - List of IPs to ignore. \ No newline at end of file +2. Ignored IPs (`NEWDEV_ignored_IPs`) - List of IPs to ignore. \ No newline at end of file diff --git a/docs/WEB_UI_PORT_DEBUG.md b/docs/WEB_UI_PORT_DEBUG.md index 9ea3f06f..6314c94a 100755 --- a/docs/WEB_UI_PORT_DEBUG.md +++ b/docs/WEB_UI_PORT_DEBUG.md @@ -43,4 +43,7 @@ In the container execute: ## 7. Make sure permissions are correct +> [!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. + Please read the [Permissions troubleshooting guide](/docs/FILE_PERMISSIONS.md) and provide a screesnhot of the permissions and ownership in the `/app/db` and `app/config` directories. \ No newline at end of file diff --git a/front/devices.php b/front/devices.php index b2135c80..4995e130 100755 --- a/front/devices.php +++ b/front/devices.php @@ -307,8 +307,6 @@ function getDevicesTotals(devicesData) { // Calculate count dynamically based on filter condition let count = filterDataByStatus(devicesData, filter.status).length; - console.log(getSetting('UI_hide_empty')); - // Check any condition to skip adding the object to dataArray if ( (['', 'False'].includes(getSetting('UI_hide_empty')) || (getSetting('UI_hide_empty') == "True" && count > 0)) && diff --git a/front/js/modal.js b/front/js/modal.js index cc4af4bd..bcb173d4 100755 --- a/front/js/modal.js +++ b/front/js/modal.js @@ -266,7 +266,7 @@ function checkNotification() { if (oldestInterruptNotification) { // Show modal dialog with the oldest unread notification - const decodedContent = JSON.parse(decodeURIComponent(oldestInterruptNotification.content)); + const decodedContent = decodeURIComponent(oldestInterruptNotification.content); showModalOK("Notification", decodedContent, function() { // Mark the notification as read diff --git a/front/maintenance.php b/front/maintenance.php index 4a38038d..af9021ae 100755 --- a/front/maintenance.php +++ b/front/maintenance.php @@ -425,8 +425,10 @@ $db->close();
app.log
+
- + +
@@ -690,6 +692,22 @@ function PiaPurgeDBBackups() }); } +// Restart Backend +function restartBackend() { + // Execute + $.ajax({ + method: "POST", + url: "php/server/util.php", + data: { function: 'restartBackend' }, + success: function(data, textStatus) { + showModalOk ('Result', data ); + } + }) + + + +} + // Export CSV function askExportCSV() { // Ask diff --git a/front/php/server/util.php b/front/php/server/util.php index 19e764ad..83c42b63 100755 --- a/front/php/server/util.php +++ b/front/php/server/util.php @@ -28,6 +28,10 @@ if(array_key_exists('settings', $_REQUEST) != FALSE) // call functions based on requested params switch ($FUNCTION) { + case 'restartBackend': + + restartBackend(); + break; case 'savesettings': saveSettings(); @@ -243,6 +247,28 @@ function addToExecutionQueue($action) } +// ---------------------------------------------------------------------------------------- +function restartBackend() +{ + $command = 'pkill -f "python /app/server" && (python /app/server > /dev/null 2>&1 &) && echo "done" 2>&1'; + + // Execute the command + $output = []; + $output_str = ""; + $return_var = 0; + exec($command, $output, $return_var); + + // Format the output + foreach ($output as $line) { + $output_str .= $line . "\n"; + } + + + echo "Command result: $return_var, $output_str"; + +} + + // ---------------------------------------------------------------------------------------- function cleanLog($logFile) { diff --git a/front/php/templates/language/de_de.json b/front/php/templates/language/de_de.json index 6139153e..000e7b34 100755 --- a/front/php/templates/language/de_de.json +++ b/front/php/templates/language/de_de.json @@ -742,6 +742,7 @@ "settings_core_label": "", "settings_device_scanners": "", "settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus", + "settings_device_scanners_info": "", "settings_device_scanners_label": "Gerätescanner", "settings_enabled": "Aktive Einstellungen", "settings_enabled_icon": "fa-solid fa-toggle-on", @@ -756,6 +757,7 @@ "settings_other_scanners_label": "Andere Scanner", "settings_publishers": "", "settings_publishers_icon": "fa-solid fa-paper-plane", + "settings_publishers_info": "", "settings_publishers_label": "Veröffentlicher", "settings_saved": "
Settings saved to the app.conf file.

A time-stamped backup of the previous file created.

Reloading...
", "settings_system_icon": "fa-solid fa-gear", diff --git a/front/php/templates/language/en_us.json b/front/php/templates/language/en_us.json index 81555935..03f7cb1a 100755 --- a/front/php/templates/language/en_us.json +++ b/front/php/templates/language/en_us.json @@ -661,6 +661,7 @@ "settings_core_label": "Core", "settings_device_scanners": "Device scanners used to discover devices that write into the CurrentScan database table.", "settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus", + "settings_device_scanners_info": "Load even more Device Scanners with the LOADED_PLUGINS setting", "settings_device_scanners_label": "Device scanners", "settings_enabled": "Enabled settings", "settings_enabled_icon": "fa-solid fa-toggle-on", @@ -675,6 +676,7 @@ "settings_other_scanners_label": "Other scanners", "settings_publishers": "Enabled notification gateways - publishers, that will send a notification depending on your settings.", "settings_publishers_icon": "fa-solid fa-paper-plane", + "settings_publishers_info": "Load more Publishers with the LOADED_PLUGINS setting", "settings_publishers_label": "Publishers", "settings_saved": "
Settings saved.
Reloading...

", "settings_system_icon": "fa-solid fa-gear", diff --git a/front/php/templates/language/es_es.json b/front/php/templates/language/es_es.json index 49e931ab..94fd3a69 100755 --- a/front/php/templates/language/es_es.json +++ b/front/php/templates/language/es_es.json @@ -741,6 +741,7 @@ "settings_core_label": "Núcleo", "settings_device_scanners": "Los escáneres de los dispositivos se utilizan para descubrir dispositivos que escriben en la tabla de base de datos de CurrentScan.", "settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus", + "settings_device_scanners_info": "", "settings_device_scanners_label": "Escáneres de dispositivos", "settings_enabled": "Configuración activada", "settings_enabled_icon": "fa-solid fa-toggle-on", @@ -755,6 +756,7 @@ "settings_other_scanners_label": "Otros escáneres", "settings_publishers": "Puertas de enlace para las notificación habilitadas: editores, que enviarán una notificación según su configuración.", "settings_publishers_icon": "fa-solid fa-paper-plane", + "settings_publishers_info": "", "settings_publishers_label": "Editores", "settings_saved": "
Ajustes guardados.

Recargando...

", "settings_system_icon": "fa-solid fa-gear", diff --git a/front/php/templates/language/fr_fr.json b/front/php/templates/language/fr_fr.json index 3fa8ca75..f6d5c8b4 100755 --- a/front/php/templates/language/fr_fr.json +++ b/front/php/templates/language/fr_fr.json @@ -661,6 +661,7 @@ "settings_core_label": "", "settings_device_scanners": "", "settings_device_scanners_icon": "", + "settings_device_scanners_info": "", "settings_device_scanners_label": "Scanners d'appareils", "settings_enabled": "Paramètres activés", "settings_enabled_icon": "", @@ -675,6 +676,7 @@ "settings_other_scanners_label": "", "settings_publishers": "", "settings_publishers_icon": "", + "settings_publishers_info": "", "settings_publishers_label": "Éditeurs", "settings_saved": "", "settings_system_icon": "", diff --git a/front/php/templates/language/it_it.json b/front/php/templates/language/it_it.json index 1e1f1a67..65dd76aa 100755 --- a/front/php/templates/language/it_it.json +++ b/front/php/templates/language/it_it.json @@ -661,6 +661,7 @@ "settings_core_label": "Core", "settings_device_scanners": "Scanner dei dispositivi utilizzati per rilevare i dispositivi che scrivono nella tabella del database CurrentScan.", "settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus", + "settings_device_scanners_info": "", "settings_device_scanners_label": "Scanner dispositivi", "settings_enabled": "Impostazioni abilitate", "settings_enabled_icon": "fa-solid fa-toggle-on", @@ -675,6 +676,7 @@ "settings_other_scanners_label": "Altri scanner", "settings_publishers": "Gateway/editori di notifica abilitati, che invieranno una notifica in base alle tue impostazioni.", "settings_publishers_icon": "fa-solid fa-paper-plane", + "settings_publishers_info": "", "settings_publishers_label": "Editori", "settings_saved": "
Impostazioni salvate.
Aggiornamento in corso...

", "settings_system_icon": "fa-solid fa-gear", diff --git a/front/php/templates/language/nb_no.json b/front/php/templates/language/nb_no.json index 62df412b..6292f818 100755 --- a/front/php/templates/language/nb_no.json +++ b/front/php/templates/language/nb_no.json @@ -661,6 +661,7 @@ "settings_core_label": "Core", "settings_device_scanners": "Enhets-skannere som brukes til å oppdage enheter som skrives inn i CurrentScan databasetabellen.", "settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus", + "settings_device_scanners_info": "", "settings_device_scanners_label": "Enhets skannere", "settings_enabled": "Aktiverte innstillinger", "settings_enabled_icon": "fa-solid fa-toggle-on", @@ -675,6 +676,7 @@ "settings_other_scanners_label": "Andre skannere", "settings_publishers": "Aktivert notifikasjons-gateways - utgivere, som vil sende en notifikasjon avhengig av innstillingene dine.", "settings_publishers_icon": "fa-solid fa-paper-plane", + "settings_publishers_info": "", "settings_publishers_label": "Utgivere", "settings_saved": "
Innstillinger lagret.
Laster inn på nytt...

", "settings_system_icon": "fa-solid fa-gear", diff --git a/front/php/templates/language/pl_pl.json b/front/php/templates/language/pl_pl.json index 2fc5df4c..bd8ec834 100755 --- a/front/php/templates/language/pl_pl.json +++ b/front/php/templates/language/pl_pl.json @@ -661,6 +661,7 @@ "settings_core_label": "Główne", "settings_device_scanners": "Urządzenia skanujące użyte do wykrycia urządzeń które wpisują do tabeli bazy danych CurrentScan.", "settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus", + "settings_device_scanners_info": "", "settings_device_scanners_label": "Skanery Urządzeń", "settings_enabled": "Włącz ustawienia", "settings_enabled_icon": "fa-solid fa-toggle-on", @@ -675,6 +676,7 @@ "settings_other_scanners_label": "Inne Skanery", "settings_publishers": "Włącz bramy/wydawców powiadomień, którzy będą wysyłać powiadomienia zależnie od ustawień.", "settings_publishers_icon": "fa-solid fa-paper-plane", + "settings_publishers_info": "", "settings_publishers_label": "Wydawcy", "settings_saved": "
Ustawienia zapisane.
Przeładowanie...

", "settings_system_icon": "fa-solid fa-gear", diff --git a/front/php/templates/language/pt_br.json b/front/php/templates/language/pt_br.json index a3ca6892..df3220cd 100755 --- a/front/php/templates/language/pt_br.json +++ b/front/php/templates/language/pt_br.json @@ -661,6 +661,7 @@ "settings_core_label": "", "settings_device_scanners": "", "settings_device_scanners_icon": "", + "settings_device_scanners_info": "", "settings_device_scanners_label": "", "settings_enabled": "", "settings_enabled_icon": "", @@ -675,6 +676,7 @@ "settings_other_scanners_label": "", "settings_publishers": "", "settings_publishers_icon": "", + "settings_publishers_info": "", "settings_publishers_label": "", "settings_saved": "", "settings_system_icon": "", diff --git a/front/php/templates/language/ru_ru.json b/front/php/templates/language/ru_ru.json index a71d6850..5c40982d 100755 --- a/front/php/templates/language/ru_ru.json +++ b/front/php/templates/language/ru_ru.json @@ -661,6 +661,7 @@ "settings_core_label": "Основные", "settings_device_scanners": "Сканеры устройств, используемые для обнаружения устройств, записывающих данные в таблицу базы данных CurrentScan.", "settings_device_scanners_icon": "fa-solid fa-magnifying-glass-plus", + "settings_device_scanners_info": "", "settings_device_scanners_label": "Сканеры устройств", "settings_enabled": "Вкл. настройки", "settings_enabled_icon": "fa-solid fa-toggle-on", @@ -675,6 +676,7 @@ "settings_other_scanners_label": "Другие сканеры", "settings_publishers": "Включенные шлюзы уведомлений - сервисы, которые будут отправлять уведомления в зависимости от ваших настроек.", "settings_publishers_icon": "fa-solid fa-paper-plane", + "settings_publishers_info": "", "settings_publishers_label": "Уведомления", "settings_saved": "
Настройки сохранены.
Перезагрузка...

", "settings_system_icon": "fa-solid fa-gear", diff --git a/front/php/templates/language/tr_tr.json b/front/php/templates/language/tr_tr.json index 023a0d09..96f7fe56 100755 --- a/front/php/templates/language/tr_tr.json +++ b/front/php/templates/language/tr_tr.json @@ -661,6 +661,7 @@ "settings_core_label": "", "settings_device_scanners": "", "settings_device_scanners_icon": "", + "settings_device_scanners_info": "", "settings_device_scanners_label": "", "settings_enabled": "", "settings_enabled_icon": "", @@ -675,6 +676,7 @@ "settings_other_scanners_label": "", "settings_publishers": "", "settings_publishers_icon": "", + "settings_publishers_info": "", "settings_publishers_label": "", "settings_saved": "", "settings_system_icon": "", diff --git a/front/php/templates/language/zh_cn.json b/front/php/templates/language/zh_cn.json index fc74ebc3..46f6d1b3 100755 --- a/front/php/templates/language/zh_cn.json +++ b/front/php/templates/language/zh_cn.json @@ -661,6 +661,7 @@ "settings_core_label": "", "settings_device_scanners": "", "settings_device_scanners_icon": "", + "settings_device_scanners_info": "", "settings_device_scanners_label": "", "settings_enabled": "", "settings_enabled_icon": "", @@ -675,6 +676,7 @@ "settings_other_scanners_label": "", "settings_publishers": "", "settings_publishers_icon": "", + "settings_publishers_info": "", "settings_publishers_label": "", "settings_saved": "", "settings_system_icon": "", diff --git a/front/plugins/__template/README.md b/front/plugins/__template/README.md index c73241c3..4c0aa412 100755 --- a/front/plugins/__template/README.md +++ b/front/plugins/__template/README.md @@ -1,6 +1,6 @@ ## Overview -PLugin functionality overview and links to external resources if relevant. Include use cases if available. +Plugin functionality overview and links to external resources if relevant. Include use cases if available. > [!TIP] > Some tip. diff --git a/front/plugins/__template/config.json b/front/plugins/__template/config.json index 555375bf..8f6aa5c4 100755 --- a/front/plugins/__template/config.json +++ b/front/plugins/__template/config.json @@ -1,9 +1,9 @@ { - "code_name": "sync", - "unique_prefix": "SYNC", - "plugin_type": "system", + "code_name": "folder_name", + "unique_prefix": "", + "plugin_type": "core|general|system|scanner|other|publisher", "enabled": true, - "data_source": "script", + "data_source": "script|app-db-query|template|sqlite-db-query", "mapped_to_table": "CurrentScan", "data_filters": [ { @@ -19,13 +19,13 @@ "display_name": [ { "language_code": "en_us", - "string": "Sync Hub" + "string": "Display Name" } ], "description": [ { "language_code": "en_us", - "string": "Plugin to synchronize multiple NetAlertX instances." + "string": "Plugin to ..." } ], "icon": [ @@ -55,27 +55,18 @@ { "language_code": "en_us", "string": "When to run" - }, - { - "language_code": "es_es", - "string": "Cuándo ejecutar" - }, - { - "language_code": "de_de", - "string": "Wann laufen" } ], "description": [ { "language_code": "en_us", - "string": "When the sync should run. Data might be lost if you run the sync less frequently. Good options are always_after_scan, on_new_device, on_notification" + "string": "When the plugin should run. Good options are always_after_scan, on_new_device, on_notification" } ] }, { "function": "RUN_SCHD", "type": "text", - "default_value": "*/5 * * * *", "options": [], "localized": ["name", "description"], @@ -89,19 +80,11 @@ { "language_code": "en_us", "string": "Only enabled if you select schedule in the SYNC_RUN setting. Make sure you enter the schedule in the correct cron-like format (e.g. validate at crontab.guru). For example entering 0 4 * * * will run the scan after 4 am in the TIMEZONE you set above. Will be run NEXT time the time passes." - }, - { - "language_code": "es_es", - "string": "Solo está habilitado si selecciona schedule en la configuración SYNC_RUN. Asegúrese de ingresar la programación en el formato similar a cron correcto (por ejemplo, valide en crontab.guru). Por ejemplo, ingresar 0 4 * * * ejecutará el escaneo después de las 4 a.m. en el TIMEZONE que configuró arriba. Se ejecutará la PRÓXIMA vez que pase el tiempo." - }, - { - "language_code": "de_de", - "string": "Nur aktiviert, wenn Sie schedule in der SYNC_RUN-Einstellung auswählen. Stellen Sie sicher, dass Sie den Zeitplan im richtigen Cron-ähnlichen Format eingeben (z. B. validieren unter crontab.guru). Wenn Sie beispielsweise 0 4 * * * eingeben, wird der Scan nach 4 Uhr morgens in der TIMEZONE den Sie oben festgelegt haben. Wird das NÄCHSTE Mal ausgeführt, wenn die Zeit vergeht." } ] }, { - "function": "api_token", + "function": "text_example", "type": "text", "maxLength": 50, "default_value": "", @@ -110,79 +93,18 @@ "name": [ { "language_code": "en_us", - "string": "API token" + "string": "Setting name" } ], "description": [ { "language_code": "en_us", - "string": "API token to secure communication. It's sent in the request header. The API token needs to be the same on the hub and on the nodes." + "string": "Description / simple setup instructions" } ] }, { - "function": "encryption_key", - "type": "text", - "maxLength": 50, - "default_value": "", - "options": [], - "localized": ["name", "description"], - "name": [ - { - "language_code": "en_us", - "string": "Encryption Key" - } - ], - "description": [ - { - "language_code": "en_us", - "string": "Encryption key used to encrypt the data before sending and for decryption on th ehub. The key needs to be the same on the hub and on the nodes." - } - ] - }, - { - "function": "hub_url", - "type": "text", - - "maxLength": 50, - "default_value": "", - "options": [], - "localized": ["name", "description"], - "name": [ - { - "language_code": "en_us", - "string": "Hub URL" - } - ], - "description": [ - { - "language_code": "en_us", - "string": "The URL of the hub (target instance). Set on the Node. Without a trailig slash, for example http://192.168.1.82:20211" - } - ] - }, - { - "function": "node_name", - "type": "text", - "maxLength": 50, - "default_value": "", - "options": [], - "localized": ["name", "description"], - "name": [ - { - "language_code": "en_us", - "string": "Node name" - } - ], - "description": [ - { - "language_code": "en_us", - "string": "Use a unique node name, without spaces or special characters, such as Node_Vlan01" - } - ] - }, - { - "function": "devices", + "function": "boolean_example", "type": "boolean", "default_value": false, "options": [], @@ -190,18 +112,18 @@ "name": [ { "language_code": "en_us", - "string": "Sync Devices" + "string": "Setting name" } ], "description": [ { "language_code": "en_us", - "string": "When enabled the whole Devices table is sent over. Only new devices with new MACs are inserted in the target hub." + "string": "Description / simple setup instructions" } ] }, { - "function": "plugins", + "function": "multiselect_example_from_setting", "type": "text.multiselect", "maxLength": 50, "default_value": [], @@ -217,13 +139,13 @@ "name": [ { "language_code": "en_us", - "string": "Sync Plugins" + "string": "Setting name" } ], "description": [ { "language_code": "en_us", - "string": "Plugins to synchronize. Only plugins that produce some kind of output in last_result.log can be synchronized." + "string": "Description / simple setup instructions" } ] }, @@ -237,28 +159,12 @@ { "language_code": "en_us", "string": "Command" - }, - { - "language_code": "es_es", - "string": "Comando" - }, - { - "language_code": "de_de", - "string": "Befehl" } ], "description": [ { "language_code": "en_us", "string": "Command to run. This can not be changed" - }, - { - "language_code": "es_es", - "string": "Comando a ejecutar. Esto no se puede cambiar" - }, - { - "language_code": "de_de", - "string": "Befehl zum Ausführen. Dies kann nicht geändert werden" } ] }, @@ -272,28 +178,12 @@ { "language_code": "en_us", "string": "Run timeout" - }, - { - "language_code": "es_es", - "string": "Tiempo límite de ejecución" - }, - { - "language_code": "de_de", - "string": "Zeitüberschreitung" } ], "description": [ { "language_code": "en_us", "string": "Maximum time in seconds to wait for the script to finish. If this time is exceeded the script is aborted." - }, - { - "language_code": "es_es", - "string": "Tiempo máximo en segundos para esperar a que finalice el script. Si se supera este tiempo, el script se cancela." - }, - { - "language_code": "de_de", - "string": "Maximale Zeit in Sekunden, die auf den Abschluss des Skripts gewartet werden soll. Bei Überschreitung dieser Zeit wird das Skript abgebrochen." } ] } @@ -312,14 +202,6 @@ { "language_code": "en_us", "string": "MAC" - }, - { - "language_code": "es_es", - "string": "MAC" - }, - { - "language_code": "de_de", - "string": "MAC" } ] }, @@ -336,14 +218,6 @@ { "language_code": "en_us", "string": "IP" - }, - { - "language_code": "es_es", - "string": "IP" - }, - { - "language_code": "de_de", - "string": "IP" } ] }, @@ -376,14 +250,6 @@ { "language_code": "en_us", "string": "Vendor" - }, - { - "language_code": "es_es", - "string": "Proveedor" - }, - { - "language_code": "de_de", - "string": "Hersteller" } ] }, @@ -434,14 +300,6 @@ { "language_code": "en_us", "string": "Scan method" - }, - { - "language_code": "es_es", - "string": "Método de escaneo" - }, - { - "language_code": "de_de", - "string": "Scanmethode" } ] }, @@ -457,14 +315,6 @@ { "language_code": "en_us", "string": "Created" - }, - { - "language_code": "es_es", - "string": "Creado" - }, - { - "language_code": "de_de", - "string": "Erstellt" } ] }, @@ -480,14 +330,6 @@ { "language_code": "en_us", "string": "Changed" - }, - { - "language_code": "es_es", - "string": "Cambiado" - }, - { - "language_code": "de_de", - "string": "Geändert" } ] }, @@ -520,14 +362,6 @@ { "language_code": "en_us", "string": "Status" - }, - { - "language_code": "es_es", - "string": "Estado" - }, - { - "language_code": "de_de", - "string": "Status" } ] } diff --git a/front/plugins/sync/config.json b/front/plugins/sync/config.json index 4f12ba57..862efcfb 100755 --- a/front/plugins/sync/config.json +++ b/front/plugins/sync/config.json @@ -136,7 +136,7 @@ "description": [ { "language_code": "en_us", - "string": "Encryption key used to encrypt the data before sending and for decryption on th ehub. The key needs to be the same on the hub and on the nodes." + "string": "Encryption key used to encrypt the data before sending and for decryption on the hub. The key needs to be the same on the hub and on the nodes." } ] }, diff --git a/front/plugins/ui_settings/README.md b/front/plugins/ui_settings/README.md index c73241c3..1ec55841 100755 --- a/front/plugins/ui_settings/README.md +++ b/front/plugins/ui_settings/README.md @@ -1,23 +1,8 @@ ## Overview -PLugin functionality overview and links to external resources if relevant. Include use cases if available. - -> [!TIP] -> Some tip. - -### Quick setup guide - -To set up the plugin correctly, make sure... - -#### Required Settings - -- When to run `PREF_RUN` -- +UI-related settings. ### Usage -- Head to **Settings** > **Plugin name** to adjust the default values. +- Head to **Settings** > **UI Settings** to adjust the default values. -### Notes - -- Additional notes, limitations, Author info. \ No newline at end of file diff --git a/front/plugins/unifi_import/README.md b/front/plugins/unifi_import/README.md index 08ea07fd..9a891420 100755 --- a/front/plugins/unifi_import/README.md +++ b/front/plugins/unifi_import/README.md @@ -6,14 +6,16 @@ A plugin allowing for importing devices from a UniFi controller. Specify the following settings in the Settings section of NetAlertX: -- `UNFIMP_username` - Username used to login into the UNIFI controller. -- `UNFIMP_password` - Password used to login into the UNIFI controller. -- `UNFIMP_host` - Host url or IP address where the UNIFI controller is hosted (excluding http://) +- `UNFIMP_username` - Username used to log in the UNIFI controller. +- `UNFIMP_password` - Password used to log in the UNIFI controller. +- `UNFIMP_host` - Host URL or IP address where the UNIFI controller is hosted (excluding `http://`) - `UNFIMP_sites` - Name of the sites (usually 'default', check the URL in your UniFi controller UI if unsure. The site id is in the following part of the URL: `https://192.168.1.1:8443/manage/site/this-is-the-site-id/settings/`). - `UNFIMP_protocol` - https:// or http:// -- `UNFIMP_port` - Usually 8443 +- `UNFIMP_port` - Usually `8443` or `8843` +- `UNFIMP_version` - e.g. `UDMP-unifiOS` is used for the "Cloud Gateway Ultra" + ### Notes - Currently only used to import devices, not their status, type or network map. -- It is recommend to create a read-only user in your UniFi controller \ No newline at end of file +- It is recommended to create a read-only user in your UniFi controller \ No newline at end of file diff --git a/front/settings.php b/front/settings.php index f8d33a63..9bf7394f 100755 --- a/front/settings.php +++ b/front/settings.php @@ -122,7 +122,7 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
">
-
+
@@ -136,7 +136,7 @@ $settingsJSON_DB = json_encode($settings, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX
">
-
+
diff --git a/install/netalertx.template.conf b/install/netalertx.template.conf index dc6ecfa8..66e2a364 100755 --- a/install/netalertx.template.conf +++ b/install/netalertx.template.conf @@ -5,6 +5,36 @@ server { add_header X-Forwarded-Prefix "/app" always; proxy_set_header X-Forwarded-Prefix "/app"; + # Increase buffer sizes to handle larger headers + proxy_buffer_size 512k; + proxy_buffers 16 512k; + proxy_busy_buffers_size 512k; + proxy_http_version 1.1; + proxy_set_header Connection ""; + + + # # Whitelisting IP addresses + # location /api/ { + # # Allow requests from localhost (loopback address) + # allow 127.0.0.1; + # # Allow requests from other trusted IP addresses + # # allow 192.168.1.0/24; # Replace with the actual IP of a trusted client + # # Deny all other IP addresses + # deny all; + + # # Enable CORS for specific frontend domain + # add_header 'Access-Control-Allow-Origin' 'http://vlan_ip' always; + # add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; + # add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type' always; + + # if ($request_method = 'OPTIONS') { + # return 204; + # } + + # try_files $uri $uri/ =404; + # } + + location ~* \.php$ { # Set Cache-Control header to prevent caching on the first load add_header Cache-Control "no-store"; diff --git a/server/plugin.py b/server/plugin.py index b6b2bf58..713c31a6 100755 --- a/server/plugin.py +++ b/server/plugin.py @@ -14,7 +14,8 @@ from logger import mylog from helper import timeNowTZ, updateState, get_file_content, write_file, get_setting, get_setting_value from api import update_api from plugin_utils import logEventStatusCounts, get_plugin_string, get_plugin_setting_obj, print_plugin_info, list_to_csv, combine_plugin_objects, resolve_wildcards_arr, handle_empty, custom_plugin_decoder, decode_and_rename_files -from notification import Notification_obj +from notification import Notification_obj, write_notification + #------------------------------------------------------------------------------- class plugin_param: @@ -750,6 +751,9 @@ class plugin_object_class: def check_and_run_user_event(db, all_plugins, pluginsState): # Check if the log file exists logFile = os.path.join(logPath, "execution_queue.log") + + # track if not an API event + show_events_completed = False if not os.path.exists(logFile): return pluginsState @@ -767,8 +771,10 @@ def check_and_run_user_event(db, all_plugins, pluginsState): event, param = columns if event == 'test': + show_events_completed = True pluginsState = handle_test(param, db, all_plugins, pluginsState) if event == 'run': + show_events_completed = True pluginsState = handle_run(param, db, all_plugins, pluginsState) if event == 'update_api': # update API endpoints @@ -777,6 +783,10 @@ def check_and_run_user_event(db, all_plugins, pluginsState): # Clear the log file open(logFile, "w").close() + # only show pop up if not an API event + if show_events_completed: + write_notification('[Ad-hoc events] All Events executed', 'interrupt', timeNowTZ()) + return pluginsState