설정 가이드 · 3 min read · Jan 03, 2026
Mailscanner/Exim Gateway With Communigate PRO Guide - Page 3
FuzzyOCR
이미지 해시를 mysql 데이터베이스에 저장하여 성능을 향상시켜, 이미 스캔한 이미지는 다시 스캔되지 않도록 합니다. OCR은 자원 집약적인 활동입니다.
MySQL 데이터베이스 생성
sql 스크립트는 데이터베이스와 테이블을 생성하고 사용자 fuzzyocr를 비밀번호 fuzzyocr로 추가합니다:
mysql -p < /usr/local/src/devel/FuzzyOcr.mysql비밀번호 변경:
mysqladmin -u fuzzyocr -p fuzzyocr password기본 설정
/etc/mail/spamassassin/FuzzyOCR.cf 파일을 편집하고 기본 옵션을 설정합니다:
focr_path_bin /usr/bin:/usr/local/bin
focr_minimal_scanset 1
focr_autosort_scanset 1
focr_enable_image_hashing 3
focr_logfile /tmp/FuzzyOcr.log
FuzzyOCR가 데이터베이스를 사용하도록 설정
/etc/mail/spamassassin/FuzzyOCR.cf 파일을 편집하고 다음을 추가합니다:
focr_mysql_db FuzzyOcr
focr_mysql_hash Hash
focr_mysql_safe Safe
focr_mysql_user fuzzyocr
focr_mysql_pass password
focr_mysql_host localhost
focr_mysql_port 3306
focr_mysql_socket /var/lib/mysql/mysql.sock
Razor 구성
razor 시스템을 등록합니다:
razor-admin -registerClamav 구성
기본 구성
이 clamav 설치는 공식 서명과 이미지 및 pdf 스팸 및 피싱 공격을 방어하는 데 사용되는 sanesecurity 서명을 모두 사용합니다.
clamav 사용자를 exim 그룹에 추가합니다:
usermod -G exim clamavclamd가 유닉스 소켓을 수신하도록 구성합니다:
LocalSocket /var/run/clamav/clamd.socket부팅 시 clamd가 시작되도록 구성합니다:
chkconfig --level 345 clamd onSELinux
clamav가 강제 모드에서 작동할 수 있도록 일부 지역화된 정책 모듈을 추가해야 합니다. 샘플 정책은 아래와 같습니다:
module clamlocal 1.0;
require {
class dir { add_name read remove_name search write };
class file { create getattr lock read write append };
type clamd_t;
type clamd_var_log_t;
type logwatch_t;
type proc_t;
type sysctl_kernel_t;
type var_spool_t;
type var_t;
type var_log_t;
role system_r;
};
allow clamd_t proc_t:file { getattr read };
allow clamd_t sysctl_kernel_t:dir search;
allow clamd_t sysctl_kernel_t:file read;
allow clamd_t var_spool_t:dir read;
allow clamd_t var_spool_t:file { getattr read };
allow clamd_t var_t:dir { add_name read remove_name write };
allow clamd_t var_t:file { create getattr lock read write };
allow logwatch_t clamd_var_log_t:dir { read search };
allow clamd_t var_log_t:file append;
allow clamd_t var_t:dir { read write };
모듈은 http://www.topdog-software.com/files/clamlocal.te.gz에서 다운로드할 수 있습니다.
모듈을 빌드하고 설치합니다:
wget http://www.topdog-software.com/files/clamlocal.te.gz
gunzip clamlocal.te.gz
checkmodule -M -m -o clamlocal.mod clamlocal.te
semodule_package -o clamlocal.pp -m clamlocal.mod
semodule -i clamlocal.ppMailwatch 구성
향상된 릴리스를 위한 패치
이 패치는 mailwatch가 실제 메시지를 smtp 서버를 통해 재주입하여 원래 전송된 메시지처럼 보이도록 합니다. 기본 mailwatch 릴리스는 postmaster 계정에서 첨부 파일로 릴리스된 메일을 보냅니다.
wget http://www.topdog-software.com/files/mailwatch_release.patch.gz
gunzip mailwatch_release.patch.gz
cd /var/www/html
patch -i ../mailwatch_release.patch기본 디렉토리 구성
mailwatch를 /var/www/html에 설치하므로 config conf.php를 수정하여 이를 반영해야 합니다:
define(MAILWATCH_HOME, '/var/www/html');
데이터베이스 구성
conf.php에서 다음 옵션을 설정합니다:
define(DB_TYPE, 'mysql');
define(DB_USER, 'mailwatch');
define(DB_PASS, 'password');
define(DB_HOST, 'localhost:/var/lib/mysql/mysql.sock');
define(DB_NAME, 'mailscanner');
격리
conf.php 파일에서 다음을 설정합니다:
define(QUARANTINE_USE_FLAG, true);
define(QUARANTINE_DAYS_TO_KEEP, 30);
격리 정리 스크립트를 설치합니다:
cp /usr/local/src/mailwatch-1.0.4/tools/quarantine_maint.php /usr/local/bin/
chmod +x /usr/local/bin/quarantine_maint.php
ln -s /usr/local/bin/quarantine_maint.php /etc/cron.dailymailscanner가 설치한 cron 스크립트 /etc/cron.daily/clean.quarantine를 비활성화합니다:
$disabled = 1;SELinux
mailwatch가 강제 모드에서 작동하도록 하려면 사용자 정의 selinux 정책 모듈을 설치해야 합니다. 모듈 소스는 아래와 같습니다:
module mailwatch 1.0;
require {
class dir { getattr read search };
class file { getattr read execute execute_no_trans ioctl };
class lnk_file { read getattr };
class tcp_socket name_connect;
type spamc_exec_t;
type clamd_t;
type getty_t;
type hostname_exec_t;
type initrc_t;
type unconfined_t;
type var_spool_t;
type etc_mail_t;
type ls_exec_t;
type smtp_port_t;
type spamassassin_exec_t;
type httpd_sys_content_t;
type httpd_t;
type mysqld_t;
type lib_t;
};
allow httpd_t clamd_t:dir getattr;
allow httpd_t hostname_exec_t:file getattr;
allow httpd_t var_spool_t:dir read;
allow httpd_t var_spool_t:file { getattr ioctl read };
allow httpd_t spamc_exec_t:file { execute execute_no_trans getattr read ioctl };
allow httpd_t etc_mail_t:dir { search getattr read };
allow httpd_t etc_mail_t:file { getattr read ioctl };
allow httpd_t etc_mail_t:lnk_file { getattr read };
allow httpd_t hostname_exec_t:file { execute read execute_no_trans };
allow httpd_t unconfined_t:dir { getattr search read };
allow httpd_t unconfined_t:file { read };
allow httpd_t initrc_t:dir { getattr search read };
allow httpd_t initrc_t:file read;
allow httpd_t ls_exec_t:file { execute read getattr execute_no_trans };
allow httpd_t spamassassin_exec_t:file { execute getattr read execute_no_trans ioctl };
allow mysqld_t httpd_sys_content_t:dir { getattr read search };
allow mysqld_t httpd_sys_content_t:file { read getattr };
allow httpd_t smtp_port_t:tcp_socket name_connect;
allow httpd_t lib_t:file execute_no_trans;
모듈 소스는 http://www.topdog-software.com/files/mailwatch.te.gz에서 다운로드할 수 있습니다.
모듈을 빌드하고 설치합니다:
wget http://www.topdog-software.com/files/mailwatch.te.gz
gunzip mailwatch.te.gz
checkmodule -M -m -o mailwatch.mod mailwatch.te
semodule_package -o mailwatch.pp -m mailwatch.mod
semodule -i mailwatch.ppGeoIP
서버에 연결 http://hostname/ 로그인 후 “Tools/Links” 메뉴에서 “Update GeoIP database”를 클릭하고 “Run Now”를 클릭합니다.
메일 큐 모니터
모니터링 스크립트를 설치합니다:
cp /usr/local/src/mailwatch-1.0.4/mailq.php /usr/local/bin
chmod +x /usr/local/bin/mailq.php
crontab -e
0-59 * * * * /usr/local/bin/mailq.php새 디렉토리 레이아웃을 편집합니다:
if(flock($fl, LOCK_EX + LOCK_NB)) {
require "/var/www/html/functions.php";
``새 게시물을 받은 편지함에서 받기
스팸은 없습니다. 언제든지 구독 해지 가능합니다.