Skip to content
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

[Added] account name checks for leaf nodes in operator mode #1739

Merged
merged 4 commits into from Nov 24, 2020

Conversation

matthiashanel
Copy link
Contributor

Rules out implausible ones

Signed-off-by: Matthias Hanel mh@synadia.com

Rules out implausible ones.

Signed-off-by: Matthias Hanel <mh@synadia.com>
server/server.go Outdated
@@ -451,6 +451,18 @@ func NewServer(opts *Options) (*Server, error) {
return nil, fmt.Errorf("no local account %q for remote leafnode", r.LocalAccount)
}
}
} else {
if len(opts.LeafNode.Users) != 0 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would that be possible to move those checks in validateLeafNode() which checks for options?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

absolutely, I placed them here because of the non operator mode checks. Ok to move all those checks?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That being said, I am not sure since we call this in NewServer()

if err := validateOptions(opts); err != nil {
    return nil, err
}

but before we actually process the trusted keys:

	// Trusted root operator keys.
	if !s.processTrustedKeys() {
		return nil, fmt.Errorf("Error processing trusted operator keys")
	}

would have to make sure that the validation of leafnode would still work if you move them there.

server/leafnode_test.go Outdated Show resolved Hide resolved
Signed-off-by: Matthias Hanel <mh@synadia.com>
server/leafnode.go Show resolved Hide resolved
server/leafnode.go Outdated Show resolved Hide resolved
Signed-off-by: Matthias Hanel <mh@synadia.com>
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there :-)

server/leafnode.go Outdated Show resolved Hide resolved
server/leafnode.go Show resolved Hide resolved
Signed-off-by: Matthias Hanel <mh@synadia.com>
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants