TIPS Xivo IncrediblePBX Errors - is /usr/sbin/xivo-strip-queue-info IncrediblePBX Code

yajrendrag

Member
Joined
Sep 17, 2010
Messages
83
Reaction score
8
IGNORE THIS AND SEE NEXT POST AS IT IS MORE SUCCINCT AND UP TO DATE

I am getting 2 emails every 3 hours about certain errors. I also shared same on Xivo forums and devs felt they were IncrediblePBX issues:

see highlights below - i'm not so concerned about the email recipient issue as i am the underlying issues being reported on:
-postgres user not being part of sudoers (1st email), and
-pbxstatus related erros (2nd email)

wondering if these are upgrade issues which would have resulted from 16.08 to 16.10 upgrade and associated database restore.

Code:
Delivery to the following recipient failed permanently:

    [email protected]

Technical details of permanent failure:
DNS Error: 44536174 DNS type 'mx' lookup of xivo-clients.proformatique.com responded with code NXDOMAIN
Domain name not found: xivo-clients.proformatique.com

----- Original message -----

DKIM-Signature: < snipped all of the gmail headers of the email>

To: [email protected]
Auto-Submitted: auto-generated
Subject: *** SECURITY information for xivo.incrediblepbx.com ***
Message-Id: <[email protected]>
Date: Mon, 15 Aug 2016 09:00:02 -0600 (MDT)

xivo.incrediblepbx.com : Aug 15 09:00:02 : postgres : user NOT in sudoers ; TTY=unknown ; PWD=/var/lib/postgresql ; USER=root ; COMMAND=/sbin/iptables -nL

Code:
Delivery to the following recipient failed permanently:

    [email protected]

Technical details of permanent failure:
DNS Error: 9302585 DNS type 'mx' lookup of xivo-clients.proformatique.com responded with code NXDOMAIN
Domain name not found: xivo-clients.proformatique.com

----- Original message -----

DKIM-Signature: < snipped all of the gmail headers of the email>
To: [email protected]
Subject: Cron <root@xivo>    xivo-strip-queue-info 10800 > /dev/null
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <LOGNAME=root>
Message-Id: <[email protected]>
Date: Mon, 15 Aug 2016 09:00:02 -0600 (MDT)

tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
TERM environment variable not set.
tar (child): lastupdatexivo.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
rm: cannot remove ‘lastupdatexivo.tar.gz’: No such file or directory
/root/update-IncrediblePBX: line 23: /root/lastupdatexivo: No such file or directory
rm: cannot remove ‘lastupdatexivo’: No such file or directory
/usr/local/sbin/pbxstatus: line 4: /etc/hostip: Permission denied
/usr/local/sbin/pbxstatus: line 18: asterisk: command not found

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

   #1) Respect the privacy of others.
   #2) Think before you type.
   #3) With great power comes great responsibility.

sudo: no tty present and no askpass program specified
/usr/local/sbin/pbxstatus: line 82: ifconfig: command not found
Error opening terminal: unknown.
TERM environment variable not set.

Any ideas?

thanks
 
Last edited:

yajrendrag

Member
Joined
Sep 17, 2010
Messages
83
Reaction score
8
ok - i've done some more investigating here... first, i fixed my email delivery failure issue as displayed above, so ignore that issue

but I am getting 2 emails every 3 hours indicating errors - i believe the two emails are related. the first email seems to be a result of /etc/cron.d/xivo-config - specifically the command that is running every 3 hours:
xivo-strip-queue-info 10800 > /dev/null

