Skip to content
No results
  • About Me (Resume)
  • Meetup Note/Share
  • เงินทอง งอกเงย
naiwaen@DebuggingSoft วงแหวนเว็บ
  • About Me (Resume)
  • Meetup Note/Share
  • เงินทอง งอกเงย
naiwaen@DebuggingSoft วงแหวนเว็บ
boats on a river
Photo by Chait Goli on Pexels.com

AUTH COMMAND

  • AdminpingAdminping
  • June 10, 2021
  • Network & Security, Linux

จาก BLOG: mailx ส่งเมล์จาก Linux แบบ command line หากสังเกตุตรง Config ดีๆ จะมีในส่วนของ set smtp-auth ครับ ที่เห็นว่ามันมีค่าเท่ากับ login จริงแล้วมันมีค่าได้หายแบบครับ แต่คำสั่งมัน Low-Level อยู่พอสมควร Doc เลยหายากนิดนึงครับ โดย AUTH COMMAND มี 3 แบบครับ

AUTH PLAIN

AUTH PLAIN : Client ส่ง username / password ไปยัง Mail Server แบบต่อกัน USERMAME+PASSWORD โดยการเข้ารหัสด้วยอัลกอริทึ่ม BASE64 

S: 220 smtp.server.com Simple Mail Transfer Service Ready
C: EHLO client.example.com
S: 250-smtp.server.com Hello client.example.com
S: 250-SIZE 1000000
S: 250 AUTH LOGIN PLAIN CRAM-MD5
C: AUTH PLAIN
S: 334
C: aWFtcGluZ2t1bmcrdGhpc2kkcGFzc3dvcmQ= (username iampingkung และ password thisi$password ที่ต่อกัน iampingkung+thisi$password
S: 235 2.7.0 Authentication successful

AUTH LOGIN

AUTH LOGIN : เหมือน AUTH PLAIN แต่ขั้นตอนการสื่อสารของ Server และ Client จะเป็น อัลกอริทึ่ม BASE64  ทั้งหมด อาทิ เช่น

  • SERVER Reply กับมาว่าขอ Username คำว่า Username: ถูกแปลงเป็น BASE64 VXNlcm5hbWU6
  • โดยที่ Client ตอบ Username ค่านี้ถูกเข้ารหัสด้วย BASE64 เหมือนกัน
  • SERVER Reply กับมาว่าขอ Password คำว่า Password: ถูกแปลงเป็น BASE64 UGFzc3dvcmQ6
  • และเมื่อ Client ตอบ Password ค่านี้ถูกเข้ารหัสด้วย BASE64 เหมือนกัน
S: 220 smtp.server.com Simple Mail Transfer Service Ready
C: EHLO client.example.com
S: 250-smtp.server.com Hello client.example.com
S: 250-SIZE 1000000
S: 250 AUTH LOGIN PLAIN CRAM-MD5
C: AUTH LOGIN
S: 334 VXNlcm5hbWU6 (Username:)
C: aWFtcGluZ2t1bmc= (iampingkung)
S: 334 UGFzc3dvcmQ6 (Password:)
C: dGhpc2kkcGFzc3dvcmQ= (thisi$password)
S: 235 2.7.0 Authentication successful

AUTH CRAM-MD5

AUTH CRAM-MD5 : เนื่องจากอัลกอริทึ่ม BASE64 ถูกถอดได้ง่าย มีการปรับแก้กระบวนการแทน โดยแทนที่ Server จะถาม Username Password ตรงๆ คราวนี้ Server ส่ง One-Time Secret Key เข้ามา เพื่อเอาตั้งต้นสำหรับเข้ารหัส username และ password ด้วย hash-based message authentication code หรือ HMAC เพื่อส่งไปที่ Server แทน

S: 220 smtp.server.com Simple Mail Transfer Service Ready
C: EHLO client.example.com
S: 250-smtp.server.com Hello client.example.com
S: 250-SIZE 1000000
S: 250 AUTH LOGIN PLAIN CRAM-MD5
C: AUTH CRAM-MD5
S: 334 PDQxOTI5NDIzNDEuMTI4Mjg0NzJAc291cmNlZm91ci5hbmRyZXcuY211LmVkdT4=  (One-Time Secret Key)
C: cmpzMyBlYzNhNTlmZWQzOTVhYmExZWM2MzY3YzRmNGI0MWFjMA==  (username และ password ที่ใช่ HMAC + One-Time Secret Key)
S: 235 2.7.0 Authentication successful

Reference

  • Base64 Encode - Online
  • Base64 Decode - Online
  • AUTH Command and its Mechanisms SMTP Commands Reference

Share this:

  • Tweet
  • Click to email a link to a friend (Opens in new window) Email
  • Click to print (Opens in new window) Print
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp

Like this:

Like Loading...

Related


Discover more from naiwaen@DebuggingSoft

Subscribe to get the latest posts sent to your email.

Tags
# AUTH COMMAND# SMTP# AUTH PLAIN# AUTH LOGIN# AUTH CRAM-MD5

About me

Adminping

Adminping

My name is Chatri Ngambenchawong and I am a Software Developer, Blogger, Geek and FoodMania ^__^

View Full Profile →

Donate (ร่วมสนับสนุน)

Facebook Page

Facebook Page

Categories

Archives

Pages

  • About Me (Resume)
  • Meetup Note/Share
  • นโยบายการใช้คุกกี้ (Cookies Policy)
  • นโยบายความเป็นส่วนตัวของข้อมูล (Privacy Policy)
  • เงินทอง งอกเงย

Recent Posts

  • Cloud Native Bangkok Community Group #01
  • [CR] Starbucks Lychee Osmanthus Garden Tea
  • แก้ปัญหา GitLab อาการผีหลอกก เช่น push branch หาย!! / Branch protection rule ไม่ทำงาน
  • Man Hin By Chef Man-ข้าวมันไก่ฮ่องกง 99 บาท
  • [JAVA] Json Path

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Related Posts

บางทีปัญหา No such file or directory / Private Key ใช้ไม่ได้ สรุปเกิดจากแค่เรื่อง CTRL-M (^M)

  • April 25, 2025

How to fixed icon (lxqt) are missing after upgrade lubuntu

  • February 4, 2025

[Powershell] ssh with .pem key error Bad permissions. Try removing permissions for user: NT AUTHORITY\\Authenticated Users

  • August 14, 2024

ถ้าสนใจ Blog สรุปต่างๆ ลองมา Subscribe กันได้ครับ เดี๋ยวจะมีเมล์จาก [email protected] มาให้กด Confirm อีกทีครับ

  • About Me (Resume)
  • นโยบายการใช้คุกกี้ (Cookies Policy)
Copyright © 2025 - WordPress Theme by CreativeThemes
Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
View preferences
{title} {title} {title}
%d