0

recently we have been victim of a simple phishing. Yet simple but it can be scary for some users, I don't know how to block this.

The intruder connects via telnet to our mail server and sends phishing emails from a local address to the same address. Seems the relay is open for local connections and I cannot find where to disable this or at least to require authentication.

The way they do this, is simple enough

telnet server 25
helo domain
MAIL FROM: <mail@domain>
RCPT TO: <mail@domain>
data
mail content
,

Once this is done the mail content is then sent to the same address.

I tried this using this settings:

smtp_sender_restrictions = permit_mynetworks permit_sasl_authenticated check_sender_access

but I can still reproduce this error. The server is running postfix and has DKIM, SPF and DMARC.

I'm running out of ideas also saw this post where I also tried these settings but again with no success.

How to reject relaying e-mail from users impersonating myself to myself


EDIT

after the comment of Mr Shunz. The following was changed

smtp_sender_restrictions -> smtpd_sender_restrictions

With that I could not receive mails from gmail for example so I reverted these changes. Also as Mr Shunz asked here is my main.cf

main.cf:

smtpd_banner = reverseIP.
biff = no

append_dot_mydomain = no

alias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
alias_database = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
mydestination = mail.domain, localhost, localhost.localdomain
relayhost =
mynetworks = 127.0.0.0/8 [::1]/128
inet_interfaces = all
recipient_delimiter = +

strict_rfc821_envelopes = yes
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_delay_reject = yes
policy-spf_time_limit = 3600s
postscreen_greet_action = enforce

readme_directory = /usr/share/doc/postfix
html_directory = /usr/share/doc/postfix/html
virtual_alias_domains =
virtual_alias_maps = hash:/var/lib/mailman/data/virtual-mailman, proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, proxy:mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /var/vmail
virtual_uid_maps = mysql:/etc/postfix/mysql-virtual_uids.cf
virtual_gid_maps = mysql:/etc/postfix/mysql-virtual_gids.cf
sender_bcc_maps = proxy:mysql:/etc/postfix/mysql-virtual_outgoing_bcc.cf
inet_protocols = all
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_restriction_classes = greylisting
greylisting = check_policy_service inet:127.0.0.1:10023
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unknown_recipient_domain, reject_unauth_destination, check_recipient_access mysql:/etc/postfix/mysql-virtual_recipient.cf, che$
smtpd_use_tls = yes
smtpd_tls_security_level = may
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
transport_maps = hash:/var/lib/mailman/data/transport-mailman, proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
relay_domains = mysql:/etc/postfix/mysql-virtual_relaydomains.cf
relay_recipient_maps = mysql:/etc/postfix/mysql-virtual_relayrecipientmaps.cf
smtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql-virtual_sender_login_maps.cf
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $sender_bcc_maps $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_$
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname
smtpd_sender_restrictions = check_sender_access regexp:/etc/postfix/tag_as_originating.re , permit_mynetworks ,inline:{ student@domain=reject_unauth_destination }, permit_sasl_authenticated, check_sende$
smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unknown_client_hostname, check_client_access mysql:/etc/postfix/mysql-virtual_client.cf,  reject_rbl_client cbl.abuseat.org,  rej$
smtpd_client_message_rate_limit = 100
maildrop_destination_concurrency_limit = 1
maildrop_destination_recipient_limit = 1
virtual_transport = dovecot
header_checks = regexp:/etc/postfix/header_checks
mime_header_checks = regexp:/etc/postfix/mime_header_checks
nested_header_checks = regexp:/etc/postfix/nested_header_checks
body_checks = regexp:/etc/postfix/body_checks
owner_request_special = no
smtp_tls_security_level = may
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
smtpd_tls_protocols = !SSLv2,!SSLv3
smtp_tls_protocols = !SSLv2,!SSLv3
smtpd_tls_exclude_ciphers = RC4, aNULL
smtp_tls_exclude_ciphers = RC4, aNULL
myhostname = mail.domain
dovecot_destination_recipient_limit = 1
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
content_filter = amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings
mailbox_size_limit = 0
message_size_limit = 0
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
Diogo Jesus
  • 131
  • 7
  • Hello and welcome to Server Fault! Sharing your research helps everyone. Please [edit] your question and post the content of your postfix configuration (i.e. `main.cf`), what you've tried and why it didn’t meet your needs. For example your `stmp_sender_restriction` is wrong (should be `smtpd_sender_restrictions`) and options should be separated by comma (`,`) and not spaces. Please see also: [ask]. – Daniele Santi Apr 15 '19 at 10:09
  • Hello @MrShunz thank you for the comment, the post has been changed. Hopefully now it has all the important information on it. Thank you for your time – Diogo Jesus Apr 15 '19 at 10:34

1 Answers1

-1

answer solved after some digging around server fault website. The method used was the 3rd one available in this answer: https://serverfault.com/a/689940/439892

Now if I try the same steps via telnet I get this message:

553 5.7.1 <mail@domain>: Sender address rejected: not logged in

which is exacly what I was looking for. Sorry if my question was not enough specified.

Diogo Jesus
  • 131
  • 7