Outils pour utilisateurs

Outils du site


linux:telnet (lu 1378 fois)

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
linux:telnet [15-03-2018 10:41]
edmc73
linux:telnet [26-06-2018 14:53]
edmc73
Ligne 29: Ligne 29:
  
 Be aware that different servers will come up with different greetings but you should get SOMETHING. If nothing comes up at this point there are 2 possible problems. Port 25 is being blocked at your firewall, or their server is not responding. Try a different domain, if that works then it's not you. Be aware that different servers will come up with different greetings but you should get SOMETHING. If nothing comes up at this point there are 2 possible problems. Port 25 is being blocked at your firewall, or their server is not responding. Try a different domain, if that works then it's not you.
 +
 Now, use simple SMTP commands to send a test email. This is very important, you CANNOT use the backspace key, it will work onscreen but not be interpreted correctly. You have to type these commands perfectly. Now, use simple SMTP commands to send a test email. This is very important, you CANNOT use the backspace key, it will work onscreen but not be interpreted correctly. You have to type these commands perfectly.
  
Ligne 65: Ligne 66:
  
 See the difference? On the RCPT TO line, we're sending to a domain that is not controlled by the SMTP server we're sending to. You will get an immediate error is SMTP relay is turned off. If you're able to continue and send an email, then relay is allowed by that server. See the difference? On the RCPT TO line, we're sending to a domain that is not controlled by the SMTP server we're sending to. You will get an immediate error is SMTP relay is turned off. If you're able to continue and send an email, then relay is allowed by that server.
 +
 +
 +===== SMTP with Auth =====
 +
 +To encode text to base64, use the following syntax:
 +
 +  $ echo -n 'scottlinux.com rocks' | base64
 +  c2NvdHRsaW51eC5jb20gcm9ja3MK
 +To decode, use base64 -d. To decode base64, use a syntax like the following:
 +
 +  $ echo -n c2NvdHRsaW51eC5jb20gcm9ja3MK | base64 -d
 +  scottlinux.com rocks
 +
 +
 +What will be returned from each command is a base64 encoding of the username and password; save these as you will need them later. Now connect to the mail server using Telnet:
 +
 +  telnet mailserver.com 25
 +Greet the mail server:
 +
 +  EHLO mailserver.com
 +Tell the server you want to authenticate with it:
 +
 +  AUTH LOGIN
 +The server should have returned 334 VXNlcm5hbWU6; this is a base64 encoded string asking you for your username, paste the base64 encoded username you created earlier, example:
 +
 +  dXNlcm5hbWUuY29t
 +Now the server should have returned 334 UGFzc3dvcmQ6;. Again this is a base64 encoded string now asking for your password, paste the base64 encoded password you created, example:
 +
 +  bXlwYXNzd29yZA==
 +Now you should have received a message telling you that you successfully authenticated. If it failed your user/pass may have been wrong or your mailserver is broken.
 +
 +Below is a log of a real successful SMTP AUTH connection over Telnet:
 +<code>
 +user@localhost [~]# telnet exampledomain.com 25
 +Trying 1.1.1.1...
 +Connected to exampledomain.com (1.1.1.1).
 +Escape character is '^]'.
 +220-server1.exampledomain.com ESMTP Exim 4.66 #1 Wed, 09 May 2007 23:55:12 +0200
 +220-We do not authorize the use of this system to transport unsolicited,
 +220 and/or bulk e-mail.
 +EHLO exampledomain.com
 +250-server1.exampledomain.com Hello  [1.1.1.2]
 +250-SIZE 52428800
 +250-PIPELINING
 +250-AUTH PLAIN LOGIN
 +250-STARTTLS
 +250 HELP
 +AUTH LOGIN
 +334 VXNlcm5hbWU6
 +dXNlcm5hbWUuY29t
 +334 UGFzc3dvcmQ6
 +bXlwYXNzd29yZA==
 +
 +235 Authentication succeeded
 +</code>
  
 ===== HTTPS ===== ===== HTTPS =====
linux/telnet.txt · Dernière modification: 26-06-2018 14:53 de edmc73