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

Keyring support #1177

Merged
merged 56 commits into from
Jul 28, 2020
Merged

Keyring support #1177

merged 56 commits into from
Jul 28, 2020

Conversation

vit-tomica
Copy link
Contributor

@vit-tomica vit-tomica commented Mar 3, 2020

SAF keyring configuration for Zowe

This PR enhances certificate configuration scripts to store certificates in keyrings.
The idea is to provide analogous actions for keyrings to what we currently have for keystores, i.e. generating a local zowe CA and zowe cert, importing external certs, delete certs or generally doing certs cleanup

Motivation:

  • run Zowe on keyrings
  • when configuring keyrings, do as much automation as possible
  • if possible avoid writing a lot of documenation (commands for each ESMs etc...)

How much java keytool can handle SAF keyrings
it can:

  • generate and connect a certificate with a keyring, creates the keyring if does not exist.
  • import/export a certificate from/to a keystore, creates the keyring if does not exist.
  • disconnect a certifice from a keyring.
  • there is also a java hwkeytool utility that can take advantage of crypto hardware.

it can't:

  • delete keyring
  • delete a certificate from RACF database.

The keyring-util program (leverages R_datalib API) provides keyring actions that the Java keytool can't do.
it can:

  • delete keyring
  • delete a certificates from RACF database
  • refresh DIGTCERT class

The keyring-util's functions could be useful in scenarios like:

  • cleanup keyring configuration
  • renewing certs
  • automation
  • if keyring configuration fails in the middle of the process, we can cleanup partial setup and start from scratch

  • Tests for the changes have been added (for bug fixes / features)
  • Necessary documentation (if appropriate) have been added / updated
  • DCO signoffs have been added to all commits, including this PR

PR type

What type of changes does your PR introduce to Zowe? Put an x in the box that applies to this PR. If you're unsure about any of them, don't hesitate to ask.

  • Bugfix
  • Feature
  • Other... Please describe:

Relevant issues

Fixes

Changes proposed in this PR

Does this PR introduce a breaking change?

  • Yes
  • No

Does this PR do something the person installing Zowe should know about?


  • Affected function: general area of interest *

  • Description: 1 line description *

  • Part: name of customizable file involved *

multi-line description

Is there a related doc issue or Pull Request?

Doc issue/PR number:
zowe/docs-site#1214

Other information

@OnnoVdT OnnoVdT self-assigned this Mar 4, 2020
@OnnoVdT
Copy link
Contributor

OnnoVdT commented Mar 4, 2020

assigned myself to have a closer look when I have some time as this is interesting stuff

@vit-tomica
Copy link
Contributor Author

Thanks Onno.
From user perspective, the action should be simple - setting a keyring name for the ZOWE_KEYRING= variable in the zowe-setup-certificates.env, the rest should be handled by the zowe-setup-certificates.sh script

@vit-tomica vit-tomica changed the title WIP: Keyring support Keyring support Mar 5, 2020
@OnnoVdT
Copy link
Contributor

OnnoVdT commented Mar 20, 2020

Do ACF2 and TSS support the R_datalib API ? I thought this was RACF only (but could be mistaken).
Also, we heard that they current script for keystores is extremely slow on ZD&T (takes about an hour),. This is likely because we drive several invocations of the keytool utility, which in turn drives Java.
We are using keytool here as well, so the keyring support might end up being slow as well. We should try this out and maybe consider to see if something can be doen with direct RACF/ACF2/TSS commands. That would be another issue/pull request, just bringing it to your attention here.

@vit-tomica
Copy link
Contributor Author

Yes, they do. The Java keytool leverages R_datalib API and we recently used this in Zowe to read zosmf keyring to get and trust the zosmf cert. However, I have found a bug in TSS/ACF2 when creating/deleting keyring using R_datalib. Security team is working on the fix and this PR will not work for TSS/ACF2 until it's fixed.

You're right about the ZD&T. It'll be slow because of the keytool commands. In this case, usual security commands make sense.

@1000TurquoisePogs
Copy link
Member

@timgerstel @vit-tomica Tim's working on using the JWT key info to enable SSO on our other servers. Can you two please collaborate on if these changes will work with ongoing SSO efforts? We don't want the way SAF keyring support is done to hold back SSO work, so just double-check on the files & formats.

@timgerstel
Copy link
Contributor

@vit-tomica @1000TurquoisePogs I do not believe this pull request will interfere with the work to enable SSO. All necessary files will still exist and are in the correct format.

# Conflicts:
#	bin/zowe-setup-certificates.sh
@plavjanik
Copy link
Contributor

