mirror of
https://github.com/juanfont/headscale.git
synced 2025-09-25 17:51:11 +02:00
policy: validate protocol and portnumber
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
a31249c043
commit
ab7eefb9c9
@ -1720,6 +1720,11 @@ func (p *Policy) validate() error {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Validate protocol-port compatibility
|
||||
if err := validateProtocolPortCompatibility(acl.Protocol, acl.Destinations); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
}
|
||||
|
||||
for _, ssh := range p.SSHs {
|
||||
|
@ -352,20 +352,6 @@ func TestUnmarshalPolicy(t *testing.T) {
|
||||
name: "2652-asterix-error-better-explain",
|
||||
input: `
|
||||
{
|
||||
"acls": [
|
||||
{
|
||||
"action": "accept",
|
||||
"src": [
|
||||
"*"
|
||||
],
|
||||
"dst": [
|
||||
"*:*"
|
||||
],
|
||||
"proto": [
|
||||
"*:*"
|
||||
]
|
||||
}
|
||||
],
|
||||
"ssh": [
|
||||
{
|
||||
"action": "accept",
|
||||
@ -375,9 +361,7 @@ func TestUnmarshalPolicy(t *testing.T) {
|
||||
"dst": [
|
||||
"*"
|
||||
],
|
||||
"proto": [
|
||||
"*:*"
|
||||
]
|
||||
"users": ["root"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user