jokob-sk / NetAlertX

🖧🔍 WIFI / LAN intruder detector. Scans for devices connected to your network and alerts you if new and unknown devices are found.
GNU General Public License v3.0
2.74k stars 160 forks source link

[bug] Settings aren't displaying #473

Closed AmadeusGraves closed 11 months ago

AmadeusGraves commented 11 months ago

Describe the issue

When submitting an issue ❗enable debug❗ and have a look at the docs

[describe your issue]

When I check the pi.alert configuration just after upgrading to the latest version, I see that the configuration is not displayed.

Paste your pialert.conf (remove personal info)

#-----------------AUTOGENERATED FILE-----------------#
#                                                    #
#         Generated:  2022-12-30_22-19-40            #
#                                                    #
#   Config file for the LAN intruder detection app:  #
#      https://github.com/jokob-sk/Pi.Alert          #
#                                                    #
#-----------------AUTOGENERATED FILE-----------------#

# General
#---------------------------
# Scan using interface eth0
# SCAN_SUBNETS    = ['192.168.1.0/24 --interface=eth0']
#
# Scan multiple interfaces (eth1 and eth0):
# SCAN_SUBNETS    = [ '192.168.1.0/24 --interface=eth1', '192.168.1.0/24 --interface=eth0' ]

SCAN_SUBNETS=['192.168.1.0/24 --interface=eth1']

TIMEZONE='Europe/Berlin'
PIALERT_WEB_PROTECTION=False
PIALERT_WEB_PASSWORD='8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92'
INCLUDED_SECTIONS=['internet','new_devices','down_devices','events']
DAYS_TO_KEEP_EVENTS=90
# Used for generating links in emails. Make sure not to add a trailing slash!
REPORT_DASHBOARD_URL='http://pi.alert'

# Email
#---------------------------
REPORT_MAIL=False
SMTP_SERVER='smtp.gmail.com'
SMTP_PORT=587
REPORT_TO='user@gmail.com'
REPORT_FROM='Pi.Alert <user@gmail.com>'
SMTP_SKIP_LOGIN=False
SMTP_USER='user@gmail.com'
SMTP_PASS='password'
SMTP_SKIP_TLS=False

# Webhooks
#---------------------------
REPORT_WEBHOOK=False
WEBHOOK_URL='http://n8n.local:5555/webhook-test/aaaaaaaa-aaaa-aaaa-aaaaa-aaaaaaaaaaaa'
WEBHOOK_PAYLOAD='json'                 # webhook payload data format for the "body > attachements > text" attribute 
                                       # in https://github.com/jokob-sk/Pi.Alert/blob/main/docs/webhook_json_sample.json 
                                       #   supported values: 'json', 'html' or 'text'
                                       #   e.g.: for discord use 'html'
WEBHOOK_REQUEST_METHOD='GET'

# Apprise
#---------------------------
REPORT_APPRISE=False
APPRISE_HOST='http://localhost:8000/notify'
APPRISE_URL='mailto://smtp-relay.sendinblue.com:587?from=user@gmail.com&name=apprise&user=user@gmail.com&pass=password&to=user@gmail.com'

# NTFY
#---------------------------
REPORT_NTFY=False
NTFY_HOST='https://ntfy.sh'
NTFY_TOPIC='replace_my_secure_topicname_91h889f28'
NTFY_USER='user'
NTFY_PASSWORD='passw0rd'

# PUSHSAFER
#---------------------------
REPORT_PUSHSAFER=False
PUSHSAFER_TOKEN='ApiKey'

# MQTT
#---------------------------
REPORT_MQTT=False
MQTT_BROKER='192.168.1.2'
MQTT_PORT=1883
MQTT_USER='mqtt'
MQTT_PASSWORD='passw0rd'
MQTT_QOS=0
MQTT_DELAY_SEC=2

# DynDNS
#---------------------------
DDNS_ACTIVE=False
DDNS_DOMAIN='your_domain.freeddns.org'
DDNS_USER='dynu_user'
DDNS_PASSWORD='A0000000B0000000C0000000D0000000'
DDNS_UPDATE_URL='https://api.dynu.com/nic/update?'

#-------------------IMPORTANT INFO-------------------#
#   This file is ingested by a python script, so if  #
#        modified it needs to use python syntax      #
#-------------------IMPORTANT INFO-------------------#

Paste your docker-compose.yml and .env (remove personal info)

docker-compose.yml

name: pi-alert
services:
  app:
    cpu_shares: 90
    command: []
    container_name: pialert
    deploy:
      resources:
        limits:
          memory: 15869M
    environment:
      - HOST_USER_GID=1000
      - HOST_USER_ID=1000
      - PGID=1000
      - PUID=1000
      - TZ=XXXXXXXX
    image: jokobsk/pi.alert:latest
    labels:
      icon: https://raw.githubusercontent.com/pucherot/Pi.Alert/main/front/img/pialertLogoGray50.png
    ports:
      - target: 20211
        published: "20211"
        protocol: tcp
    restart: always
    volumes:
      - type: bind
        source: /XXXXXXXXX/pi-alert/config
        target: /XXXXX/config
      - type: bind
        source: /XXXXXX/pi-alert/db
        target: /XXXXXX/pialert/db
    x-casaos:
      envs:
        - container: PUID
          description:
            en_us: ""
        - container: PGID
          description:
            en_us: ""
    devices: []
    cap_add: []
    network_mode: host
    privileged: false
x-casaos:
  architectures:
    - amd64
    - arm
    - arm64
  author: XXXXXX
  category: XXXXXX
  description:
    en_us: WIFI / LAN intruder detector
  developer: ""
  hostname: ""
  icon: https://raw.githubusercontent.com/pucherot/Pi.Alert/main/front/img/pialertLogoGray50.png
  index: /
  main: app
  port_map: "20211"
  scheme: http
  store_app_id: pi-alert
  tagline:
    en_us: Wifi / Lan Intruder Detector
  thumbnail: https://raw.githubusercontent.com/pucherot/Pi.Alert/main/docs/img/1_devices.jpg
  title:
    custom: Pi.alert
    en_us: Pi.alert

Screenshots

[If applicable, add screenshots to help explain your problem.] image

image

Paste last few lines from pialert.log

You can use tail -100 /home/pi/pialert/front/log/pialert.log

