phpmailer, client not responding to server - phpmailer

When trying to send an email through the phpmailer nothing happens. After looking at the log it seems that when the server asks for XOAUTH2 the client simply doesn't respond... Usually the client would send the XOAUTH2 authorisation
2020-09-09 21:14:20 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP p9sm413427wma.42 - gsmtp
2020-09-09 21:14:20 CLIENT -> SERVER: EHLO 'website'
2020-09-09 21:14:20 SERVER -> CLIENT: 250-smtp.gmail.com at your service, ['ip']250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
2020-09-09 21:14:20 CLIENT -> SERVER: STARTTLS
2020-09-09 21:14:20 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2020-09-09 21:14:20 CLIENT -> SERVER: EHLO 'website'
2020-09-09 21:14:20 SERVER -> CLIENT: 250-smtp.gmail.com at your service, ['ip']250-SIZE 35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
This suddenly stopped working recently for an unknown reason. Nothing has been altered on my end to cause this to occur.
Does anyone have any idea about what could be causing this?

So it seems it was an outdated refresh token.
Odd that no error was appearing in debug mode though

Related

Security handshake failed: {"description":"Handshake read failed"}

What version of gRPC and what language are you using?
#grpc/grpc-js - 1.5.10
What operating system (Linux, Windows,...) and version?
server running in a docker container on azure cloud
What did you do?
I have created a grpc server with SSL. It is a test server, where I use self signed certificates for server. The connection between server and client works fine. But I enabled the debug and trace (tcp, http) logs on the server. I keep getting handshake failed error.
I0427 12:07:40.319067700 18 tcp_server_custom.cc:224] SERVER_CONNECT: 0x7f06409cf3a0 accepted connection: ipv4:10.92.0.9:52824
I0427 12:07:40.319239300 18 tcp_custom.cc:353] Creating TCP endpoint 0x7f0640c78430
I0427 12:07:40.319432800 18 tcp_custom.cc:174] TCP:0x7f0640c78430 read_allocation_done: "No Error"
I0427 12:07:40.319503900 18 tcp_custom.cc:191] Initiating read on 0x7f0640c78430: error="No Error"
I0427 12:07:40.331081600 18 tcp_custom.cc:127] TCP:0x7f0640afea60 call_cb 0x7f0641ed57e0 0x7f0640848b90:0x7f0641ed5610
I0427 12:07:40.331206000 18 tcp_custom.cc:131] read: error={"created":"#1651061260.331064200","description":"EOF","file":"../deps/grpc/src/core/lib/iomgr/tcp_uv.cc","file_line":106}
D0427 12:07:40.331327300 18 security_handshaker.cc:176] Security handshake failed: {"created":"#1651061260.331311100","description":"Handshake read failed","file":"../deps/grpc/src/core/lib/security/transport/security_handshaker.cc","file_line":357,"referenced_errors":[{"created":"#1651061260.331064200","description":"EOF","file":"../deps/grpc/src/core/lib/iomgr/tcp_uv.cc","file_line":106}]}
I0427 12:07:40.331412400 18 tcp_custom.cc:287] TCP 0x7f0640afea60 shutdown why={"created":"#1651061260.331311100","description":"Handshake read failed","file":"../deps/grpc/src/core/lib/security/transport/security_handshaker.cc","file_line":357,"referenced_errors":[{"created":"#1651061260.331064200","description":"EOF","file":"../deps/grpc/src/core/lib/iomgr/tcp_uv.cc","file_line":106}]}
D0427 12:07:40.331443800 18 chttp2_server.cc:122] Handshaking failed: {"created":"#1651061260.331311100","description":"Handshake read failed","file":"../deps/grpc/src/core/lib/security/transport/security_handshaker.cc","file_line":357,"referenced_errors":[{"created":"#1651061260.331064200","description":"EOF","file":"../deps/grpc/src/core/lib/iomgr/tcp_uv.cc","file_line":106}]}
### Anything else we should know about your project / environment?
I have an envoy proxy also running for the grpc server to make grpc-web requests.
Node version: node:14-alpine

Encrypted connection from Nodemailer to Postfix fails with "SSL23_GET_SERVER_HELLO:unknown protocol"

