Why the first EHLO command is "unrecognized command" on gsmtp? - smtp

I'm learning basics of the networking and want to send a email via command line. I opened a telnet session with gmail-smtp-in.l.google.com:25 and issue the very first command EHLO gmail.com
220 mx.google.com ESMTP u16-20020ac25190000000b00449fff280afsi9331201lfi.49 - gmtp
EHLO gmail.com
502 5.5.1 Unrecognized command. u16-20020ac25190000000b00449fff280afsi9331201lf.49 - gsmtp
EHLO gmail.com
250-mx.google.com at your service, [xxx.xxx.xxx.xxx]
250-SIZE 157286400
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
When i first issuing EHLO gmail.com it says Unrecognized command but then it accepts my command. What am i doing wrong?

I cannot replicate your problem. telnet gmail-smtp-in.l.google.com 25 followed by EHLO localhost after having received the greeting works fine for me. (You're not supposed to use gmail.com in EHLO, but this shouldn't matter. The correct way would be to use the fully qualified domain name for your machine (not localhost) or your IP address in square brackets if your machine has no DNS address.)
RFC 5321 specifies that SMTP clients should wait for the greeting from the server before sending the EHLO command. Delaying the greeting can be used as an anti-spam measure, but I don't think that this is the problem here.

Related

Zabbix scheduledreport: test failed Cannot connect to web service couldn't connect to server

