📄 importreqs
字号:
## 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 = "importReqs";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 Requests");$cmd = $query->subVar( $cmd, '$orig', $orig );$cmd = $query->subVar( $cmd, '$dest', $dir ); print addLogSection("Importing 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 $data = new OpenCA::REQ( SHELL=>$cryptoShell, INFILE=>"$fileName" ); if ( (not $data) or ( not $tmpType = $data->getParsed()->{TYPE} ) ) { print addErrorLog("Failed creating REQ obj form '$fileName'"); closePage(); exit; } else { if ( $tmpType =~ /RENEW/ ) { $storeType = "RENEW_REQUEST"; } elsif ( $tmpType =~ /REVOKE/ ) { $storeType = "REVOKE_REQUEST"; } else { $storeType = "PENDING_REQUEST"; } } if ( not $db->storeItem( DATATYPE=>$storeType, OBJECT=>$data ) ) { print addErrorLog("Failed adding request to dB!"); closePage(); exit; } else { unlink( "$fileName" ); } $ret .= "Added <I>" . $data->getParsed()->{CN} . " (" . $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 + -