Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added p11-kit-trust for pki CLI #265

Merged
merged 1 commit into from
Oct 15, 2019
Merged

Conversation

edewata
Copy link
Contributor

@edewata edewata commented Oct 8, 2019

The pki CLI has been modified to add the p11-kit-trust module
into the NSS database such that it trusts the CA certificates
provided by the system.

This can be tested with this command:

$ rm -rf ~/.dogtag/nssdb
$ pki -U https://pki.demo.dogtagpki.org ca-cert-find
$ certutil -L -d ~/.dogtag/nssdb
$ modutil -list -dbdir ~/.dogtag/nssdb

Expected results:

  • The NSS database should be created automatically.
  • The search should work without importing/trusting any certificate in the NSS database.
  • The p11-kit-trust module should be added automatically into the NSS database.

Docs: https://www.dogtagpki.org/wiki/PKI_10.8_PKI_CLI_Changes

@edewata edewata requested a review from cipherboy October 8, 2019 20:10
// All rights reserved.
// --- END COPYRIGHT BLOCK ---

package org.dogtagpki.nss;
Copy link
Member

@cipherboy cipherboy Oct 8, 2019

Choose a reason for hiding this comment

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

Should this live in JSS instead? Generally we have to initialize a CryptoManager explicitly. I could see using shims for now (er, ProcessBuilder to call certutil/modutil) until we have a fuller implementation. Since its static, and wouldn't necessarily require initializing NSS, I think its fine to put this under JSS.

The flow would look like:

if (!db_exists) {
  NSSDatabase.create(db)
  NSSDatabase.makeUseful(db)
}

CryptoManager.initialize(db);

}
// Install p11-kit-trust module if it doesn't exist
if (!nssdb.isModuleInstalled("p11-kit-trust")) {
nssdb.addModule("p11-kit-trust", "/usr/lib64/pkcs11/p11-kit-trust.so");
Copy link
Member

Choose a reason for hiding this comment

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

Ugh, please don't hard-code this path. We should check with Bob if there's an alternative way to get this path and/or at least handle non-/usr/lib64 installations.

@edewata
Copy link
Contributor Author

edewata commented Oct 8, 2019

As discussed on IRC, this depends on the following JSS ticket:
dogtagpki/jss#282

@cipherboy
Copy link
Member

That looks better. I won't hold it up based on moving it to JSS, we can do that at a later date when we have more time.

Java doesn't need to be multi-arch clean, so I think we're fine here. I just worry about the occasional non-Intel system (ppc64 and s390x) but other than that I think we're good.

The pki CLI has been modified to add the p11-kit-trust module
into the NSS database such that it trusts the CA certificates
provided by the system.

// Install p11-kit-trust module if it doesn't exist
if (!isModuleInstalled("p11-kit-trust")) {
addModule("p11-kit-trust", "/usr/share/pki/lib/p11-kit-trust.so");
Copy link
Member

Choose a reason for hiding this comment

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

The last remaining thing I want a discussion on is this: automatically adding root system store to the client.

There's an argument that, by only explicitly adding certificates of CAs you trust (namely, only the Dogtag CA -- that's generally the only CA necessary for PKI interactions), you're safer here. It probably only matters on say, KRA operations, and matters less on say, CSR submissions.

I'm not inclined to care too much here; we can assume this is a fairly safe list of CA certs. However, I am inclined to ask @ladycfu if there's any wording that CC perhaps might care about this that we'll need to explicitly mention. Thoughts?

(If they do care, I'd prefer to make this a separate command, something like pki trust-root-store perhaps).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed on IRC, the p11-kit-trust will only be added to a new NSS database created by the CLI. If the user already has an NSS database without the module (e.g. for CC), the CLI will not add the module. Also if the system administrator wants to limit the trusted certs, that can be done centrally on the system, and the CLI should continue to use the p11-kit-trust to trust the system-provided certs.

@edewata edewata merged commit 114b010 into dogtagpki:master Oct 15, 2019
@edewata
Copy link
Contributor Author

edewata commented Oct 15, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants