๐ก Sendmail MTA Setup on Linux & SMTP Relay โ Executive Summary
Technical architectural analysis, practical configuration manifests, and deployment instructions for Sendmail MTA Setup on Linux & SMTP Relay.
bash
#!/bin/sh
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install -y libsasl2-modules sasl2-bin
sudo apt-get install -y libsasl2-2
sudo apt-get install -y sendmail
sudo sed -i "s/127.0.0.1 localhost/127.0.0.1 localhost.localdomain localhost/" /etc/hosts
sudo bash -c "cat << 'END_HELP' >> /etc/mail/sendmail.mc
TRUST_AUTH_MECH(\`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
END_HELP"
sudo bash -c "cat << 'END_HELP' >> /etc/mail/sendmail.mc
define(\`confAUTH_MECHANISMS', \`EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
END_HELP"
sudo sh -c "m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf"
sudo sh -c "echo Connect:172.16 RELAY >> /etc/mail/access"
sudo sh -c "makemap hash /etc/mail/access < /etc/mail/access"
cd /usr/lib/sasl2/
sudo bash -c 'cat << EOF > Sendmail.conf
pwcheck_method:saslauthd
EOF'
sudo systemctl restart saslauthd
sudo saslauthd -a pam
sudo useradd -m -s /bin/false mailsender
sudo sh -c "echo mailsender:Mailsender123@ | sudo chpasswd"
sudo systemctl restart sendmail
- Mail sending test
1. Connect to port 25 using Telnet
2. Say hello with the HELO \
3. Specify the sender using the MAIL FROM:\
4. RCPT TO:\
5. Communicating the intention to input text using the DATA command
6. Enter text
7. . After entering, press Enter โ Notification of completion of text input
8. Quit with quit command
- auth authentication test
- echo -ne โ\\0mailsender\\0Mailsender123@โ \| base64
- Copy the base64 result from the above command
- telnet localhost 25
- ehlo localhost
- auth plain AG1haWxzZW5kZXIATWFpbHNlbmRlcjEyM0A=
- When the message โOk Authenticatedโ appears, authentication is successful.




Leave a Reply