FYI (TomS) XiVO CGI-BIN problems

TomS

Guru
Joined
Oct 18, 2007
Messages
240
Reaction score
6
I have been trying to port some of my bash shell cgi-bin scripts to the XiVO platform.
I have tested the simple script and HTML file below on my FreePBX/Incredible RPi-3 and FreePBX/Incredible CentOS. If this won't work, no need to go any farther.

My RPi-3 is running Debian(FreePBX) so the CGI-BIN is in /usr/lib/cgi-bin location which is the same as my VirtualBox XiVO.

On my VirtualBox XiVO:
I checked for the 'ScriptAlias' and '<Directory> ... </Directory>' for cgi-bin.
These are commented out on the /etc/apache2/conf-available/php5-cgi-bin.conf file.
I un-commented them and rebooted the server but still no luck running the bash shell and/or proccgi.c programs.
I even moved the lines to a new .conf file to see if that would work but no such luck.
I am probably just missing something simple in the conf files, but I have not found it yet.
I have been trying for the last 2 weeks before I finally gave in and posted this request.
I am no expert in Apache2 configurations so I am currently at a loss as to what needs to be updated to allow actual programs to run in /usr/lib/cgi-bin and descending directories.

These are a stripped down set of files that run on the RPi-3 FreePBX but not on the XoVO.

I use the following 'testit.html' file in /var/lib/html directory:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<!--    GPL-3 2016 by Tom Schmitt [email protected]    -->
<!--            testit.html calls testit.sh              -->

<html>
<HEAD><TITLE>testit.sh</TITLE></HEAD>
<body>
<form action="cgi-bin/testit.sh" method="post">
<b><u><i>Test-It Script</i></u></b>
<br><small><small><small><b>
</small></small></small>
<br><input type="submit" value="Submit">
<small><small><small>
<br><br>FORM /var/www/html/testit.html CALLS cgi-bin/testit.sh
<br>by Tom Schmitt (testit)
</small></small></small>
</form>
</body>
</html>

I use the following 'testit.sh' file in /usr/lib/cgi-bin directory:
Code:
#!/bin/bash
#ident "@(#)testit.sh Ver. 1.0 Tom Schmitt 2016"
# Purpose of this script:
#    To verify that the Apache configuration allows execution of
#        .sh and .c files from the 'cgi-bin' directory.
#    This is done with almost pure HTML code.
# Locations:
#    Place this testit.sh in: 
#        /var/www/cgi-bin directory (CentOS) or
#        /usr/lib/cgi-bin directory (Debian)
#    Place 'testit.html' in /var/www/html directory.
# Access the web page:  http://<server-ip>/testit.html
# Try it:   Click 'Submit' button
# Returns:  'Hello World from testit.sh'

PGM=`basename $0`    # This script's name

cat <<!
Content-type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body>
<pre>
<small><b>
Hello World from $PGM
<br>PWD = `pwd`
<br>`id`
</b></small>
</pre>
</body>
</html>
!

BTW:
What file ownership(s) and permissions(of course execute) should files be given in the XiVO cgi-bin?
What user/group is running Apache2/HTTP?
What command do you use on XiVO to restart Apache?


Any assistance is greatly appreciated!
Thanks,
TomS
[email protected]
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,201
Reaction score
5,221
XiVO doesn't use Apache. It uses NGINX. I am anything but an expert. You might want to post this on the XiVO forums and let one of the XiVO devs walk you through what needs to be done.
 

TomS

Guru
Joined
Oct 18, 2007
Messages
240
Reaction score
6
XiVO doesn't use Apache. It uses NGINX. I am anything but an expert. You might want to post this on the XiVO forums and let one of the XiVO devs walk you through what needs to be done.

Thanks Ward for the quick response!
TomS
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,201
Reaction score
5,221
Thanks Sylvain
TomS

Keep in mind that, with Incredible PBX for XiVO, we have peeled off http: in /var/www/html to use for Incredible PBX apps using subdirectories beneath /var/www/html. Requests to http://ipaddress without a subdirectory are redirected to XiVO's https interface.
 

TomS

Guru
Joined
Oct 18, 2007
Messages
240
Reaction score
6
Ward or Sylvain,
I tried to modify the files on my RPi-3 XiVO to no avail.
I created the testit.html file in /var/www/html/tools directory and can bring up the screen:
http://<server-ip>/tools/testit.html
I do get the SUBMIT button to try and reach the cgi-bin bash shell script.
When I hit the button, I get "certificate error" then when I try to go from their I get "No input file specified".
At this rate, I may never get the tools scripts working.

Example of options on the helpdesk menu:
-- ping an IP
-- traceroute
-- nslookup
-- DNS server test
-- Check a class C range
-- test Email server
-- clear out email MTA and MSP queues
-- check path to the Internet
-- show Environment variables known to your server request
All from a web page

Other examples:
-- force a reboot of the server from a password protected web page
-- Xymon functions where you can use Asterisk as an out-of-bound notification service
if you Email or Internet service is down using TTS
-- multiple Xymon scripts used to validate/verify the system files
-- team scheduling notifications
-- Simple check for a possible power failure in remote buildings if non-UPS printers are down
-- Call the Asterisk server and have it repeat to you its external ip address for dynamic ip services
-- fping an entire class c and compare it to a known device list to see if someone is trying to
gain access to your services
-- an easy shell script to setup certificate access between servers rather than login/password
I have been using this for many years - 'remote-setup.sh'
-- FreeRADIUS scripts to create temporary token accesses with a window of allowed usage
-- multiple items using MySQL for calling access so that you can then login
-- Simple Key access - this is added to /etc/profile or HOME/.bash_profile to add one additional
level of access by requesting a Site Password similar to the old System V undocumented
site password

I am currently working on a refresh web page that the background script runs every minute.
It creates a web page to show you SIP IAX2 and XMPP/GV peers or statuses.
It shows Asterisk and PiaF or XiVO release info.
Internal IP, how many messages are stuck in the outgoing directory.
Email MTA and MSP queues.
Architecture e.g. arm, etc.

Just a few of the things I have worked on in the past few years.

Ward,
I have the 'say-external-ip.sh' script working if you would like to test it out?
It is a simple dialplan entry for extension 3947 (EXIP) and a simple 'curl' to get the external IP in an agi-bin script.
I have this working on my RPi-3 PiaF and RPi-3 XiVO and my development machine Dell T105 PiaF.

Send me an Email if you want to give it a try.

Thanks All and Happy Holidays!
TomS (Tom Schmitt)
[email protected]
 
Last edited:

Members online

No members online now.

Forum statistics

Threads
25,812
Messages
167,763
Members
19,241
Latest member
bellabos
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