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

Extend email plugin settings api #48048

Merged
merged 11 commits into from
Oct 30, 2024
21 changes: 21 additions & 0 deletions api/proto/teleport/legacy/types/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6612,6 +6612,27 @@ message SMTPSpec {
string host = 1;
// Port specifies the SMTP service port number.
int32 port = 2;
// StartTLSPolicy specifies the SMTP start TLS policy used to send emails over
// SMTP.
SMTPStartTLSPolicy start_tls_policy = 3;
}

// 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;
bernardjkim marked this conversation as resolved.
Show resolved Hide resolved
}

message PluginBootstrapCredentialsV1 {
Expand Down
24 changes: 24 additions & 0 deletions api/types/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,30 @@ func TestPluginEmailSettings(t *testing.T) {
require.NoError(t, err)
},
},
{
name: "(smtp) change start TLS policy",
mutateSettings: func(s *PluginEmailSettings) {
s.Spec = &PluginEmailSettings_SmtpSpec{
SmtpSpec: &SMTPSpec{
Host: "smtp.example.com",
Port: 587,
StartTlsPolicy: SMTPStartTLSPolicy_SMTP_OPPORTUNISTIC_START_TLS,
},
}
},
creds: &PluginCredentialsV1{
Credentials: &PluginCredentialsV1_StaticCredentialsRef{
&PluginStaticCredentialsRef{
Labels: map[string]string{
"label1": "value1",
},
},
},
},
assertErr: func(t require.TestingT, err error, args ...any) {
require.NoError(t, err)
},
},
}

for _, tc := range testCases {
Expand Down
Loading
Loading