📄 importcrr
字号:
## OpenCA - CA Command## (c) 1998-2001 by Massimiliano Pala and OpenCA Group#### File Name: importReqs## Brief: Import Certificate Requests## Description: Import Requests from removable media into local dB## Parameters: my $cmdName = "importCRR";if ( $cmd !~ /$cmdName/i ) { configError( "Wrong Command Usage ($cmd over $cmdName)!" ); exit 1;}## GNU Tar required for importing Certification Request## to the CA. We use the GNU tar because of its availability## for all the platforms and its stability.## Get required parameters from the configuration filemy $cmd = getRequired( 'UnpackArchive' );my $orig = getRequired( 'ImportDev' );my $dir = getRequired( 'NewReqsDir' );my $tmpReq;print startLogPage("Importing Certificate Revocation Requests");$cmd = $query->subVar( $cmd, '$orig', $orig );$cmd = $query->subVar( $cmd, '$dest', $dir ); print addLogSection("Importing Certificate Revocation Requests ... ");my $ret = `$cmd 2>&1`;if( $? != 0 ) { print addErrorLog( "Importing Requests Failed from $orig!" ); closePage(); exit;} print addLogLine("Ok.");print addPreLogLine( $ret );print closeLogSection();print addLogSection("Importing Requests to dB ... ");opendir( REQS, "$dir" ); my @reqsList = grep( /^[a-f0-9]+.req/i, readdir( REQS ) );closedir( REQS );$ret = "";foreach $tmpReq (@reqsList) { my $storeType, $tmpType; my $fileName = "$dir/$tmpReq"; my $content = ""; open ( FD, "<$dir/$tmpReq" ); while ( $tmp = <FD> ) { $content .= $tmp; } close FD; my $data = new OpenCA::CRR( SHELL=>$cryptoShell, DATA => $content ); if ( not $data ) { print addErrorLog("Failed creating CRR obj "); closePage(); exit; } if ( not $db->storeItem( DATATYPE=>"PENDING_CRR", OBJECT=>$data ) ) { print addErrorLog("Failed adding request to dB!"); closePage(); exit; } else { unlink( "$fileName" ); } $ret .= "Added <I>" . $data->getParsed()->{CERTIFICATE_DN} . " (" . $data->getParsed->{EMAIL} . ")</I><BR>\n";}print addLogLine("Ok.");print addPreLogLine( $ret );print closeLogSection();closePage();1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -