-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[Feature] Headscale policy set validate ACL before applying? #2044
Comments
Also see #2045 - I'm happy to contribute but writing design docs is rather outside my area of expertise, and you probably wouldn't want any code contributions from me as I'm very much a novice. |
Would make sense, @pallabpain are you able to take a look? |
Yes, I'll take a look. @dragon2611 It'd be great if you could share the policy file you were trying to apply. Although the SetPolicy API does validate the payload Line 723 in 948d53f
|
Whilst I'd rather not post the entire ACL The thing that seemed to trip things up was
What appeared to work was however
|
Thanks. This helps. I'll use this for debugging the issue. |
No problem, just be wary github initially parsed it I think as the * wasn't showing. Was having a bit of problem with the formatting. |
So the issue is that while the policy may be a valid HuJSON/JSON that can be marshaled into the policy struct, it may not have the right values expected in the policy. The current code only ensures format. |
I'm guessing the tailscale client didn't like the lack of a port definition, which is weird as for no TCP/UDP traffic there wouldn't be a port anyways. |
Per Tailscale docs, the port is expected. |
@kradalby I couldn't find anything in the tailscale client that I can use to validate the policy. Looks like it has to be implemented in headscale. |
Slightly offtopic but in our company we have integration tests for ACL changes using NixOS VMs based testing framework. The misconfiguration were a coomon thing before that. So I can imagine how proper validation tests could help a lot with ACLs. |
this commit aims to improve the feedback of "runtime" policy errors which would only manifest when the rules are compiled to filter rules with nodes. this change will in; file-based mode load the nodes from the db and try to compile the rules on start up and return an error if they would not work as intended. database-based mode prevent a new ACL being written to the database if it does not compile with the current set of node. Fixes juanfont#2073 Fixes juanfont#2044 Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
I think this is being solved, or at least improved in #2089 |
Use case
Is it possible to have the headscale policy set command run validation before applying the policy and only load the policy if it passed syntax checking.
Description
I accidentally put autogroup:internet instead of autogroup:internet:* and it really didn't like that.
Basically all the clients started throwing back
Could not get the create map update error="strconv.ParseUint: parsing \"internet\": invalid syntax"
and I'm pretty sure they all dropped off the tailnet.Contribution
How can it be implemented?
No response
The text was updated successfully, but these errors were encountered: