You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2021/07/26 05:57:36 UTC
[karaf] branch karaf-4.2.x updated: KARAF-7219 - Document improved
password encryption algorithms
This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch karaf-4.2.x
in repository https://gitbox.apache.org/repos/asf/karaf.git
The following commit(s) were added to refs/heads/karaf-4.2.x by this push:
new 3284620 KARAF-7219 - Document improved password encryption algorithms
3284620 is described below
commit 32846200df4cb6b87a61e365d568066cf6fe51d1
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Mon Jul 5 15:39:35 2021 +0100
KARAF-7219 - Document improved password encryption algorithms
(cherry picked from commit 81106d3ad4e153454842ce10f92ee712d5e2fde4)
---
.../features/standard/src/main/feature/feature.xml | 17 +++++++-------
.../apache/karaf/jaas/modules/impl/Activator.java | 2 +-
manual/src/main/asciidoc/user-guide/security.adoc | 27 +++++++++++++---------
3 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/assemblies/features/standard/src/main/feature/feature.xml b/assemblies/features/standard/src/main/feature/feature.xml
index e6a5595..0bbe5bb 100644
--- a/assemblies/features/standard/src/main/feature/feature.xml
+++ b/assemblies/features/standard/src/main/feature/feature.xml
@@ -657,9 +657,12 @@ encryption.enabled = ${env:ORG_APACHE_KARAF_JAAS_ENCRYPTION_ENABLED:-false}
#
# Encryption Service name
-# the default one is 'basic'
-# a more powerful one named 'jasypt' is available
-# when installing the encryption feature
+# basic: the default encryption service which digests passwords without
+# salting them
+# jasypt: a more powerful alternative which supports salting
+# spring-security-crypto: Supports bcrypt, argon2, pbkdf2, scrypt. Requires
+# the "spring-security-crypto-encryption" feature
+# to be installed.
#
encryption.name = ${env:ORG_APACHE_KARAF_JAAS_ENCRYPTION_NAME:-basic}
@@ -676,12 +679,8 @@ encryption.suffix = {CRYPT}
#
# Set the encryption algorithm to use in Karaf JAAS login module
# Supported encryption algorithms follow:
-# MD2
-# MD5
-# SHA-1
-# SHA-256
-# SHA-384
-# SHA-512
+# basic/jasypt: MD2, MD5, SHA-1, SHA-256, SHA-384, SHA-512
+# spring-security-crypto: argon2, bcrypt, pbkdf2, scrypt
#
encryption.algorithm = ${env:ORG_APACHE_KARAF_JAAS_ENCRYPTION_ALGORITHM:-MD5}
diff --git a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/impl/Activator.java b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/impl/Activator.java
index 8feff9e..b91f5f6 100644
--- a/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/impl/Activator.java
+++ b/jaas/modules/src/main/java/org/apache/karaf/jaas/modules/impl/Activator.java
@@ -104,7 +104,7 @@ public class Activator extends BaseActivator implements ManagedService {
populate(config, ENCRYPTION_ENABLED, "false");
populate(config, ENCRYPTION_PREFIX, "{CRYPT}");
populate(config, ENCRYPTION_SUFFIX, "{CRYPT}");
- populate(config, ENCRYPTION_ALGORITHM, "MD5");
+ populate(config, ENCRYPTION_ALGORITHM, "SHA-256");
populate(config, ENCRYPTION_ENCODING, "hexadecimal");
populate(config, EVENTADMIN_ENABLED, "true");
populate(config, "audit.file.enabled", "false");
diff --git a/manual/src/main/asciidoc/user-guide/security.adoc b/manual/src/main/asciidoc/user-guide/security.adoc
index dfddb9d..b548df3 100644
--- a/manual/src/main/asciidoc/user-guide/security.adoc
+++ b/manual/src/main/asciidoc/user-guide/security.adoc
@@ -317,9 +317,12 @@ encryption.enabled = false
#
# Encryption Service name
-# the default one is 'basic'
-# a more powerful one named 'jasypt' is available
-# when installing the encryption feature
+# basic: the default encryption service which digests passwords without
+# salting them
+# jasypt: a more powerful alternative which supports salting
+# spring-security-crypto: Supports bcrypt, argon2, pbkdf2, scrypt. Requires
+# the "spring-security-crypto-encryption" feature
+# to be installed.
#
encryption.name = basic
@@ -336,12 +339,8 @@ encryption.suffix = {CRYPT}
#
# Set the encryption algorithm to use in Karaf JAAS login module
# Supported encryption algorithms follow:
-# MD2
-# MD5
-# SHA-1
-# SHA-256
-# SHA-384
-# SHA-512
+# basic/jasypt: MD2, MD5, SHA-1, SHA-256, SHA-384, SHA-512
+# spring-security-crypto: argon2, bcrypt, pbkdf2, scrypt
#
encryption.algorithm = MD5
@@ -361,12 +360,18 @@ prefixed and suffixed with `\{CRYPT\`}. To re-encrypt the password, you can rese
file), without the `\{CRYPT\`} prefix and suffix. Apache Karaf will detect that this password is in clear (because it's not
prefixed and suffixed with `\{CRYPT\`}) and encrypt it again.
+The `encryption.name` property defines which encryption provider is used. The default is "basic" which just supports basic
+digesting of the password, without salting. This is not secure for production environments. A more secure alternative is
+"jasypt", which supports digesting with salting. However, the most secure alternative which should be used in production is
+"spring-security-crypto", which supports modern password digest algorithms such as "argon2" and "bcrypt".
+
The `etc/org.apache.karaf.jaas.cfg` configuration file allows you to define advanced encryption behaviours:
* the `encryption.prefix` property defines the prefix to "flag" a password as encrypted. The default is `\{CRYPT\`}.
* the `encryption.suffix` property defines the suffix to "flag" a password as encrypted. The default is `\{CRYPT\`}.
-* the `encryption.algorithm` property defines the algorithm to use for encryption (digest). The possible values are `MD2`, `MD5`,
-`SHA-1`, `SHA-256`, `SHA-384`, `SHA-512`. The default is `MD5`.
+* the `encryption.algorithm` property defines the algorithm to use for encryption (digest). The possible values for the "basic" and
+"jasypt" provides are: `MD2`, `MD5`, `SHA-1`, `SHA-256`, `SHA-384`, `SHA-512`. The default is `SHA-256` since Karaf 4.3.0, prior to this it was `MD5`.
+When the "spring-security-crypto" `encryption.name` is configured, the possible values are: `argon2`, `bcrypt`, `pbkdf2`, `scrypt`.
* the `encryption.encoding` property defines the encoding of the encrypted password. The possible values are `hexadecimal`
or `base64`. The default value is `hexadecimal`.