SOLVED Travelin Man 3 update problem

rchalk

Active Member
Joined
Feb 19, 2010
Messages
403
Reaction score
55
I installed TM3 on an older version of PBIAF (Silver) and everything works as expected, except the auto check and update feature. If I run ipchecker it updates iptables, but does not appear to do the restart, and ipchecker does not appear to run as specified in crontab. Running ipchecker and iptables-restart manually works fine.

Here is the ipchecker file as installed: FQDNs removed for privacy


Code:
#!/bin/bash
 
# Insert the account filenames to be checked below
# Remember to increment the account[#] for new entries
 
account[0]=
account[1]=
account[2]=
account[3]=
account[4]=
account[5]=
account[6]=
account[7]=
account[8]=
account[9]=
account[10]=
account[11]=
account[12]=
account[13]=
account[14]=
account[15]=
account[16]=
account[17]=
account[18]=
account[19]=
account[20]=
 
 
# ipchecker (c) Copyright 2012, Ward Mundy & Associates LLC. All Rights Reserved.
#
# ipchecker 1.0 is licensed under the GPL2 license
#
# For a copy of license, visit http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# For additional information, contact us: http://pbxinaflash.com/about/comment.php
 
 
 
# Don't make changes below this line
cd /root
element_count=${#account[@]}
restartflag=0
index=0
while [ "$index" -lt "$element_count" ]
do
if [ ! -s "${account[$index]}" ]; then
echo "Ooops. ${account[$index]} not found."
ip="0.0.0.0"
test=$ip
fqdn=$ip
else
fqdn=`cat ${account[$index]} | cut -f 1 -d " "`
ip=`cat ${account[$index]} | cut -f 2 -d " "`
test=`dig +short $fqdn`
LEN=${#test}
if [ $LEN -gt 15 ]; then
echo "Ooops. We gotta a DIG overage problem. Forcing a match on IP to avoid disaster."
test=$ip
fi
if [ $LEN -lt 7 ]; then
echo "Ooops. We gotta a DIG fail problem. Forcing a match on IP to avoid disaster."
test=$ip
fi
if [ "$ip" = "$fqdn" ]; then
test=$ip
echo "Ooops. Missing FQDN. Entry ignored."
fi
fi
if [ "$ip" != "$test" ]; then
echo "Account ${account[$index]} CHANGED"
restartflag=1
echo " FQDN: $fqdn"
echo "OLD IP: $ip"
echo "NEW IP: $test"
echo "$fqdn $test" > /root/${account[$index]}
else
echo "Account ${account[$index]} OK"
fi
((index++))
done
if [ $restartflag -eq 1 ]; then
# service iptables restart
# iptables-restore /etc/sysconfig/iptables
iptables-restart
fi
exit 0

Can anyone tell me if there are differences in crontab instruction format between different versions, or can you help me to get this working correctly?

Thanks
Richard
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,228
Please surround code in code tags (second icon from the right.

Please post your entry from /etc/crontab.
 

rchalk

Active Member
Joined
Feb 19, 2010
Messages
403
Reaction score
55
Here is crontab. Did I do the code tags correctly?

Code:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=
HOME=/
 
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
 
0 0 * * * root /var/lib/asterisk/agi-bin/run_recurring
3 0 * * * root /var/lib/asterisk/agi-bin/run_reminders
 
04 0 * * * root rm -f /var/lib/asterisk/sounds/tts/tts*
*/10 * * * * root /root/ipchecker > /dev/null
[CODE]
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,228
Try running this command and then wait 15 minutes...

Code:
sed -i 's| iptables-restart| /usr/local/sbin/iptables-restart|' /root/ipchecker
 

sukasem

Guru
Joined
Sep 13, 2008
Messages
142
Reaction score
26
Here is crontab. Did I do the code tags correctly?

Code:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=
HOME=/
 
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
 
0 0 * * * root /var/lib/asterisk/agi-bin/run_recurring
3 0 * * * root /var/lib/asterisk/agi-bin/run_reminders
 
04 0 * * * root rm -f /var/lib/asterisk/sounds/tts/tts*
*/10 * * * * root /root/ipchecker > /dev/null
[CODE]
Make sure you press "enter" after ipchecker > /dev/null
I happen to me before, just simply add enter to the end solve it ;). I don't think there is the problem with TM3
 

rchalk

Active Member
Joined
Feb 19, 2010
Messages
403
Reaction score
55
Make sure you press "enter" after ipchecker > /dev/null
I happen to me before, just simply add enter to the end solve it ;). I don't think there is the problem with TM3

Checked this, and it appears to be OK

Richard
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,228
The patch has been pushed out to Incredible PBX 11 users. Thanks.
 

rchalk

Active Member
Joined
Feb 19, 2010
Messages
403
Reaction score
55
The patch has been pushed out to Incredible PBX 11 users. Thanks.

Well, it looks as if I may have spoken too soon. The ipchecker runs every 10 minutes as scheduled, but it does not appear to restart iptables when a change occurs. I set ipchecker to create a log file, and this is what I get:
Code:
Ooops. fqdn1 not found.
Account fqdn1 OK
Ooops. fqdn2 not found.
Account fqdn2 OK
This continues all the way through 20 fqdn listings, and I don't know if this is correct. At any rate, it never seems to satisfy the IF statement, and cause a restart of iptables. Restarting manually does apply the updates.

Any further thoughts?

Richard
 

directionpointer

New Member
Joined
May 27, 2013
Messages
18
Reaction score
6
I received the update on my system and it reset my FQDNs back to larry.iptables, curry.iptables and moe.iptables, and also made the ipchecker file uneditable (yet permissions showed otherwise). In short it broke ipchecker, and locked me out of my system short of system reboot. I ended up using the command "chattr -i /root/ipchecker", minus the quotes, then edited the file back to include my own FQDNs that I have setup on my system. Saved the changes to ipchecker, and all is working well again.

Hope this helps others if you may have run into the same thing. I have been checking my system for four days now and all appears well.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,206
Reaction score
5,228
I received the update on my system and it reset my FQDNs back to larry.iptables, curry.iptables and moe.iptables, and also made the ipchecker file uneditable (yet permissions showed otherwise). In short it broke ipchecker, and locked me out of my system short of system reboot. I ended up using the command "chattr -i /root/ipchecker", minus the quotes, then edited the file back to include my own FQDNs that I have setup on my system. Saved the changes to ipchecker, and all is working well again.

Hope this helps others if you may have run into the same thing. I have been checking my system for four days now and all appears well.

Shouldn't have done that obviously? Assuming this was Incredible PBX 11 on PIAF, it's been fixed.

If anyone else has the problem:
Code:
cd /root
chattr -i ipchecker
nano -w ipchecker
# add your whitelist.iptables entries when ipchecker editor opens
 

directionpointer

New Member
Joined
May 27, 2013
Messages
18
Reaction score
6
It was on Monday morning after getting the update on Saturday or Sunday and getting locked out every time my IP address changed. I am running PIAF Green with with Incredible PBX 11. Your code is what I did so it looks like I should be just fine. Thank you for clarifying my post and for all the efforts of the PIAF team!
 

Members online

Forum statistics

Threads
25,825
Messages
167,835
Members
19,250
Latest member
mark-curtis
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top