2023-10-07T17:10:48.695984639Z Starting nginx: nginx.
2023-10-07T17:13:03.985477640Z 19:10:48 [MAIN] Setting up ...
2023-10-07T17:13:03.985504103Z 19:10:48 [conf.tz] Setting up ...
2023-10-07T17:13:03.985509465Z 19:10:48 
2023-10-07T17:13:03.985513431Z 
2023-10-07T17:13:03.985517301Z 19:10:48 The container restarted (started). If this is unexpected check https://bit.ly/PiAlertDebug for troubleshooting tips.
2023-10-07T17:13:03.985521451Z 19:10:48 
2023-10-07T17:13:03.985525309Z 
2023-10-07T17:13:03.985529072Z 19:10:48 Permissions check (All should be True)
2023-10-07T17:13:03.985532839Z 19:10:48 ------------------------------------------------
2023-10-07T17:13:03.985536524Z 19:10:48   /config/pialert.conf |  READ  | False
2023-10-07T17:13:03.985540230Z 19:10:48   /config/pialert.conf |  WRITE | False
2023-10-07T17:13:03.985543969Z 19:10:48   /db/pialert.db       |  READ  | False
2023-10-07T17:13:03.985547687Z 19:10:48   /db/pialert.db       |  WRITE | False
2023-10-07T17:13:03.985551454Z 19:10:48 ------------------------------------------------
2023-10-07T17:13:03.985555149Z 19:10:48 [Setup] (/home/pi/pialert/config/pialert.conf) file is not readable or missing. Trying to copy over the default one.
2023-10-07T17:13:03.985559084Z 19:10:48 [Setup] (/home/pi/pialert/back/pialert.conf_bak) copied over successfully to (/home/pi/pialert/config/pialert.conf).
2023-10-07T17:13:03.985562966Z 19:10:48 [Setup] (/home/pi/pialert/db/pialert.db) file is not readable or missing. Trying to copy over the default one.
2023-10-07T17:13:03.985567276Z 19:10:48 [Setup] (/home/pi/pialert/back/pialert.db_bak) copied over successfully to (/home/pi/pialert/db/pialert.db).
2023-10-07T17:13:03.985571188Z 19:10:48 [Setup] Attempting to fix permissions.
2023-10-07T17:13:03.985574911Z 19:10:48 [Setup] Attempting to fix permissions.
2023-10-07T17:13:03.985578627Z 19:10:48 [Database] Opening DB
2023-10-07T17:13:03.985582345Z 19:10:48 [upgradeDB] Adding dev_Network_Node_MAC_ADDR to the Devices table
2023-10-07T17:13:03.985586172Z 19:10:48 [upgradeDB] Adding dev_Network_Node_port to the Devices table
2023-10-07T17:13:03.985590177Z 19:10:48 [upgradeDB] Adding dev_Icon to the Devices table
2023-10-07T17:13:03.985594042Z 19:10:48 [upgradeDB] Re-creating Settings table
2023-10-07T17:13:03.985597729Z 19:10:48 [upgradeDB] Re-creating Pholus_Scan table
2023-10-07T17:13:03.985601817Z 19:10:48 [upgradeDB] Re-creating Parameters table
2023-10-07T17:13:03.985605641Z 19:10:49 [Version check] Running the latest version.
2023-10-07T17:13:03.985609401Z 19:10:49 [Config] reading config file
2023-10-07T17:13:03.985613179Z 19:10:49 [Config] Plugins: Number of dynamically loaded plugins: 17
2023-10-07T17:13:03.985617172Z 19:10:49 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.985620880Z 19:10:49 [Plugins] display_name: DDNS update
2023-10-07T17:13:03.985632387Z 19:10:49 [Plugins] description: A plugin update the DDNS record.
2023-10-07T17:13:03.985636478Z 19:10:49 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.985640224Z 19:10:49 [Plugins] display_name: Internet check
2023-10-07T17:13:03.985644988Z 19:10:49 [Plugins] description: A plugin to check your internet connectivity and IP.
2023-10-07T17:13:03.985648805Z 19:10:49 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.985652593Z 19:10:49 [Plugins] display_name: SNMP discovery
2023-10-07T17:13:03.985656326Z 19:10:49 [Plugins] description: This plugin is used to discover devices via the arp table(s) of a RFC1213 compliant router or switch.
2023-10-07T17:13:03.985660230Z 19:10:49 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.985663916Z 19:10:49 [Plugins] display_name: DHCP Leases (Device import)
2023-10-07T17:13:03.985667642Z 19:10:49 [Plugins] description: This plugin is to import devices from dhcp.leases files.
2023-10-07T17:13:03.985671403Z 19:10:50 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.985675110Z 19:10:50 [Plugins] display_name: UniFi import
2023-10-07T17:13:03.985678824Z 19:10:50 [Plugins] description: This plugin is used to import devices from an UNIFI controller.
2023-10-07T17:13:03.985682589Z 19:10:50 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.985686269Z 19:10:50 [Plugins] display_name: Rogue DHCP
2023-10-07T17:13:03.985689952Z 19:10:50 [Plugins] description: This plugin is to use NMAP to monitor for rogue DHCP servers.
2023-10-07T17:13:03.985693787Z 19:10:50 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.985697474Z 19:10:50 [Plugins] display_name: PiHole (Device sync)
2023-10-07T17:13:03.985701148Z 19:10:50 [Plugins] description: This plugin syncs devices from the PiHole database
2023-10-07T17:13:03.985705012Z 19:10:51 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.985708701Z 19:10:51 [Plugins] display_name: Arp-Scan (Network scan)
2023-10-07T17:13:03.985780534Z 19:10:51 [Plugins] description: This plugin is to execute an arp-scan on the local network
2023-10-07T17:13:03.985798059Z 19:10:51 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.985811078Z 19:10:51 [Plugins] display_name: CSV backup
2023-10-07T17:13:03.985823894Z 19:10:51 [Plugins] description: A plugin to auto-generate devices.csv backups.
2023-10-07T17:13:03.985837879Z 19:10:51 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.985860864Z 19:10:51 [Plugins] display_name: Un-Discoverable Devices
2023-10-07T17:13:03.985874615Z 19:10:51 [Plugins] description: This plugin is to import undiscoverable devices from a file.
2023-10-07T17:13:03.985888015Z 19:10:51 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.985901346Z 19:10:51 [Plugins] display_name: DB cleanup
2023-10-07T17:13:03.985918976Z 19:10:51 [Plugins] description: A plugin to schedule database cleanup & upkeep tasks.
2023-10-07T17:13:03.985931118Z 19:10:51 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.985944430Z 19:10:51 [Plugins] display_name: Vendor update
2023-10-07T17:13:03.985956330Z 19:10:51 [Plugins] description: A plugin to schedule vendor database updates for mac based vendor resolution.
2023-10-07T17:13:03.985968646Z 19:10:51 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.985997807Z 19:10:51 [Plugins] display_name: Pholus-Scan (Name discovery)
2023-10-07T17:13:03.986013454Z 19:10:51 [Plugins] description: This plugin is to execute a Pholus-scan (name discovery) on the local network
2023-10-07T17:13:03.986025286Z 19:10:51 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.986036766Z 19:10:51 [Plugins] display_name: Services & Ports (NMAP)
2023-10-07T17:13:03.986049094Z 19:10:51 [Plugins] description: This plugin shows all services discovered by NMAP scans.
2023-10-07T17:13:03.986060785Z 19:10:51 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.986072217Z 19:10:51 [Plugins] display_name: Website monitor
2023-10-07T17:13:03.986084282Z 19:10:51 [Plugins] description: This plugin is to monitor status changes of services or websites.
2023-10-07T17:13:03.986095602Z 19:10:52 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.986107538Z 19:10:52 [Plugins] display_name: Set password
2023-10-07T17:13:03.986118313Z 19:10:52 [Plugins] description: A simple plugin to set the web ui password on app start.
2023-10-07T17:13:03.986129043Z 19:10:52 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.986140569Z 19:10:52 [Plugins] display_name: New Devices
2023-10-07T17:13:03.986151172Z 19:10:52 [Plugins] description: The template used for new devices.
2023-10-07T17:13:03.986162315Z 19:10:53 [API] Updating table_settings.json file in /front/api
2023-10-07T17:13:03.986172989Z 19:10:53 [Config] Imported new config
2023-10-07T17:13:03.986183256Z 19:10:53 [API] Updating table_devices.json file in /front/api
2023-10-07T17:13:03.986193522Z 19:10:53 [API] Updating table_events_pending_alert.json file in /front/api
2023-10-07T17:13:03.986204433Z 19:10:53 [API] Updating table_plugins_events.json file in /front/api
2023-10-07T17:13:03.986216042Z 19:10:53 [API] Updating table_plugins_history.json file in /front/api
2023-10-07T17:13:03.986227021Z 19:10:53 [API] Updating table_plugins_objects.json file in /front/api
2023-10-07T17:13:03.986237433Z 19:10:53 [API] Updating table_plugins_language_strings.json file in /front/api
2023-10-07T17:13:03.986247755Z 19:10:53 [API] Updating table_custom_endpoint.json file in /front/api
2023-10-07T17:13:03.986259701Z 19:10:53 [Notification] Check if something to report
2023-10-07T17:13:03.986276655Z 19:10:53 [Notification] Open text Template
2023-10-07T17:13:03.986287821Z 19:10:53 [Notification] Open html Template
2023-10-07T17:13:03.986299058Z 19:10:53 [Notification] Using template/back/report_template.html
2023-10-07T17:13:03.986309460Z 19:10:53 [Notification] included sections: ['internet', 'new_devices', 'down_devices', 'events']
2023-10-07T17:13:03.986324322Z 19:10:53 [Notification] New Devices sections done.
2023-10-07T17:13:03.986336185Z 19:10:53 [Notification] Down Devices sections done.
2023-10-07T17:13:03.986346733Z 19:10:53 [Notification] Events sections done.
2023-10-07T17:13:03.986356990Z 19:10:53 [Notification] No changes to report
2023-10-07T17:13:03.986367194Z 19:10:53 [Notification] Notifications changes: 0
2023-10-07T17:13:03.986377535Z 19:10:53 [MAIN] Process: Wait
2023-10-07T17:13:03.986388742Z 19:10:58 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986399759Z 19:11:03 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986410194Z 19:11:08 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986420286Z 19:11:13 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986430451Z 19:11:18 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986441298Z 19:11:23 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986451498Z 19:11:28 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986461586Z 19:11:33 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986471813Z 19:11:38 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986481873Z 19:11:43 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986493507Z 19:11:48 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986503881Z 19:11:53 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986514130Z 19:11:58 [Notification] Check if something to report
2023-10-07T17:13:03.986524324Z 19:11:58 [Notification] Open text Template
2023-10-07T17:13:03.986534556Z 19:11:58 [Notification] Open html Template
2023-10-07T17:13:03.986545520Z 19:11:58 [Notification] Using template/back/report_template.html
2023-10-07T17:13:03.986556054Z 19:11:58 [Notification] included sections: ['internet', 'new_devices', 'down_devices', 'events']
2023-10-07T17:13:03.986566597Z 19:11:58 [Notification] New Devices sections done.
2023-10-07T17:13:03.986577458Z 19:11:58 [Notification] Down Devices sections done.
2023-10-07T17:13:03.986587691Z 19:11:58 [Notification] Events sections done.
2023-10-07T17:13:03.986598744Z 19:11:58 [Notification] No changes to report
2023-10-07T17:13:03.986610943Z 19:11:58 [Notification] Notifications changes: 0
2023-10-07T17:13:03.986621323Z 19:11:58 [MAIN] Process: Wait
2023-10-07T17:13:03.986631576Z 19:12:03 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986641917Z 19:12:08 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986657344Z 19:12:13 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986668967Z 19:12:18 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986679289Z 19:12:23 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986690170Z 19:12:28 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986700552Z 19:12:33 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986711380Z 19:12:38 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986722244Z 19:12:43 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986732747Z 19:12:48 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986743094Z 19:12:53 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986753430Z 19:12:58 [MAIN] waiting to start next loop
2023-10-07T17:13:03.986764506Z 19:13:03 [Plugins] ---------------------------------------------
2023-10-07T17:13:03.986775636Z 19:13:03 [Plugins] display_name: Arp-Scan (Network scan)

paste code below

jokob-sk commented 11 months ago

Hi there,

Thanks for the detailed description!

  1. Can you try to refresh the browser cache?
  2. Can you please have a look if there are any browser dev console javascript errors?

Thanks in advance, j

AmadeusGraves commented 11 months ago

thanks @jokob-sk for the rapid response, I already discover what happens. Today I updated CasaOS to the versión 0.4.4-3 and installed Pi.alert on that version. That was the problem because when i roll back to the previous version of CasaOS (0.4.4-2), Pi.alert work again.

But, I found one strange problem, when Pi.alert are executing the ARP Scan, the ram that consumes Pi.alert, jump to 5.6 GB! I think it was because i add to arp scan the net 192.168.1.0/8 when is 192.168.1.0/24.

P.D.: Sorry for my English, still learning XD.

jokob-sk commented 11 months ago

Thanks for the update!

Previously high RAM consumption was correlated with excessive database size. You can check the Maintenance section to see if the DB size is outside of normal values (<10MB depending on runtime).

AmadeusGraves commented 11 months ago

I'll check that but i have one question, i see that for example, the network provider offline when i have connection to the network.

image

Suddenly some devices mark offline but in 30 seconds mark online. It's strange.

jokob-sk commented 11 months ago

Please make sure the schedules are synchronized as per: https://github.com/jokob-sk/Pi.Alert/issues/462

AmadeusGraves commented 11 months ago

Yes, I just put the comment and saw the same issue that you have given me. Thanks.

jokob-sk commented 11 months ago

Great, let me know if you still need assistance, if not, please close this issue and consider supporting me;)

jokob-sk commented 11 months ago

I assume this is solved. I will re-open if needed.

AmadeusGraves commented 11 months ago

Yes, sorry @jokob-sk , it's solved. I'll close the issue and i'll buy you a coffee. Thanks for the help.

jokob-sk commented 11 months ago

@AmadeusGraves it means a lot, thanks 🙏