One of the emails indicates a security warning that the postgres user is not in sudoers (which is easy enough to fix, but i don't know if i should add that or why it seems to be missing to begin with).

the text of the email:
xivo.incrediblepbx.com : Aug 18 18:00:01 : postgres : user NOT in sudoers ; TTY=unknown ; PWD=/var/lib/postgresql ; USER=root ; COMMAND=/sbin/iptables -nL

I am thinking xivo.incredible.pbx is simply getting picked up from /etc/hosts - but the cron file calls /usr/sbin/xivo-strip-queue-info every 3 hours. xivo-strip-queue-info is a python program and it has a couple of lines that pass a sql query command to the shell as the user postgres, who doesn't have sudo access:

Code:
command = ['su', '-', '-c', 'psql -d asterisk -c "%s"' % sql_query, 'postgres']
subprocess.check_call(command)

I'm trying to figure out if this is a xivo issue or an incrediblePBX issue so i can determine who can help resolve it..

Can you please advise - is this IncrediblePBX code? If so, any idea what happened here? could this be upgrade (i upgraded from 16.08 to 16.10) related or database restore related (i restored a 16.08 to 16.10 post upgrade). I've asked on Xivo's forum too... will update accordingly

thanks
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
It's not Incredible PBX code. IIRC there were some glitches in the latest upgrade code for some users.
 

yajrendrag

Member
Joined
Sep 17, 2010
Messages
83
Reaction score
8
what appears to be happening, however, is that the cron job running every 3 hours:
xivo-strip-queue-info 10800 > /dev/null

is causing /etc/profile.d/incrediblepbx.sh to run.

So, apparently, after the psql command in xivo-strip-queue-info (which is run as the user postgres) runs, that causes a bash login shell to run, which causes the .sh files in /etc/profile.d to run - one of those contains incredible PBX code. not sure why this is a problem yet - here are the errors from the 2nd email - maybe there's a clue here? (note that if i comment out the lines in /etc/profile.d/incrediblepbx.sh the problem goes away, or, if i simply move the contents of /etc/profile.d/incrediblepbx.sh to root's .profile instead, the problem also goes away..)

Code:
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
TERM environment variable not set.
rm: cannot remove ‘lastupdatexivo’: Permission denied
tar: lastupdatexivo: Cannot open: File exists
tar: Exiting with failure status due to previous errors
rm: cannot remove ‘lastupdatexivo.tar.gz’: Permission denied
rm: cannot remove ‘lastupdatexivo’: Permission denied
/usr/local/sbin/pbxstatus: line 4: /etc/hostip: Permission denied
/usr/local/sbin/pbxstatus: line 18: asterisk: command not found

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

   #1) Respect the privacy of others.
   #2) Think before you type.
   #3) With great power comes great responsibility.

sudo: no tty present and no askpass program specified
/usr/local/sbin/pbxstatus: line 82: ifconfig: command not found
Error opening terminal: unknown.
TERM environment variable not set.


further thoughts?
 
Last edited:

yajrendrag

Member
Joined
Sep 17, 2010
Messages
83
Reaction score
8
i hadn't, but i just did, and that yields same result - i get errors. for the time being, i going to simply move the contents of /etc/profile.d/incrediblepbx.sh to root's .profile. I also asked xivo devs if they have any insight as to why it's current placement is causing the errors... will see what they say too.. that python script is running the psql command via "su -..." so presuming that is what is causing a login shell to run, but beyond that, i don't know why that is incompatible with cron - or maybe it's just my installation that is messed up..
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Please let us know what you find out. Wouldn't think an update should be running all of the default profile scripts. If so, we'll make some adjustments.
 

yajrendrag

Member
Joined
Sep 17, 2010
Messages
83
Reaction score
8
This wasn't upgrade related. i finally was able to install 16.10 from scratch and see the same issues. (although i couldn't make the wizard.py run successfully using virtualbox... installed instead using kvm and then converted qcow to vdi and it runs fine in vb...).

Any scripts in /etc/profile.d are running every 3 hours due to the way the xivo-strip-queue-info script invokes the psql command (which caused a login shell to run). Xivo devs agreed with my suggestion that didn't need to happen; they opened a ticket on it. So my guess is they'll fix it in a way that you can leave incrediblepbx.sh in /etc/profile.d.

why no one else here seems to have found this, however, is odd. It doesn't affect anything on a pure xivo system because the only script in /etc/profile.d simply exports XIVO_UUID... but if no one did anything to configure postfix properly to forward emails to root, that might be one reason..
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Thanks, @yajrendrag. In the installer, I've moved the profile script to .profile just to be safe moving forward.
 
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