]> WPIA git - cassiopeia.git/blobdiff - src/apps/client.cpp
upd: reduce logging of successful CRL signing
[cassiopeia.git] / src / apps / client.cpp
index 32ecc1f1f93a936dbdc0143f6cd4baac086af4ae..e26ebbb83d4b875bb00d64a0c32a0533701e6402 100644 (file)
@@ -36,10 +36,7 @@ void checkCRLs( std::shared_ptr<Signer> sign ) {
     logger::note( "Signing CRLs" );
 
     for( auto& x : CAs ) {
-        logger::notef( "Checking: %s ...", x.first );
-
         if( !x.second->crlNeedsResign() ) {
-            logger::warnf( "Skipping Resigning CRL: %s ...", x.second->name );
             continue;
         }
 
@@ -59,7 +56,7 @@ bool pathExists( const std::string& name ) {
     return stat( name.c_str(), &buffer ) == 0;
 }
 
-void signOCSP( std::shared_ptr<Signer> sign, std::string profileName, std::string req, std::string crtName ) {
+void signOCSP( std::shared_ptr<Signer> sign, std::string profileName, std::string req, std::string crtName, std::string failName ) {
     auto cert = std::make_shared<TBSCertificate>();
     cert->ocspCA = profileName;
     cert->wishFrom = "now";
@@ -78,6 +75,7 @@ void signOCSP( std::shared_ptr<Signer> sign, std::string profileName, std::strin
     std::shared_ptr<SignedCertificate> res = sign->sign( cert );
 
     if( !res ) {
+        writeFile( failName, "failed" );
         logger::error( "OCSP Cert signing failed." );
         return;
     }
@@ -118,6 +116,12 @@ void checkOCSP( std::shared_ptr<Signer> 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<X509Req> parsed = X509Req::parseCSR( req );
@@ -127,7 +131,7 @@ void checkOCSP( std::shared_ptr<Signer> sign ) {
             continue;
         }
 
-        signOCSP( sign, profileName, req, crtName );
+        signOCSP( sign, profileName, req, crtName, failName );
     }
 }