-
Notifications
You must be signed in to change notification settings - Fork 484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Got error "Unable to parse JWT for call ..." on core-command when get command by kuiper rule with security enabled #4508
Comments
This is always going to be an issue as eKuiper will never have the JWT. We could try going through the API Gateway, but again, eKuiper will not have the gateway token. @bnevis-i , thoughts? |
|
Kuiper is invoked via MessageBus.
Yea, I wonder if their REST action spec in the rule can take a JWT. But it would be in plain text since eKuiper doesn't have access to our SecretStore. :-(
Is this built in already? I wouldn't think this is a good thing as it does end around the secure endpoints |
Would need the ability to invoke an external module to provide it. JWT's are bearer tokens and they need to be fresh.
https://github.com/edgexfoundry/go-mod-bootstrap/blob/main/bootstrap/handlers/auth_middleware.go#L94
See https://ekuiper.org/docs/en/latest/edgex/edgex_rule_engine_command.html#option-2-use-messaging |
@bnevis-i, This needs to be added to the docs here: https://docs.edgexfoundry.org/3.0/microservices/configuration/CommonEnvironmentVariables/#standard-environment-variables I think the other security Envs are also missing from this section. |
Docs update here: |
|
According to the discussion in Core WG meeting on April 11 2023, we decided to skip Kuiper tests until we fix this issue. |
|
So I've been thinking about this issue. Here is where I currently sit: EDGEX_DISABLE_JWT_VALIDATIONStill seems to be the most expedient way. Message bus optionAs in https://ekuiper.org/docs/en/latest/edgex/edgex_rule_engine_command.html#option-2-use-messaging. Looking at that it doesn't appear as if there is a way to authenticate to the external message bus. The example seems to imply that the message bus will just take any client that connects to it, which isn't right. If you can just send stuff to core-command via an unauthenticated message bus, it is exactly equivalent to setting EDGEX_DISABLE_JWT_VALIDATION on core-command and using an http rule action. OAuth methodAs in https://ekuiper.org/docs/en/latest/guide/sources/builtin/http_pull.html#global-http-pull-configurations. I performed a small prototype where I created an HTTP server that returned a JWT, and fed it into the request as prescribed, and it worked just fine. However, in the example, the authentication credential is right there in the configuration. In the simplest case, I could inject a small token service inside the eKuiper container. Because it was "inside" it would be trusted. However, because we also need to support snap-based deployments, creating such a service would be a back door when it listened on the host's localhost interface. Thus, that solution is docker specific. Moreover, unless the eKuiper API is secured, eKuiper could be used to inject ANY rest API call into EdgeX, whether eKuiper is dockerized or not. For something that would work with snaps, we would have to make it an internal (authenticated) API. However, since eKuiper itself isn't authenticated, any client could just connect to eKuiper, read the rules config, and get whatever secret was there. Thus, regardless of the authentication method (API key, client_id/client_secret, vault username/password, etc), because eKuiper itself is not currently deployed in secure mode, we're just creating a backdoor and thus authenticating the ekuiper client would be security theater. To have this approach be meaningful, we also need to ensure that eKuiper API security is also enabled. See https://github.com/lf-edge/ekuiper/blob/master/docs/en_US/api/restapi/authentication.md (Filed: #4538) Still, manually syncing a credential to be inlined into a rule would seem difficult to use. Custom EdgeX pluginHaving a way to for eKuiper to securely drop something into the EdgeX message bus seems to best way. After all, eKuiper can already authenticate in secure mode. But none of the http nor mqtt rule examples really show how this integration as it exists today would work for a rule action. |
This behavior, and recommended workarounds, has been documented in the EdgeX 3.0 migration guide: https://docs.edgexfoundry.org/3.0/V3TopLevelMigration/#secure-mode Additionally, the OpenZiti zero-trust prototype has shown that it can resolve this issue fully by zitifying eKuiper. |
🐞 Bug Report
Affected Services [REQUIRED]
The issue is located in: core-command, rules-engineIs this a regression?
YesDescription and Minimal Reproduction [REQUIRED]
🔥 Exception or Error
Found the following error on core-command and rules-engine services.
🌍 Your Environment
Deployment Environment: Ubuntu22 / x86
EdgeX Version [REQUIRED]: Main
Anything else relevant?
The text was updated successfully, but these errors were encountered: