#!/usr/bin/perl -w =head1 NAME configure-link-cgi - configure a CGI that reports on or repairs links. =head1 SYNOPSIS configure-link-cgi.pl [options] cgi-file-name =head1 DESCRIPTION Each CGI program should be hardcoded with it's own configuration. At the same time we want to use one central program file. This is achieved by simply building scripts which set variables and then run the main cgi program. This program should be run only once the basics of the linkcontroller system have been configured for the current user with B =head1 OPTIONS The C<--reporter> option will generate a CGI which reports on the status of links. The C<--fixer> option will generate one which can fix links. If both are given then both are generated. If neither are given then a reporter is generated by default. =head1 TRUST The CGI bin program trusts the perl libraries. The CGI bin program trusts the diretory structure and that the link_report.cgi program can be called safely. =head1 SECURITY The program was written to pass Perl's tainting mechanism. The program deletes various environment variables. $ENV{PATH} = "/bin:/usr/bin"; delete @ENV{qw(HOME IFS CDPATH ENV BASH_ENV)}; # Make %ENV safer This means that the users own configuration file in the users home directory will be ignored. The reason for this is that CGIs aren't guaranteed to be run by the right user. Hardcode any of the configuration you want to copy from there. =head1 ISSUES I don't think the following are bugs, but I might be wrong so you should be aware of them. =over =item - We use the WWW::Link_Controller::ReadConf module to get configuration. This goes poking around in home directories for configuration files and doesn't check that the files are secure?? =item - There are probably issues. If you need security call in a security audit company to check this file over. Donating the results is appreciated. =back =head1 BUGS None, but see ISSUES ;-) =head1 SEE ALSO L; L; L L; L; L; L L; L; L The LinkController manual in the distribution in HTML, info, or postscript formats, included in the distribution. http://scotclimb.org.uk/software/linkcont/ - the LinkController homepage. =cut use strict; use WWW::Link_Controller::ReadConf; use WWW::Link_Controller::ReadConf::utils; use Fcntl; use vars qw(%config $reporter_script $fixer_script $reporter_filename $fixer_filename @vars); use Getopt::Function qw(maketrue makevalue); $::opthandler = new Getopt::Function [ "version V>version", "usage h>usage help>usage", "help-opt=s", "verbose:i v>verbose", "reporter r>reporter", "fixer f>fixer", "link-report=s", "fix-link=s", ], { reporter => [\&maketrue, "Create a CGI for reporting on links" ], fixer => [\&maketrue, "Create a CGI for fixing links" ], "link-report" => [\&makevalue, "Change the location of link-report.cgi", "FILEPATH"], "fix-link" => [\&makevalue, "Change the location of fix-link.cgi", "FILEPATH"], }; $::opthandler->std_opts; $::opthandler->check_opts; sub usage() { print <list_opts; print <