Cybersecurity is an ever-growing concern in today's world, and one of the big potential attack vectors is your own network. Improper security settings or shady smart home devices can all be ways for someone to gain access to your home network, and wreak havoc from there.

That's why it's a good idea to stay alert and monitor your network for unknown devices, but most people don't have the time to be checking a dashboard filled with devices just to see when there's something suspicious. Thankfully, self-hosting comes in clutch once again, and there's a Docker service called NetAlertX you can use to make things much easier through notifications. I tried setting it up, and it's easy to see how useful it can be.

Deploying is easy

Using a NAS as the host makes things breezy

As per usual for me, I tested NetAlertX using my NAS to host the Docker container, because it's a lot easier to manage with a tool like Dockge. The GitHub project for NetAlertX offers a few ways to start the container, but the easiest method for me tis to use the example Docker compose file in Dockge to set everything up for me.

The default compose file mounts the storage for the container in an inaccessible location, so you may want to change it so that the required volumes are mounted to a local folder already in your storage, making it so you can make manual edits to the container and manage your files more directly. I tried this, but unfortunately I was running into issues with permissions for the folders, so I had to scrap that idea and stick with the default approach. With a little more time, though, this should be completely doable.

With that, I left all the settings in the compose file as they are in the provided example, and that made things fairly breezy. Once I started the container, the service was quickly accessible through the respective port, and I could see all the devices connected to my network after a couple of minutes. There's nothing else you need to do for the basics of the service to start working, so it's just a matter of setting up the notifications at this point.

👁 Dockge running on a Mac
Portainer made Docker approachable, but Dockge made me uninstall Portainer

Discover the tool that simplifies Docker management and made Portainer less useful for me.

Setting up email notifications

Get alerts when needed

Setting up your email notifications is where you'll have to do most of the work now. First, you might want to change the kind of events that generate a notification, since all of them will result in emails. The default includes devices being disconnected from the network and other general events, so you may want to remove those so you only get notifications for new devices on the network. That way, you won't constantly get notified when one of your own devices connects and disconnects.

To do this, you'll want to head to the Settings tab on the sidebar on the left, then, under the Core section, expand the Notification Processing field. If you only want to receive notifications, remove the down_devices and events fields that are added by default, then click at the bottom of the page.

After that, enabling email notifications can be done at the bottom of the page, under the Publishers section. The SMTP publisher is enabled by default so you can configure email notifications, and a lot of the required fields are pre-populated. You'll need to start by changing the When to run dropdown field to on-notification.

You'll need to enter the appropriate settings for logging into the email server of your choice, which is Gmail by default. There's a big caveat here, though. The service asks for your SMTP user (email address) and a password, but Gmail requires two-factor authentication (2FA), which isn't supported. To make this work, you'll need to go to your account settings to create an app password, which bypasses 2FA.

But even that may not be enough. When I tried to do this for the first time, I still wasn't getting emails, so I looked into the logs and realized there was an error in the Python script used for emailing me. With the help of a friend, I realized that, for some reason, the script attempts to read the password as a base64 value, rather than the UTF-8 encoding that it's trying to use. So, I had to convert the password to base64 to make this functional, which isn't ideal for security purposes.

The official recommended settings also suggest a few other changes, though they may not be necessary:

  • SMTP server port: 465
  • Do not use TLS: Enabled
  • Force SSL: Enabled

Once this was all done, I was able to receive email alerts for all the notifications from NetAlertX.

You can get notifications elsewhere

Email isn't required

If email notifications don't seem like the right solution for you, NetAlertX thankfully makes it possible to receive alerts through a variety of other publishers, too. In the aforementioned settings page, you can go into the Core section and find the Loaded plugins option to load other publisher plugins, most notably AppRise, which can send notifications to a wide range of services.

For me, though, Telegram is all I need, and that's built in. I just added Telegram, saved my settings, and then I was able to configure Telegram notifications using a bot. It's free and easy to create bots on Telegram, so I just had to do that, get the respective bot token, and find the chat ID for my direct messages. Entering these two values in the respective fields was all it took, and I was getting Telegram notifications in real time on my phone or any other device I was logged into.

I do find that NetAlertX rarely identifies device types, so you may want to keep a list of the IPs or MAC addresses of your known devices, or maybe check your router's settings to see if you can glean more information about a specific device.

A simple step towards better security

I'm of the belief that most people don't need to go paranoid trying to make sure their home network is as secure as possible, and a handful of best practices will keep most threats at bay. But even if you don't want too much hassle, a simple network monitor like this with notifications can make it a lot easier to stay on top of any potential threats to your network, ensuring you always know who's connected. It's a relatively simple step that makes a big difference.

NetAlertX