kubernetes-client / c

Official C client library for Kubernetes
Apache License 2.0
146 stars 45 forks source link

secure_getenv() returns NULL when I do setcap to executable file. #101

Closed JayJay-K closed 2 years ago

JayJay-K commented 2 years ago

I made executable file in the linux by using kubernetes-client/c code. There was a problem because secure_getenv( ) returned NULL when I did setcap to the executable file. I have to use setcap to the executable file because it's a non-root process and it needs some linux capabilities.

How can I solve the problem, if I have to use setcap to the executable file? I checked the manual for secure_getenv() and I guess my program requires "secure execution" in the manual Do I have to use secure_getenv() instead of simple getenv() in this situation?

ityuhui commented 2 years ago

I think setcap and secure_getenv cannot take effect at the same time. If you need setcap, you can use getenv instead but there are vulnerabilities that could occur if set-user-ID or set-group-ID programs accidentally trusted the environment.