I configured an SMTP mail server using Postfix and Dovecot.
OS: Debian 9
Web Server: Apache
certificate from https://www.sslforfree.com/
When I try using an external client to send emails over TLS, I get the following error:
/var/log/syslog:
Oct 31 19:40:49 designtuner postfix/submission/smtpd[30394]: connect from unknown[185.81.141.117]
Oct 31 19:40:49 designtuner postfix/submission/smtpd[30395]: connect from unknown[185.81.141.117]
Oct 31 19:40:49 designtuner postfix/submission/smtpd[30394]: lost connection after CONNECT from unknown[185.81.141.117]
Oct 31 19:40:49 designtuner postfix/submission/smtpd[30394]: disconnect from unknown[185.81.141.117] commands=0/0
Oct 31 19:40:49 designtuner postfix/submission/smtpd[30395]: lost connection after CONNECT from unknown[185.81.141.117]
Oct 31 19:40:49 designtuner postfix/submission/smtpd[30395]: disconnect from unknown[185.81.141.117] commands=0/0
Node JS client:
{ Error: 1XXXXXXXXXX35275584:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:797:
code: 'ECONNECTION', command: 'CONN' }
Node JS file:
let transporter = nodemailer.createTransport({
host: 'mail.designtuner.com',
port: 587,
secure: true, // secure:true for port 465, secure:false for port 587
auth: {
user: 'admin#designtuner.com',
pass: 'XXXXXXX'
},
tls: {
rejectUnauthorized: false
}
});
Am I missing something? Is it because my reverse DNS hasn't propagated yet? I recently updated my reverse DNS, but the website is accessible from a web browser just fine, and the SSL certificate seems to be working fine.
SMTPs and STARTTLS
There are two ways of encrypted SMTP: SMTPs on port 465, which first establishes an TLS handshake and then start the SMTP session, and SMTP with STARTTLS on port 587 which first start an SMTP session and then initializes TLS after the STARTTLS SMTP command (and then starts with authentication and everything to be protected).
SMTPs (TLS first, port 465) is considered deprecated; standard conformant SMTP with STARTTLS (port 587) does not imply any drawbacks with respect to security or privacy. A properly configured SMTP server will not allow any unsecured connection on the SMTP submission port.
Enforcing encryption with Nodemailer
The secure flag of nodemailer is only to indicate TLS before SMTP, which is also indicated by the comment following the line (which also explicitly explains what setting to use).
secure: true, // secure:true for port 465, secure:false for port 587
Looking at the Nodemailer documentation, there is some further information on configuration options:
options.secure if true the connection will only use TLS. If false (the default), TLS may still be upgraded to if available via the STARTTLS command.
[...]
options.requireTLS if this is true and secure is false, it forces Nodemailer to use STARTTLS even if the server does not advertise support for it.
With other words, to enforce an encrypted session following standards and best practices, set requireTLS instead of secure and use SMTP submission on port 587.
The comment in your code already points you to the problem in that secure should be set to false for port 587
port: 587,
secure: true, // secure:true for port 465, secure:false for port 587
Same is true for the documentation which clearly says:
secure – if true the connection will use TLS when connecting to server. If false (the default) then TLS is used if server supports the STARTTLS extension. In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false
The reason for this is that secure expects implicit TLS, i.e. TLS from start. But, port 25 and port 587 usually use explicit TLS, i.e. plain connection and then upgrade to TLS after a successful STARTTLS command.
If you want to use explicit TLS (port 587) but also make sure that TLS is not optional use requireTLS as documented:
requireTLS – if this is true and secure is false then Nodemailer tries to use STARTTLS even if the server does not advertise support for it. If the connection can not be encrypted then message is not sent

ngrok error Failed to read valid http request: malformed HTTP request

