- insecure-fork-wanted
- insecure-setuid-wanted
- issuers-chain-path
+ - jwt.allow_none_alg
- jwt.decrypt_alg_list
- jwt.decrypt_enc_list
- key-base
The OCSP features are able to use the completed chain when no .issuer was
used, or no chain was provided in the PEM.
+jwt.allow_none_alg
+ Allow JWT signed token with the "none" algorithm in the 'jwt_verify'
+ converter. They will always be considered valid when this option is set. By
+ default unsigned tokens are rejected since they are considered unsafe (see
+ RFC8725 section 3.1).
+
jwt.decrypt_alg_list <list>
Set the list of algorithms allowed in the jwt_decrypt_XXX converters. JWT
tokens using an unsupported or disabled algorithms will never be decrypted.
| PS256 | RSASSA-PSS using SHA-256 and MGF1 with SHA-256 |
| PS384 | RSASSA-PSS using SHA-384 and MGF1 with SHA-384 |
| PS512 | RSASSA-PSS using SHA-512 and MGF1 with SHA-512 |
- | none | No digital signature or MAC performed |
+ | none | No digital signature or MAC performed (see note below) |
+--------------+---------------------------------------------------------+
+ Please note that the "none" algorithm is not allowed by default to follow
+ the recommendations in RFC8725 section 3.2. Set global option
+ 'jwt.allow_none_alg' to explicitely allow it.
+
- <key> can be either a string or a variable name (See also "set-var") that
holds a secret or a public key path.
/* Tree into which the public certificates used to validate JWTs will be stored. */
static struct eb_root jwt_cert_tree = EB_ROOT_UNIQUE;
+/* Set whether "none" algorithm should be allowed or not */
+static int jwt_verify_allow_none_alg = 0;
/*
* The possible algorithm strings that can be found in a JWS's JOSE header are
if (ctx.alg == JWT_ALG_DEFAULT)
return JWT_VRFY_UNKNOWN_ALG;
+ if (ctx.alg == JWS_ALG_NONE && !jwt_verify_allow_none_alg)
+ return JWT_VRFY_UNMANAGED_ALG;
+
if (jwt_tokenize(token, items, item_num))
return JWT_VRFY_INVALID_TOKEN;
return retval;
}
+/* Parse 'jwt.allow_none_arg' option */
+static int cfg_parse_global_jwt_none_alg(char **args, int section_type, struct proxy *curpx,
+ const struct proxy *defpx, const char *file, int linenum, char **err)
+{
+ if (*args[1]) {
+ memprintf(err, "parsing [%s:%d]: keyword '%s' in '%s' section does not take any arguments.\n", file, linenum, args[0], cursection);
+ goto error;
+ }
+
+ jwt_verify_allow_none_alg = 1;
+
+ return 0;
+
+error:
+ return -1;
+}
+
static void jwt_deinit(void)
{
}
REGISTER_POST_DEINIT(jwt_deinit);
+static struct cfg_kw_list cfg_kws = {ILH, {
+ { CFG_GLOBAL, "jwt.allow_none_alg", cfg_parse_global_jwt_none_alg },
+ { 0, NULL, NULL },
+}};
+
+INITCALL1(STG_REGISTER, cfg_register_keywords, &cfg_kws);
+
#endif /* USE_OPENSSL */