I am using zabbix to monitor my workplace infra, everything works fine. Now, I want to start generating reports. Although I followed everything as it is on the doc I still get this error:
Report generating test failed.
Cannot connect to web service: couldn't connect to server
​
Zabbix server (6.0 LTS), the database (mysql) and the web gui are all installed on the same VM on centos 8 stream without gui. I access, manage and administrate from my computer through ssh to the server and access the web gui through https://server_ip/zabbix. All traffic needed is allowed on firewall. I installed google-chrome-stable and the zabbix-web-service and configured it as it says (http://server_ip:10053/report). In the zabbix gui I added the Frontend URL https://server_ip/zabbix. I went through all the combinations of #ip, localhost, 127.0.0.1 between the server and the web-service and still get the same error, I also tried chromium and nothing.
From the server I tried curl -v http://server-ip:10053/report and I got
* Trying ip#...
* TCP_NODELAY set
* Connected to ip# (ip#) port 10053 (#0)
GET /report HTTP/1.1
Host: ip#:10053
User-Agent: curl/7.61.1
Accept: */*
HTTP/1.1 405 Method Not Allowed
Content-Type: application/problem+json
X-Content-Type-Options: nosniff
Date: Tue, 07 Feb 2023 14:35:16 GMT
Content-Length: 38
{"detail":"Method is not supported."}
* Connection #0 to host ip# left intact
Normally it should work because everything is on the same VM!

Unable to reach localhost from Chrome, after having installed Rancher desktop on Windows 10

After having installed Rancher desktop on my Windows 10 laptop, I cannot reach services listening on localhost through Chrome. Rancher desktop is configured to support Moby/dockerd.
The error reported by Chrome is:
This site can’t be reached
The connection was reset.
Try:
Checking the connection
Checking the proxy and the firewall
Running Windows Network Diagnostics
ERR_CONNECTION_RESET
Replacing localhost with 127.0.0.1 they are reachable, instead.
Ping resolves localhost to 127.0.0.1 correctly:
PS C:\> ping localhost
Pinging xxxxxxxxxx [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
PS C:\>
I noticed that the hosts file (C:\Windows\System32\drivers\etc\hosts) contains the following entry:
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
I tried to add
127.0.0.1 localhost
to the hosts file, unsuccessfully.
I tried to run the following:
netsh winsock reset
netsh int ip reset
ipconfig /release
ip/config /renew
ipconfig /flushdns
and to restart the pc, but it didn't work, either.
I also tried solutions to similar problems, like:
Localhost not working in Chrome, 127.0.0.1 does work
chrome wont let me access localhost (it google searches instead)
Any suggestion to solve the problem?

SMTP (port 25) Plesk 12 on CentOS 7 "None of the authentication methods supported by your server"

I have just moved my server to OVH Dedicated server and now having a problem with SMTP, which I need a bit of help with.
SMTP is set on port 25, but when I am setting up my email client (MS Outlook 2010 or Android Email Client) I have notification "server does not support authentication"
I can receive emails on all of the email clients and can send email but only via webmail.
here is an update:
220 myserver.net ESMTP Postfix
EHLO iamuser
250-myserver.net
250-PIPELINING
250-SIZE 10240000
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DNS
Also if I enable TLS on Outlook the it works, but it does not work on android even with TLS.
Please help!!!
Server doesn't provide auth, it may be because of "smtpd_tls_auth_only = yes" in /etc/postfix/main.cf.
"smtpd_tls_auth_only = yes" forbid authentication on non-secure connection like port 25.
You can just change it to "no", or try using secure port 465 in Android Mail Client.
It's quite easy to check your SMTP server auth methods.
On Windows you need telnet client:
CMD> telnet yourserver.name 25
SERVER> 220 deb7x64-plesk12-1.local ESMTP Postfix (Debian/GNU)
CLIENT> EHLO iamuser
SERVER> 250-deb7x64-plesk12-1.local
SERVER> 250-PIPELINING
SERVER> 250-SIZE 10240000
SERVER> 250-ETRN
SERVER> 250-STARTTLS
SERVER> 250-AUTH DIGEST-MD5 CRAM-MD5 PLAIN LOGIN
SERVER> 250-ENHANCEDSTATUSCODES
SERVER> 250-8BITMIME
SERVER> 250 DSN
CLIENT> quit
SERVER> 221 2.0.0 Bye
Where "DIGEST-MD5", "CRAM-MD5", "PLAIN", "LOGIN" it's an authentication methods.
I've checked that "Android Email Client" is replaced with google's Gmail application and it working fine with provided auth methods.

SMTP MAIL FROM AUTH= format to connect to gmail

I have an older PHP system that uses SMTP commands for mail. We are switching over to gmail and I need to authenticate. I can connect to the server. Unfortunately, I get a 530-5.5.1 Authentication Required. Learn more at" message when I send the MAIL FROM command in my PHP code.
if (fputs($this->Socket, "MAIL FROM: \"admin\" <admin#yourdomain.com>\r\n")<0){
I cannot find a clear example of adding authentication. I read at http://www.faqs.org/rfcs/rfc2554.html that I must add AUTH= to my MAIL FROM command. I am having troubles interpretting what to put in the AUTH=
Examples:
C: MAIL FROM:<e=mc2#example.com> AUTH=e+3Dmc2#example.com
S: 250 OK
Do you know the format of authentication?
There are several ways to do SMTP authentication, but one of them is to use the SMTP AUTH LOGIN command. The transcript of the session would look like this:
host: 220 banner_here
client: EHLO StephaniePC
host: 250-name.of.host hello [clientip], pleased to meet you
host: 250-AUTH LOGIN PLAIN
host: 250 OK
client: AUTH LOGIN
host: 334 VXNlcm5hbWU6
client: am9lc21pdGg=
host: 334 UGFzc3dvcmQ6
client: bGV0bWVpbg0K
host: 235 2.7.0 Authentication successful
client: MAIL FROM: <sender#senderdomain.tld>
host: 250 2.1.0 Ok
client: RCPT TO: <recipient#recipientdomain.tld>
host: 250 2.1.0 Ok
client: DATA
host: 354 End data with <CR><LF>.<CR><LF>
....
The encoded strings that you see above are base64 encoded. If you have a mail client that is capable of logging, you can try sending a message through gmail, and the transcript of the session should look like the transcript above.
FYI, instead of writing code yourself to do SMTP authentication, you might want to use phpmailer. phpmailer can do SMTP authentication, and it's very lightweight and easy to use.

Webmin port 25 is blocked

I have set up webmin on my CentOS server with a few domains. I have also added a test email account but cannot send any emails from my Outlook after configuring the settings for IMAP/STMP server. If I try and telnet to port 25, i get an error. Iptables isn't blocking port 25, postfix server is running and ISP isn't blocking any ports. I have also tried turning off iptables which made no difference.
Any ideas?