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

Cluster Configuration #1430

Merged
merged 2 commits into from
Oct 27, 2017
Merged

Cluster Configuration #1430

merged 2 commits into from
Oct 27, 2017

Conversation

russjones
Copy link
Contributor

@russjones russjones commented Oct 25, 2017

Purpose

Create a services.ClusterConfig which contains a field that controls where (and if) a session is recorded.

Implementation

  • Created a services.ClusterConfig resource which holds cluster level configuration. At the moment it only stores where a session should be recorded.
  • If session recording is disabled, then we use the new events.discardSessionLogger.

Related Issues

Fixes #1329
Fixes #1263

Copy link
Contributor

@klizhentas klizhentas left a comment

Choose a reason for hiding this comment

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

I need to review more, but here is my initial feedback (see in the comments)

@@ -27,8 +27,8 @@ import (
)

// NewRoleAuthorizer authorizes everyone as predefined role
func NewRoleAuthorizer(r teleport.Role) (Authorizer, error) {
authContext, err := contextForBuiltinRole(r)
func NewRoleAuthorizer(recordAtProxy bool, r teleport.Role) (Authorizer, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not scalable, I would assume that proxy will switch to different role name based on whether it is recording or not, why does authorizer has to know about this flag?

Copy link
Contributor Author

@russjones russjones Oct 26, 2017

Choose a reason for hiding this comment

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

Ideally the proxy would have it's own role, but to access the Auth Server to find out if it's recording or not, it first it has to register itself with the Auth Server with the role it will assume, which it can't do because it has not connected to the Auth Server yet.

So we have two choices, either we make the authorizer smarter (what I did in this PR) or we create another role that can just be used to query the Auth Server for services.ClusterConfig. With the second approach, we can't change roles on the fly.

I can change the behavior here so it takes a services.ClusterConfiguration that way it can change it's value on the fly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@klizhentas As per our discussion, I've backed out these changes. I'll address this in another PR since this one has gotten too big already: #1431

return nil, trace.Wrap(err)
}
var recordAtProxy bool
if clusterConfig.GetSessionRecording() == services.RecordAtProxy {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would assume two different builtin proxy roles based on whether proxy is recording or not, rather than modifying the role on the fly.

package events

/*
Package events currently implements the audit log using a simple filesystem backend.
Copy link
Contributor

Choose a reason for hiding this comment

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

this line should go right above package entry to be viewable in godoc, to check simply do godoc and the name of the module

if cfg.Auth.ClusterConfig.GetSessionRecording() == services.RecordOff {
recordSessions = false

warningMessage := "Warning: Teleport session recording have been turned off. " +
Copy link
Contributor

Choose a reason for hiding this comment

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

same message duplicated twice, make a constant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a different message. In the other message, the audit log and session log were disabled.

return &cc, nil
}

// ClusterConfigV2 implements the ClusterConfig interface.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we are on V3 as a baseline for resources

all := []string{string(RecordAtNode), string(RecordAtProxy), string(RecordOff)}
ok := utils.SliceContainsStr(all, string(c.Spec.SessionRecording))
if !ok {
return trace.BadParameter(`session_recording must either be "node", "proxy", or "off".`)
Copy link
Contributor

Choose a reason for hiding this comment

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

strings.Join(all, ",")

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.

3 participants