Securing applications and management interfaces using an identity store
Guide to securing JBoss EAP management interfaces and deployed applications by using an identity store such as the filesystem, a database, Lightweight Directory Access Protocol (LDAP), or a custom identity store
Abstract
Providing feedback on JBoss EAP documentation Copy linkLink copied to clipboard!
To report an error or to improve our documentation, log in to your Red Hat Jira account and submit an issue. If you do not have a Red Hat Jira account, then you will be prompted to create an account.
Procedure
- Click the following link to create a ticket.
- Enter a brief description of the issue in the Summary.
- Provide a detailed description of the issue or enhancement in the Description. Include a URL to where the issue occurs in the documentation.
- Clicking Submit creates and routes the issue to the appropriate documentation team.
Making open source more inclusive Copy linkLink copied to clipboard!
Red Hat is committed to replacing problematic language in our code, documentation, and web properties. We are beginning with these four terms: master, slave, blacklist, and whitelist. Because of the enormity of this endeavor, these changes will be implemented gradually over several upcoming releases. For more details, see our CTO Chris Wright’s message.
Chapter 1. Configuring identity stores Copy linkLink copied to clipboard!
1.1. Creating a filesystem-realm Copy linkLink copied to clipboard!
1.1.1. Filesystem realm in Elytron Copy linkLink copied to clipboard!
With a filesystem security realm, filesystem-realm, you can use a filesystem-based identity store in Elytron to store user credentials and attributes. Elytron stores each identity along with the associated credentials and attributes in an XML file in the filesystem. The name of the XML file is the name of the identity. You can associate multiple credentials and attributes with each identity.
By default, identities are stored in the filesystem as follows:
Elytron applies two levels of directory hashing to the directory structure where an identity is stored. For example, an identity named "user1" is stored at the location
u/s/user1.xml.This is done to overcome the limit set by some filesystems on the number of files you can store in a single directory and for performance reasons.
Use the
levelsattribute to configure the number of levels of directory hashing to apply.The identity names are Base32 encoded before they are used as filenames. This is done because some filesystems are case-insensitive or might restrict the set of characters allowed in a filename.
You can turn off the encoding by setting the attribute
encodedtofalse.
For information about other attributes and their default values, see filesystem-realm attributes.
Encryption
The filesystem-realm uses Base64 encoding for clear passwords, hashed passwords, and attributes when storing an identity in an identity file. For added security, you can encrypt the clear passwords, hashed passwords, and attributes using a secret key stored in a credential store. The secret key is used both for encrypting and decrypting the passwords and attributes.
Integrity check
To ensure that the identities created with a filesystem-realm are not tampered with, you can enable integrity checking on the filesystem-realm by referencing a key pair in the filesystem-realm during creation.
Integrity checking works in filesystem-realm as follows:
-
When you create an identity in the
filesystem-realmwith integrity checking enabled, Elytron creates the identity file and generates a signature for it. - Whenever the identity file is read, for example when updating the identity or loading the identity for authentication, Elytron verifies the identity file contents against the signature to ensure the file has not been tampered with since the last authorized write.
When you update an existing identity that has an associated signature, Elytron updates the content and generates a new signature after the original content passes verification.
If the verification fails, you get the following failure message:
{ "outcome" => "failed", "failure-description" => "WFLYCTL0158: Operation handler failed:java.lang.RuntimeException: WFLYELY01008: Failed to obtain the authorization identity.", "rolled-back" => true }{ "outcome" => "failed", "failure-description" => "WFLYCTL0158: Operation handler failed:java.lang.RuntimeException: WFLYELY01008: Failed to obtain the authorization identity.", "rolled-back" => true }Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.1.2. Creating a filesystem-realm in Elytron Copy linkLink copied to clipboard!
Create a filesystem-realm and a security domain that references the realm to secure the JBoss EAP server interfaces or the applications deployed on the server.
Prerequisites
- JBoss EAP is running.
Procedure
Create a
filesystem-realmin Elytron.Syntax
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add(path=<file_path>)
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add(path=<file_path>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add a user to the realm and configure the user’s role.
Add a user.
Syntax
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity(identity=<user_name>)
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity(identity=<user_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add-identity(identity=user1) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add-identity(identity=user1) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set a password for the user.
Syntax
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:set-password(identity=<user_name>, clear={password=<password>})/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:set-password(identity=<user_name>, clear={password=<password>})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleSecurityRealm:set-password(identity=user1, clear={password="passwordUser1"}) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleSecurityRealm:set-password(identity=user1, clear={password="passwordUser1"}) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set roles for the user.
Syntax
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>, name=<roles_attribute_name>, value=[<role_1>,<role_N>])
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>, name=<roles_attribute_name>, value=[<role_1>,<role_N>])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add-identity-attribute(identity=user1, name=Roles, value=["Admin","Guest"]) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add-identity-attribute(identity=user1, name=Roles, value=["Admin","Guest"]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a security domain that references the
filesystem-realm.Syntax
/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<filesystem_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<filesystem_realm_name>,role-decoder="<role_decoder_name>"}])/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<filesystem_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<filesystem_realm_name>,role-decoder="<role_decoder_name>"}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm}]) {"outcome" => "success"}/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm}]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
To verify that Elytron can load an identity from the
filesystem-realm, use the following command:Syntax
/subsystem=elytron/security-domain=<security_domain_name>:read-identity(name=<username>)
/subsystem=elytron/security-domain=<security_domain_name>:read-identity(name=<username>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You now can use the created security domain to add authentication and authorization to management interfaces and applications. For more information, see Securing management interfaces and applications.
1.1.3. Creating an encrypted filesystem-realm in Elytron Copy linkLink copied to clipboard!
Create an encrypted filesystem-realm to secure JBoss EAP applications or server interfaces and ensure that the user credentials are encrypted and therefore secure.
1.1.3.1. Creating a secret-key-credential-store for a standalone server Copy linkLink copied to clipboard!
Create a secret-key-credential-store using the management CLI. When you create a secret-key-credential-store, JBoss EAP generates a secret key by default. The name of the generated key is key and its size is 256-bit.
Prerequisites
- JBoss EAP is running.
-
You have provided at least read/write access to the directory containing the
secret-key-credential-storefor the user account under which JBoss EAP is running.
Procedure
Use the following command to create a
secret-key-credential-storeusing the management CLI:Syntax
/subsystem=elytron/secret-key-credential-store=<name_of_credential_store>:add(path="<path_to_the_credential_store>", relative-to=<path_to_store_file>)
/subsystem=elytron/secret-key-credential-store=<name_of_credential_store>:add(path="<path_to_the_credential_store>", relative-to=<path_to_store_file>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/secret-key-credential-store=examplePropertiesCredentialStore:add(path=examplePropertiesCredentialStore.cs, relative-to=jboss.server.config.dir) {"outcome" => "success"}/subsystem=elytron/secret-key-credential-store=examplePropertiesCredentialStore:add(path=examplePropertiesCredentialStore.cs, relative-to=jboss.server.config.dir) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.1.3.2. Creating an encrypted filesystem-realm Copy linkLink copied to clipboard!
Create an encrypted filesystem-realm and a security domain that references the realm to secure the JBoss EAP server interfaces or the applications deployed on the server.
Prerequisites
- JBoss EAP is running.
You have created a
secret-key-credential-store.For more information, see Creating a
secret-key-credential-storefor a standalone server.
Procedure
Create an encrypted
filesystem-realmin Elytron.Syntax
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add(path=<file_path>,credential-store=<name_of_credential_store>,secret-key=<key>)
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add(path=<file_path>,credential-store=<name_of_credential_store>,secret-key=<key>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir, credential-store=examplePropertiesCredentialStore, secret-key=key) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir, credential-store=examplePropertiesCredentialStore, secret-key=key) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add a user to the realm and configure the user’s role.
Add a user.
Syntax
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity(identity=<user_name>)
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity(identity=<user_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add-identity(identity=user1) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add-identity(identity=user1) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set a password for the user.
Syntax
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:set-password(identity=<user_name>, clear={password=<password>})/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:set-password(identity=<user_name>, clear={password=<password>})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleSecurityRealm:set-password(identity=user1, clear={password="passwordUser1"}) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleSecurityRealm:set-password(identity=user1, clear={password="passwordUser1"}) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set roles for the user.
Syntax
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>, name=<roles_attribute_name>, value=[<role_1>,<role_N>])
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>, name=<roles_attribute_name>, value=[<role_1>,<role_N>])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add-identity-attribute(identity=user1, name=Roles, value=["Admin","Guest"]) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add-identity-attribute(identity=user1, name=Roles, value=["Admin","Guest"]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a security domain that references the
filesystem-realm.Syntax
/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<filesystem_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<filesystem_realm_name>,role-decoder="<role_decoder_name>"}])/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<filesystem_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<filesystem_realm_name>,role-decoder="<role_decoder_name>"}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm}]) {"outcome" => "success"}/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm}]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
To verify that Elytron can load an identity from the encrypted
filesystem-realm, use the following command:Syntax
/subsystem=elytron/security-domain=<security_domain_name>:read-identity(name=<username>)
/subsystem=elytron/security-domain=<security_domain_name>:read-identity(name=<username>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You can now use the created security domain to add authentication and authorization to management interfaces and applications.
1.1.4. Creating a filesystem-realm with integrity support in Elytron Copy linkLink copied to clipboard!
Create a filesystem-realm with integrity support to secure JBoss EAP applications or server interfaces and ensure that the user credentials are not tampered with.
1.1.4.1. Creating a key pair by using the management CLI Copy linkLink copied to clipboard!
Create a key store with a key pair in Elytron.
Prerequisites
- JBoss EAP is running.
Procedure
Create a key store.
Syntax
/subsystem=elytron/key-store=<key_store_name>:add(path=<path_to_key_store_file>,credential-reference={<password>})/subsystem=elytron/key-store=<key_store_name>:add(path=<path_to_key_store_file>,credential-reference={<password>})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/key-store=exampleKeystore:add(path=keystore, relative-to=jboss.server.config.dir, type=JKS, credential-reference={clear-text=secret}) {"outcome" => "success"}/subsystem=elytron/key-store=exampleKeystore:add(path=keystore, relative-to=jboss.server.config.dir, type=JKS, credential-reference={clear-text=secret}) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a key pair in the key store.
Syntax
/subsystem=elytron/key-store=<key_store_name>:generate-key-pair(alias=<alias>,algorithm=<key_algorithm>,key-size=<size_of_key>,validity=<validity_in_days>,distinguished-name="<distinguished_name>")
/subsystem=elytron/key-store=<key_store_name>:generate-key-pair(alias=<alias>,algorithm=<key_algorithm>,key-size=<size_of_key>,validity=<validity_in_days>,distinguished-name="<distinguished_name>")Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/key-store=exampleKeystore:generate-key-pair(alias=localhost,algorithm=RSA,key-size=1024,validity=365,distinguished-name="CN=localhost") {"outcome" => "success"}/subsystem=elytron/key-store=exampleKeystore:generate-key-pair(alias=localhost,algorithm=RSA,key-size=1024,validity=365,distinguished-name="CN=localhost") {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Persist the key pair to the key store file.
Syntax
/subsystem=elytron/key-store=<key_store_name>:store()
/subsystem=elytron/key-store=<key_store_name>:store()Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/key-store=exampleKeystore:store() { "outcome" => "success", "result" => undefined }/subsystem=elytron/key-store=exampleKeystore:store() { "outcome" => "success", "result" => undefined }Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.1.4.2. Creating a filesystem-realm with integrity support Copy linkLink copied to clipboard!
Create a filesystem-realm with integrity support and a security domain that references the realm to secure the JBoss EAP server interfaces or the applications deployed on the server.
Prerequisites
- JBoss EAP is running.
You have created a
secret-key-credential-store.For more information, see Creating a key pair by using the management CLI.
Procedure
Create
filesystem-realmin Elytron.Syntax
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add(path=<file_path>,key-store=<key_store_name>,key-store-alias=<key_store_alias>)
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add(path=<file_path>,key-store=<key_store_name>,key-store-alias=<key_store_alias>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir, key-store=exampleKeystore, key-store-alias=localhost) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir, key-store=exampleKeystore, key-store-alias=localhost) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add a user to the realm and configure the user’s role.
Add a user.
Syntax
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity(identity=<user_name>)
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity(identity=<user_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add-identity(identity=user1) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add-identity(identity=user1) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set a password for the user.
Syntax
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:set-password(identity=<user_name>, clear={password=<password>})/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:set-password(identity=<user_name>, clear={password=<password>})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleSecurityRealm:set-password(identity=user1, clear={password="passwordUser1"}) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleSecurityRealm:set-password(identity=user1, clear={password="passwordUser1"}) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set roles for the user.
Syntax
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>, name=<roles_attribute_name>, value=[<role_1>,<role_N>])
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:add-identity-attribute(identity=<user_name>, name=<roles_attribute_name>, value=[<role_1>,<role_N>])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add-identity-attribute(identity=user1, name=Roles, value=["Admin","Guest"]) {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleSecurityRealm:add-identity-attribute(identity=user1, name=Roles, value=["Admin","Guest"]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a security domain that references the
filesystem-realm.Syntax
/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<filesystem_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<filesystem_realm_name>,role-decoder="<role_decoder_name>"}])/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<filesystem_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<filesystem_realm_name>,role-decoder="<role_decoder_name>"}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm}]) {"outcome" => "success"}/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm}]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
To verify that Elytron can load an identity from the
filesystem-realm, use the following command:Syntax
/subsystem=elytron/security-domain=<security_domain_name>:read-identity(name=<username>)
/subsystem=elytron/security-domain=<security_domain_name>:read-identity(name=<username>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You now can use the created security domain to add authentication and authorization to management interfaces and applications. For more information, see Securing management interfaces and applications.
1.1.4.3. Updating the key pair in an existing filesystem-realm with integrity support enabled Copy linkLink copied to clipboard!
You can update the key pair referenced in a filesystem-realm with integrity support enabled in the case that the existing key was compromised. Also, it is a good practice to rotate keys.
Prerequisites
- You have generated a key pair.
You have created a
filesystem-realmwith integrity checking enabled.For more information, see Creating a
filesystem-realmwith integrity support.
Procedure
Create a key pair in the existing key store.
Syntax
/subsystem=elytron/key-store=<key_store_name>:generate-key-pair(alias=<alias>,algorithm=<key_algorithm>,key-size=<size_of_key>,validity=<validity_in_days>,distinguished-name="<distinguished_name>")
/subsystem=elytron/key-store=<key_store_name>:generate-key-pair(alias=<alias>,algorithm=<key_algorithm>,key-size=<size_of_key>,validity=<validity_in_days>,distinguished-name="<distinguished_name>")Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/key-store=exampleKeystore:generate-key-pair(alias=localhost2,algorithm=RSA,key-size=1024,validity=365,distinguished-name="CN=localhost") {"outcome" => "success"}/subsystem=elytron/key-store=exampleKeystore:generate-key-pair(alias=localhost2,algorithm=RSA,key-size=1024,validity=365,distinguished-name="CN=localhost") {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Persist the key pair to the key store file.
Syntax
/subsystem=elytron/key-store=<key_store_name>:store()
/subsystem=elytron/key-store=<key_store_name>:store()Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/key-store=exampleKeystore:store() { "outcome" => "success", "result" => undefined }/subsystem=elytron/key-store=exampleKeystore:store() { "outcome" => "success", "result" => undefined }Copy to Clipboard Copied! Toggle word wrap Toggle overflow Update the key store alias to reference a new key pair.
Syntax
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:write-attribute(name=key-store-alias, value=<key_store_alias>)
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:write-attribute(name=key-store-alias, value=<key_store_alias>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Reload the server.
reload
reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow Use the new key pair to update the files in
filesystem-realmwith new signatures.Syntax
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:update-key-pair()
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:update-key-pair()Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/filesystem-realm=exampleSecurityRealm:update-key-pair() {"outcome" => "success"}/subsystem=elytron/filesystem-realm=exampleSecurityRealm:update-key-pair() {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify that the key pair referenced in the
filesystem-realmhas been updated using the following management CLI command:Syntax
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:read-resource()
/subsystem=elytron/filesystem-realm=<filesystem_realm_name>:read-resource()Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The key pair referenced in the filesystem-realm has been updated.
1.1.5. Encrypting an unencrypted filesystem-realm Copy linkLink copied to clipboard!
If you have a filesystem-realm configured in Elytron, you can add encryption to it using the WildFly Elytron Tool.
1.1.5.1. Creating a secret-key-credential-store for a standalone server Copy linkLink copied to clipboard!
Create a secret-key-credential-store using the management CLI. When you create a secret-key-credential-store, JBoss EAP generates a secret key by default. The name of the generated key is key and its size is 256-bit.
Prerequisites
- JBoss EAP is running.
-
You have provided at least read/write access to the directory containing the
secret-key-credential-storefor the user account under which JBoss EAP is running.
Procedure
Use the following command to create a
secret-key-credential-storeusing the management CLI:Syntax
/subsystem=elytron/secret-key-credential-store=<name_of_credential_store>:add(path="<path_to_the_credential_store>", relative-to=<path_to_store_file>)
/subsystem=elytron/secret-key-credential-store=<name_of_credential_store>:add(path="<path_to_the_credential_store>", relative-to=<path_to_store_file>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/secret-key-credential-store=examplePropertiesCredentialStore:add(path=examplePropertiesCredentialStore.cs, relative-to=jboss.server.config.dir) {"outcome" => "success"}/subsystem=elytron/secret-key-credential-store=examplePropertiesCredentialStore:add(path=examplePropertiesCredentialStore.cs, relative-to=jboss.server.config.dir) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.1.5.2. Converting an unencrypted filesystem-realm to an encrypted filesystem-realm Copy linkLink copied to clipboard!
You can convert an unencrypted filesystem-realm into an encrypted one by using the WildFly Elytron tool filesystem-realm-encrypt command.
Prerequisites
You have an existing
filesystem-realm.For more information, see Creating a
filesystem-realmin Elytron.You have created a
secret-key-credential-store.For more information, see Creating a
secret-key-credential-storefor a standalone server.- JBoss EAP is running.
Procedure
Convert an unencrypted
filesystem-realminto an encrypted one.Syntax
JBOSS_HOME/bin/elytron-tool.sh filesystem-realm-encrypt --input-location <existing_filesystem_realm_name> --output-location JBOSS_HOME/standalone/configuration/<target_filesystem_realm_name> --credential-store <path_to_credential_store>/<credential_store>
$ JBOSS_HOME/bin/elytron-tool.sh filesystem-realm-encrypt --input-location <existing_filesystem_realm_name> --output-location JBOSS_HOME/standalone/configuration/<target_filesystem_realm_name> --credential-store <path_to_credential_store>/<credential_store>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
JBOSS_HOME/bin/elytron-tool.sh filesystem-realm-encrypt --input-location JBOSS_HOME/standalone/configuration/fs-realm-users --output-location JBOSS_HOME/standalone/configuration/fs-realm-users-enc --credential-store JBOSS_HOME/standalone/configuration/examplePropertiesCredentialStore.cs
$ JBOSS_HOME/bin/elytron-tool.sh filesystem-realm-encrypt --input-location JBOSS_HOME/standalone/configuration/fs-realm-users --output-location JBOSS_HOME/standalone/configuration/fs-realm-users-enc --credential-store JBOSS_HOME/standalone/configuration/examplePropertiesCredentialStore.cs Creating encrypted realm for: JBOSS_HOME/standalone/configuration/fs-realm-users Found credential store and alias, using pre-existing keyCopy to Clipboard Copied! Toggle word wrap Toggle overflow The WildFly Elytron command
filesystem-realm-encryptcreates afilesystem-realmspecified with the--output-locationargument. It also creates a CLI script at the root of thefilesystem-realmthat you can use to add thefilesystem-realmresource in theelytronsubsystem.TipUse the
--summaryoption to see a summary of the command execution.Use the generated CLI script to add the
filesystem-realmresource in theelytronsubsystem.Synax
JBOSS_HOME/bin/jboss-cli.sh --connect --file=<target_filesystem_realm_directory>/<target_filesystem_realm_name>.cli
$ JBOSS_HOME/bin/jboss-cli.sh --connect --file=<target_filesystem_realm_directory>/<target_filesystem_realm_name>.cliCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example
JBOSS_HOME/bin/jboss-cli.sh --connect --file=JBOSS_HOME/standalone/configuration/fs-realm-users-enc/encrypted-filesystem-realm.cli
$ JBOSS_HOME/bin/jboss-cli.sh --connect --file=JBOSS_HOME/standalone/configuration/fs-realm-users-enc/encrypted-filesystem-realm.cliCopy to Clipboard Copied! Toggle word wrap Toggle overflow
You can use the encrypted filesystem-realm to create a security domain that references the realm to secure the JBoss EAP server interfaces or the applications deployed on the server.
1.1.6. Adding integrity support to an existing filesystem-realm Copy linkLink copied to clipboard!
If you have a filesystem-realm configured in Elytron, you can sign it with a key pair by using the WildFly Elytron Tool to enable integrity checks.
1.1.6.1. Creating a key pair by using the management CLI Copy linkLink copied to clipboard!
Create a key store with a key pair in Elytron.
Prerequisites
- JBoss EAP is running.
Procedure
Create a key store.
Syntax
/subsystem=elytron/key-store=<key_store_name>:add(path=<path_to_key_store_file>,credential-reference={<password>})/subsystem=elytron/key-store=<key_store_name>:add(path=<path_to_key_store_file>,credential-reference={<password>})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/key-store=exampleKeystore:add(path=keystore, relative-to=jboss.server.config.dir, type=JKS, credential-reference={clear-text=secret}) {"outcome" => "success"}/subsystem=elytron/key-store=exampleKeystore:add(path=keystore, relative-to=jboss.server.config.dir, type=JKS, credential-reference={clear-text=secret}) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a key pair in the key store.
Syntax
/subsystem=elytron/key-store=<key_store_name>:generate-key-pair(alias=<alias>,algorithm=<key_algorithm>,key-size=<size_of_key>,validity=<validity_in_days>,distinguished-name="<distinguished_name>")
/subsystem=elytron/key-store=<key_store_name>:generate-key-pair(alias=<alias>,algorithm=<key_algorithm>,key-size=<size_of_key>,validity=<validity_in_days>,distinguished-name="<distinguished_name>")Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/key-store=exampleKeystore:generate-key-pair(alias=localhost,algorithm=RSA,key-size=1024,validity=365,distinguished-name="CN=localhost") {"outcome" => "success"}/subsystem=elytron/key-store=exampleKeystore:generate-key-pair(alias=localhost,algorithm=RSA,key-size=1024,validity=365,distinguished-name="CN=localhost") {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Persist the key pair to the key store file.
Syntax
/subsystem=elytron/key-store=<key_store_name>:store()
/subsystem=elytron/key-store=<key_store_name>:store()Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/key-store=exampleKeystore:store() { "outcome" => "success", "result" => undefined }/subsystem=elytron/key-store=exampleKeystore:store() { "outcome" => "success", "result" => undefined }Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.1.6.2. Enabling integrity checks for a filesystem-realm Copy linkLink copied to clipboard!
You can create a filesystem-realm with integrity checks from an existing non-empty filesystem-realm by using the WildFly Elytron tool filesystem-realm-integrity command.
You can use the filesystem-realm-integrity command for the following use cases:
-
Creating a new
filesystem-realmwith integrity checks from an existingfilesystem-realm. -
Adding integrity checks to an existing
filesystem-realm.
Prerequisites
You have an existing
filesystem-realm.For more information, see Creating a
filesystem-realmin Elytron.You have generated a key pair.
For more information, see Creating a key pair by using the management CLI.
- JBoss EAP is running.
Procedure
Create a
filesystem-realmwith integrity support by using an existingfilesystem-realmand signing it with a key pair.To add integrity support to the existing
filesystem-realm, omit the--output-locationand--realm-nameoptions in the following command. If you specify the--output-locationand--realm-nameoptions, the command creates a newfilesystem-realmwith integrity checks without updating the existing one.Syntax
JBOSS_HOME/bin/elytron-tool.sh filesystem-realm-integrity --input-location <path_to_existing_filesystem_realm> --keystore <path_to_key_store_file> --password <keystore_password> --key-pair <key_pair_alias> --output-location <path_for_new_filesystem_realm> --realm-name <name_of_new_filesystem_realm>
$ JBOSS_HOME/bin/elytron-tool.sh filesystem-realm-integrity --input-location <path_to_existing_filesystem_realm> --keystore <path_to_key_store_file> --password <keystore_password> --key-pair <key_pair_alias> --output-location <path_for_new_filesystem_realm> --realm-name <name_of_new_filesystem_realm>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
JBOSS_HOME/bin/elytron-tool.sh filesystem-realm-integrity --input-location JBOSS_HOME/standalone/configuration/fs-realm-users/ --keystore JBOSS_HOME/standalone/configuration/keystore --password secret --key-pair localhost --output-location JBOSS_HOME/standalone/configuration/fs-realm-users --realm-name exampleRealmWithIntegrity
$ JBOSS_HOME/bin/elytron-tool.sh filesystem-realm-integrity --input-location JBOSS_HOME/standalone/configuration/fs-realm-users/ --keystore JBOSS_HOME/standalone/configuration/keystore --password secret --key-pair localhost --output-location JBOSS_HOME/standalone/configuration/fs-realm-users --realm-name exampleRealmWithIntegrityCopy to Clipboard Copied! Toggle word wrap Toggle overflow Exmaple output
Creating filesystem realm with integrity verification for: JBOSS_HOME/standalone/configuration/fs-realm-users
Creating filesystem realm with integrity verification for: JBOSS_HOME/standalone/configuration/fs-realm-usersCopy to Clipboard Copied! Toggle word wrap Toggle overflow The WildFly Elytron command
filesystem-realm-integritycreates afilesystem-realmspecified with the--output-locationargument. It also creates a CLI script at the root of thefilesystem-realmthat you can use to add thefilesystem-realmresource in theelytronsubsystem.TipUse the
--summaryoption to see a summary of the command execution.Use the generated CLI script to add the
filesystem-realmresource in theelytronsubsystem.Syntax
JBOSS_HOME/bin/jboss-cli.sh --connect --file=<target_filesystem_realm_directory>/<target_filesystem_realm_name>.cli
$ JBOSS_HOME/bin/jboss-cli.sh --connect --file=<target_filesystem_realm_directory>/<target_filesystem_realm_name>.cliCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example
JBOSS_HOME/bin/jboss-cli.sh --connect --file=JBOSS_HOME/standalone/configuration/fs-realm-users/exampleRealmWithIntegrity.cli
$ JBOSS_HOME/bin/jboss-cli.sh --connect --file=JBOSS_HOME/standalone/configuration/fs-realm-users/exampleRealmWithIntegrity.cliCopy to Clipboard Copied! Toggle word wrap Toggle overflow
You can use the filesystem-realm to create a security domain that references the realm to secure the JBoss EAP server interfaces or the applications deployed on the server.
1.2. Creating a JDBC realm Copy linkLink copied to clipboard!
1.2.1. Creating a jdbc-realm in Elytron Copy linkLink copied to clipboard!
Create a jdbc-realm and a security domain that references the realm to secure the JBoss EAP server interfaces or the applications deployed on the server.
The examples in the procedure use a PostgreSQL database which is configured as follows:
- Database name: postgresdb
Database login credentials:
- username: postgres
- password: postgres
- Table name: example_jboss_eap_users
example_jboss_eap_users contents:
Expand username password roles user1
passwordUser1
Admin
user2
passwordUser2
Guest
Prerequisites
- You have configured the database containing the users.
- JBoss EAP is running.
- You have downloaded the appropriate JDBC driver.
Procedure
Deploy the database driver for the database using the management CLI.
Syntax
deploy <path_to_jdbc_driver>/<jdbc-driver>
deploy <path_to_jdbc_driver>/<jdbc-driver>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
deploy PATH_TO_JDBC_DRIVER/postgresql-42.2.9.jar
deploy PATH_TO_JDBC_DRIVER/postgresql-42.2.9.jarCopy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the database as the data source.
Syntax
data-source add --name=<data_source_name> --jndi-name=<jndi_name> --driver-name=<jdbc-driver> --connection-url=<database_URL> --user-name=<database_username> --password=<database_username>
data-source add --name=<data_source_name> --jndi-name=<jndi_name> --driver-name=<jdbc-driver> --connection-url=<database_URL> --user-name=<database_username> --password=<database_username>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
data-source add --name=examplePostgresDS --jndi-name=java:jboss/examplePostgresDS --driver-name=postgresql-42.2.9.jar --connection-url=jdbc:postgresql://localhost:5432/postgresdb --user-name=postgres --password=postgres
data-source add --name=examplePostgresDS --jndi-name=java:jboss/examplePostgresDS --driver-name=postgresql-42.2.9.jar --connection-url=jdbc:postgresql://localhost:5432/postgresdb --user-name=postgres --password=postgresCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a
jdbc-realmin Elytron.Syntax
/subsystem=elytron/jdbc-realm=<jdbc_realm_name>:add(principal-query=[<sql_query_to_load_users>])
/subsystem=elytron/jdbc-realm=<jdbc_realm_name>:add(principal-query=[<sql_query_to_load_users>])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/jdbc-realm=exampleSecurityRealm:add(principal-query=[{sql="SELECT password,roles FROM example_jboss_eap_users WHERE username=?",data-source=examplePostgresDS,clear-password-mapper={password-index=1},attribute-mapping=[{index=2,to=Roles}]}]) {"outcome" => "success"}/subsystem=elytron/jdbc-realm=exampleSecurityRealm:add(principal-query=[{sql="SELECT password,roles FROM example_jboss_eap_users WHERE username=?",data-source=examplePostgresDS,clear-password-mapper={password-index=1},attribute-mapping=[{index=2,to=Roles}]}]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe example shows how to obtain passwords and roles from a single
principal-query. You can also create additionalprincipal-querywithattribute-mappingattributes if you require multiple queries to obtain roles or additional authentication or authorization information.For a list of supported password mappers, see Password Mappers.
Create a security domain that references the
jdbc-realm.Syntax
/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<jdbc_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=< jdbc_realm_name>,role-decoder="<role_decoder_name>"}])/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<jdbc_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=< jdbc_realm_name>,role-decoder="<role_decoder_name>"}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm}]) {"outcome" => "success"}/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm}]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
To verify that Elytron can load data from the database, use the following command:
Syntax
/subsystem=elytron/security-domain=<security_domain_name>:read-identity(name=<username>)
/subsystem=elytron/security-domain=<security_domain_name>:read-identity(name=<username>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The output confirms that Elytron can load data from the database.
You now can use the created security domain to add authentication and authorization to management interfaces and applications. For more information, see Securing management interfaces and applications.
1.3. Creating an LDAP realm Copy linkLink copied to clipboard!
1.3.1. LDAP realm in Elytron Copy linkLink copied to clipboard!
The Lightweight Directory Access Protocol (LDAP) realm, ldap-realm, in Elytron is a security realm that you can use to load identities from an LDAP identity store.
The following example illustrates how an identity in LDAP is mapped with an Elytron identity in JBoss EAP.
Example LDAP Data Interchange Format (LDIF) file
Example commands to create an LDAP realm
/subsystem=elytron/dir-context=exampleDirContext:add(url="ldap://10.88.0.2",principal="cn=admin,dc=wildfly,dc=org",credential-reference={clear-text="secret"})
/subsystem=elytron/ldap-realm=exampleSecurityRealm:add(dir-context=exampleDirContext,identity-mapping={search-base-dn="ou=Users,dc=wildfly,dc=org",rdn-identifier="uid",user-password-mapper={from="userPassword"},attribute-mapping=[{filter-base-dn="ou=Roles,dc=wildfly,dc=org",filter="(&(objectClass=groupOfNames)(member={1}))",from="cn",to="Roles"}]})
/subsystem=elytron/dir-context=exampleDirContext:add(url="ldap://10.88.0.2",principal="cn=admin,dc=wildfly,dc=org",credential-reference={clear-text="secret"})
/subsystem=elytron/ldap-realm=exampleSecurityRealm:add(dir-context=exampleDirContext,identity-mapping={search-base-dn="ou=Users,dc=wildfly,dc=org",rdn-identifier="uid",user-password-mapper={from="userPassword"},attribute-mapping=[{filter-base-dn="ou=Roles,dc=wildfly,dc=org",filter="(&(objectClass=groupOfNames)(member={1}))",from="cn",to="Roles"}]})
The commands result in the following configuration:
- 1
- The realm definition.
-
nameis theldap-realmrealm name. -
dir-contextis the configuration to connect to an LDAP server.
-
- 2
- Define how identity is mapped.
rdn-identifieris relative distinguished name (RDN) of the principal’s distinguished name (DN) to use to obtain the principal’s name from an LDAP entry. In the example LDIF,uidis configured to represent the principal’s name from the baseDN=ou=Users,dc=wildfly,dc=org.search-base-dnis the base DN to search for identities. In the example LDIF, it is defined asdn: ou=Users,dc=wildfly,dc=org.
- 3
- Define the LDAP attributes to the identity’s attributes mappings.
- 4
- Configure how to map a specific LDAP attribute as an Elytron identity attribute.
-
fromis the LDAP attribute to map. If it is not defined, the DN of the entry is used. -
tois the name of the identity’s attribute mapped from LDAP attribute. If not provided, the name of the attribute is the same as the one defined infrom. Iffromis also not defined, the DN of the entry is used. filteris a filter to use to obtain the values for a specific attribute. String '{0}' is replaced by the username, '{1}' by user identity DN.-
objectClassis the LDAP object class to use. In the example LDIF, the object class to use is defined asgroupOfNames. -
memberis the member to map.{0}is replaced by user name, and{1}by user identity DN. In this example,{1}is used to mapmembertouser1.
-
filter-base-dnis the name of the context where the filter should be applied.The result of the example filter is that the user
user1is mapped with theAdminrole.
-
- 5
user-password-mapperdefines the LDAP attribute from which an identity’s password is obtained. In the example it is configured asuserPassword, which is defined in the LDIF asuserPassword1.
1.3.2. Creating an ldap-realm in Elytron Copy linkLink copied to clipboard!
Create an Elytron security realm backed by a Lightweight Directory Access Protocol (LDAP) identity store. Use the security realm to create a security domain to add authentication and authorization to management interfaces or the applications deployed on the server.
ldap-realm configured as caching realm does not support Active Directory. For more information, see Changing LDAP/AD User Password via JBossEAP CLI for Elytron.
In cases where the elytron subsystem uses an LDAP server to perform authentication, JBoss EAP will return a 500 error code, or internal server error, if that LDAP server is unreachable.
To ensure that the management interfaces and applications secured using an LDAP realm can be accessed even if the LDAP server becomes available, use a failover realm. For information see Creating a failover realm.
For the examples in this procedure, the following LDAP Data Interchange Format (LDIF) is used:
The LDAP connection parameters used for the example are as follows:
-
LDAP URL:
ldap://10.88.0.2 LDAP admin password:
secretYou need this for Elytron to connect with the LDAP server.
-
LDAP admin Distinguished Name (DN):
(cn=admin,dc=wildfly,dc=org) LDAP organization:
wildflyIf no organization name is specified, it defaults to
Example Inc.LDAP domain:
wildfly.orgThis is the name that is matched when the platform receives an LDAP search reference.
Prerequisites
- You have configured an LDAP identity store.
- JBoss EAP is running.
Procedure
Configure a directory context that provides the URL and the principal used to connect to the LDAP server.
Syntax
/subsystem=elytron/dir-context=<dir_context_name>:add(url="<LDAP_URL>",principal="<principal_distinguished_name>",credential-reference=<credential_reference>)
/subsystem=elytron/dir-context=<dir_context_name>:add(url="<LDAP_URL>",principal="<principal_distinguished_name>",credential-reference=<credential_reference>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/dir-context=exampleDirContext:add(url="ldap://10.88.0.2",principal="cn=admin,dc=wildfly,dc=org",credential-reference={clear-text="secret"})/subsystem=elytron/dir-context=exampleDirContext:add(url="ldap://10.88.0.2",principal="cn=admin,dc=wildfly,dc=org",credential-reference={clear-text="secret"})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an LDAP realm that references the directory context. Specify the Search Base DN and how users are mapped.
Syntax
/subsystem=elytron/ldap-realm=<ldap_realm_name>add:(dir-context=<dir_context_name>,identity-mapping=search-base-dn="ou=<organization_unit>,dc=<domain_component>",rdn-identifier="<relative_distinguished_name_identifier>",user-password-mapper={from=<password_attribute_name>},attribute-mapping=[{filter-base-dn="ou=<organization_unit>,dc=<domain_component>",filter="<ldap_filter>",from="<ldap_attribute_name>",to="<identity_attribute_name>"}]})/subsystem=elytron/ldap-realm=<ldap_realm_name>add:(dir-context=<dir_context_name>,identity-mapping=search-base-dn="ou=<organization_unit>,dc=<domain_component>",rdn-identifier="<relative_distinguished_name_identifier>",user-password-mapper={from=<password_attribute_name>},attribute-mapping=[{filter-base-dn="ou=<organization_unit>,dc=<domain_component>",filter="<ldap_filter>",from="<ldap_attribute_name>",to="<identity_attribute_name>"}]})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/ldap-realm=exampleSecurityRealm:add(dir-context=exampleDirContext,identity-mapping={search-base-dn="ou=Users,dc=wildfly,dc=org",rdn-identifier="uid",user-password-mapper={from="userPassword"},attribute-mapping=[{filter-base-dn="ou=Roles,dc=wildfly,dc=org",filter="(&(objectClass=groupOfNames)(member={1}))",from="cn",to="Roles"}]})/subsystem=elytron/ldap-realm=exampleSecurityRealm:add(dir-context=exampleDirContext,identity-mapping={search-base-dn="ou=Users,dc=wildfly,dc=org",rdn-identifier="uid",user-password-mapper={from="userPassword"},attribute-mapping=[{filter-base-dn="ou=Roles,dc=wildfly,dc=org",filter="(&(objectClass=groupOfNames)(member={1}))",from="cn",to="Roles"}]})Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you store hashed passwords in the LDIF file, you can specify the following attributes:
-
hash-encoding: This attribute specifies the string format for the password if it is not stored in plain text. It is set tobase64encoding by default, buthexis also supported. -
hash-charset: This attribute specifies the character set to use when converting the password string to a byte array. It is set toUTF-8by default.
WarningIf any referenced LDAP servers contain a loop in referrals, it can result in a
java.lang.OutOfMemoryErrorerror in JBoss EAP.-
Create a role decoder to map attributes to roles.
Syntax
/subsystem=elytron/simple-role-decoder=<role_decoder_name>:add(attribute=<attribute>)
/subsystem=elytron/simple-role-decoder=<role_decoder_name>:add(attribute=<attribute>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/simple-role-decoder=from-roles-attribute:add(attribute=Roles)
/subsystem=elytron/simple-role-decoder=from-roles-attribute:add(attribute=Roles)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a security domain that references the LDAP realm and the role decoder.
Syntax
/subsystem=elytron/security-domain=<security_domain_name>:add(realms=[{realm=<ldap_realm_name>,role-decoder=<role_decoder_name>}],default-realm=<ldap_realm_name>,permission-mapper=<permission_mapper>)/subsystem=elytron/security-domain=<security_domain_name>:add(realms=[{realm=<ldap_realm_name>,role-decoder=<role_decoder_name>}],default-realm=<ldap_realm_name>,permission-mapper=<permission_mapper>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:add(realms=[{realm=exampleSecurityRealm,role-decoder=from-roles-attribute}],default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper)/subsystem=elytron/security-domain=exampleSecurityDomain:add(realms=[{realm=exampleSecurityRealm,role-decoder=from-roles-attribute}],default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper)Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You now can use the created security domain to add authentication and authorization to management interfaces and applications. For more information, see Securing management interfaces and applications.
1.4. Creating a properties realm Copy linkLink copied to clipboard!
1.4.1. Create a security domain referencing a properties-realm in Elytron Copy linkLink copied to clipboard!
Create a properties-realm and a security domain that references the realm to secure your JBoss EAP management interfaces or the applications that you deployed on the server.
Prerequisites
- JBoss EAP is running.
You have an authorized user and an existing legacy properties file with the correct realm written in the commented out line in the
users.propertiesfile:Example
$EAP_HOME/standalone/configuration/my-example-users.properties#$REALM_NAME=exampleSecurityRealm$ user1=078ed9776d4b8e63b6e51135ec45cc75
#$REALM_NAME=exampleSecurityRealm$ user1=078ed9776d4b8e63b6e51135ec45cc75Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
The password for
user1isuserPassword1. The password is hashed to the file asHEX( MD5( user1:exampleSecurityRealm:userPassword1 )).
-
The password for
The authorized user listed in your
users.propertiesfile has a role in thegroups.propertiesfile:Example
$EAP_HOME/standalone/configuration/my-example-groups.propertiesuser1=Admin
user1=AdminCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Procedure
Create a
properties-realmin Elytron.Syntax
/subsystem=elytron/properties-realm=<properties_realm_name>:add(users-properties={path=<file_path>},groups-properties={path=<file_path>})/subsystem=elytron/properties-realm=<properties_realm_name>:add(users-properties={path=<file_path>},groups-properties={path=<file_path>})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/properties-realm=exampleSecurityRealm:add(users-properties={path=my-example-users.properties,relative-to=jboss.server.config.dir,plain-text=true},groups-properties={path=my-example-groups.properties,relative-to=jboss.server.config.dir})/subsystem=elytron/properties-realm=exampleSecurityRealm:add(users-properties={path=my-example-users.properties,relative-to=jboss.server.config.dir,plain-text=true},groups-properties={path=my-example-groups.properties,relative-to=jboss.server.config.dir})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a security domain that references the
properties-realm.Syntax
/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<properties_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<properties_realm_name>,role-decoder="<role_decoder_name>"}])/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<properties_realm_name>,permission-mapper=default-permission-mapper,realms=[{realm=<properties_realm_name>,role-decoder="<role_decoder_name>"}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm,role-decoder=groups-to-roles}])/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleSecurityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleSecurityRealm,role-decoder=groups-to-roles}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
To verify that Elytron can load data from the properties file, use the following command:
Syntax
/subsystem=elytron/security-domain=<security_domain_name>:read-identity(name=<username>)
/subsystem=elytron/security-domain=<security_domain_name>:read-identity(name=<username>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The output confirms that Elytron can load data from the properties file.
You now can use the created security domain to add authentication and authorization to management interfaces and applications. For more information, see Securing management interfaces and applications.
1.5. Creating a custom realm Copy linkLink copied to clipboard!
1.5.1. Adding a custom-realm security realm in Elytron Copy linkLink copied to clipboard!
You can use a custom-realm to create an Elytron security realm that is tailored to your use case. You can add a custom-realm when existing Elytron security realms do not suit your use case.
Prerequisites
- JBoss EAP is installed and running.
- Maven is installed.
- You have an implemented custom realm java class.
Procedure
Implement a custom realm java class and package it as a
JARfile.mvn package
$ mvn packageCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add a module containing your custom realm implementation.
Syntax
module add --name=<name_of_your_wildfly_module> --resources=<path_to_custom_realm_jar> --dependencies=org.wildfly.security.elytron
module add --name=<name_of_your_wildfly_module> --resources=<path_to_custom_realm_jar> --dependencies=org.wildfly.security.elytronCopy to Clipboard Copied! Toggle word wrap Toggle overflow Example
module add --name=com.example.customrealm --resources=EAP_HOME/custom-realm.jar --dependencies=org.wildfly.security.elytron
module add --name=com.example.customrealm --resources=EAP_HOME/custom-realm.jar --dependencies=org.wildfly.security.elytronCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create your
custom-realm.Syntax
/subsystem=elytron/custom-realm=<name_of_your_custom_realm>:add(module=<name_of_your_wildfly_module>,class-name=<class_name_of_custom_realm_>,configuration={<configuration_option_1>=<configuration_value_1>,<configuration_option_2>=<configuration_value_2>})/subsystem=elytron/custom-realm=<name_of_your_custom_realm>:add(module=<name_of_your_wildfly_module>,class-name=<class_name_of_custom_realm_>,configuration={<configuration_option_1>=<configuration_value_1>,<configuration_option_2>=<configuration_value_2>})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/custom-realm=example-realm:add(module=com.example.customrealm,class-name=com.example.customrealm.ExampleRealm,configuration={exampleConfigOption1=exampleConfigValue1,exampleConfigOption2=exampleConfigValue2})/subsystem=elytron/custom-realm=example-realm:add(module=com.example.customrealm,class-name=com.example.customrealm.ExampleRealm,configuration={exampleConfigOption1=exampleConfigValue1,exampleConfigOption2=exampleConfigValue2})Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThis example expects that the implemented custom realm has the class name
com.example.customrealm.ExampleRealm.NoteYou can use the
configurationattribute to passkey/valueconfiguration to thecustom-realm. Theconfigurationattribute is optional.Define a security domain based on the realm that you created.
Syntax
/subsystem=elytron/security-domain=<your_security_domain_name>:add(realms=[{realm=<your_realm_name>}],default-realm=<your_realm_name>,permission-mapper=<your_permission_mapper_name>)/subsystem=elytron/security-domain=<your_security_domain_name>:add(realms=[{realm=<your_realm_name>}],default-realm=<your_realm_name>,permission-mapper=<your_permission_mapper_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:add(realms=[{realm=example-realm}],default-realm=example-realm,permission-mapper=default-permission-mapper)/subsystem=elytron/security-domain=exampleSecurityDomain:add(realms=[{realm=example-realm}],default-realm=example-realm,permission-mapper=default-permission-mapper)Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You now can use the created security domain to add authentication and authorization to management interfaces and applications. For more information, see Securing management interfaces and applications.
Chapter 2. Securing management interfaces and applications Copy linkLink copied to clipboard!
2.1. Adding authentication and authorization to management interfaces Copy linkLink copied to clipboard!
You can add authentication and authorization for management interfaces to secure them by using a security domain. To access the management interfaces after you add authentication and authorization, users must enter login credentials.
You can secure JBoss EAP management interfaces as follows:
Management CLI
By configuring a
sasl-authentication-factory.Management console
By configuring an
http-authentication-factory.
Prerequisites
- You have created a security domain referencing a security realm.
- JBoss EAP is running.
Procedure
Create an
http-authentication-factory, or asasl-authentication-factory.Create an
http-authentication-factory.Syntax
/subsystem=elytron/http-authentication-factory=<authentication_factory_name>:add(http-server-mechanism-factory=global, security-domain=<security_domain_name>, mechanism-configurations=[{mechanism-name=<mechanism-name>, mechanism-realm-configurations=[{realm-name=<realm_name>}]}])/subsystem=elytron/http-authentication-factory=<authentication_factory_name>:add(http-server-mechanism-factory=global, security-domain=<security_domain_name>, mechanism-configurations=[{mechanism-name=<mechanism-name>, mechanism-realm-configurations=[{realm-name=<realm_name>}]}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/http-authentication-factory=exampleAuthenticationFactory:add(http-server-mechanism-factory=global, security-domain=exampleSecurityDomain, mechanism-configurations=[{mechanism-name=BASIC, mechanism-realm-configurations=[{realm-name=exampleSecurityRealm}]}]) {"outcome" => "success"}/subsystem=elytron/http-authentication-factory=exampleAuthenticationFactory:add(http-server-mechanism-factory=global, security-domain=exampleSecurityDomain, mechanism-configurations=[{mechanism-name=BASIC, mechanism-realm-configurations=[{realm-name=exampleSecurityRealm}]}]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a
sasl-authentication-factory.Syntax
/subsystem=elytron/sasl-authentication-factory=<sasl_authentication_factory_name>:add(security-domain=<security_domain>,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=<mechanism-name>,mechanism-realm-configurations=[{realm-name=<realm_name>}]}])/subsystem=elytron/sasl-authentication-factory=<sasl_authentication_factory_name>:add(security-domain=<security_domain>,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=<mechanism-name>,mechanism-realm-configurations=[{realm-name=<realm_name>}]}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/sasl-authentication-factory=exampleSaslAuthenticationFactory:add(security-domain=exampleSecurityDomain,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=PLAIN,mechanism-realm-configurations=[{realm-name=exampleSecurityRealm}]}]) {"outcome" => "success"}/subsystem=elytron/sasl-authentication-factory=exampleSaslAuthenticationFactory:add(security-domain=exampleSecurityDomain,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=PLAIN,mechanism-realm-configurations=[{realm-name=exampleSecurityRealm}]}]) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Update the management interfaces.
Use the
http-authentication-factoryto secure the management console.Syntax
/core-service=management/management-interface=http-interface:write-attribute(name=http-authentication-factory, value=<authentication_factory_name>)
/core-service=management/management-interface=http-interface:write-attribute(name=http-authentication-factory, value=<authentication_factory_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
sasl-authentication-factoryto secure the management CLI.Syntax
/core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=<sasl_authentication_factory>})/core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=<sasl_authentication_factory>})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Reload the server.
reload
reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
To verify that the management console requires authentication and authorization, navigate to the management console at
http://127.0.0.1:9990/console/index.html.You are prompted to enter user name and password.
To verify that the management CLI requires authentication and authorization, start the management CLI using the following command:
bin/jboss-cli.sh --connect
$ bin/jboss-cli.sh --connectCopy to Clipboard Copied! Toggle word wrap Toggle overflow You are prompted to enter user name and password.
2.2. Using a security domain to authenticate and authorize application users Copy linkLink copied to clipboard!
Use a security domain that references a security realm to authenticate and authorize application users. The procedures for developing an application are provided only as an example.
2.2.1. Developing a simple web application Copy linkLink copied to clipboard!
You can create a simple web application to follow along with the configuring security realms examples.
The following procedures are provided as an example only. If you already have an application that you want to secure, you can skip these and go directly to Adding authentication and authorization to applications.
2.2.1.1. Creating a Maven project for web-application development Copy linkLink copied to clipboard!
For creating a web-application, create a Maven project with the required dependencies and the directory structure.
The following procedure is provided only as an example and should not be used in a production environment. For information about creating applications for JBoss EAP, see Getting started with developing applications for JBoss EAP deployment.
Prerequisites
- You have installed Maven. For more information, see Downloading Apache Maven.
Procedure
Set up a Maven project using the
mvncommand. The command creates the directory structure for the project and thepom.xmlconfiguration file.Syntax
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Navigate to the application root directory:
Syntax
cd <name-of-your-application>
$ cd <name-of-your-application>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
cd simple-webapp-example
$ cd simple-webapp-exampleCopy to Clipboard Copied! Toggle word wrap Toggle overflow Replace the content of the generated
pom.xmlfile with the following text:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
In the application root directory, enter the following command:
mvn install
$ mvn installCopy to Clipboard Copied! Toggle word wrap Toggle overflow You get an output similar to the following:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You can now create a web-application.
2.2.1.2. Creating a web application Copy linkLink copied to clipboard!
Create a web application containing a servlet that returns the user name obtained from the logged-in user’s principal. If there is no logged-in user, the servlet returns the text "NO AUTHENTICATED USER".
In this procedure, <application_home> refers to the directory that contains the pom.xml configuration file for the application.
Prerequisites
You have created a Maven project.
For more information, see Creating a Maven project for web-application development.
- JBoss EAP is running.
Procedure
Create a directory to store the Java files.
Syntax
mkdir -p src/main/java/<path_based_on_artifactID>
$ mkdir -p src/main/java/<path_based_on_artifactID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
mkdir -p src/main/java/com/example/app
$ mkdir -p src/main/java/com/example/appCopy to Clipboard Copied! Toggle word wrap Toggle overflow Navigate to the new directory.
Syntax
cd src/main/java/<path_based_on_artifactID>
$ cd src/main/java/<path_based_on_artifactID>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
cd src/main/java/com/example/app
$ cd src/main/java/com/example/appCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a file
SecuredServlet.javawith the following content:Copy to Clipboard Copied! Toggle word wrap Toggle overflow In the application root directory, compile your application with the following command:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Deploy the application.
mvn wildfly:deploy
$ mvn wildfly:deployCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
In a browser, navigate to
http://localhost:8080/simple-webapp-example/secured.You get the following message:
Secured Servlet Current Principal 'NO AUTHENTICATED USER'
Secured Servlet Current Principal 'NO AUTHENTICATED USER'Copy to Clipboard Copied! Toggle word wrap Toggle overflow Because no authentication mechanism is added, you can access the application.
You can now secure this application by using a security domain so that only authenticated users can access it.
2.2.2. Adding authentication and authorization to applications Copy linkLink copied to clipboard!
You can add authentication and authorization to web applications to secure them by using a security domain. To access the web applications after you add authentication and authorization, users must enter login credentials.
Prerequisites
- You have created a security domain referencing a security realm.
- You have deployed applications on JBoss EAP.
- JBoss EAP is running.
Procedure
Configure an
application-security-domainin theundertow subsystem:Syntax
/subsystem=undertow/application-security-domain=<application_security_domain_name>:add(security-domain=<security_domain_name>)
/subsystem=undertow/application-security-domain=<application_security_domain_name>:add(security-domain=<security_domain_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=undertow/application-security-domain=exampleApplicationSecurityDomain:add(security-domain=exampleSecurityDomain) {"outcome" => "success"}/subsystem=undertow/application-security-domain=exampleApplicationSecurityDomain:add(security-domain=exampleSecurityDomain) {"outcome" => "success"}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the application’s
web.xmlto protect the application resources.Syntax
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can use a different
auth-method.Configure your application to use a security domain by either creating a
jboss-web.xmlfile in your application or setting the default security domain in theundertowsubsystem.Create
jboss-web.xmlfile in the your application’sWEB-INFdirectory referencing theapplication-security-domain.Syntax
<jboss-web> <security-domain> <!-- The security domain to associate with the application --></security-domain> </jboss-web>
<jboss-web> <security-domain> <!-- The security domain to associate with the application --></security-domain> </jboss-web>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
<jboss-web> <security-domain>exampleApplicationSecurityDomain</security-domain> </jboss-web>
<jboss-web> <security-domain>exampleApplicationSecurityDomain</security-domain> </jboss-web>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the default security domain in the
undertowsubsystem for applications.Syntax
/subsystem=undertow:write-attribute(name=default-security-domain,value=<application_security_domain_to_use>)
/subsystem=undertow:write-attribute(name=default-security-domain,value=<application_security_domain_to_use>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Reload the server.
reload
reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
In the application root directory, compile your application with the following command:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Deploy the application.
mvn wildfly:deploy
$ mvn wildfly:deployCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
In a browser, navigate to
http://localhost:8080/simple-webapp-example/secured. You get a login prompt confirming that authentication is now required to access the application.
Your application is now secured with a security domain and users can log in only after authenticating. Additionally, only users with specified roles can access the application.
Chapter 3. Configuring Elytron with identity realm to allow easy authentication and authorization for local users Copy linkLink copied to clipboard!
You can use an identity-realm provided by Elytron to allow local users to connect to JBoss EAP management interfaces.
The JBoss EAP management CLI is preconfigured to use an identity-realm named local. This allows local users to connect without having to provide credentials. An identity realm can only be used with the JBOSS-LOCAL-USER mechanism.
3.1. Securing a management interface with an identity realm Copy linkLink copied to clipboard!
You can secure a management interface by using an identity-realm security realm with the JBOSS-LOCAL-USER mechanism.
Prerequisites
- JBoss EAP is running.
Procedure
Create a local
identity-realm.Syntax
/subsystem=elytron/identity-realm=<local_identity_realm_name>:add(identity="$local",attribute-name=<attribute_name>,attribute-values=<attribute_value>)
/subsystem=elytron/identity-realm=<local_identity_realm_name>:add(identity="$local",attribute-name=<attribute_name>,attribute-values=<attribute_value>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/identity-realm=exampleLocalIdentityRealm:add(identity="$local",attribute-name=AttributeName,attribute-values=Value)
/subsystem=elytron/identity-realm=exampleLocalIdentityRealm:add(identity="$local",attribute-name=AttributeName,attribute-values=Value)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional If you want to use a name for your local
identity-realmother than $local, change the value ofwildfly.sasl.local-user.default-userproperty in the attributeconfigurable-sasl-server-factory=<sasl_server_factory>.Syntax
/subsystem=elytron/configurable-sasl-server-factory=<sasl_server_factory>:write-attribute(name=properties,value={"wildfly.sasl.local-user.default-user" => "<new_local_username>", "wildfly.sasl.local-user.challenge-path" => expression "${jboss.server.temp.dir}/auth"})/subsystem=elytron/configurable-sasl-server-factory=<sasl_server_factory>:write-attribute(name=properties,value={"wildfly.sasl.local-user.default-user" => "<new_local_username>", "wildfly.sasl.local-user.challenge-path" => expression "${jboss.server.temp.dir}/auth"})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/configurable-sasl-server-factory=configured:write-attribute(name=properties,value={"wildfly.sasl.local-user.default-user" => "john", "wildfly.sasl.local-user.challenge-path" => expression "${jboss.server.temp.dir}/auth"})/subsystem=elytron/configurable-sasl-server-factory=configured:write-attribute(name=properties,value={"wildfly.sasl.local-user.default-user" => "john", "wildfly.sasl.local-user.challenge-path" => expression "${jboss.server.temp.dir}/auth"})Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Create a security domain that references the
identity-realmthat you created.Syntax
/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<local_identity_realm_name>,permission-mapper=<permission_mapper_name>,realms=[{realm=<Local_identity_realm_name>}])/subsystem=elytron/security-domain=<security_domain_name>:add(default-realm=<local_identity_realm_name>,permission-mapper=<permission_mapper_name>,realms=[{realm=<Local_identity_realm_name>}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleLocalIdentityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleLocalIdentityRealm}])/subsystem=elytron/security-domain=exampleSecurityDomain:add(default-realm=exampleLocalIdentityRealm,permission-mapper=default-permission-mapper,realms=[{realm=exampleLocalIdentityRealm}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add SASL Authentication factory.
Syntax
/subsystem=elytron/sasl-authentication-factory=<sasl_auth_factory_name>:add(security-domain=<security_domain_name>,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=JBOSS-LOCAL-USER}])/subsystem=elytron/sasl-authentication-factory=<sasl_auth_factory_name>:add(security-domain=<security_domain_name>,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=JBOSS-LOCAL-USER}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/sasl-authentication-factory=exampleSaslAuthenticationFactory:add(security-domain=exampleSecurityDomain,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=JBOSS-LOCAL-USER}])/subsystem=elytron/sasl-authentication-factory=exampleSaslAuthenticationFactory:add(security-domain=exampleSecurityDomain,sasl-server-factory=configured,mechanism-configurations=[{mechanism-name=JBOSS-LOCAL-USER}])Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable SASL Authentication factory for your management interface.
Syntax
/core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=<sasl_auth_factory_name>})/core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=<sasl_auth_factory_name>})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=exampleSaslAuthenticationFactory})/core-service=management/management-interface=http-interface:write-attribute(name=http-upgrade,value={enabled=true,sasl-authentication-factory=exampleSaslAuthenticationFactory})Copy to Clipboard Copied! Toggle word wrap Toggle overflow Reload your management interface.
reload
$ reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 4. Configuring audit logging in Elytron Copy linkLink copied to clipboard!
You can use Elytron to complete security audits on triggering events. Security auditing refers to triggering events, such as writing to a log, in response to an authorization or authentication attempt.
The type of security audit performed on events depends on your security realm configuration.
4.1. Elytron audit logging Copy linkLink copied to clipboard!
After you enable audit logging with the elytron subsystem, you can log Elytron authentication and authorization events within the application server. Elytron stores audit log entries in either JSON or SIMPLE formats. Use SIMPLE for human readable text format or JSON for storing individual events in JSON.
Elytron audit logging differs from other types of audit logging, such as audit logging for the JBoss EAP management interfaces.
Elytron disables audit logging by default, however, you can enable audit logging by configuring any of the following log handlers. You can also add the log handler to a security domain.
File audit logging
For more information, see Enabling file audit logging in Elytron.
Periodic rotating file audit logging
For more information, see Enabling periodic rotating file audit logging in Elytron.
Size rotating file audit logging
For more information, see Enabling size rotating file audit logging in Elytron.
syslogaudit loggingFor more information, see Enabling syslog audit logging in Elytron.
Custom audit logging
For more information, see Using custom security event listeners in Elytron.
You can use the aggregate-security-event-listener resource to send security events to more destinations, such as loggers. The aggregate-security-event-listener resource delivers all events to all listeners specified in the aggregate listener definition.
4.2. Enabling file audit logging in Elytron Copy linkLink copied to clipboard!
File audit logging stores audit log messages in a single file within your file system.
By default, Elytron specifies local-audit as the file audit logger.
You must enable local-audit so that it can write Elytron audit logs to EAP_HOME/standalone/log/audit.log on a standalone server or EAP_HOME/domain/log/audit.log for a managed domain.
Prerequisites
You have secured an application.
For more information, see Creating a
filesystem-realmin Elytron.
Procedure
Create a file audit log.
Syntax
/subsystem=elytron/file-audit-log=<audit_log_name>:add(path="<path_to_log_file>",format=<format_type>,synchronized=<whether_to_log_immediately>)
/subsystem=elytron/file-audit-log=<audit_log_name>:add(path="<path_to_log_file>",format=<format_type>,synchronized=<whether_to_log_immediately>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/file-audit-log=exampleFileAuditLog:add(path="file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true)
/subsystem=elytron/file-audit-log=exampleFileAuditLog:add(path="file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the file audit log to a security domain.
Syntax
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<audit_log_name>)
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<audit_log_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=exampleFileAuditLog)
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=exampleFileAuditLog)Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
In a browser, log in to your secured application.
For example, to log in to the application created in Using a security domain to authenticate and authorize application users, navigate to http://localhost:8080/simple-webapp-example/secured and log in.
Navigate to the directory configured to store the audit log. If you use the example commands in the procedure, the directory is EAP_HOME/standalone/log.
Note that a file called
file-audit.logis created. It contains the logs of the events triggered by logging in to the application.Example file-audit.log file
2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.3. Enabling periodic rotating file audit logging in Elytron Copy linkLink copied to clipboard!
You can use the elytron subsystem to enable periodic rotating file audit logging for your standalone server or a server running as a managed domain.
Periodic rotating file audit logging automatically rotates audit log files based on your configured schedule. Periodic rotating file audit logging is similar to default file audit logging, but periodic rotating file audit logging contains an additional attribute: suffix.
The value of the suffix attribute is a date specified using the java.time.format.DateTimeFormatter format, such as .yyyy-MM-dd. Elytron automatically calculates the period of the rotation from the value provided with the suffix. The elytron subsystem appends the suffix to the end of a log file name.
Prerequisites
You have secured an application.
For more information, see Creating a
filesystem-realmin Elytron.
Procedure
Create a periodic rotating file audit log.
Syntax
/subsystem=elytron/periodic-rotating-file-audit-log=<periodic_audit_log_name>:add(path="<periodic_audit_log_filename>",format=<record_format>,synchronized=<whether_to_log_immediately>,suffix="<suffix_in_DateTimeFormatter_format>")
/subsystem=elytron/periodic-rotating-file-audit-log=<periodic_audit_log_name>:add(path="<periodic_audit_log_filename>",format=<record_format>,synchronized=<whether_to_log_immediately>,suffix="<suffix_in_DateTimeFormatter_format>")Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/periodic-rotating-file-audit-log=examplePreiodicFileAuditLog:add(path="periodic-file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true,suffix="yyyy-MM-dd")
/subsystem=elytron/periodic-rotating-file-audit-log=examplePreiodicFileAuditLog:add(path="periodic-file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true,suffix="yyyy-MM-dd")Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the periodic rotating file audit logger to a security domain.
Syntax
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<periodic_audit_log_name>)
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<periodic_audit_log_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=examplePreiodicFileAuditLog)
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=examplePreiodicFileAuditLog)Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
In a browser, log in to your secured application.
For example, to log in to the application created in Using a security domain to authenticate and authorize application users, navigate to http://localhost:8080/simple-webapp-example/secured and log in.
Navigate to the directory configured to store the audit log. If you use the example commands in the procedure, the directory is EAP_HOME/standalone/log.
Note that a file called
periodic-file-audit.logis created. It contains the logs of the events triggered by logging in to the application.Example periodic-file-audit.log file
2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.4. Enabling size rotating file audit logging in Elytron Copy linkLink copied to clipboard!
You can use the elytron subsystem to enable size rotating file audit logging for your standalone server or a server running as a managed domain.
Size rotating file audit logging automatically rotates audit log files when the log file reaches a configured file size. Size rotating file audit logging is similar to default file audit logging, but the size rotating file audit logging contains additional attributes.
When the log file size exceeds the limit defined by the rotate-size attribute, Elytron appends the suffix .1 to the end of the current file andcreates a new log file. For each existing log file, Elytron increments the suffix by one. For example, Elytron renames audit_log.1 to audit_log.2. Elytron continues the increments until the log file amount reaches the maximum number of log files, as defined by max-backup-index. When a log file exceeds the max-backup-index value, Elytron removes the file. For example, if the max-backup-index defines "98" as the max-backup-index value, the audit_log.99 file would be over the limit.
Prerequisites
You have secured an application.
For more information, see Creating a
filesystem-realmin Elytron.
Procedure
Create a size rotating file audit log.
Syntax
/subsystem=elytron/size-rotating-file-audit-log=<audit_log_name>:add(path="<path_to_log_file>",format=<record_format>,synchronized=<whether_to_log_immediately>,rotate-size="<max_file_size_before_rotation>",max-backup-index=<max_number_of_backup_files>)
/subsystem=elytron/size-rotating-file-audit-log=<audit_log_name>:add(path="<path_to_log_file>",format=<record_format>,synchronized=<whether_to_log_immediately>,rotate-size="<max_file_size_before_rotation>",max-backup-index=<max_number_of_backup_files>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/size-rotating-file-audit-log=exampleSizeFileAuditLog:add(path="size-file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true,rotate-size="10m",max-backup-index=10)
/subsystem=elytron/size-rotating-file-audit-log=exampleSizeFileAuditLog:add(path="size-file-audit.log",relative-to=jboss.server.log.dir,format=SIMPLE,synchronized=true,rotate-size="10m",max-backup-index=10)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the size rotating audit logger to a security domain.
Syntax
/subsystem=elytron/security-domain=<domain_size_logger>:write-attribute(name=security-event-listener,value=<audit_log_name>)
/subsystem=elytron/security-domain=<domain_size_logger>:write-attribute(name=security-event-listener,value=<audit_log_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=exampleSizeFileAuditLog)
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=exampleSizeFileAuditLog)Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
In a browser, log in to your secured application.
For example, to log in to the application created in Using a security domain to authenticate and authorize application users, navigate to http://localhost:8080/simple-webapp-example/secured and log in.
Navigate to the directory configured to store the audit log. If you use the example commands in the procedure, the directory is EAP_HOME/standalone/log.
Note that a file called
size-file-audit.logis created. It contains the logs of the events triggered by logging in to the application.Example size-file-audit.log file
2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}2023-10-24 23:31:04,WARNING,{event=SecurityPermissionCheckSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true,permission=[type=org.wildfly.security.auth.permission.LoginPermission,actions=,name=]} 2023-10-24 23:31:04,WARNING,{event=SecurityAuthenticationSuccessfulEvent,event-time=2023-10-24 23:31:04,security-identity=[name=user1,creation-time=2023-10-24 23:31:04],success=true}Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.5. Enabling syslog audit logging in Elytron Copy linkLink copied to clipboard!
You can use the elytron subsystem to enable syslog audit logging for your standalone server or a server running as a managed domain. When you use syslog audit logging, you send the logging results to a syslog server, which provides more security options than logging to a local file.
The syslog handler specifies parameters used to connect to a syslog server, such as the syslog server’s host name and the port on which the syslog server listens. You can define multiple syslog handlers and activate them simultaneously.
Supported log formats include RFC5424 and RFC3164. Supported transmission protocols include UDP, TCP, and TCP with SSL.
When you define a syslog for the first instance, the logger sends an INFORMATIONAL priority event containing the message to the syslog server, as demonstrated in the following example:
"Elytron audit logging enabled with RFC format: <format>"
"Elytron audit logging enabled with RFC format: <format>"
<format> refers to the Request for Comments (RFC) format configured for the audit logging handler, which defaults to RFC5424.
Prerequisites
You have secured an application.
For more information, see Creating a
filesystem-realmin Elytron.
Procedure
Add a
sysloghandler.Syntax
/subsystem=elytron/syslog-audit-log=<syslog_audit_log_name>:add(host-name=<record_host_name>,port=<syslog_server_port_number>,server-address=<syslog_server_address>,format=<record_format>, transport=<transport_layer_protocol>)
/subsystem=elytron/syslog-audit-log=<syslog_audit_log_name>:add(host-name=<record_host_name>,port=<syslog_server_port_number>,server-address=<syslog_server_address>,format=<record_format>, transport=<transport_layer_protocol>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can also send logs to a
syslogserver over TLS:Syntax for
syslogconfiguration to send logs over TLS/subsystem=elytron/syslog-audit-log=<syslog_audit_log_name>:add(transport=SSL_TCP,server-address=<syslog_server_address>,port=<syslog_server_port_number>,host-name=<record_host_name>,ssl-context=<client_ssl_context>)
/subsystem=elytron/syslog-audit-log=<syslog_audit_log_name>:add(transport=SSL_TCP,server-address=<syslog_server_address>,port=<syslog_server_port_number>,host-name=<record_host_name>,ssl-context=<client_ssl_context>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the
syslogaudit logger to a security domain.Syntax
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<syslog_audit_log_name>)
/subsystem=elytron/security-domain=<security_domain_name>:write-attribute(name=security-event-listener,value=<syslog_audit_log_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=exampleSyslog)
/subsystem=elytron/security-domain=exampleSecurityDomain:write-attribute(name=security-event-listener,value=exampleSyslog)Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.6. Using custom security event listeners in Elytron Copy linkLink copied to clipboard!
You can use Elytron to define a custom event listener. A custom event listener processes incoming security events. You can use the event listener for custom audit logging purposes, or you can use the event listener to authenticate users against your internal identity storage.
The ability to add and remove modules by using the module management CLI command is provided as a Technology Preview feature only. The module command is not appropriate for use in a managed domain or when connecting with a remote management CLI. You must manually add or remove modules in a production environment.
Technology Preview features are not supported with Red Hat production service level agreements (SLAs), might not be functionally complete, and Red Hat does not recommend to use them for production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
See Technology Preview Features Support Scope on the Red Hat Customer Portal for information about the support scope for Technology Preview features.
Prerequisites
You have secured an application.
For more information, see Creating a
filesystem-realmin Elytron.
Procedure
Create a class that implements the
java.util.function.Consumer<org.wildfly.security.auth.server.event.SecurityEvent>interface.Example of creating a Java class that uses the specified interface:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The Java class in the example prints a message whenever a user succeeds or fails authentication.
Add the JAR file that provides the custom event listener as a module to JBoss EAP.
The following is an example of the management CLI command that adds a custom event listener as a module to Elytron.
Example of using the
modulecommand to add a custom event listener as a module to Elytron:/subsystem=elytron/custom-security-event-listener=<listener_name>:add(module=<module_name>, class-name=<class_name>)
/subsystem=elytron/custom-security-event-listener=<listener_name>:add(module=<module_name>, class-name=<class_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Reference the custom event listener in the security domain.
Example of referencing a custom event listener in
ApplicationDomain:/subsystem=elytron/security-domain=<domain_name>:write-attribute(name=security-event-listener, value=<listener_name>)
/subsystem=elytron/security-domain=<domain_name>:write-attribute(name=security-event-listener, value=<listener_name>)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Restart the server.
reload
$ reloadCopy to Clipboard Copied! Toggle word wrap Toggle overflow The event listener receives security events from the specified security domain.
Chapter 5. Reference Copy linkLink copied to clipboard!
5.1. custom-realm attributes Copy linkLink copied to clipboard!
You can configure your custom-realm by setting its attributes.
| Attribute | Description |
|---|---|
|
| Fully qualified class name of the implementation of the custom realm. |
|
|
The optional |
|
| Name of the module to use to load the custom realm. |
5.2. filesystem-realm attributes Copy linkLink copied to clipboard!
You can configure filesystem-realm by setting its attributes.
| Attribute | Description |
|---|---|
| credential-store |
Reference to the credential store that contains the secret key to encrypt and decrypt the clear passwords, hashed passwords, and attributes in the realm. When you use this attribute, you must also specify the secret key to use by defining it in the |
| encoded |
The attribute that indicates whether the identity names should be stored encoded (Base32) in file names. The default value is |
| hash-charset | The character set to use when converting the password string to a byte array. The default is UTF-8. |
| hash-encoding | The string format for the password if it is not stored in plain text. It can be one of:
The default is base64. |
| key-store |
Reference to the key store that contains the key pair to use to verify integrity. When you define this attribute, you must also specify the key store alias in the |
| key-store-alias |
The alias that identifies the private key entry within the key store to use to verify integrity. Use this attribute if you have added a reference to a key store by defining the |
| levels |
The number of levels of directory hashing to apply. The default value is |
| path | The path to the directory containing the realm. |
| relative-to |
The predefined relative path to use with |
| secret-key |
The alias of the secret key to encrypt and decrypt the clear passwords, hashed passwords, and attributes in the realm. Use this attribute if you have added a reference to a credential store by defining the |
5.3. file-audit-log attributes Copy linkLink copied to clipboard!
| Attribute | Description |
|---|---|
|
|
Specifies if the output stream requires flushing after every audit event. If you do not define the attribute, the |
|
|
Specifies the audit file encoding. The default is
|
|
|
Default value is |
|
| Defines the location of the log files. |
|
| Optional attribute. Defines the location of the log files. |
|
|
Default value is |
5.4. http-authentication-factory attributes Copy linkLink copied to clipboard!
You can configure http-authentication-factory by setting its attributes.
| Attribute | Description |
|---|---|
| http-server-mechanism-factory |
The |
| mechanism-configurations | The list of mechanism-specific configurations. |
| security-domain | The security domain to associate with the resource. |
| Attribute | Description |
|---|---|
| credential-security-factory | The security factory to use to obtain a credential as required by the mechanism. |
| final-principal-transformer | A final principal transformer to apply for this mechanism realm. |
| host-name | The host name this configuration applies to. |
| mechanism-name | This configuration will only apply where a mechanism with the name specified is used. If this attribute is omitted then this will match any mechanism name. |
| mechanism-realm-configurations | The list of definitions of the realm names as understood by the mechanism. |
| pre-realm-principal-transformer | A principal transformer to apply before the realm is selected. |
| post-realm-principal-transformer | A principal transformer to apply after the realm is selected. |
| protocol | The protocol this configuration applies to. |
| realm-mapper | The realm mapper to be used by the mechanism. |
| Attribute | Description |
|---|---|
| final-principal-transformer | A final principal transformer to apply for this mechanism realm. |
| post-realm-principal-transformer | A principal transformer to apply after the realm is selected. |
| pre-realm-principal-transformer | A principal transformer to apply before the realm is selected. |
| realm-mapper | The realm mapper to be used by the mechanism. |
| realm-name | The name of the realm to be presented by the mechanism. |
5.5. identity-realm attributes Copy linkLink copied to clipboard!
You can configure your identity-realm by setting its attributes.
| Attribute | Description |
|---|---|
|
| The name of the attribute associated with this identity. |
|
| The list of values associated with the identity’s attribute. |
|
| The identity available from the security realm. |
5.6. jdbc-realm attributes Copy linkLink copied to clipboard!
You can configure jdbc-realm by setting its attributes.
| Attribute | Description |
|---|---|
| hash-charset | The character set to use when converting the password string to a byte array. The default is UTF-8. |
| principal-query | The list of authentication queries used to authenticate users based on specific key types. |
| Attribute | Description |
|---|---|
| attribute-mapping | The list of attribute mappings defined for this resource. |
| bcrypt-mapper |
A key mapper that maps a column returned from a SQL query to a |
| clear-password-mapper |
A key mapper that maps a column returned from a SQL query to a clear password key type. This has a |
| data-source | The name of the data source used to connect to the database. |
| salted-simple-digest-mapper |
A key mapper that maps a column returned from a SQL query to a |
| scram-mapper |
A key mapper that maps a column returned from a SQL query to a |
| simple-digest-mapper |
A key mapper that maps a column returned from a SQL query to a |
| sql | The SQL statement used to obtain the keys as table columns for a specific user and map them accordingly with their type. |
| Attribute | Description |
|---|---|
| index | The column index from the SQL query that represents the mapped attribute. |
| to | The name of the identity attribute mapped from a column returned from the SQL query. |
5.7. key-store attributes Copy linkLink copied to clipboard!
You can configure a key-store by setting its attributes.
| Attribute | Description |
|---|---|
| alias-filter | A filter to apply to the aliases returned from the keystore, can either be a comma separated list of aliases to return or one of the following formats:
Note
The |
| credential-reference |
The password to use to access the keystore. This can be specified in clear text or as a reference to a credential stored in a |
| path | The path to the keystore file. |
| provider-name | The name of the provider to use to load the keystore. When you set this attribute, the search for the first provider that can create a key store of the specified type is disabled. |
| providers | A reference to the providers that should be used to obtain the list of provider instances to search. If not specified, the global list of providers will be used instead. |
| relative-to |
The base path this store is relative to. This can be a full path or a predefined path such as |
| required |
If set to |
| type |
The type of the key store, for example, Note The following key store types are automatically detected:
You must manually specify the other key store types. A full list of key store types can be found in Java Cryptography Architecture Standard Algorithm Name Documentation for JDK 11 in the Oracle JDK documentation. |
5.8. ldap-realm attributes Copy linkLink copied to clipboard!
You can configure ldap-realm by setting its attributes.
| Attribute | Description |
|---|---|
| allow-blank-password | Whether this realm supports blank password direct verification. If this attribute is not set, a blank password attempt is rejected. |
| dir-context |
The name of the |
| direct-verification |
If this attribute is set to |
| hash-charset | The character set to use when converting the password string to a byte array. The default is UTF-8. |
| hash-encoding | The string format for the password if it is not stored in plain text. It can be one of:
The default is base64. |
| identity-mapping | The configuration options that define how principals are mapped to their corresponding entries in the underlying LDAP server. |
| Attribute | Description |
|---|---|
| attribute-mapping | List of attribute mappings defined for this resource. |
| filter-name | The LDAP filter for getting identity by name. |
| iterator-filter | The LDAP filter for iterating over identities of the realm. |
| new-identity-attributes |
The list of attributes of newly created identities. It is required for the modifiability of the realm. This is a list of |
| new-identity-parent-dn | The DN of the parent of newly created identities. Required for modifiability of the realm. |
| otp-credential-mapper | The credential mapping for OTP credential. |
| rdn-identifier | The RDN part of the principal’s DN to be used to obtain the principal’s name from an LDAP entry. This is also used when creating new identities. |
| search-base-dn | The base DN to search for identities. |
| use-recursive-search |
If this attribute is set to |
| user-password-mapper | The credential mapping for a credential, similar to userPassword. |
| x509-credential-mapper |
The configuration that enables using LDAP as storage of X509 credentials. If none of the |
| Attribute | Description |
|---|---|
| extract-rdn | The RDN key to use as the value for an attribute, in case the value in its raw form is in X.500 format. |
| filter |
The filter to use to obtain the values for a specific attribute. The string |
| filter-base-dn | The name of the context where the filter should be performed. |
| from | The name of the LDAP attribute to map to an identity attribute. If not defined, DN of entry is used. |
| reference | The name of the LDAP attribute containing DN of entry to obtain value from. |
| role-recursion |
Maximum depth for recursive role assignment. Use |
| role-recursion-name |
Determine the LDAP attribute of role entry which will be a substitute for "{0}" in |
| search-recursive |
If |
| to |
The name of the identity attribute mapped from a specific LDAP attribute. If not provided, the name of the attribute is the same as defined in |
| Attribute | Description |
|---|---|
| from | The name of the LDAP attribute to map to an identity attribute. If not defined, DN of entry is used. |
| verifiable |
If |
| writable |
If |
| Attribute | Description |
|---|---|
| algorithm-from | The name of the LDAP attribute of OTP algorithm. |
| hash-from | The name of the LDAP attribute of OTP hash function. |
| seed-from | The name of the LDAP attribute of OTP seed. |
| sequence-from | The name of the LDAP attribute of OTP sequence number. |
| Attribute | Description |
|---|---|
| certificate-from | The name of the LDAP attribute to map to an encoded user certificate. If not defined, the encoded certificate will not be checked. |
| digest-algorithm |
The digest algorithm, which is the hash function, that is used to compute the digest of the user certificate. It will be used only if |
| digest-from | The name of the LDAP attribute to map to a user certificate digest. If not defined, the certificate digest will not be checked. |
| serial-number-from | The name of the LDAP attribute to map to a serial number of the user certificate. If not defined, the serial number will not be checked. |
| subject-dn-from | The name of the LDAP attribute to map to a subject DN of user certificate. If not defined, the subject DN will not be checked. |
5.9. Password mapper attributes Copy linkLink copied to clipboard!
A password mapper constructs a password from multiple fields in a database using one of the following algorithm types:
- Clear text
- Simple digest
- Salted simple digest
- bcrypt
- SCRAM
- Modular crypt
A password mapper has the following attributes:
The index of the first column is 1 for all the mappers.
| Mapper name | Attributes | Encryption method |
|---|---|---|
|
|
| No encryption. |
|
|
| A simple hashing mechanism is used. |
|
|
| A simple hashing mechanism is used with a salt. |
|
|
| Blowfish algorithm used for hashing. |
|
|
| Salted Challenge Response Authentication mechanism is used for hashing. |
|
|
| The modular-crypt encoding supports multiple pieces of information to be encoded in a single string. The information can include the following:
|
5.10. periodic-rotating-file-audit-log attributes Copy linkLink copied to clipboard!
| Attribute | Description |
|---|---|
|
|
Specifies if the output stream requires flushing after every audit event. If you do not define the attribute, the |
|
|
Specifies the audit file encoding. The default is
|
|
|
Use |
|
| Defines the location of the log files. |
|
| Optional attribute. Defines the location of the log files. |
|
|
Optional attribute. Adds a date suffix to a rotated log. You must use the |
|
|
Default value is |
5.11. properties-realm attributes Copy linkLink copied to clipboard!
You can configure properties-realm by setting its attributes.
| Attribute | Description |
|---|---|
|
|
The name of the attribute in the returned |
|
| The properties file containing the users and their groups. |
|
|
Specifies the name of the character set to use when converting the client provided password string to a byte array for hashing calculations. Set to |
|
|
Specifies the string format for the hashed password if the password is not being stored in plain text. It may specify one of two: |
|
| The properties file containing the users and their passwords. |
| Attribute | Description |
|---|---|
|
| The default realm name to use for digested passwords if one is not discovered in the properties file. |
|
| The path to the file containing the users and their passwords. The file should contain realm name declaration. |
|
|
If |
|
| The predefined path that the path is relative to. |
| Attribute | Description |
|---|---|
|
| The path to the file containing the users and their groups. |
|
| The predefined path that the path is relative to. |
5.12. sasl-authentication-factory attributes Copy linkLink copied to clipboard!
You can configure sasl-authentication-factory by setting its attributes.
| Attribute | Description |
|---|---|
| mechanism-configurations | The list of mechanism specific configurations. |
| sasl-server-factory | The SASL server factory to associate with this resource. |
| security-domain | The security domain to associate with this resource. |
| Attribute | Description |
|---|---|
| credential-security-factory | The security factory to use to obtain a credential as required by the mechanism. |
| final-principal-transformer | A final principal transformer to apply for this mechanism realm. |
| host-name | The host name this configuration applies to. |
| mechanism-name | This configuration will only apply where a mechanism with the name specified is used. If this attribute is omitted then this will match any mechanism name. |
| mechanism-realm-configurations | The list of definitions of the realm names as understood by the mechanism. |
| protocol | The protocol this configuration applies to. |
| post-realm-principal-transformer | A principal transformer to apply after the realm is selected. |
| pre-realm-principal-transformer | A principal transformer to apply before the realm is selected. |
| realm-mapper | The realm mapper to be used by the mechanism. |
| Attribute | Description |
|---|---|
| final-principal-transformer | A final principal transformer to apply for this mechanism realm. |
| post-realm-principal-transformer | A principal transformer to apply after the realm is selected. |
| pre-realm-principal-transformer | A principal transformer to apply before the realm is selected. |
| realm-mapper | The realm mapper to be used by the mechanism. |
| realm-name | The name of the realm to be presented by the mechanism. |
5.13. secret-key-credential-store Attributes Copy linkLink copied to clipboard!
You can configure secret-key-credential-store by setting its attributes.
| Attribute | Description |
|---|---|
| create |
Set the value to |
| default-alias |
The alias name for a key generated by default. The default value is |
| key-size | The size of a generated key. The default size is 256 bits. You can set the value to one of the following:
|
| path | The path to the credential store. |
| populate |
If a credential store does not contain a |
| relative-to |
A reference to a previously defined path that the attribute |
5.14. security-domain attributes Copy linkLink copied to clipboard!
You can configure security-domain by setting its attributes.
| Attribute | Description |
|---|---|
| default-realm | The default realm contained by this security domain. |
| evidence-decoder | A reference to an EvidenceDecoder to be used by this domain. |
| outflow-anonymous | This attribute specifies whether the anonymous identity should be used if outflow to a security domain is not possible, which happens in the following scenarios:
Outflowing anonymous identity clears any previously established identity for that domain. |
| outflow-security-domains | The list of security domains that the security identity from this domain should automatically outflow to. |
| permission-mapper | A reference to a PermissionMapper to be used by this domain. |
| post-realm-principal-transformer | A reference to a principal transformer to be applied after the realm has operated on the supplied identity name. |
| pre-realm-principal-transformer | A reference to a principal transformer to be applied before the realm is selected. |
| principal-decoder | A reference to a PrincipalDecoder to be used by this domain. |
| realm-mapper | Reference to the RealmMapper to be used by this domain. |
| realms | The list of realms contained by this security domain. |
| role-decoder | Reference to the RoleDecoder to be used by this domain. |
| role-mapper | Reference to the RoleMapper to be used by this domain. |
| security-event-listener | Reference to a listener for security events. |
| trusted-security-domains | The list of security domains that are trusted by this security domain. |
| trusted-virtual-security-domains | The list of virtual security domains that are trusted by this security domain. |
5.15. simple-role-decoder attributes Copy linkLink copied to clipboard!
You can configure simple role decoder by setting its attribute.
| Attribute | Description |
|---|---|
| attribute | The name of the attribute from the identity to map directly to roles. |
5.16. size-rotating-file-audit-log attributes Copy linkLink copied to clipboard!
| Attribute | Description |
|---|---|
|
|
Specifies if the output stream requires flushing after every audit event. If you do not define the attribute, the |
|
|
Specifies the audit file encoding. The default is
|
|
|
Default value is |
|
|
The maximum number of files to back up when rotating. The default value is |
|
| Defines the location of the log files. |
|
| Optional attribute. Defines the location of the log files. |
|
|
By default, Elytron does not create a new log file when you restart a server. Set this attribute to |
|
|
The maximum size that the log file can reach before Elytron rotates the log. The default is |
|
|
Optional attribute. Adds a date suffix to a rotated log. You must use the |
|
|
Default value is |
5.17. syslog-audit-log attributes Copy linkLink copied to clipboard!
| Attribute | Description |
|---|---|
|
| The format in which audit events are recorded. Supported values:
Default value:
|
|
| The host name to be embedded into all events sent to the syslog server. |
|
|
The listening port on the |
|
|
The maximum number of times that Elytron will attempt to send successive messages to a Supported values:
Default value:
|
|
|
IP address of the |
|
|
The SSL context to use when connecting to the |
|
| The RFC format to be used for describing the audit event. Supported values:
Default value:
|
|
|
The transport layer protocol to use to connect to the Supported values:
Default value:
|