Merge pull request #1705 from jokob-sk/master

[netalertx] another try
This commit is contained in:
Alexandre
2025-01-10 22:45:23 +01:00
committed by GitHub
9 changed files with 60 additions and 73 deletions

View File

@@ -1,3 +1,19 @@
## 0.0.6
- test symlinks
## 0.0.5
- attempt at starting start.sh, back to prod image
## 0.0.4
- removal of unnecessary files WARNING: dev image
## 0.0.3
- removal of app_conf_override
## 0.0.2
- armv6 removal, host network

View File

@@ -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 #
@@ -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" ]
@@ -116,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

View File

@@ -23,7 +23,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
@@ -40,19 +40,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 <http://homeassistant:20211>.
```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: "<//SERVER/SHARE>" # 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

View File

@@ -67,14 +67,13 @@
],
"environment": {
"PORT": "20211",
"TZ": "Europe/Berlin",
"APP_CONF_OVERRIDE":{"GRAPHQL_PORT":"20212"}
"TZ": "Europe/Berlin"
},
"host_network": true,
"image": "ghcr.io/alexbelgium/netalertx-{arch}",
"init": false,
"map": [
"config:rw",
"addon_config:rw",
"media:rw",
"share:rw",
"ssl"
@@ -97,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,

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bashio
# shellcheck shell=bash
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 #
##############
chmod +x /app/dockerfiles/start.sh
/app/dockerfiles/start.sh

View File

@@ -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

View File

@@ -1 +0,0 @@
/etc/s6-overlay/s6-rc.d/init-alexbelgium/run