I’ve been applying Authentication Policy to my testing service using JWT. I have followed the guide on this link: https://istio.io/docs/tasks/security/authn-policy/#end-user-authentication. And yes, it did work as expected. But when I tried to using a different pod image, it did not work even though almost everything is the same. Is there anyone facing this issue? And know the reason why it did not work in my case? Thank you very much!
Hi @YangminZhu,
Yes, I did deploy to namespace ‘foo’ for the hostname. I forgot to put it into the yaml above. Everything will be deployed into namespace ‘foo’. But it did not work!
I have tried to use another image to test it and it’s working now.
What do you mean it did not work? Is the request with the JWT token being rejected? or a request without JWT token being accepted?
What I meant it did not work means the JWT policy did not take affect, the request still returns status of 200. Like there is no policy applied to the service.
I did not know why it did not affect with the image which I used in the yaml above. Sorry, I did refresh the cluster and use a different image, so I don’t have the log right now but as far as I remembered the Istio-proxy logs is normal, I don’t know how to get the Pilot logs yet (please guide me if you know).
I am having the same issue! I checked out the link that @YangminZhu sent and there was a discrepancy in step 4 in that there was no local_jwks set.
It is useful to know what the issue is but might be better if the documentation described how to fix it. Maybe an unknown issue?
I have listed my environment below after reapplying it.
My Environment:
[procyclinsur@P-428 k8s]$ for i in `ls`; do kubectl apply -n solarmori -f $i ; done
configmap/core-api-config-map created
deployment.extensions/core-api-app created
gateway.networking.istio.io/core-api-gateway created
virtualservice.networking.istio.io/core-api-virtual-service created
policy.authentication.istio.io/core-api-policy created
service/core-api-service created
@Guilherme_Durazzo have you found out and fixed the issue in the meantime ?
I have the same problem although policy is in the same namespace, target is the service name ‘letsencryptverifier’ and the service’s port is called http-letsencrypt.
There is a default policy for mutual TLS active and the specific policy for testing JWT auth
There is a default policy for mutual TLS active and the specific policy for testing JWT auth
Are you having 2 authentication policies for the same service? (i.e. 2 different Policy with the same target letsencryptverifier). If so, could you remove any extra Policy and make sure there is only 1 Policy selecting the target letsencryptverifier?
This seems indicating Pilot somehow failed to get the JWT public key at jwksUri. Would you mind to check the pilot logs and see if there is anything related to pubkey or jwt?
I’ve deleted the default policy and edited the specific one, but no success so far.
Unfortunately I don’t have a good understanding how information like policies are handled in istio. I’d expected pilot to distribute policies to the envoys, but I cannot nail it down in pilot’s logs, not even in log=tracing mode. Policies and destinationrules unfortunately don’t manifest in istioctl (or do they ?)
As an update: I created a meshpolicy with JWT auth and that works fine.
Second update: dumping the envoy config with http://localhost:15000/config_dump (after forwarding the port of the istio-proxy) shows clearly that the JWT config is available as http_filter