-
Notifications
You must be signed in to change notification settings - Fork 467
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
Hostname resolution of API client is not updated timely #2872
Comments
@moritzj29: Thanks for opening an issue, it is currently awaiting triage. In the meantime, you can:
DetailsI am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository. |
from my very low knowledge around the subject, by default golang uses the local system dns resolver to find the ip address (and will inherit any caching from the dns resolver itself), however, if you are storing the names within /etc/hosts file for golang to be more performant it will only read this file on the first http request and then cache it for the rest of the life cycle. if it is the latter then I would be wary to change this behaviour as reading a file per request depending on the size will cause extreme CPU/RAM overhead for very little gain. |
thanks for your reply! actually I did not set any entry in also clearing the systems DNS cache had no effect. For me it looks like that the hostname is not resolved for every http request but just retried with the same IP over and over again (which would also make sense in some cases, but maybe not for a 404). For now I added a static hosts entry in |
further investigation shows there is no caching on golang side unless the developers have implemented it, we use the default http handler. The only thing it could be is when we hit a retry loop since the resolution has already been done, then this may cause the issue but I have been trying to replicate it over the weekend to no avail. classing this as not planned until a reproducible scenario can be achieved |
What happened?
My issue is with cs-firwall-bouncer-iptables, but I guess its is a general API client topic.
I have a setup where crowdsec LAPI is running on a different host than the bouncer. Therefore the bouncer needs to connect to the LAPI via URL (not just 127.0.0.1).
I had some issues with hostname resolution on my machine. Consequently, also the crowdsec LAPI could not be reached anymore as apparent from the 404 error code:
But even after fixing my DNS issues on the machine and name resolution is working fine again (tested with nslookup), the crowdsec bouncer still gives the same 404 error code.
When I restart the crowdsec-firewall-bouncer everything is working immediately.
I suppose the API client still uses the wrong IP and does not try to resolve the hostname again (at least within 1h).
Only upon restart the hostname is resolved again.
What did you expect to happen?
crowdsec API client should try to resolve the hostname for every request (at least if it is failing) and use the most recent resolved IP.
How can we reproduce it (as minimally and precisely as possible)?
actually I can just reproduce it the other way around, but it still demonstrates that changes to the DNS config are not picked up timely:
Anything else we need to know?
No response
Crowdsec version
OS version
Enabled collections and parsers
Acquisition config
On Windows:
C:> Get-Content C:\ProgramData\CrowdSec\config\acquis.yaml
paste output here
Config show
Prometheus metrics
Related custom configs versions (if applicable) : notification plugins, custom scenarios, parsers etc.
The text was updated successfully, but these errors were encountered: