Email Alerts in Navi are Back!

Casey Reid a.k.a Packet Chaos
3 min readOct 3, 2023

On May 30, 2022 google removed the ability to authenticate SMTP requests via user name and password. This move is important for email security and made it more challenging for scripted solutions like Navi to send emails for alerts.

I made a swift decision to remove the navi mail command until I found a reasonable replacement to Gmail. The replacement that was brought to my attention that works perfect is GMX mail.

If you are looking to share navi screenshots and navi generated files in an automated way, start with signing up for a new GMX email. You don’t need to use GMX to unlock alerting in navi, you will need an SMTP service that allows for authentication using a username and password.

The mail command is very simple to use but not obvious if you are not a command-line guru. One of the concepts you might be new to is concatenating two commands together; taking the second command as input for the first command. Let me show you an example.

We will answer the question: How would email the output of the navi find creds command, to find and alert on credential failures?

navi find creds

To email a screenshot we start with the navi mail command and embed our desired command within the message option. Notice that the email fields in the navi command need to be encapsulated by double quotes to avoid triggering command line options. The (-v) option is to print the command to the screen as well for visual confirmation. It isn’t required for automation.

navi mail --to "your_desired_email@domain.com" --subject "Context about the alert" -v

The message option and file option are omitted above to explain the concatenation possible on Linux machines and Docker versions of Navi.

The tick(`) mark on a linux shell takes the output of the command and allows one to use it as input to another command. In this case, we add the tick mark between the double quotes and embed our navi command in the middle; shown below:

--message "`navi find creds`"

Note that in the absence of (-v) command nothing is printed to the screen but “Email sent!”. The entire command and output are shown below:

Admittedly, I need to work on the email output. Direct translation looses it’s command-line style. With this method you can send the output of any command through email. With the use of the file option you can add a file to the email.

Brief History

The navi mail command was created in December 2019 and was removed In May of this year in version 7 of Navi. Navi 7.5.1 now contains the same code deployed in earlier versions of navi.

What’s Next?

There are some minor limitations right now that I plan on resolving. Sending multiple files is not currently supported, but will be a focus in the coming months.

Got more time? Take a look at an older article that goes into more depth on the command → https://medium.com/@packetchaos/alerting-for-automation-navi-mail-6873124109a2

--

--

Casey Reid a.k.a Packet Chaos

I'm a perpetually curious avid learner and athletic hacker/tinker who dabbles in python development, tenable integrations, philosophy, and writing