0

How to make exim4 so that it only allow smtp connection to send mail from 127.0.0.1 only. but also recieve mail at the same time. I am confused with this because if I change dc_local_interfaces to 127.0.0.1, it is unable to receive mail, but only allows 127.0.0.1, which is what I want. But, I also want to receive mail from the internet while it allows only 127.0.0.1 to send mail.

I am using Ubuntu. But I think this is probably not really related to Ubuntu.

update-exim4.conf.conf

# /etc/exim4/update-exim4.conf.conf
#
# Edit this file and /etc/mailname by hand and execute update-exim4.conf
# yourself or use 'dpkg-reconfigure exim4-config'
#
# Please note that this is _not_ a dpkg-conffile and that automatic changes
# to this file might happen. The code handling this will honor your local
# changes, so this is usually fine, but will break local schemes that mess
# around with multiple versions of the file.
#
# update-exim4.conf uses this file to determine variable values to generate
# exim configuration macros for the configuration file.
#
# Most settings found in here do have corresponding questions in the
# Debconf configuration, but not all of them.
#
# This is a Debian specific file

dc_eximconfig_configtype='internet'
dc_other_hostnames='mydomain.com'
dc_local_interfaces='0.0.0.0 ; ::0'
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost=''
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname=''
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'

I can't post exim4.conf.template cuz of stackexchange character limitation sorry.

  • Welcome to Server Fault. Maybe you could just add authentication, because i don't see any particular method of doing this. i've done the resarch. –  Dec 01 '20 at 07:22
  • Any reasonable default configuration should already do this. You should provide your actual configuration here if you still want assistance. – Michael Hampton Dec 01 '20 at 12:35
  • I can't post the config here. Because of limit of 30k characters. I can say that I have not modified the exim4.conf.template from the install. only update-exim4.conf is modified. – WebTestingRL Dec 02 '20 at 09:41
  • You've got an answer. check it out –  Dec 05 '20 at 15:37

2 Answers2

0

In the default exim4 configuration, the relay_from_hosts list determines which hosts can send mail from your server. See the Exim docs:

Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47
  • I changed my `relay_from_hosts` to `127.0.0.1`, and `local_domains` to `@`, and the mail server stop recieving mails even if i open it to 0.0.0.0 and ::0. It works until I do that. And it only works again if I reinstall exim4. I checked the log, and it says `rejected RCPT myself@mydomain.com` – WebTestingRL Dec 05 '20 at 16:46
  • If I change `local_domains` to my domain name instead, it works, but still allows remote relay. – WebTestingRL Dec 05 '20 at 16:57
0

I just changed to postfix because of this.