Script works from command line, but not as CGI

 
Post new topic   Reply to topic    Aprelium Forum Index -> Perl
View previous topic :: View next topic  
Author Message
robertcInT
-


Joined: 04 Apr 2012
Posts: 2

PostPosted: Wed Apr 04, 2012 10:56 pm    Post subject: Script works from command line, but not as CGI Reply with quote

Hi,
I am writing a Perl tool which interfaces with Gnu Privacy Guard (GPG). As part of this application, GPG has to access a public key server. I have written the script as a stand-alone Perl/Tk app and it works perfectly. I have been requested to port this to a CGI so that the UI is a web browser. I can communicate fine with GPG; I cannot ping the key server from my script, nor can GPG access it under the CGI. I am running Windows XP as admin, so I didn't think that permissions would be an issue; However, I tested trying to ping Google instead of the key server. This works, so I am suspicious. Abyss is running on localhost, listening on a non-standard port. We plan to migrate this to a Linux server once the UI is finalized.
My question to the support gurus is 1) Is there any special processing I have to do to enable the CGI to access additional IP addresses, and 2) Does Abyss run under a fake user (like Apache) who does not have sufficient permissions? Is running as localhost:xxxx causing issues? There must be something like this or GPG would be able to access the server (as it can from the command line)

Thanks
P.S. I am very experienced in Perl, getting my feet wet with CGI
P.P.S This script is for work, so if people want samples I will have to sanitize; let me know
Back to top View user's profile Send private message
admin
Site Admin


Joined: 03 Mar 2002
Posts: 1295

PostPosted: Wed Apr 04, 2012 11:33 pm    Post subject: Re: Script works from command line, but not as CGI Reply with quote

robertcInT,

Does your script fail with Error 500? If so, have you checked the cgi.log file for a detailed error report? What was it?
_________________
Follow @abyssws on Twitter
Subscribe to our newsletter
_________________
Forum Administrator
Aprelium - https://aprelium.com
Back to top View user's profile Send private message
robertcInT
-


Joined: 04 Apr 2012
Posts: 2

PostPosted: Thu Apr 05, 2012 12:23 am    Post subject: Reply with quote

Hi,
No. Currently I have the script die and exit when the ping fails, since the next call to GPG will return an error if I bypass the ping operation. The script runs to completion in either case, so no 500 error.
One additional data point: I tried pinging keyserver.pgp.com as a test and I am getting a response from it, but when I try to manually ping it from the command line I am getting an 'unreachable' response with TCP protocol (not a timeout). The other keyserver can be pinged successfully from the command line, or from my Perl/Tk script using ICMP. It cannot be pinged with any protocol from the CGI. My Perl/Tk script spawns GPG using IPC::Cmd and it works correctly. The same code run from the CGI results in GPG not being able to access the keyserver.
Back to top View user's profile Send private message
aprelium-support
-


Joined: 20 Feb 2009
Posts: 356

PostPosted: Mon May 07, 2012 3:05 pm    Post subject: Reply with quote

robertcInT,

Abyss Web Server runs under the privileges of the user who launched it on Windows. So there should be no permissions issues.

Are you sure your CGI script does not need or invoke any GUI tool/application? When running as CGI you are in "command line" only environment with no access to the GUI. This may make some tools fail mysteriously.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> Perl All times are GMT + 1 Hour
Page 1 of 1

 
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


Powered by phpBB phpBB Group