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

Allow TLS cipher suites to be set for the OPA server #6537

Merged

Conversation

ashutosh-narkar
Copy link
Member

This change adds a new flag to opa run to allow users to specify a list of enabled TLS 1.0–1.2 cipher suites. This allows users to control the cipher suites the OPA server supports during a TLS handshake.

Copy link
Contributor

@charlieegan3 charlieegan3 left a comment

Choose a reason for hiding this comment

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

This looks good to me, is there an issue we might link to or create to add context to the request? TLS 1.3 nearly 6 years old and < 1.2 is deprecated.

test/e2e/tls/tls_test.go Show resolved Hide resolved
cmd/run.go Outdated
@@ -221,6 +225,7 @@ Current behaviors enabled by this flag include:
runCommand.Flags().IntVar(&cmdParams.rt.GracefulShutdownPeriod, "shutdown-grace-period", 10, "set the time (in seconds) that the server will wait to gracefully shut down")
runCommand.Flags().IntVar(&cmdParams.rt.ShutdownWaitPeriod, "shutdown-wait-period", 0, "set the time (in seconds) that the server will wait before initiating shutdown")
runCommand.Flags().BoolVar(&cmdParams.skipKnownSchemaCheck, "skip-known-schema-check", false, "disables type checking on known input schemas")
runCommand.Flags().StringSliceVar(&cmdParams.cipherSuites, "tls-cipher-suites", []string{}, "set list of enabled TLS 1.0–1.2 cipher suites")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth noting for which requests these will be used for? aka, not http.send?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since it's a flag on opa run and the other tls-related flags don't specify anything in particular, I think we should be fine. We can always update if users have questions.

charlieegan3
charlieegan3 previously approved these changes Jan 23, 2024
Copy link
Contributor

@johanfylling johanfylling left a comment

Choose a reason for hiding this comment

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

Looks god 👍 . Just a couple of comments.

cmd/run.go Outdated
}

for _, c := range tls.InsecureCipherSuites() {
cipherSuitesMap[c.Name] = c.ID
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we take the opportunity here to warn about the user specifying an insecure suit?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking about it but we have no logger initialized at this point and adding a print did not seem that important. We could move this in the runtime if necessary but doesn't feel like.

cmd/run.go Show resolved Hide resolved
@@ -400,6 +401,12 @@ func (s *Server) WithNDBCacheEnabled(ndbCacheEnabled bool) *Server {
return s
}

// WithCipherSuites sets the list of enabled TLS 1.0–1.2 cipher suites.
Copy link
Contributor

Choose a reason for hiding this comment

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

Some of the supported suites accepted by verifyCipherSuites() are compatible with TLS 1.3: TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384, TLS_CHACHA20_POLY1305_SHA256. Is this description wrong, or is something else in play here that disqualifies 1.3?
If the former, maybe we should not be so specific in the description.
If the latter, then we should probably make sure the user can't select these suites in the first place.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, It's the latter. See my comment below 👇 .

server/server.go Show resolved Hide resolved
cmd/run_test.go Show resolved Hide resolved
This change adds a new flag to `opa run` to allow
users to specify a list of enabled TLS 1.0–1.2 cipher
suites. This allows users to control the cipher suites
the OPA server supports during a TLS handshake.

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
@ashutosh-narkar ashutosh-narkar merged commit 737b213 into open-policy-agent:main Jan 23, 2024
25 checks passed
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

3 participants