-
Notifications
You must be signed in to change notification settings - Fork 828
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
POST request to get token is hanging out for all UAA 77.x.x version #3104
Comments
A reason for "hanging" could be fips compliant version of bouncy castle. Can you provide the docker file and how you setup UAA . You need to set with property and we know from some platforms that even then dev/random is used with FIPS version. so you need to gather more random... if the issue is, what I assume that it could be, e.g. https://stackoverflow.com/questions/26021181/not-enough-entropy-to-support-dev-random-in-docker-containers-running-in-boot2d |
Hello @strehle ; following is docker file
This property("java.security.egd", "file:/dev/./urandom") was added 2 years ago. |
Please try tomcat:9-jdk17-openjdk-slim The start of the UAA is normal ? I assume if you do "uaac token get client xxx " then you see the hanging. Do you run your docker on a RHEL VM ? Ask because we have seen this behavior and this there is a work around, see https://issues.redhat.com/browse/RHEL-3478 , means -Dsecurerandom.strongAlgorithms=PKCS11:SunPKCS11-NSS-FIPS |
tomcat:9-jdk17-openjdk-slim did not help. Deploy new image on any k8s environment, port forward. Then try to get token via Postman. The issue was observed when I was trying to get token in 2nd/3rd time. |
Yes, but then we can close this and you run an insecure UAA. If you want have solved this with newer UAAs, then I need your help in try-out, because K8s is something which I have no option to test. I run UAA sometimes also in a docker env, but locally and as mentioned we have seen issues, if we run this on RHEL VMs. With UAA 77.x the bc-fips replaces the bc-java for signature creation. This was not the only change for the major upgrade, but one reason why we moved from 76.x -> 77.x If you are willing to test, then here is another test where you can setup system properties From there I would give a try to
So should decide whether you close this or we proceed in finding the reason. I mentioned this because you can decide on it. |
i replaced |
ok, thanks for keeping on it. and yesCentOS is a RedHad derivate, means it behaves similar...; so this here is the bug which is relevant for your case I have noticed, that the combination of JDK17 and RHEL8/9 (dont know what it means on CentOS but the have relations) and this will be fixed with newer version. The issue is here is only for your information. A real solution now whould be to setup a deamon for your entropy, e.g. rngd or havedge Then it should work without extra system settings and best: you run your UAA with more secure signatures because your random is now good enough. |
Close this now, but commented for later - simply. |
Hello @strehle : Unfortunately it did not resolve the issue; it worked only one time. |
on your host , can you just execute cat /proc/sys/kernel/random/entropy_avail , you can execute it selveral times..... and if you seen hanging UAA then this number may is very low. If this expectation is true, then you should install on your host haveged |
Hello @strehle : Following is the result when i execute cat /proc/sys/kernel/random/entropy_avail for uaa version 76.31.0 and uaa version 77.19.0
77.19.0
The consensus is that numbers below 1000 will lead to processes blocking waiting for more entropy. |
I re-opend the ticket/issue, because I think about adding a YAML options for your case Your results are expected. The 77.x uses /dev/random not urandom and this random gets empty and then it waits for more :-) that is the reason why you are waiting... The better solution would be to add a daemon ( havedge or rngd=) which fill-up your random again and then you dont have a problem. A workaround would be use change the algorithm. We had similar issue in a forked UAA and solved it with some extra settings. Therefore we should add this to community UAA, however the best solution is to have a stable random device |
I tried to install the rng-tools package and map it to use the /dev/urandom inside docker container.
Unfortunately it did not help. |
The docker container uses /dev/random, even if you setup /dev/urandom. |
Hello @strehle : no problem with some days for preparing new packaging. I will test it and let you know the result. Many thanks in advance. |
Hello @strehle : Do you think I can have new packaging from you this week for testing ? 🙏 |
will do it tomorrow. I have a RHEL 8 for validation and for me it worked with
see: If you have no success with it, I will send you a uaa.war (based on 77.19.0) with this setting at a early UAA start, then it should work for sure |
Tried with
Unfortunately it did not help, The issue was observed when I was trying to get token in 3rd time. Following is the result when i execute cat /proc/sys/kernel/random/entropy_avail
|
Ok, the system does not allow you to set it. The war is more than I can upload. Is a war (based on 77.19.0) enough for you ? if yes, can you provider a place where I can upload 60 MBs for you ? Otherwise here is the patch With the patch after start you see in uaa.log ERROR --- YamlServletProfileInitializer: Current securerandom.strongAlgorithms: NativePRNGBlocking:SUN,DRBG:SUN So is only an error, because then you can better search for it, however the point is, if you see this, then you have the patched UAA running and then it will work.... as mentioned I can verify your issue on a RHEL8 with a simply loop around "uaac token client get admin -s adminsecret" |
Hi @strehle : is it possible commit your algorithm.patch in dedicated branch as https://github.com/cloudfoundry/uaa/tree/77.19.0-algorithm-patch or what ever name you wish that I can build war file easily ? I had this auto script for building it. |
|
https://github.com/cloudfoundry/uaa/tree/77.19.0-algorithm-patch resolved this issue. 🙏 🙏
I can see 2 ERROR above relating to securerandom.strongAlgorithms in uaa logs
That's great work. |
What version of UAA are you running?
77.x.x versions
How are you deploying the UAA?
deployed UAA docker image in kubernetes
What did you do?
upgrading uaa version from 76.31.0 to 77.x.x version
What did you expect to see? What goal are you trying to achieve with the UAA?
Everything works fine as UAA version 76.31.0; POST request to get token is not hanging out
What did you see instead?
Faced with the issue that the first POST request to get token is success, the following requests are hanging without any errors in the logs.
The logs contains two POST request fetching tokens. The first POST request was made at:
[2024-10-15 08:41:13.549] uaa - 1 [http-nio-8080-exec-3] .... DEBUG — FilterChainProxy: Securing POST /oauth/token
and got response without delays:
[2024-10-15 08:41:14.208] uaa - 1 [http-nio-8080-exec-3] .... DEBUG — DispatcherServlet: Completed 200 OK
The second request was made at
[2024-10-15 08:42:18.699] uaa - 1 [http-nio-8080-exec-6] .... DEBUG — FilterChainProxy: Securing POST /oauth/token
and stuck at:
[2024-10-15 08:42:18.943] uaa - 1 [http-nio-8080-exec-6] .... DEBUG — DataSourceUtils: Fetching JDBC Connection from DataSource
The response was received at:
[2024-10-15 08:43:43.745] uaa - 1 [http-nio-8080-exec-6] .... DEBUG — DispatcherServlet: Completed 200 OK
The text was updated successfully, but these errors were encountered: