From b41898105cefaa18b61e84ee1c1b40c6b461f2fd Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Mon, 6 Jan 2025 20:43:02 +1100 Subject: [PATCH 1/8] removal of app_conf_override --- netalertx/CHANGELOG.md | 4 ++++ netalertx/config.json | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/netalertx/CHANGELOG.md b/netalertx/CHANGELOG.md index 9a2f755b9..90f4f104b 100644 --- a/netalertx/CHANGELOG.md +++ b/netalertx/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.3 + +- removal of app_conf_override + ## 0.0.2 - armv6 removal, host network diff --git a/netalertx/config.json b/netalertx/config.json index de2478d3e..551fc4669 100644 --- a/netalertx/config.json +++ b/netalertx/config.json @@ -67,8 +67,7 @@ ], "environment": { "PORT": "20211", - "TZ": "Europe/Berlin", - "APP_CONF_OVERRIDE":{"GRAPHQL_PORT":"20212"} + "TZ": "Europe/Berlin" }, "host_network": true, "image": "ghcr.io/alexbelgium/netalertx-{arch}", From d2c844fc3e3f0c11cc106e03c1cf16cbd9133862 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Wed, 8 Jan 2025 08:19:44 +1100 Subject: [PATCH 2/8] dev image --- netalertx/CHANGELOG.md | 4 ++ netalertx/README.md | 13 +++--- netalertx/build.json | 6 +-- netalertx/config.json | 9 +--- .../s6-rc.d/init-alexbelgium/99-run.sh | 12 ++++++ .../dependencies.d/init-netalertx-config | 1 - .../s6-overlay/s6-rc.d/init-alexbelgium/run | 43 ------------------- .../s6-overlay/s6-rc.d/init-alexbelgium/type | 1 - .../s6-overlay/s6-rc.d/init-alexbelgium/up | 1 - 9 files changed, 25 insertions(+), 65 deletions(-) create mode 100644 netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/99-run.sh delete mode 100644 netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/dependencies.d/init-netalertx-config delete mode 100644 netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/run delete mode 100644 netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/type delete mode 100644 netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/up diff --git a/netalertx/CHANGELOG.md b/netalertx/CHANGELOG.md index 90f4f104b..a36aa1abf 100644 --- a/netalertx/CHANGELOG.md +++ b/netalertx/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.4 + +- removal of unnecessary files WARNING: dev image + ## 0.0.3 - removal of app_conf_override diff --git a/netalertx/README.md b/netalertx/README.md index 2074516b1..fc4272ad3 100644 --- a/netalertx/README.md +++ b/netalertx/README.md @@ -22,7 +22,7 @@ _Thanks to everyone having starred my repo! To star it click on the image below, ## About -🖧🔍 WIFI / LAN intruder detector. Scans for devices connected to your network and alerts you if new and unknown devices are found. +🖧🔍 WIFI / LAN intruder detector. Scans for devices connected to your network and alerts you if new and unknown devices are found. This addon is based on the [docker image](https://github.com/jokob-sk/NetAlertX/tree/main/dockerfiles) from jokob-sk. ## Installation @@ -39,19 +39,16 @@ comparison to installing any other Hass.io add-on. ## Configuration -1. If unavailable, the app generates a default app.conf and app.db file on the first run. -1. The preferred way is to manage the configuration via the Settings section in the UI, if UI is inaccessible you can modify app.conf in the /app/config/ folder directly -1. You have to specify which network(s) should be scanned. This is done by entering subnets that are accessible from the host. If you use the default ARPSCAN plugin, you have to specify at least one valid subnet and interface in the SCAN_SUBNETS setting. See the [documentation on How to set up multiple SUBNETS, VLANs and what are limitations](https://github.com/jokob-sk/NetAlertX/blob/main/docs/SUBNETS.md) for troubleshooting and more advanced scenarios. +1. If unavailable, the app generates a default `app.conf` and `app.db` file on the first run. +1. The preferred way is to manage the configuration via the Settings section in the UI, if UI is inaccessible you can modify `app.conf` in the `/app/config/` folder directly. +1. You have to specify which network(s) should be scanned. This is done by entering subnets that are accessible from the host. If you use the default `ARPSCAN` plugin, you have to specify at least one valid subnet and interface in the `SCAN_SUBNETS` setting. See the [documentation on How to set up multiple SUBNETS, VLANs and what are limitations](https://github.com/jokob-sk/NetAlertX/blob/main/docs/SUBNETS.md) and for troubleshooting and more advanced scenarios. +1. Read how to get devices into your [Home Assistant instance via the MQTT plugin](https://github.com/jokob-sk/NetAlertX/blob/main/docs/HOME_ASSISTANT.md) Webui can be found at . ```yaml PGID: user GPID: user -localdisks: sda1 #put the hardware name of your drive to mount separated by commas, or its label. ex. sda1, sdb1, MYNAS... -networkdisks: "" # list of smbv2/3 servers to mount (optional) -cifsusername: "username" # smb username (optional) -cifspassword: "password" # smb password (optional) ``` [repository]: https://github.com/alexbelgium/hassio-addons diff --git a/netalertx/build.json b/netalertx/build.json index d3fd71ab6..775ea014e 100644 --- a/netalertx/build.json +++ b/netalertx/build.json @@ -1,8 +1,8 @@ { "build_from": { - "aarch64": "jokobsk/netalertx:latest", - "amd64": "jokobsk/netalertx:latest", - "armv7": "jokobsk/netalertx:latest" + "aarch64": "jokobsk/netalertx-dev:latest", + "amd64": "jokobsk/netalertx-dev:latest", + "armv7": "jokobsk/netalertx-dev:latest" }, "codenotary": { "signer": "alexandrep.github@gmail.com" diff --git a/netalertx/config.json b/netalertx/config.json index 551fc4669..6df169f1e 100644 --- a/netalertx/config.json +++ b/netalertx/config.json @@ -96,14 +96,7 @@ "DAC_READ_SEARCH" ], "schema": { - "PGID": "int", - "PUID": "int", - "TZ": "str?", - "cifsdomain": "str?", - "cifspassword": "str?", - "cifsusername": "str?", - "localdisks": "str?", - "networkdisks": "str?" + "TZ": "str?" }, "slug": "netalertx", "udev": true, diff --git a/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/99-run.sh b/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/99-run.sh new file mode 100644 index 000000000..1d315be35 --- /dev/null +++ b/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/99-run.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bashio +# shellcheck shell=bash +set -e + +bashio::log.warning "App starting." + +############## +# LAUNCH APP # +############## + +chmod +x /app/dockerfiles/start.sh +/app/dockerfiles/start.sh diff --git a/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/dependencies.d/init-netalertx-config b/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/dependencies.d/init-netalertx-config deleted file mode 100644 index 8b1378917..000000000 --- a/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/dependencies.d/init-netalertx-config +++ /dev/null @@ -1 +0,0 @@ - diff --git a/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/run b/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/run deleted file mode 100644 index 1302f5c39..000000000 --- a/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/run +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/with-contenv bashio -# shellcheck shell=bash -set -e - -################## -# SYMLINK CONFIG # -################## - -#Create folders - -if [ ! -d /share/netalertx ]; then - echo "Creating /share/netalertx" - mkdir -p /share/netalertx - chown -R "$PUID:$PGID" /share/netalertx -else - chown -R "$PUID:$PGID" /share/netalertx -fi - -mkdir -p /config/www/local -if [ ! -d /share/netalertx/config ] && [ -d /config/www/local/config ]; then - echo "moving config folder" - mv /config/www/local/config /share/netalertx - ln -s /share/netalertx/config /config/www/local - echo "links done" -else - if [ -d /config/www/local/config ]; then rm -r /config/www/local/config; fi - ln -s /share/netalertx/config /config/www/local - echo "Using existing config" -fi - -mkdir -p /config/keys -if [ ! -d /share/netalertx/keys ]; then - echo "moving keys folder" - mv /config/keys /share/netalertx - ln -s /share/netalertx/keys /config - echo "links done" -else - rm -r /config/keys - ln -s /share/netalertx/keys /config - echo "Using existing keys folder" -fi - - diff --git a/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/type b/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/type deleted file mode 100644 index bdd22a185..000000000 --- a/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/type +++ /dev/null @@ -1 +0,0 @@ -oneshot diff --git a/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/up b/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/up deleted file mode 100644 index 55d7a583f..000000000 --- a/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/up +++ /dev/null @@ -1 +0,0 @@ -/etc/s6-overlay/s6-rc.d/init-alexbelgium/run From 00b5cdf9375a5b4d489789f93072e54a66cc36e0 Mon Sep 17 00:00:00 2001 From: jokob-sk <96159884+jokob-sk@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:42:28 +1100 Subject: [PATCH 3/8] back to production image --- netalertx/build.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/netalertx/build.json b/netalertx/build.json index 775ea014e..d3fd71ab6 100644 --- a/netalertx/build.json +++ b/netalertx/build.json @@ -1,8 +1,8 @@ { "build_from": { - "aarch64": "jokobsk/netalertx-dev:latest", - "amd64": "jokobsk/netalertx-dev:latest", - "armv7": "jokobsk/netalertx-dev:latest" + "aarch64": "jokobsk/netalertx:latest", + "amd64": "jokobsk/netalertx:latest", + "armv7": "jokobsk/netalertx:latest" }, "codenotary": { "signer": "alexandrep.github@gmail.com" From 9a50e3566338c21d211d6d9703d62738a0fb68c6 Mon Sep 17 00:00:00 2001 From: jokob-sk <96159884+jokob-sk@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:44:15 +1100 Subject: [PATCH 4/8] Update CHANGELOG.md --- netalertx/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/netalertx/CHANGELOG.md b/netalertx/CHANGELOG.md index a36aa1abf..6792e66a8 100644 --- a/netalertx/CHANGELOG.md +++ b/netalertx/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.5 + +- attempt at starting start.sh, back to prod image + ## 0.0.4 - removal of unnecessary files WARNING: dev image From fb3174ac0b42701867129fffaa8235bd2068ea7f Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:33:18 +0100 Subject: [PATCH 5/8] This is not needed - the addon location is mapped to /config through HA --- netalertx/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/netalertx/Dockerfile b/netalertx/Dockerfile index 67cb517a6..e4cabf02f 100644 --- a/netalertx/Dockerfile +++ b/netalertx/Dockerfile @@ -28,9 +28,9 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \ S6_SERVICES_GRACETIME=0 # Global LSIO modifications -ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_lsio.sh" "/ha_lsio.sh" -ARG CONFIGLOCATION="/config/addons_config/netalertx" -RUN chmod 744 /ha_lsio.sh && if grep -qr "lsio" /etc; then /ha_lsio.sh "$CONFIGLOCATION"; fi && rm /ha_lsio.sh +#ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_lsio.sh" "/ha_lsio.sh" +#ARG CONFIGLOCATION="/config/addons_config/netalertx" +#RUN chmod 744 /ha_lsio.sh && if grep -qr "lsio" /etc; then /ha_lsio.sh "$CONFIGLOCATION"; fi && rm /ha_lsio.sh ################## # 3 Install apps # From 60472e947dab582c80bea070aa9c23ba7ff9ea9b Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:35:03 +0100 Subject: [PATCH 6/8] This is the new way --- netalertx/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netalertx/config.json b/netalertx/config.json index 6df169f1e..1da18a517 100644 --- a/netalertx/config.json +++ b/netalertx/config.json @@ -73,7 +73,7 @@ "image": "ghcr.io/alexbelgium/netalertx-{arch}", "init": false, "map": [ - "config:rw", + "addon_config:rw", "media:rw", "share:rw", "ssl" From c19a383a70895dec23ae3c7ea65d4fc7888c45ba Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Thu, 9 Jan 2025 08:32:26 +1100 Subject: [PATCH 7/8] unnecessary line removal from DOCKERFILE --- netalertx/Dockerfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/netalertx/Dockerfile b/netalertx/Dockerfile index 67cb517a6..f70f3fd1f 100644 --- a/netalertx/Dockerfile +++ b/netalertx/Dockerfile @@ -72,11 +72,6 @@ ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templat ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_entrypoint_modif.sh" "/ha_entrypoint_modif.sh" RUN chmod 777 /ha_entrypoint.sh /ha_entrypoint_modif.sh && /ha_entrypoint_modif.sh && rm /ha_entrypoint_modif.sh -# hadolint ignore=SC2013 -RUN \ - for file in $(grep -Esril "/local/config/addons_config/netalertx" /etc /defaults); do sed -i "s=/local/config/addons_config/netalertx=/local/config=g" "$file"; done - - # #WORKDIR / #ENTRYPOINT [ "/usr/bin/env" ] From 6734dfdc7aba73b2cf91fa9064eb6024d8d207d1 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Sat, 11 Jan 2025 08:41:08 +1100 Subject: [PATCH 8/8] symlinks test --- netalertx/CHANGELOG.md | 4 ++++ netalertx/Dockerfile | 5 +++++ .../s6-rc.d/init-alexbelgium/99-run.sh | 16 ++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/netalertx/CHANGELOG.md b/netalertx/CHANGELOG.md index 6792e66a8..a5e572d9c 100644 --- a/netalertx/CHANGELOG.md +++ b/netalertx/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.6 + +- test symlinks + ## 0.0.5 - attempt at starting start.sh, back to prod image diff --git a/netalertx/Dockerfile b/netalertx/Dockerfile index 953201f57..384b56100 100644 --- a/netalertx/Dockerfile +++ b/netalertx/Dockerfile @@ -111,3 +111,8 @@ LABEL \ #################### # 6 HealthcheckNOT # #################### +# # In the dockerfile Changing hard links if possible +# RUN for folder in config db; do \ +# echo "Adapting hard links" && \ +# grep -rl "/app/$folder" / 2>/dev/null | xargs sed -i "s|/app/$folder|/config/$folder|g"; \ +# done \ No newline at end of file diff --git a/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/99-run.sh b/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/99-run.sh index 1d315be35..b70636f87 100644 --- a/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/99-run.sh +++ b/netalertx/rootfs/etc/s6-overlay/s6-rc.d/init-alexbelgium/99-run.sh @@ -4,6 +4,22 @@ set -e bashio::log.warning "App starting." + + +# In the addon script, make symlinks on the fly +echo "Creating symlinks" +for folder in config db; do + echo "Creating for $folder" + # Create symlinks + mkdir -p /config/"$folder" + if [ -d /app/"$folder" ] && [ "$(ls -A /app/"$folder")" ]; then + cp -rn /app/"$folder"/* /config/"$folder"/ + fi + rm -r /app/"$folder" + ln -sf /config/"$folder" /app/"$folder" +done + + ############## # LAUNCH APP # ##############