rodcorsi/mattermail

certificate error (x509)

Closed this issue · 4 comments

Hi,

I'm currently working on a prototype of Mattermost and Mattermail for our company and I want to use the Mattermail plugin. But when I try to connect to our internal mail server I'm getting the follwing error:

DEBG 12:21:20 Debug mode on
INFO 12:21:20 Checking new emails
DEBG 12:21:20 CheckNewMails
DEBG 12:21:20 CheckImapConnection: DialTLS
IMAP 12:21:20 Connected to {IP}:993 (Tag=LKFEH)
IMAP 12:21:20 S: (x509: certificate signed by unknown authority)
IMAP 12:21:20 Close reason: protocol error
IMAP 12:21:20 Connection closing (flush=false)
IMAP 12:21:20 Greeting error: x509: certificate signed by unknown authority
EROR 12:21:20 Unable to connect: x509: certificate signed by unknown authority
INFO 12:21:20 Error on check new email: x509: certificate signed by unknown authority

I've already applied the certificate in my local storage and it was added as expected.

sudo dpkg-reconfigure ca-certificates
Trigger für ca-certificates (20170717~16.04.1) werden verarbeitet ...
Updating certificates in /etc/ssl/certs...
2 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.

On the other hand, I've tried to set the switch 'TLSAcceptAllCerts' to 'true' but I looks like that this does nothing. The whole config looks like (removed personal parts):

[
{
"Name": "{name}",
"Server": "http://{IP}:8065",
"Team": "{TEAM}",
"Channel": "#{CHANNEL}",
"MattermostUser": "admin",
"MattermostPass": "{ADMPASS}",
"ImapServer": "{IMAP-SRV:PORT}",
"Email": "{MAIL}",
"EmailPass": "{PASS}",
"MailTemplate": ":incoming_envelope: From: %v\n>%v\n\n%v",
"StartTLS": true,
"TLSAcceptAllCerts": true,
"Disabled": false,
"Debug": true,
"LinesToPreview": 20,
"NoRedirectChannel": true,
"NoAttachment": true,
"Filter":[
{"From":"", "Subject":" ", "Channel":"#CHANNEL"}
]
}
]

The Mattermail version that I use is: 3.5.0
The Mattermost version that I use is: 4.2.0

Any help is much appreciated! If you need anything else, please do let me know.
Thank you.

Could you test it again with Release 4?

hi rodcorsi,

it is working now, thank you! The migration from the old to the new config works like a charm.
The new release is marked as a beta but may I should inform you that the filter isn't working as expected. Some mails which are definetely not in the list filter list are pushed in the channel.

Would be great if I could define something like:

"From":"@test.com",
"Subject":"INC_TEST_
",

So work with placeholder. The subject has to 'start with' something. Same for 'From' property.

Or do I missunderstand something and the Filter list is only for special rules?
I assume that if a filter is set, every email will be ignored expect from the ones that are filtered via the rules.

Thank you for your support in this. Much appreciated!
Cheers

Thank you to know about that!
I'll close this issue.

About the filters, they are case insensitive and work with "contains", you can see here
ex:

{Subject:"Order"} will match with:
"Order"
"oRdEr"
"anything ORDER123"

{Subject:"foo", From:"@example.com"} will check if the "Subject" AND "From" match.

The sequence of filters are important too, because the first matching filter rule will be used.
You can see more about sequence that the email will be redirected here
Could you open an issue with one example of this filter problem?
About the placeholder I think regex is the best alternative I opened a issue about this #59

The issue with the filter problem is not an issue anymore after your explanation.
I assumed that 'If a filter is set, every email will be ignored and not posted. Only if a filter can be applied'.

I will think about an workaround to have only specific mails in an channel, rather than all.