Ignore repeated requests from client after using ca remove command

This commit is contained in:
Andrew Jaffie 2018-08-08 11:34:37 -04:00 committed by Michael Friedrich
parent a970f7dcf9
commit 429f1ed317
2 changed files with 7 additions and 1 deletions

View File

@ -61,7 +61,7 @@ int CARemoveCommand::Run(const boost::program_options::variables_map& vm, const
<< "No request exists for fingerprint '" << ap[0] << "'.";
return 1;
}
Utility::SaveJsonFile(ApiListener::GetCertificateRequestsDir() + "/" + ap[0] + ".removed", 700, Utility::LoadJsonFile(requestFile));
if(remove(requestFile.CStr()) != 0)
return 1;

View File

@ -129,6 +129,12 @@ Value RequestCertificateHandler(const MessageOrigin::Ptr& origin, const Dictiona
return result;
}
} else if (Utility::PathExists(requestDir + "/" + certFingerprint + ".removed")) {
Log(LogInformation, "JsonRpcConnection")
<< "Certificate for CN " << cn << " has been removed. Ignoring signing request.";
result->Set("status_code", 1);
result->Set("error", "Ticket for CN " + cn + " declined by administrator.");
return result;
}
std::shared_ptr<X509> newcert;