이 콘텐츠는 선택한 언어로 제공되지 않습니다.

12.4. Configuration Examples


12.4.1. SpamAssassin and Postfix

SpamAssasin is an open-source mail filter that provides a way to filter unsolicited email (spam messages) from incoming email.[12]
When using Red Hat Enterprise Linux, the spamassassin package provides SpamAssassin. Run the rpm -q spamassassin command to see if the spamassassin package is installed. If it is not installed, run the following command as the root user to install it:
~]# yum install spamassassin
Copy to Clipboard Toggle word wrap
SpamAssassin operates in tandom with a mailer such as Postfix to provide spam-filtering capabilities. In order for SpamAssassin to effectively intercept, analyze and filter mail, it must listen on a network interface. The default port for SpamAssassin is TCP/783, however this can be changed. The following example provides a real-world demonstration of how SELinux complements SpamAssassin by only allowing it access to a certain port by default. This example will then demonstrate how to change the port and have SpamAssassin operate on a non-default port.
Note that this is an example only and demonstrates how SELinux can affect a simple configuration of SpamAssassin. Comprehensive documentation of SpamAssassin is beyond the scope of this document. Refer to the official SpamAssassin documentation for further details. This example assumes the spamassassin is installed, that any firewall has been configured to allow access on the ports in use, that the SELinux targeted policy is used, and that SELinux is running in enforcing mode:

Procedure 12.1. Running SpamAssassin on a non-default port

  1. Run the semanage command to show the port that SELinux allows spamd to listen on by default:
    ~]# semanage port -l | grep spamd
    spamd_port_t		tcp	783
    
    Copy to Clipboard Toggle word wrap
    This output shows that TCP/783 is defined in spamd_port_t as the port for SpamAssassin to operate on.
  2. Edit the /etc/sysconfig/spamassassin configuration file and modify it so that it will start SpamAssassin on the example port TCP/10000:
    # Options to spamd
    SPAMDOPTIONS="-d -p 10000 -c m5 -H"
    
    Copy to Clipboard Toggle word wrap
    This line now specifies that SpamAssassin will operate on port 10000. The rest of this example will show how to modify SELinux policy to allow this socket to be opened.
  3. Start SpamAssassin and an error message similar to the following will appear:
    ~]# service spamassassin start
    Starting spamd: [2203] warn: server socket setup failed, retry 1: spamd: could not create INET socket on 127.0.0.1:10000: Permission denied
    [2203] warn: server socket setup failed, retry 2: spamd: could not create INET socket on 127.0.0.1:10000: Permission denied
    [2203] error: spamd: could not create INET socket on 127.0.0.1:10000: Permission denied
    spamd: could not create INET socket on 127.0.0.1:10000: Permission denied
                                                               [FAILED]
    
    Copy to Clipboard Toggle word wrap
    This output means that SELinux has blocked access to this port.
  4. A denial similar to the following will be logged by SELinux:
    SELinux is preventing the spamd (spamd_t) from binding to port 10000.
    
    Copy to Clipboard Toggle word wrap
  5. As the root user, run semanage to modify SELinux policy in order to allow SpamAssassin to operate on the example port (TCP/10000):
    ~]# semanage port -a -t spamd_port_t -p tcp 10000
    Copy to Clipboard Toggle word wrap
  6. Confirm that SpamAssassin will now start and is operating on TCP port 10000:
    ~]# service spamassassin start
    Starting spamd:					[ OK ]
    
    ~]# netstat -lnp | grep 10000
    tcp	0	0 127.0.0.1:10000	0.0.0.0:*	LISTEN	2224/spamd.pid
    
    Copy to Clipboard Toggle word wrap
  7. At this point, spamd is properly operating on TCP port 10000 as it has been allowed access to that port by SELinux policy.


[12] Refer to the SpamAssassin project page for more information.
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat