WAN IPCheck - Send an email if WAN IP has changed

Post new topic   Reply to topic    DD-WRT Forum Index -> Contributions Upload
Goto page Previous  1, 2, 3, 4
Author Message
Johsnon
DD-WRT Novice


Joined: 29 Apr 2011
Posts: 6

PostPosted: Wed Oct 03, 2012 15:01    Post subject: Reply with quote
@Ranger2000:
Is your sendmail binary somehow different from the one you can download from the first post? Because that one does not seem to support mail server login, only the following options are allowed:
Code:
root@WRT54GL:/jffs/etc/config# sendmail --?
usage:  sendmail [-f<name>] [-t] [-s<server>] [-p<port>] [-T<timeout>] [-v] [address ...]

Inside your script you use this:
Code:
sendmail -S$MAIL_SERVER -au$MAIL_USER -ap$MAIL_PASS -f$MAIL_FROM

If I execute this (by hand and replaced the $variables), I only get the usage-line from sendmail, as I were calling it incorrectly.
Can you please provide a sendmail which can handle login arguments?
(I use DD-WRT v24-sp2 (07/22/09) mini; SVN revision 12548M NEWD Eko)
Shall I update to std_generic build 14896? Is sendmail included in that build?

Thanks!
Sponsor
Johsnon
DD-WRT Novice


Joined: 29 Apr 2011
Posts: 6

PostPosted: Sat Oct 20, 2012 17:06    Post subject: Re: mini sendmail problems Reply with quote
vuknix wrote:

I'm using a linksys wrt54gl with DD-WRT v24-sp2 (07/21/09) voip.

For some reason even if I enabled jffs from the web interface I cannot create any folders under /jffs.

Hi vuknix,
that is because you don't have any flash memory space left. I got the same problem. I think I will reflash to dd-wrt.v24_mini_generic.bin (since the "standard" version doesn't supprt jffs at all.

The other problem I'm currently facing is the correct usage of sendmail. Like I already proposed in my previous post, I updated to build verion 14896.
If I connect to the router (using SSH, putty) and try a sendmail command by hand,
e.g. like
Code:
sendmail -v -S"mail.gmx.net" -auMYADDRESS@gmx.de -apMYPASSWORD -f"MYADDRESS@gmx.de" -s"testSubject" -m"testMessage" DESTaddr@googlemail.com

I get this in return
Code:
220 mail.gmx.net GMX Mailservices ESMTP {mp019}
250 2.0.0 ok {mp019}
250 STARTTLS
550 5.7.0 Need to authenticate via SMTP-AUTH-Login {mp019}
334 VRNlcn7hbWU8
Segmentation fault

I have no clue how to use the correct authentication (I want to use port 465 SSL/TLS method).
This example here didn't work out somehow.

update: THIS thread helped me out. I used this syntax and it worked! The mail was sent Laughing
sendmail -S<SMTP server> -u<SMTP user name> -p<SMTP password> -f<from address> -F<from name> -s<subject> -m<body> -aattachment.txt <recipient address>
What's also important: the <SMTP user name> must not be an email address! E.g. when using gmx, typically your address is also your user login; use your CustomerNo instead for login (you can find this number in the browser address bar, e.g. ht.ps://service.gmx.net/de/cgi/g.fcgi/application/navigator?CUSTOMERNO=1234567&t=de.....
Now I can start adapting the startup-script to my likes Wink
wrt2012
DD-WRT Novice


Joined: 27 Aug 2012
Posts: 5

PostPosted: Thu Nov 08, 2012 17:05    Post subject: Segmentation fault Reply with quote
When trying Sendmail i get stuck with an segmentation fault:


220 fwd03.t-online.de T-Online ESMTP receiver fmsad1725 ready. / T-Online ESMTP receiver smtpmail.t-online.de ready.
250 2.0.0 Ok.
Segmentation fault

Running DD-WRT v24-sp2 (06/14/11) mega on a Linksys/Cisco E3200.

Any ideas anybody?
Johsnon
DD-WRT Novice


Joined: 29 Apr 2011
Posts: 6

PostPosted: Wed Dec 05, 2012 17:41    Post subject: delivery failure from GMX to GMAIL: likely unsolicited mail Reply with quote
I set up my sendmail to use a @gmx.de mail address to send to a @gmail.com address.
And in the last days, Google is suddenly denying any mails which my router (sendmail) sent, because of the following reason:

GMX is returnig wrote:

Hi. This is the qmail-send program at mailout-de.gmx.net.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

<xxxRECEIVER*ADDRxxx@gmail.com>:
173.194.70.27_failed_after_I_sent_the_message./Remote_host_said:_550-5.7.1_[213.165.64.22______11]_Our_system_has_detected_that_this_message_is/550-5.7.1_likely_unsolicited_mail._To_reduce_the_amount_of_spam_sent_to_Gmail,/550-5.7.1_this_message_has_been_blocked._Please_visit/550-5.7.1_http://support.google.com/mail/bin/answer.py?hl=en&answer=188131_for/550_5.7.1_more_information._k48si7525338een.38/

--- Below this line is a copy of the message.

Return-Path: <xxxSENDER*ADDRxxx@gmx.de>
Received: (qmail invoked by alias); 05 Dec 2012 06:37:07 -0000
Received: from HSI-KBW-*******.hsi14.kabel-badenwuerttemberg.de (EHLO É}ÿÒ}ÿá}ÿì}ÿù}ÿ ~ÿ'~ÿ¢~ÿ) [my.IP.addr.ess]
by mail.gmx.net (mp010) with SMTP; 05 Dec 2012 07:37:07 +0100
X-Authenticated: #2043****
X-Provags-ID: V01U2FsdGVkX1/HnTM8zqrHeaq92KdQndxE1V5ZwZXLikWrESwPuj
hwojo7RjM6R569
To: xxxRECEIVER*ADDRxxx@gmail.com
Subject: IP changed to my.IP.addr.ess
X-Y-GMX-Trusted: 0
X-GMX-Antivirus: 0 (no virus found)

