mirror of
https://github.com/decke/smtprelay.git
synced 2025-12-25 16:02:31 -07:00
Merge pull request #49 from NoUseFreak/add-skip-verify
Allow ignoring an insecure tls connection
This commit is contained in:
@@ -36,6 +36,7 @@ var (
|
|||||||
allowedUsers = flag.String("allowed_users", "", "Path to file with valid users/passwords")
|
allowedUsers = flag.String("allowed_users", "", "Path to file with valid users/passwords")
|
||||||
command = flag.String("command", "", "Path to pipe command")
|
command = flag.String("command", "", "Path to pipe command")
|
||||||
remoteHost = flag.String("remote_host", "", "Outgoing SMTP server")
|
remoteHost = flag.String("remote_host", "", "Outgoing SMTP server")
|
||||||
|
remoteSkipVerify = flag.Bool("remote_skip_verify", false, "Ignore invalid remote certificates")
|
||||||
remoteUser = flag.String("remote_user", "", "Username for authentication on outgoing SMTP server")
|
remoteUser = flag.String("remote_user", "", "Username for authentication on outgoing SMTP server")
|
||||||
remotePass = flag.String("remote_pass", "", "Password for authentication on outgoing SMTP server")
|
remotePass = flag.String("remote_pass", "", "Password for authentication on outgoing SMTP server")
|
||||||
remoteAuthStr = flag.String("remote_auth", "none", "Auth method on outgoing SMTP server (none, plain, login)")
|
remoteAuthStr = flag.String("remote_auth", "none", "Auth method on outgoing SMTP server (none, plain, login)")
|
||||||
|
|||||||
10
smtp.go
10
smtp.go
@@ -337,7 +337,10 @@ func SendMail(addr string, a smtp.Auth, from string, to []string, msg []byte) er
|
|||||||
}
|
}
|
||||||
var c *Client
|
var c *Client
|
||||||
if port == "465" || port == "smtps" {
|
if port == "465" || port == "smtps" {
|
||||||
config := &tls.Config{ServerName: host}
|
config := &tls.Config{
|
||||||
|
ServerName: host,
|
||||||
|
InsecureSkipVerify: *remoteSkipVerify,
|
||||||
|
}
|
||||||
conn, err := tls.Dial("tcp", addr, config)
|
conn, err := tls.Dial("tcp", addr, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -360,7 +363,10 @@ func SendMail(addr string, a smtp.Auth, from string, to []string, msg []byte) er
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if ok, _ := c.Extension("STARTTLS"); ok {
|
if ok, _ := c.Extension("STARTTLS"); ok {
|
||||||
config := &tls.Config{ServerName: c.serverName}
|
config := &tls.Config{
|
||||||
|
ServerName: c.serverName,
|
||||||
|
InsecureSkipVerify: *remoteSkipVerify,
|
||||||
|
}
|
||||||
if testHookStartTLS != nil {
|
if testHookStartTLS != nil {
|
||||||
testHookStartTLS(config)
|
testHookStartTLS(config)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,9 @@
|
|||||||
; Mailjet.com
|
; Mailjet.com
|
||||||
;remote_host = in-v3.mailjet.com:587
|
;remote_host = in-v3.mailjet.com:587
|
||||||
|
|
||||||
|
; Ignore remote host certificates
|
||||||
|
;remote_skip_verify = false
|
||||||
|
|
||||||
; Authentication credentials on outgoing SMTP server
|
; Authentication credentials on outgoing SMTP server
|
||||||
;remote_user =
|
;remote_user =
|
||||||
;remote_pass =
|
;remote_pass =
|
||||||
|
|||||||
Reference in New Issue
Block a user