I'm using ngrok building a Secure tunnels to localhost server
On server side I run the command start ngrok
./bin/ngrokd -domain="tunnel.kmic168.com" -httpAddr=":8080"
Display
[07/12/17 17:37:16] [INFO] [registry] [tun] No affinity cache specified
[07/12/17 17:37:16] [INFO] [metrics] Reporting every 30 seconds
[07/12/17 17:37:16] [INFO] Listening for public http connections on [::]:8080
[07/12/17 17:37:16] [INFO] Listening for public https connections on [::]:443
[07/12/17 17:37:16] [INFO] Listening for control and proxy connections on [::]:4443
It seems fine. Then I run the command on client side
./ngrok -subdomain=rbp -config="ngrok.cfg" 80
and the
Tunnel Status: reconnecting .
Alway reconnecting. Then I checkd the server side display these error
[07/12/17 17:40:13] [INFO] [pub:7ac836d4] New connection from
119.130.171.143:25904 [07/12/17 17:40:13] [WARN] [pub:7ac836d4] Failed to read valid http request: malformed HTTP request
"\x16\x03\x01\x00\x9a\x01\x00\x00\x96\x03\x03;Qߓ\xccj\xb7nm\xa0\xe0\x86\x04\u007fH{W5\x10\xb1\xc4\xcc\xed\xe5\xbf\xc9\x00\xa1ĥbq\x00\x00\x1c\xc0/\xc0+\xc00\xc0,\xc0\x13\xc0\t\xc0\x14\xc0"
[07/12/17 17:40:13] [DEBG] [pub:7ac836d4] Closing [07/12/17 17:40:23]
[INFO] [metrics] Reporting:
{"bytesIn.count":0,"bytesOut.count":0,"connMeter.count":0,"connMeter.m1":0,"httpTunnelMeter.count":0,"linux":0,"osx":0,"other":0,"tcpTunnelMeter.count":0,"tunnelMeter.count":0,"tunnelMeter.m1":0,"windows":0}
Here is my cfg file content
server_addr: "tunnel.kmic168.com:8080"
trust_host_root_certs: false
Is there a solution to resolve this error? Thank you very much!
finally I found the solution
https://gist.github.com/lyoshenka/002b7fbd801d0fd21f2f
you have to use the port 4443

Linux - 550 Access denied - Invalid HELO name(See RFC2821 4.1.1.1)

I am trying to send an email via Linux server but i never receive it. I'm currently using putty and I use
# php -r 'mail("*****#gmail.com","Test subject", "Test Message","From: *****#gmail.com");'
Then i go check my message with
cat /var/spool/mail/
and i got this
----- The following addresses had permanent fatal errors -----
<****#gmail.com>
**(reason: 550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1))**
----- Transcript of session follows -----
... while talking to domain.ca.:
>>> MAIL From:<*****#****> SIZE=568
<<< **550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1)**
554 5.0.0 Service unavailable
I searched on the web and i can't find an answer
some people say its an authentification problem but they are talking mainly about outlook.
I don't know if it help, but when I do telnet and ehlo i got this
# telnet localhost 25
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 *** ESMTP Sendmail 8.14.4/8.14.4; Fri, 27 Sep 2013 14:47:10 -0400
# ehlo localhost
250-****Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
I think it's missing
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
I don't know if it's because of that i have my error and that i can't send an email? If yes, I don't know what to do to make this apear.
Can someone help me please? I'm new with linux and php mail
If it's a VPS or a Dedicated Server try changing the hostname to something resolvable like server#mydomain.com with valid A records for the same
I found the following website useful
How to fix Invalid HELO Name error

Socket.io in reconnecting loop when running in Amazon EC2

I am having a problem with socket.io (websocket) when running in EC2. I don't have any http proxy or loadbalancer installed infront of the node instance. Same code works fine when running in local environment but keep reconnecting in EC2. Also even in the EC2 instance xhr-polling works fine.
Following is socket.io debug log output when transport is set to websocket and xhr-polling.
debug - discarding transport
debug - authorized
info - handshake authorized aoiP_6qFnqiqEC3r2-0N
debug - setting request GET /socket.io/1/websocket/aoiP_6qFnqiqEC3r2-0N
debug - set heartbeat interval for client aoiP_6qFnqiqEC3r2-0N
debug - client authorized for
debug - websocket writing 1::
warn - websocket parser error: reserved fields must be empty
info - transport end (undefined)
debug - set close timeout for client NxkBCtJqwOscfHzE0xba
debug - cleared close timeout for client NxkBCtJqwOscfHzE0xba
debug - cleared heartbeat interval for client NxkBCtJqwOscfHzE0xba

Resources