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

Fail to send alert messages via mail with tls enabled on a port other than 465 #1384

Closed
xiaosuiba opened this issue Jun 22, 2021 · 0 comments · Fixed by #1388
Closed

Fail to send alert messages via mail with tls enabled on a port other than 465 #1384

xiaosuiba opened this issue Jun 22, 2021 · 0 comments · Fixed by #1388
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@xiaosuiba
Copy link
Contributor

What happened:
Fail to send alert messages via mail with tls enabled on a port other than 465.

What you expected to happen:
Could send alert messages via mail with tls enabled on any port specified.

How to reproduce it (as minimally and precisely as possible):
smtp

  1. Create a channel as the picture shown above.
  2. Create an alarmpolicy and use the channel created.
  3. Trigger an alarm.

Anything else we need to know?:
pkg/notify/controller/messagerequest/smtp/send.go

if port == "465" {
		//via TLS
		conn, err := tls.Dial("tcp", addr, tlsConfig)
		if err != nil {
			return err
		}
		c, err = smtp.NewClient(conn, host)
		if err != nil {
			return err
		}
	} else {
		c, err = smtp.Dial(addr)
		if err != nil {
			return err
		}
	}
	defer c.Close()

	if err := c.Hello("localhost"); err != nil {
		return err
	}

	if port != "465" {
		if ok, _ := c.Extension("STARTTLS"); ok {
			if err := c.StartTLS(tlsConfig); err != nil {
				return err
			}
		}
	}

The code here uses port as a condition to determine whether to enable tls while we set it in other field actually.
Environment:

  • TKE version:
  • Global or business cluster:
  • Kubernetes version (use kubectl version):
  • Install addons:
  • Others:
@xiaosuiba xiaosuiba added the kind/bug Categorizes issue or PR as related to a bug. label Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant