-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
feat(inputs.radius): Add radius plugin for simple radius auth response time monitoring #12736
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Hr0bar for this awesome contribution!!! I have a few comments in the code. Besides from this, I'd like to ask you to split this into two PRs, one for each plugin. Furthermore, we need some testing...
Focusing on the RADIUS plugin for now, is there a way to test this against a docker container like FreeRadius? If so you could use code similar to this...
Added the mentioned changes. Should I close this PR to open new ones for each plugin separately? Seems both upstream tacplus and radius go packages have some sort of testing servers implementations or examples in them, could be perhaps used for the tests (gotta check whats allowed by telegraf test environment - if I can temporarily listen on some ports etc, or if the container approach is required) And a sidenote, im not the original author in our org, so no need to thank me, Im just trying to get it merged :) |
@Hr0bar the best is to keep the Radius part in this PR (change description, title etc) and open a new PR for the tacacs plugin. Furthermore, I take the liberty to thank you anyway for contributing those missing pieces and like to ask you to also thank your co-worker for the implementation! :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice update @Hr0bar! For the Radius plugin part there are only a few small comments and the request to add test(s). Best would be to base them on the server example of the library and, if possible, add an integration test against a docker container. If you need help, please let me know!
Ill have a look at creating the tests hopefully in near future. Meanwhile the tacacs part is split to separate PR now. Latest comments reflected in the code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very close. Some more small comments. Looking forward to the test. Hope to get this in for v1.26...
Added the response_code as a tag. btw thrown together some tests just now as a skeleton to start, doesnt work at all yet, im not sure if its even possible to listen on port during testing in circleci? Or is local temporary file socket needed instead? Gotta have a look at the testing packages/methods provided by telegraf I guess. The container needs config via mountpoint, the mariadb example should be helpful there. Is the container found&downloaded automagically if its present on docker hub or it needs to be enabled somewhere?
|
@Hr0bar you can listen on a port and the tests look good at a first glance. One request would be to use a dynamic port so prevent later (parallel) tests to interfere because they are using the same port... |
@Hr0bar can you please add the test above to your PR!?! For the TODO in the test (regarding mounting) you can take a look at the |
Added draft version of the tests, I could not run them locally due to problems/bad setup on my Windows machine, so I expect them needing more work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks for contributing and working on this plugin @Hr0bar!
This reverts commit c483b4b.
There were conflicts, so I have rebased you on master. I will wait for tests. |
The radius integration test is the thing that is failing currently:
This usually means that the container is missing something to start up or some option was omitted. @Hr0bar are you able to reproduce locally? |
@powersj I dont have setup for testing the containers right now. There was one run with what I think was the same config as right now, that started OK:
So seems non-deterministic. First guess is that some additional wait condition is needed to wait for certain container log output before we issue the Start(), Ill likely need to spin up local docker to see whats going on inside. |
Im afraid Im lost, tried it locally after setting powerful enough test env for Integration tests, tried with different setups but it seems to be failing because of poor support for UDP by the testcontainer tool. Looking at the testcontainer project repo it has too many open PRs / Issues regarding UDP exposing + dynamic mapping waiting to be resolved for some years now. Unless I find a working example how to achieve fully functioning UDP testcontainer with dynamic port mapping I think we will need to stick to the simple test with local Radius server, and not use full container Integration test. |
I think I'm good with the switching to a generic server. @srebhan thoughts? |
Its possible I may be missing something obvious though, that I couldnt get to the container with UDP. |
I don't think you are :( I was reproducing this locally as well yesterday. After playing with the container itself and config I was also running into issues. |
@Hr0bar I do have massive issues to setup the container with the configs by hand (without Telegraf being involved) to make a |
@srebhan I just tried something 1 minute ago and seems I got successful tests with the container. Im going to sleep now but I expect to commit the changes tomorrow morning. In short, the issue seems to be in here in telegraf wrapper around testcontainers: If I comment those lines I get the UDP working fine (but I already have some other changes as well so no idea if it works with the current PR) and just received all tests passing on my test box. But I need to confirm tomorrow. |
Seems everything is passing now, except telegraf internal tests regarding the port mapping behavior. Nothing else seems impacted. The extra wrapper that is removing the proto part from ports needs to be checked why it was done like that and the below test adjusted likely.
The logline: could likely include the protocol part - p.Proto() so its clear in the logs whats going on |
@Hr0bar I took the liberty to fix the test-container issue in your branch. Hope that is ok for you!? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one more suggestion... :-)
Co-authored-by: Sven Rebhan <[email protected]>
Download PR build artifacts for linux_amd64.tar.gz, darwin_amd64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for taking the time to put up this PR and work through the integration tests!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! Thanks for this great contribution @Hr0bar!
Opening PR after discussion in this Issue: #12573
Summary: In our org we build custom telegraf binary, with added tacacs&radius simple auth response time monitoring plugins, this PR explores discussed possibility of merging it upstream.