-
Notifications
You must be signed in to change notification settings - Fork 281
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
[ELY-2496] Add integrity to existing filesystem realms using Elytron Tool #1896
Conversation
SecretKey key; | ||
try { | ||
key = credentialStore.retrieve(alias, SecretKeyCredential.class).getSecretKey(); | ||
} catch (NullPointerException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of catching the NullPointerException
here, it would be better to check the return value of credentialStore.retrieve
prior to calling getSecretKey
. If it's null
, we can print the error and return null
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update this and the other section to be similar to getKeyPair
. This code was unchanged from the original encrypt command, so I'm not as familiar with the functionality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OndrejKotek Noting that I made some changes in response to this, in the new 5th commit
auth/realm/base/src/main/java/org/wildfly/security/auth/realm/FileSystemRealmUtil.java
Outdated
Show resolved
Hide resolved
bffc0c0
to
782550d
Compare
public static void createEncryptedRealmFromUnencrypted(FileSystemSecurityRealm unencryptedRealm, FileSystemSecurityRealm encryptedRealm) throws RealmUnavailableException { | ||
Assert.checkNotNullParam("unencryptedRealm", unencryptedRealm); | ||
Assert.checkNotNullParam("encryptedRealm", encryptedRealm); | ||
public static void cloneIdentitiesToNewRealm(FileSystemSecurityRealm oldRealm, FileSystemSecurityRealm newRealm) throws RealmUnavailableException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI for other reviewers, this is private API.
tool/src/main/java/org/wildfly/security/tool/CredentialStoreCommand.java
Outdated
Show resolved
Hide resolved
8ed421b
to
42fcbee
Compare
Looks like a random failure due to a timeout on the Windows build. Could someone please rerun the CI? |
Thanks, re-triggered it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cam-rod LGTM, thanks!
* @param warning The warning to be shown | ||
*/ | ||
protected void warningHandler(String warning) { | ||
System.out.print("WARNING: "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cam-rod just a minor, we can set status to GENERAL_CONFIGURATION_WARNING
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
turns out this change actually broke a number of tests in FileSystemRealmCommandTest, so I'm reverting it
if (passwordOption == null && passwordEnvOption == null) { | ||
passwordOption = prompt(false, ElytronToolMessages.msg.keyStorePasswordPrompt(), false, null); | ||
if (passwordOption == null) { | ||
setStatus(GENERAL_CONFIGURATION_ERROR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cam-rod just a total minor, this line is superfluous since we configured the status to be GENERAL_CONFIGURATION_ERROR
at the beginning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in this command and encryption (where I made the same change)
c760eea
to
108d334
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @cam-rod!
@cam-rod Just noticed, we have some CI failures now. |
Due to ELY-2514, this module must be compiled for Java 8. This commit can be reversed or reverted once this issue is fixed.
Thanks for the heads up, added some patches for the rebase. |
Thanks @cam-rod! |
https://issues.redhat.com/browse/ELY-2496
Commits:
1. The first two commits come from ELY-2514, since the integrity command uses JDK 11 features. First JDK 11 commit removes Java 8 specific classes2. Second JDK 11 commit replaces with Java 9 specific classes and updates POMs.(dropped from this PR)hash-charset
parameter and test cases to filesystem-realm-encrypt, which was missed in the original PR [ELY-2078] Add encryption support to FileSystemSecurityRealm #1676Command.getSecretKey()
to be more consistent, and always warn (vs. sometimes crashing from an uncaught exception)Summary of changes:
validateScript
method andScriptParams
classhash-charset
to encryption commandgetSecretKey
andgetKeyPair
toCommand
classFileSystemRealmUtil.createRealmWithIntegrityValidation()
to build new realm; moved shared code between encryption and integrity commands into a private methodHELP_PARAM
,System.getProperty(“line.separator”)
) to new classorg.wildfly.security.tool.Command$Params
Also, I've manually imported and tested all of the test case realms with the wildfly/wildfly@784cc50 commit. All identities are readable, and the
:verify-integrity
CLI command works.