Debian – Someone used the postfix smtp (port 25) to send spam mails to me

configurationdebianpostfixspam

This week, someone started to send spam-mails through my postfix-smtp access (I verified by logging in through telnet from an arbitrary pc and sending mails with any ids myself) on my server, with recipient and target being guestuser@mydomain.com. Since I have a catchall and mail-fowarding to my google account, I received all those (many) mails.

After a lot of configuration (I lost track of what change did what, going through dozends of topics here and over the net) that hole seems fixed. Still, what hapened?

Does port 25 need to be open and accepting for my catchall to work?

What configuration did I do wrong?

I remember the first thing I changed (that had an effect) was the inet_interface setting in main.cf, only later to find out that if this does not say "all", my mail to mydomain.com does not get forwarded any more.

Best Answer

Port 25 needs to be open or you can't receive any mail - spam or otherwise. Other systems connect to this port on your server to send them, the same way you did with telnet. At this point, you will need to make sure that no one can connect to your mail server and drop of mail for other domains. Otherwise you will be an open relay and will soon discover that you can't sent any mails either because any mail from your server is automatically denied.

The solution to your spam-problem is to implement a spam-filter on your system. This is an advanced topic and lots of work, and hardly worth the hassle for a simple catch-all.

Quite honestly: Your primary problem is that you run a mail server at all and don't know what you are doing. The fix is either to learn how e-mail is working and how to run a mail server (tip: This is actually not easy at all) or to disable your mail server completely and let some hosting provider do this for you (if you really need this mail domain). As a start, you could read the wikipedia entry on SMTP.

Related Topic