-
Notifications
You must be signed in to change notification settings - Fork 86
Adds wildcard support for email addresses #73
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
base: main
Are you sure you want to change the base?
Conversation
|
Thanks for putting this together. Very excited to have wildcard matching, a lot of users have been asking for it.
I don't think we should ever have the full regex schema in
This PR #68 is adding group claim matches using the kube authentication syntax We could extend this syntax to other claims like email or sub. Using this approach we could add Which would be equivalent to *@example.com without having to worry about emails that have This would allow any email address which matches with the username such as alice alice@example.com. Similar to the idea suggested here: #41 As a security precaution we'd want to reject any email address which started with I'm still thinking this through, what do you think? |
|
Sounds good! It's more expressive and in the same sense I was also thinking about separating Email and Sub so that is then also done. The fallback behavior is then to treat everything that doesn't have the kube config URN as "EmailOrSub"?
I'm not sure if I'm a fan of the substitutions. Everything that is not explicitly in here and subject to change over the lifetime of a system has nasty security implications. That also is true for wildcards but there we are explicitly allowing everything. In this example a user would want the current users, but does he really want to also add "root" or "opksshuser" ? Nevertheless I guess this can be abandoned then. |
|
My comments below are not a request to add substitutions to this PR. I don't think substitutions should be in this PR. I plan to roll these ideas and discussions into an issue to consider the future design for substitutions.
@Jonhu I agree and I'm trying to think about the least footgun way to solve this. Let me give you the requirements and rather a solution: Many organizations and many universities have the pattern username@example.edu and then username for linux, windows, etc... If they have 20,000 students they don't want a auth_id file that is 20,000 lines long that looks like: Now if they have a student named Randel Oot (R. Oot), they have a pattern and notice if they gave him root@example.edubad things would happen. So he gets the email randel.oot@example.edu or something like that. But what if the system for adding new emails is compromised, someone could create a root@example.edu and then get root on everything. That's bad and they need a mechanism to prevent that. So you really want to say, do this substitution for everything but root, backup, etc etc... Now one solution which has been proposed is to have an AuthorizedKeysCommand for opkssh. This would let anyone represent any complex policy by writing a script. I think we have to build that at some point because it is so useful, but it is also more configuration work for the admin. What are your thoughts? |
yes |
I don't think you should to abandon this PR, if that is what you are asking. You are mostly done it is just a syntax issue. |
Yeah this gets quite complex. As long as we maintain auditable logs who was who for how long this should be an opinionated solution that works without those edge cases.
I think this would be beneficial for those cases too and would also allow for substitutions if someone really wants it.
Ah I've read #68 wrong - I'll adjust it here! On that then: how do we deal with multiple matches in the auth_id file? I'm not a fan of ordering within the file - would an |
Ordering shouldn't matter. Since auth_id is an allow list, the first match which allows the requested principle lets them log in. If they match multiple times we don't care because they only need to match once. This is also how SSH auth_id works. |
|
ah, wildcard support for emails, just what I was looking for. Can this be taken out of draft now? |
|
@Jonhu Are you still working this? @aaron-riact If you want an immediate solution you can use the policy plugin system that will do email wildcarding https://github.com/openpubkey/opkssh/blob/main/docs/policyplugins.md#example-policy-configs |
|
@aaron-riact Open an issue if you run into any problems. I want the policy plugin experience to be easy to setup and use |
Issues:
#41
#461
Example on how a basic wildcard identification could be done in /etc/opk/auth_id .
I explicitly did not implement the whole regex schema as the use case has to be proven first and it'd be a bit more work to do good.
To clarify:
Currently *@example.com is both a wildcard and a valid email address and thus has a double use and cannot be explicitly granted access. This would of course be bad for someone who has that address but wouldn't compromise security.
Another option would be to include another column in the auth_id table to allow for wildcards on domain level.
@EthanHeilman any thoughts?