in reply to Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: code problem
in thread code problem

Sandal,

Try downloading the tar/gz I have just created for you on my website here.

#!/usr/bin/perl -w ###################################################################### +## # # Author: Peter L. Berghold, Schooner Technology Consulting # peter@berghold.net # # Purpose: This script is run as a CGI on a new system that I am # going to be developing CGI scripts on and tells me what I'm # getting into before I start coding and lets me know if there # are issues I need to resolve before I can start. # # Disclaimer: This code is not to be left in a production environment # because of potentially harmfull information leaks it can provide # to a potential hacker or other ne'er-do-well that deserves to be # horsewhipped in a public place and televised on international # TV. # # The author and Schooner Technology Consulting do not warrantee # any sort of merchantilability or worthiness of this code for other # than the purposes stated already. There is no warranty expressed # or implied for the support of this script and inquiries for same # will be met with cold disdain at the best. # # Lastly this code is not to be used for anything where its failure # could present a danger to human or other life. Schooner Techology # Consulting and the author are not to be held liable if this code # causes harm, loss of revenue, war, crime sprees or the Internationa +l # Space Station to fall from the sky. # # This code is hereby released into the public domain for non-commerc +ial # use. # # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +-=- # # Installation instructions: # # UNIX: # Store this file in your CGI (cgi-bin) directory # Set the permissions of the file to be executable # chmod 755 SysconfigCheck.pl # # If this code does not run after following the instructions # above I would start to suspect your CGI environment is # crippled beyond belief. # # # Windows: # Good luck. # # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +-=- $|=1; use strict; use CGI qw/ :all /; use CGI::Carp qw/ fatalsToBrowser /; # # Put modules you want to check for their existance here... hopefully # all the above exist. # # This list changes frequently depending on the requirements I have # when I work in a new CGI environment # my @modules=qw / CGI::Cookie Spreadsheet::WriteExcel DBIx::Recordset Net::SMTP HTML::Calendar::Simple HTML::TableLayout MIME::Lite Mail::Send Mail::Sendmail CGI::EZForm CGI::FormBuilder GD CGI::Graph XML::Parser /; # # Instantiate CGI my $q=new CGI; # # This is the order of checks that we are performing print header; print start_html( -title => 'CGI Environment Assessment' ); print h1('CGI Environment Assessment'); perl_info(); print hr,"\n"; env_test(); print hr,"\n"; cgi_parm_test($q); print hr,"\n"; dbi_test(); print hr,"\n"; module_inventory(@modules); print hr,"\n"; print end_html; exit(0); sub perl_info { print h2('Perl interpreter information'); print p(sprintf("Perl interpreter version %s",get_perl_version())); print p("\@INC contains:", ul(ul( ul( map { li($_) } @INC ) )) ); } sub env_test { print h2('Base Account (shell) Environment'); print table( map { Tr(td($_),td($ENV{$_})) } sort keys %ENV ); print p(b('CGI Runs As:'),`id`); print p("I was invoked as: ",$0); if ($ENV{HOME}) { if (-d $ENV{HOME} . '/cgi-bin') { print p('Found the cgi-bin directory in ', $ENV{HOME} . "/cgi-bi +n"); } else { print p("I have no clue where the cgi-bin is physically"); } } else { print p(b('OH DRAT!'),'The $HOME variable is not being set!'); } } sub cgi_parm_test { my $q=shift; print h2("Default CGI Information"); print table( map { Tr(td($_),td($q->param($_)) ) } sort $q->param ),"\n"; } sub dbi_test { print h2('DBI Environment'); eval ' use DBI; '; if ($@) { print p("No DBI on this machine."); } else { my @sources=DBI->available_drivers; print p("DBD Drivers available:", ul(ul(ul( map { li($_)} @sources ))) ); } } sub module_inventory { my @list2check=@_; print h2('Module Inventory'); print table( map { Tr ( td($_),td(attempt2load($_)) ) }sort @list2check ); } sub attempt2load { my $module=shift; eval " use $module; " ; return ($@ ? "Not Available" : "OK" ); } # # Sigh! I had to add this due to the fact that some web servers # use antique versions of perl that don't seem to understand $^V # nor do the understand the %vd printf format modifier. sub get_perl_version { open F,"perl -v|" or die "Could not run perl -v: $!"; while (my $line=<F>) { chomp $line; next unless $line =~ m@^.*\s+version\s+([\d+\.\_\-]+)\s+.*$@; return $1; } }

Instructions: read and follow carefully

  1. Download the tar/gz above.
  2. Extract the Perl script that it contains.
  3. Upload it to your site
  4. chmod 755 the script
  5. Run it.

If this script (which I just verified works) does not run on your site the following problems may exist:


Peter L. BergholdBrewer of Belgian Ales
Peter@Berghold.Netwww.berghold.net
Unix Professional

Code tags - dvergin 2003-07-23

Replies are listed 'Best First'.
Post Code, Not Links! (was: Re^10: code problem)
by sauoq (Abbot) on Jul 23, 2003 at 19:46 UTC
    Try downloading the tar/gz I have just created for you on my website

    Your assistance is certainly generous and well-intentioned, but I think it would be best if we didn't encourage posting links to scripts on our personal sites. It would have been better to simply include the source of your script, all 184 lines of it, between a couple readmore tags.

    The simplest view is that, when avoidable, it is best not to make a node dependent on an external site for completeness. There are, however, far more compelling (security) reasons. Unfortunately, they are quite subtle and easily overlooked.

    It is very important that the code provided in our answers be readily available for peer review. You might say that it was; anyone could download the code and look at it. That's not necessarily true. You can't tell who might be checking up on the site from an internet cafe, mall kiosk, or school library. Some may even decline to download the package simply because they don't want to reveal their IP to you (which might expose their place of employment, for instance.)

    It is also important that, when we do review code, we can all be sure we are talking about the same thing. A link on an external site may easily be made to look like one thing to one person and another to someone else. Hence, in this case, all I can say is that the code that I downloaded from your site looked clean after a quick inspection. I have no idea about anything that anyone else downloaded.

    -sauoq
    "My two cents aren't worth a dime.";
    

      While what you have said is perfectly valid you may be overlooking one very salient point: I did post code before and sandal said he couldn't get it to run. I am attempting to bullet proof his efforts by supplying him with the tgz.

      At any rate all 184 lines are there now, I couldn't get the bloody <readmore> tags to work so I put in an editor request for help.


      Peter L. BergholdBrewer of Belgian Ales
      Peter@Berghold.Netwww.berghold.net
      Unix Professional
Re: Re^10: code problem
by sandal (Initiate) on Jul 24, 2003 at 18:07 UTC

    Peter,


    I run syscheck script successfully.

    I have mailed details on your email. What you can tell?

    Thanks,

    sandal

      answered. let's keep further discussion as private email. This thread is starting to get beyond the scope of what is Perl related and more into what is basic Unix System Administration.

      UPDATE: The solution(s) to the quandry presented here had more to do with AIX's peculiar (compared to other flavors of Unix) security structure from what I can deduce. Not much to do with actual Perl coding.


      Peter L. BergholdBrewer of Belgian Ales
      Peter@Berghold.Netwww.berghold.net
      Unix Professional