-
Notifications
You must be signed in to change notification settings - Fork 50
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
Sanity check secrets in freeradius::client #163
Conversation
I've implemented the logic like this so we can add other "illegal" chars easily if we find them.
I haven't done this myself so I'm not quite sure... but is it possible to create a new data type with this validation that can be used in place of |
Hmm, I'm not actually sure how to create custom variable types in Puppet. I've definitely created custom resource types, but that's different. I wonder if passwords would have different valid chars in different places? I had a quick google, I'm surprised there isn't a String subtype which validates a regex. I think this sort of thing is a good thing to look in to as a mini refactor project - would that work? I can create an issue for it, and we can track it for the future. |
I may well have imagined this feature, so don't worry too much about it! |
No, you haven't imagine it, it's real. You can create a data type defining it in a directory named
this a definition I have for a type named What I don't know if it is possible is to define it like a string without
|
Ohh nice! Go team :) Ok, let me test this and refactor it with something like that in the next day or so. |
… with Pattern, and also create a type for passwords
OK - I've implemented 2 types: Freeradius::Password and Freeradius::Secret. I've done these separately, as I figure we might want to get a bit more specific about what each is allowed in the future - I'm not sure if a RADIUS secret has char limits, or length limits, for example. I've set the types for a handful of classes and resource types to match, and have created test cases for each of these. @amateo as it turns out, we didn't even need to look outside this repo for examples of Pattern - you had done several 4 years ago! |
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.
Excellent, looks great
Clients can accept secrets with a newline as part of the string, which causes the RADIUS system to restart and.. fail to start, because the resulting config is something like:
This PR implements a basic check which looks for a negative answer to "is this entire string not
\n
chars", and then raises an error. I've implemented the logic like this so we can add other "illegal" chars easily if we find them.