Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
- Set enum 0 as UNSPECIFIED
- Update enum names
  • Loading branch information
bernardjkim committed Oct 29, 2024
1 parent 0e32242 commit b4f5ab5
Show file tree
Hide file tree
Showing 4 changed files with 393 additions and 382 deletions.
29 changes: 16 additions & 13 deletions api/proto/teleport/legacy/types/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6620,19 +6620,22 @@ message SMTPSpec {
// SMTPStartTLSPolicy defines the start TLS policy used to communicate with the
// SMTP service.
enum SMTPStartTLSPolicy {
// SMTP_MANDATORY_START_TLS means that SMTP transactions must be encrypted.
// SMTP transactions are aborted unless STARTTLS is supported by the
// SMTP server. Recommended for all modern SMTP servers.
SMTP_MANDATORY_START_TLS = 0;

// SMTP_OPPORTUNISTIC_START_TLS means that SMTP transactions are encrypted if
// STARTTLS is supported by the SMTP server. Otherwise, messages are
// sent in the clear.
SMTP_OPPORTUNISTIC_START_TLS = 1;

// SMTP_NO_START_TLS means encryption is disabled and messages are sent in the
// clear.
SMTP_NO_START_TLS = 2;
// SMTP_START_TLS_POLICY_UNSPECIFIED is the default zero value.
SMTP_START_TLS_POLICY_UNSPECIFIED = 0;

// SMTP_START_TLS_POLICY_MANDATORY means that SMTP transactions must be
// encrypted. SMTP transactions are aborted unless STARTTLS is supported by
// the SMTP server. Recommended for all modern SMTP servers.
SMTP_START_TLS_POLICY_MANDATORY = 1;

// SMTP_START_TLS_POLICY_OPPORTUNISTIC means that SMTP transactions are
// encrypted if STARTTLS is supported by the SMTP server. Otherwise, messages
// are sent in the clear.
SMTP_START_TLS_POLICY_OPPORTUNISTIC = 2;

// SMTP_START_TLS_POLICY_DISABLED means encryption is disabled and messages
// are sent in the clear.
SMTP_START_TLS_POLICY_DISABLED = 3;
}

message PluginBootstrapCredentialsV1 {
Expand Down
3 changes: 3 additions & 0 deletions api/types/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,9 @@ func (c *SMTPSpec) CheckAndSetDefaults() error {
if c.Port == 0 {
return trace.BadParameter("port must be set")
}
if c.StartTlsPolicy == SMTPStartTLSPolicy_SMTP_START_TLS_POLICY_UNSPECIFIED {
c.StartTlsPolicy = SMTPStartTLSPolicy_SMTP_START_TLS_POLICY_MANDATORY
}
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion api/types/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,7 @@ func TestPluginEmailSettings(t *testing.T) {
SmtpSpec: &SMTPSpec{
Host: "smtp.example.com",
Port: 587,
StartTlsPolicy: SMTPStartTLSPolicy_SMTP_OPPORTUNISTIC_START_TLS,
StartTlsPolicy: SMTPStartTLSPolicy_SMTP_START_TLS_POLICY_OPPORTUNISTIC,
},
}
},
Expand Down
Loading

0 comments on commit b4f5ab5

Please sign in to comment.