# 메일 스팸을 차단하는 방법

**URL:** <https://meta.discourse.org/t/how-to-block-mail-spammers/274081>\
**Category:** Support\
**Created:** [8월 6, 2023, 3:53오전 UTC](https://meta.discourse.org/t/how-to-block-mail-spammers/274081 "2023-08-06T03:53:57Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![md-misko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/md-misko/32/126315_2.png) [@md-misko](https://meta.discourse.org/u/md-misko)\
**Post date:** [8월 6, 2023, 7:20오전 UTC](https://meta.discourse.org/t/how-to-block-mail-spammers/274081/3 "2023-08-06T07:20:51Z")

</div>

> [@Andro](#):
>
> 소스 IP 주소를 가지고 있지 않기 때문에

다음 명령을 사용하면 로그에서 대부분의 스팸머 IP 주소를 필터링할 수 있습니다. (이는 엄밀히 말해 RFC 요구사항은 아니지만, 거의 모든 스팸 릴레이에는 유효한 PTR이 없습니다.)

```plaintext
./launcher logs mail-receiver | grep -v 'unknown' | grep -E 'NOQUEUE'

```

겉보기에 legitimate한 서버에서 스팸이 오는 경우, 이메일 도메인을 사용하여 발신자를 차단하는 것은 여전히 어렵습니다. 도메인은 쉽게 위장할 수 있기 때문입니다. 따라서 가장 좋은 방법은 발신 SMTP 서버의 IP를 찾아서 차단하는 것입니다.

```plaintext
./launcher logs mail-receiver | grep -E '[0-9A-F]{10,}:.+(from=<[^>]|client=)'

```

결과 쌍에서 첫 번째 값은 SMTP 서버 IP를, 두 번째 값은 발신자 주소를 제공합니다.

mail-receiver를 구성하려면 다음에 설명된 지침을 사용할 수 있습니다.

> [@최근 업그레이드 후 메일 수신에서 IP의 호스트 이름 해석이 실패하여 스팸 방지 조치가 작동하지 않습니다](https://meta.discourse.org/t/mail-receiver-loses-ip-to-hostname-resolution-after-recent-upgrade-and-prevents-anti-spam-measures-from-working/205003?u=md-misko):
>
> It seems that latest [Self-hosted mail-receiver update following Let's Encrypt root certificate change](https://meta.discourse.org/t/self-hosted-mail-receiver-update-following-lets-encrypt-root-certificate-change/204924/1) mail-receiver update doesn’t resolve IPs to hostnames any more. This causes issues with previously working postfix client access restrictions, enabled by adding the following line to mail-receiver.yml: POSTCONF\_smtpd\_client\_restrictions: 'regexp:/etc/postfix/shared/client\_access\_regex' This is a snippet from the mail-receiver log, showing an inbound connection: Oct 01 17:38:11 discourse-mai…

이 접근 방식을 사용하여 거의 모든 스팸을 제거했습니다.

---

_[View the full topic](https://meta.discourse.org/t/how-to-block-mail-spammers/274081)._