This looks great. What privileges does a user need to have to be able to run it? Is there a related documentation PR?

@vit-tomica
Copy link
Contributor Author

@plavjanik I don't know exactly what all the privileges are but READ access to all of the IRR.DIGTCERT.* resources is enough + UPDATE access to IRR.DIGTCERT.CONNECT is needed to set up trust with z/OSMF. The READ access to all IRR.DIGTCERT.* resources is a bit excessive but it generally allows to perform actions only on certificates and keyrings owned by the ACID that has the READ access

There is no doc yet.

I'm also working on JCL configuration. I plan to remove the part that compile/link the keyring-util program and I'll replace it with the prebuilt program instead.

Copy link
Contributor

@plavjanik plavjanik left a comment

Choose a reason for hiding this comment

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

My latest comments have been addressed. It looks ok to me after a high-level review and no testing.

vit-tomica and others added 10 commits June 19, 2020 16:52
# Conflicts:
#	bin/zowe-setup-certificates.sh
* add keyring to artifactory build

Signed-off-by: MarkAckert <[email protected]>

* fix keyring version

Signed-off-by: MarkAckert <[email protected]>

* fix keyring manifest, add gitignore

Signed-off-by: MarkAckert <[email protected]>

* setup keyring-util as binary

Signed-off-by: MarkAckert <[email protected]>

* fix keyring during prepare-workspace, chmod in pre-package

Signed-off-by: MarkAckert <[email protected]>

* fix dir

Signed-off-by: MarkAckert <[email protected]>

* set keyring version to 1.0.1

Signed-off-by: MarkAckert <[email protected]>
Signed-off-by: Vit Tomica <[email protected]>
//*
//* SPDX-License-Identifier: EPL-2.0
//*
//* Copyright Contributors to the Zowe Project. 2018, 2020
Copy link
Contributor

Choose a reason for hiding this comment

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

this did not exist in 2018, so copyright should say 2020, 2020

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

//* user ID for the ZOWE started task.
//*
//* 4) Update the SET ZOWERING= statement to match the desired
//* name of the keyring owned by the ZOWEUSER.
Copy link
Contributor

Choose a reason for hiding this comment

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

... by the &ZOWEUSER user ID.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

//* name of the keyring owned by the ZOWEUSER.
//*
//* 5) Update the SET LABEL= statement with the name of the Zowe
//* certificate that will be added to the RACF database or that
Copy link
Contributor

Choose a reason for hiding this comment

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

keep it product neutral, so use 'security database'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

//* 2) Update the SET PRODUCT= statement to match your security
//* product.
//*
//* 3) Update the SET ZOWEUSER= statement to match the desired
Copy link
Contributor

Choose a reason for hiding this comment

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

We cannot use 'desired', at this point the ID must already exist.
... match the (existing)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

//* product.
//*
//* 3) Update the SET ZOWEUSER= statement to match the desired
//* user ID for the ZOWE started task.
Copy link
Contributor

Choose a reason for hiding this comment

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

ZOWE -> Zowe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -23,6 +23,7 @@ set -x

# expected workspace layout:
Copy link
Contributor

Choose a reason for hiding this comment

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

had to think again what and where this was. Can you update this line to say the following and remove all doubt
# expected input workspace layout ($ROOT_DIR):

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -23,6 +23,7 @@ set -x

# expected workspace layout:
# ./.pax/mediation/
# ./.pax/keyring-util/
Copy link
Contributor

Choose a reason for hiding this comment

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

keep 'm in alphabetical order so it lines up with output of ls

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -199,5 +209,5 @@ echo "[$SCRIPT_NAME] done"
# ${PAX_WORKSPACE_DIR}/ascii/zowe-${ZOWE_VERSION}/
# ${PAX_WORKSPACE_DIR}/content/zowe-${ZOWE_VERSION}/
# ${PAX_WORKSPACE_DIR}/mediation/ # already present

# ${PAX_WORKSPACE_DIR}/keyring-util/ # already present
Copy link
Contributor

Choose a reason for hiding this comment

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

keep 'm in alphabetical order

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@vit-tomica
Copy link
Contributor Author

@OnnoVdT Hi Onno, just a reminder that all your comments have been addressed.

@OnnoVdT
Copy link
Contributor

OnnoVdT commented Jul 24, 2020

sorry, I saw you did but forgot to approve. That is corrected now

@Joe-Winchester Joe-Winchester merged commit 9dd2aeb into staging Jul 28, 2020
@Joe-Winchester Joe-Winchester deleted the keyring-support branch July 28, 2020 20:48
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.

8 participants