haraka / Haraka

A fast, highly extensible, and event driven SMTP server
https://haraka.github.io
MIT License
5.08k stars 661 forks source link

Outbound mail not working, "550 I cannot deliver mail for <email@myDomain.com>" #3211

Closed Logaqm closed 8 months ago

Logaqm commented 1 year ago

Hey all, I'm trying to configure outbound mail for relaying and I've followed the guide but can't quite seem to get it working. Currently, I am deploying to ec2 w/ an elastic IP with reverse DNS set up.

This is my docker file:

FROM amazonlinux:2023

CMD haraka -c /usr/local/haraka

EXPOSE 25

# install nodejs + npm 

RUN  yum update -y
RUN  yum install nodejs npm make g++ -y 

# haraka install and configuration 

RUN npm i -g Haraka@3.0.1
RUN haraka -i /usr/local/haraka
RUN cd /usr/local/haraka

# enables tls and auth/flat_file plugins
RUN echo -e "tls\nauth/flat_file" > /usr/local/haraka/config/plugins

# create config file for the auth/flat_file plugin and write some (temporary) login credentials to it 
RUN echo -e '[core]\n' \
    'methods=PLAIN,LOGIN,CRAM-MD5 \n' \
    '[users]\n'\
    'user1=password1' > /usr/local/haraka/config/auth_flat_file.ini

And this is the haraka log:

loaded TLD files:
  1=1470
  2=9768
  3=5119
loaded 9027 Public Suffixes
loglevel: INFO
log format: DEFAULT
[WARN] [-] [core] smtp.ini.nodes unset, using 1, see https://github.com/haraka/Haraka/wiki/Performance-Tuning
Starting up Haraka version 3.0.1
[INFO] [-] [core] Loading plugins
[INFO] [-] [core] Loading plugin: tls
[INFO] [-] [core] loading tls.ini
[ERROR] [-] [core] tls key /usr/local/haraka/config/tls_key.pem could not be loaded.
[ERROR] [-] [core] tls cert /usr/local/haraka/config/tls_cert.pem could not be loaded.
[INFO] [-] [core] Loading plugin: auth/flat_file
[NOTICE] [-] [core] worker started worker=1 pid=17
loaded TLD files:
  1=1470
  2=9768
  3=5119
loaded 9027 Public Suffixes
loglevel: INFO
log format: DEFAULT
[WARN] [-] [core] smtp.ini.nodes unset, using 1, see https://github.com/haraka/Haraka/wiki/Performance-Tuning
Starting up Haraka version 3.0.1
[INFO] [-] [core] Loading plugins
[INFO] [-] [core] Loading plugin: tls
[INFO] [-] [core] loading tls.ini
[ERROR] [-] [core] tls key /usr/local/haraka/config/tls_key.pem could not be loaded.
[ERROR] [-] [core] tls cert /usr/local/haraka/config/tls_cert.pem could not be loaded.
[INFO] [-] [core] Loading plugin: auth/flat_file
[NOTICE] [-] [core] Listening on [::0]:25
[NOTICE] [-] [core] worker 1 listening on [::0]:25
[NOTICE] [953BE1E0-8C0C-48F5-91B3-A8D1A63DC818] [core] connect ip=69.129.87.175 port=56164 local_ip=172.17.0.2 local_port=25
[NOTICE] [22D70FDC-D54E-47E1-B7BF-E263EC08D973] [core] connect ip=69.129.87.175 port=56165 local_ip=172.17.0.2 local_port=25
[ERROR] [-] [tls] no valid TLS config
[ERROR] [-] [tls] no valid TLS config
[NOTICE] [953BE1E0-8C0C-48F5-91B3-A8D1A63DC818] [core] disconnect ip=69.129.87.175 rdns=h69-129-87-175.swisme.broadband.dynamic.tds.net helo=[127.0.0.1] relay=N early=N esmtp=Y tls=N pipe=N errors=0 txns=0 rcpts=0/0/0 msgs=0/0/0 bytes=0 lr="" time=0.097
[NOTICE] [22D70FDC-D54E-47E1-B7BF-E263EC08D973.1] [core] sender <> code=CONT msg=""
[NOTICE] [22D70FDC-D54E-47E1-B7BF-E263EC08D973.1] [core] recipient <email@myDomain.com> code=OK msg="" sender=""
[INFO] [22D70FDC-D54E-47E1-B7BF-E263EC08D973.1] [core] client half closed connection ip=69.129.87.175
[NOTICE] [22D70FDC-D54E-47E1-B7BF-E263EC08D973.1] [core] disconnect ip=69.129.87.175 rdns=h69-129-87-175.swisme.broadband.dynamic.tds.net helo=[127.0.0.1] relay=N early=N esmtp=Y tls=N pipe=N errors=0 txns=1 rcpts=0/0/1 msgs=0/0/0 bytes=0 lr="550 I cannot deliver mail for <email@myDomain.com>" time=0.174

I am aware there are other things to set up like proper TLS, SPF/DKIm, etc. before use as a proper MTA but I'm just trying to verify things are working right now. Weirdly, I was able to get it to send an email just from my PC about a month ago when I was fooling around but I have been unable to replicate it, although I think part of it is that I am using a different internet connection with a new ISP that seems to block some outbound ports.

msimerson commented 1 year ago

search the issues here for EC2. You need to ask AWS to unblock port 25.