Router having an E-Mail address to receive emails and act upon it


I was thinking of putting together a framework to enable LEDE to not only send emails ( which is easy ) , but to wait for a reponse from the receiver and take action on the response.

For example, I've implemented a script that will check for upgradable packages from the LEDE repository, and will present the user with the option (or not) to upgrade those packages.

In the "Email approach", the router would run that script daily, then send an email to the user, and wait for a response. Should the response be "yes", then it would apply the upgrades.

Makes any sense?

You'd be adding a huge attack vector to your router, not even just that, you'd also increase its system load significantly by having to deal with spam (also keep in mind that emails do take some space, enough to overload tmpfs or flash). Once you factor in the signature requirements, just creating a simple GUI for invoking ssh commands sounds a lot easier to accomplish.

IMHO Your script should use external mailserver (email connected only with router) and check for mails from only one known (hardcoded, trusted) address, parse it and execute commands. Of course You could increase security by parsing additional headers, not only 'From' field as it could be easily spoofed.
Personally I use SMS messages for executing some actions (i.e. kids can turn on/off guest network for their fiends, I could open port for ssh etc. only by sending SMS message). Smstools3+bash script could be really useful for this.

1 Like

I was thinking on using a gmail account, then just querying the SMTP or IMAP server for messages from a specific sender ( me ) , then delete those. Never storing those locally...

Yes, I was thinking of doing that @Wally , and only for the specific purpose of running the update ( i.e. not receiving actual bash commands and executing them ) , so a yes/no response and that's all.

Any suggestions on which smtp or imap client to use on LEDE?

Maybe ssmtp (I use it for sending mails) and fetchmail or just some script using CURL like described here: Performing IMAP queries via curl

Thanks @Wally , I'll investigate that.