Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Run Perl on the Server Locally

by peacemaker1820 (Pilgrim)
on Oct 09, 2002 at 17:15 UTC ( [id://203998]=perlquestion: print w/replies, xml ) Need Help??

peacemaker1820 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Guys.
I am trying to make my webpage local on the server so that the only people who can access it would be whoever is connected to the server. In other words, when my pages and scripts run, I don't want them to go OUT on the net. I want everything to stay inside.

Instead of "http:\\www.mypage.com\cgi-bin\test.pl"
I replaced it with: "\\ServerName\cgi-bin\test.pl" on all my pages

After doing this on all the links, my HTML pages loaded successfully, BUT my perl scripts are not executing. I get errors like "Page Cannot Be Displayed." and I get a JavaScript Error "Access Denied" because I am taking data from a popup window and putting it into my main form using JS and perl.
I would really appreciate any ideas you have about this.
Thanks in advance.

Replies are listed 'Best First'.
Re: Run Perl on the Server Locally
by dws (Chancellor) on Oct 09, 2002 at 17:33 UTC
    I am trying to make my webpage local on the server so that the only people who can access it would be whoever is connected to the server. In other words, when my pages and scripts run, I don't want them to go OUT on the net. I want everything to stay inside.

    My first thought is that you are seriously confused, but let's break your problem down a bit.

    You say you want to restrict "access" to people who are "connected" to the server [by win32 network shares?], and that you want pages and script [results] to stay inside [your intranet?] rather than going out on the net [the network outside of your intranet?].

    From what you write, is it safe to assume you're using IIS under NT/Win2K/XP Pro in a configuration that's exposed to your intranet? Or you on an intranet-only configuration, and want to further restrict access to those who can authenticate to your server?

    Please fill in the pieces, and we'll see where this goes.

Re: Run Perl on the Server Locally
by robartes (Priest) on Oct 09, 2002 at 21:44 UTC
    I second dws's Re: Run Perl on the Server Locally comment - it's not exactly clear where you want to go with this.

    But I might be able to shed some light on why your pages are no longer working when expected. When you change a link in your pages to

    \\servername\please\execute\this.pl

    I assume you want this URL to point to a file on the local system (the URL is broken BTW, you just are lucky most browsers are smart enough to work around the brokenness).

    Upon encountering this URL, the browser will happily go and read the file but become hopelessly confused as to what it's actually reading, because you're not feeding it HTML but Perl, and Perl will certainly confuse your average browser.

    To summarise your problem: you seem to be bypassing the webserver and instructing the browser go get the file locally. This will not lead to the expected result.

    If you want to restrict access to your web pages and scripts, you should be looking at the configuration of your web server, not at your pages and scripts.

    Then again, I could be misreading your question entirely in which case the above is as useful as trying to teach a camel to tapdance. Except that a tapdancing camel might actually be funny.

    CU
    Robartes-

(Kozz) Re: Run Perl on the Server Locally
by Kozz (Friar) on Oct 09, 2002 at 17:35 UTC

    Well, if you want, you could write the absolute path simply to "/cgi-bin/test.pl" instead of including the hostname. Then near the top of your script, you could do something like

    unless ( $ENV{HTTP_HOST} =~ /desired_host_name/ ){ # print content-type header if needed # along with error message, or just exit; }

    So if the script isn't being called "locally" like "http://servername/cgi-bin/test.pl" (and you're testing for "servername"), it will just exit quietly, or perhaps you could spew an error message.

    I can't speak to the relative security of this method (can it be spoofed?), and don't know if you have access to that environment variable, but it's worth a shot.

    --Kozz
Re: Run Perl on the Server Locally
by zentara (Archbishop) on Oct 10, 2002 at 15:09 UTC
    Wouldn't you be better off using a firewall to stop access to your webpages from the "outside" ? Firewalls let you distinquish between clients coming from the "trusted" internal net, and those coming from the outside.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://203998]
Approved by newrisedesigns
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-16 12:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found