I've wrote python script to notify me if there is change to public IP of my raspberry pi, and if there is to notify me via encrypted email. I might post code later on Github, someone might find it usefull

@nikolal Untested, rudimentary, invokes external software (curl, s-nail and gpg), possibly not compatible with PGP emails expected by existing software… but I think this should work:

#!/usr/bin/env python2 import os, sys def changed(new_ip, recipient): with open("ip", "w") as f: f.write(new_ip) os.system("gpg --trust-model=always -ea -r " + recipient + " - < ip | mail -s ip_has_changed " + recipient) try: with open("recipient") as f: recipient = f.read() except Exception: print('could not read recipient') sys.exit(1) try: with open("ip") as f: old_ip = f.read() except Exception: old_ip = None new_ip = os.popen("curl ipconfig.sh").read() if old_ip != new_ip: changed(new_ip, recipient)

Configure with echo -n some@email.address > recipient.

Pardon any typos. Probably usable in cron.

Follow

@ivan
Here you go, it can be run with cron
github.com/nikolalakic/changed

I'll edit it futher when I have more time

@nikolal
Ah right, home stuff so you need to use a remote mail host. Still, you should probably configure your local MTA to do the smart delivery, rather than making the client smart.

I do like how that one edgy provider's servers are hardcoded 🤪
Sign in to participate in the conversation
Mastodon 🔐 privacytools.io

Fast, secure and up-to-date instance. PrivacyTools provides knowledge and tools to protect your privacy against global mass surveillance.

Website: privacytools.io
Matrix Chat: chat.privacytools.io
Support us on OpenCollective, many contributions are tax deductible!