Skip to content
This repository has been archived by the owner on Apr 25, 2019. It is now read-only.

[HOPSWORKS-579] Refactor Hopsworks-ca for multi intermediate CAs #934

Merged
merged 2 commits into from
Jul 12, 2018
Merged

[HOPSWORKS-579] Refactor Hopsworks-ca for multi intermediate CAs #934

merged 2 commits into from
Jul 12, 2018

Conversation

SirOibaf
Copy link
Collaborator

@SirOibaf SirOibaf commented Jun 8, 2018

Make sure there is no duplicate PR for this issue

  • Please check if the PR meets the following requirements
  • Adds tests for the submitted changes (for bug fixes & features)
  • Passes the tests
  • HOPSWORKS JIRA issue has been opened for this PR
  • All commits have been squashed down to a single commit
  • Post a link to the associated JIRA issue

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

  • What is the new behavior (if this is a feature change)?

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

  • Other information:

@SirOibaf SirOibaf added the WIP Work in progress label Jun 8, 2018
@SirOibaf
Copy link
Collaborator Author

SirOibaf commented Jun 8, 2018

Work in progress, early feedback welcome

throw new AppException(Response.Status.INTERNAL_SERVER_ERROR, "Error retrieving CAs certificates");
}

CSRView signedCsr = new CSRView(csrView.getCsr(), signedCert, chainOfTrust.getValue0(), chainOfTrust.getValue1());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we skip sending back the CSR?

throw new AppException(Response.Status.INTERNAL_SERVER_ERROR, "Error retrieving CAs certificates");
}

CSRView signedCsr = new CSRView(csrView.getCsr(), signedCert, chainOfTrust.getValue0(), chainOfTrust.getValue1());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, can we skip sending back the CSR?

}

@DELETE
public Response revokeCertificate(@QueryParam("certId") String certId) throws AppException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: This assumes that kagent will handle the current certificate version

@@ -258,7 +264,10 @@ public void validateCertificate(X509Certificate certificate) throws IOException
commands.add(OPENSSL);
commands.add("verify");
commands.add("-CAfile");
commands.add(Paths.get(settings.getIntermediateCaDir(), "certs", "ca-chain.cert.pem").toString());
commands.add(Paths.get(pki.getCACertsDir(caType), "ca-chain.cert.pem").toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a method in PKI. Depending on the intermediate CA the chain file name "ca-chain.cert.pem" might differ

}
}

public String getCAConfPath(CAType caType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better for type safety the return type to be Path

}
}

public String getCACertsDir(CAType caType) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, return type Path

return Paths.get(getCAParentPath(caType), "certs").toString();
}

public String getCACRLPath(CAType caType){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

@SirOibaf
Copy link
Collaborator Author

@SirOibaf SirOibaf removed the WIP Work in progress label Jun 25, 2018
@SirOibaf SirOibaf changed the title [WIP][HOPSWORKS-579] Refactor Hopsworks-ca for multi intermediate CAs [HOPSWORKS-579] Refactor Hopsworks-ca for multi intermediate CAs Jun 26, 2018
@SirOibaf
Copy link
Collaborator Author

Tests passed. @tkakantousis whenever you want give it the final ok and merge

Copy link
Contributor

@o-alex o-alex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you tried removing the Dela related signing part from the CertSigningService into DelaTrackerCertController and DelaTrackerCertService, however I see that the CertSigningService still uses DelaTrackerCertController. If this service depends on that controller, should we name the controller Dela... ? it seems that the controller is not Dela specific.

Looking at the code I see that you didn't change the paths when spliting the service into Dela... Can I assume no api (path, params) change to the signing service as part of dela?

}

private CAExceptionErrors error;
private CertificateType certType;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SirOibaf Hops custom exceptions in v2 will extend RESTException, which brings two extra fields for passing runtime information to the users and developers using the API. For example you might want to return for which file was the CERTNOTFOUND thrown and to the developer you might want to return the entire stacktrace. Just for making it easier when the code is migrated to v2, can you add these two fields in the exception? userMsg and devMsg.

}

@DELETE
public Response revokeCertificate(@QueryParam("certId") String certId) throws CAException, IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SirOibaf Add swagger API annotations for all endpoints. https://github.com/swagger-api/swagger-core/wiki/annotations#apiparam

Particularly for mandatory queryparams and the response view class. For example
@ApiOperation(value = "Find Execution by Id", response = ExecutionDTO.class)

@tkakantousis tkakantousis merged commit c6754e4 into dc-sics:master Jul 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants