X-Git-Url: https://code.wpia.club/?p=cassiopeia.git;a=blobdiff_plain;f=src%2Fapps%2Fclient.cpp;fp=src%2Fapps%2Fclient.cpp;h=aa0e06c2a882e8b1f14d61d4677c9f36932f7e9e;hp=32ecc1f1f93a936dbdc0143f6cd4baac086af4ae;hb=6830d598f51f17ca4d96bff173a584241f43074b;hpb=05a0a1dba7994fdef90dfd8a92c2dc888fa0ce9a diff --git a/src/apps/client.cpp b/src/apps/client.cpp index 32ecc1f..aa0e06c 100644 --- a/src/apps/client.cpp +++ b/src/apps/client.cpp @@ -59,7 +59,7 @@ bool pathExists( const std::string& name ) { return stat( name.c_str(), &buffer ) == 0; } -void signOCSP( std::shared_ptr sign, std::string profileName, std::string req, std::string crtName ) { +void signOCSP( std::shared_ptr sign, std::string profileName, std::string req, std::string crtName, std::string failName ) { auto cert = std::make_shared(); cert->ocspCA = profileName; cert->wishFrom = "now"; @@ -78,6 +78,7 @@ void signOCSP( std::shared_ptr sign, std::string profileName, std::strin std::shared_ptr res = sign->sign( cert ); if( !res ) { + writeFile( failName, "failed" ); logger::error( "OCSP Cert signing failed." ); return; } @@ -118,6 +119,12 @@ void checkOCSP( std::shared_ptr sign ) { continue; } + std::string failName = "ca/" + profileName + "/ocsp.fail"; + + if( pathExists( failName ) ) { + continue; + } + logger::notef( "Discovered OCSP CSR that needs action: %s", csr ); std::string req = readFile( csr ); std::shared_ptr parsed = X509Req::parseCSR( req ); @@ -127,7 +134,7 @@ void checkOCSP( std::shared_ptr sign ) { continue; } - signOCSP( sign, profileName, req, crtName ); + signOCSP( sign, profileName, req, crtName, failName ); } }