05.12.2012__07:37:02 - IP: blablabla message content


What kind of settings do I have to do, so that gmail will accept my mails again???

P.S.: This has nothing to do with my personal SPAM-Filter within my google account; the mail isn't getting that far at all!
seanmac
DD-WRT Novice


Joined: 06 May 2013
Posts: 6

PostPosted: Tue Jun 04, 2013 15:09    Post subject: Reply with quote
Does anyone have a current binary of either sendmail or msmtp that works with DD-WRT or Tomato firmware? I have multiple routers of different models, and I can't seen to get any of the scripts listed in this thread to work. I am not n00b but I'm not a linux guy either.

I would appreciate any help I can get.
alirz
DD-WRT User


Joined: 27 Apr 2007
Posts: 61

PostPosted: Wed Aug 14, 2013 1:13    Post subject: dd-wrt send email ONLY when WAN IP changes Reply with quote
Hi,

so i would like to revie an old thread..
I've digging around for days now.

NOTE: im no good at scripting..

So i've found this script that says that i can compare Wan IP address , i.e lets say i ran it as a cronjob.

Even though i've gotten it to send me an email using the builtin sendmail binary on the latest dd-wrt (216760 on a linksys 610n V2 router.

every time i run the script it sends me the emaiil even if the wan IP has not changed.

Could someone please help me in the comparison part?
Here is the original downloaded and the modified script. Thanks
papagogo
DD-WRT Novice


Joined: 15 Sep 2007
Posts: 8

PostPosted: Mon Jan 20, 2014 11:51    Post subject: Reply with quote
Thanks a lot!
That's just what I need.
cmk001
DD-WRT Novice


Joined: 07 Mar 2014
Posts: 3

PostPosted: Wed Mar 12, 2014 10:40    Post subject: Run a script on Wan IP change Reply with quote
I am really impressed by knowledge of generous members who share their valuable scripts. Will appreciate if somebody can help me out. I am using DNS for watching tv channels. I need to run following URL to update my wan Ip on suppliers server.This URL contains my unique key. I have added some xxxxx for security purposes. On my PC it is working but I want it to be run on my DD-WRT router. Kindly guide how to implement it. Thanks.
cmk001
DD-WRT Novice


Joined: 07 Mar 2014
Posts: 3

PostPosted: Wed Mar 12, 2014 10:43    Post subject: Run a script on Wan IP change Reply with quote
With reference to my above post URL is:
"https://unlocator.com/tool/api.php?api_key=fd3b32f53e297ce83151abfd6db781ec0e60a4f1a34642379389bb47e27xxxxx
duceduc
DD-WRT User


Joined: 15 Apr 2009
Posts: 56
Location: JP

PostPosted: Fri Feb 13, 2015 23:27    Post subject: Reply with quote
I, too, am trying to get this to work on my Linksys E2000 router. I've finally got JFFS enabled and files are uploaded. When I try to test send email, I get this error in the sendmail file downloaded. I do not know what to do next. There is a sendmail file in the firmware and the location is in '/usr/sbin/sendmail', but when I use the path the test just hangs with no error.

This is the error from the sendmail file.

'Can't resolve symbol '__uClibc_start_main'

Hope someone can shine some light. Need this to work. Thanks.
moteliima
DD-WRT Novice


Joined: 06 Feb 2016
Posts: 1

PostPosted: Sat Feb 06, 2016 9:07    Post subject: Re: WAN IPCheck - Send an email if WAN IP has changed Reply with quote
cyberde wrote:
Hi, after getting a request to write a script to check your WAN ip for changes (here), and email the new ip-address to you if changed. I decided to create that script, because it seemed handy.


The attached zipfile includes the folowing:
- wanipcheck.sh
- sendmail (used for sending the notification email, I didn't made that)

Howto use this script?
Well it's easy, all you have to do is enter the variables:
Code:
INTERVAL=3600
MAIL_BINARY=/mmc/usr/sbin/sendmail
MAIL_SERVER=smtp.isp.com
MAIL_TO=emailto@isp.com
MAIL_FROM=emailfrom@isp.com
MAIL_SUBJECT="Some subject for your email"


To be able to use it, you should have an SDcard mod or JFFS2 space left to save this script and save the sendmail binary. A samba share should do too.
To start the script automatically on router boot, you could enter ./wanipcheck.sh & to your startup script or save it as eg. /mmc/etc/config/wanipcheck.startup.
For more info on this have a look at Startup scripts in the Wiki.


How does it work?
Also easy, it creates an nvram variable with the old ip-adrress and compares it to the nvram variable wan_ipaddr (which contains the current ip). If changed it sends an email (if enabled ofcourse).

The email looks like this:
Code:
WAN IP Address has changed to: 12.34.56.78
Previous known IP Address: 54.32.234.241


I hope this little script might come in handy for someone Smile

P.S. If you have any additions or improvements, please post them Smile


Other script:
PortCheck emails you when a connection has been made to a specific port.
duceduc
DD-WRT User


Joined: 15 Apr 2009
Posts: 56
Location: JP

PostPosted: Wed Mar 18, 2020 2:48    Post subject: Reply with quote
I was previously on build 30880 and the wan check script was working. I was able to receive an email when there was an ip change. Recently, I have updated the build to 42681, the script doesn't work anymore. The txt file is updated, but mail is not send. Sendmail broke?
Goto page Previous  1, 2, 3, 4 Display posts from previous:    Page 4 of 4
Post new topic   Reply to topic    DD-WRT Forum Index -> Contributions Upload All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum