📄 sendcert
字号:
#!/usr/bin/perl ## Send Certificates Tool - V2.0## (c) 1999 by Massimiliano Pala and the OpenCA Grouprequire 5.001;push (@INC, "lib/" );## Uses the OpenCA::TRIStateCGI module by Massimiliano Pala## to generate, check and manipulate FORMs Objectsuse OpenCA::TRIStateCGI;## Uses the OpenCA::Configuration module by Massimiliano Pala## to load the configuration fileuse OpenCA::Configuration;my $query = new OpenCA::Configuration;## Build a Configuration Objectmy $config = new OpenCA::Configuration;## Define the Configuration Namemy $CONFIG = 'conf/public.conf';## Load the Configuration file (read and parse)if( $config->loadCfg( $CONFIG ) == undef ) { print "Content-type: text/html\n\n"; configError( "Unable to load configuration file (request.cnf)!");}## Flush the output stream$|=1;my $cacert = getRequired( 'cacert' );putCACert( "$cacert" );## Subroutines Section (Last Modified on 08 September 1998)## Changes by Massimiliano Pala (madwolf@comune.modena.it)sub putCACert { my @keys = @_; my $cacert = $keys[0]; my $ret; open (FD ,"<$cacert") or die "Error: Can't access CA Certificate!"; while (<FD>) { $ret = $_; } close ( FD ); print "Content-type: application/x-x509-ca-cert\n"; print "Content-length: " . length( $ret ) . "\n\n"; print "$ret\n"; exit(1);}sub getRequired { ## Returns required parameter SINGLE STRING VALUE ## this function simplifies the parameter access ## but returns only the first parameter my $name = @_[0]; my $tmp; if( ($tmp = $config->getParam($name)) == undef ) { ## If there is an Error, just send the missing ## parameter error to the browser configError( "Missing Configuration Keyword : $dir" ); } ## If all gone well we should have the value string in ## $ret and return it to the calling funcion; $ret = $tmp->{VALUES}->[0]; return $ret;}sub configError { my @keys = @_; my $err = $keys[0]; print $query->start_html(-title=>"Administration Error", -BGCOLOR=>"#FFFFFF"); print "<CENTER><BR><HR WIDTH=80%><BR></CENTER>"; print "<OL><OL><H1><FONT COLOR=red>Error 690 </FONT></H1>"; print "<OL> <B>Configuration Error</B>. $err.</OL></OL></OL>"; print "<CENTER><HR></CENTER>\n</BODY>\n</HTML>\n";}1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -