Amavisd clamav spamassassin postfix centos 7

Hagamos algo mas interesante …

Paso 1 : Configurar Posftix … la manera basica
Yum -y install posftix

nano /etc/postfix/main.cf

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
mail_owner = postfix
myhostname = nombre_de_mi_servidor
mydomain = midominio.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, $mydomain, otrodominioquetengohosteado.com
unknown_local_recipient_reject_code = 550
mynetworks = 127.0.0.1 , redes_ip_.0/24
relay_domains = $mynetworks
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mail_spool_directory = /data/mail <—- donde alojo los mailbox , en caso de trabajar con él
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
xxgdb $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
disable_vrfy_command = yes
delay_warning_time = 10h
default_destination_concurrency_limit = 2
smtpd_recipient_restrictions = permit_mynetworks,
reject_unauth_destination,
check_policy_service unix:private/policy,
reject_unknown_recipient_domain,
reject_invalid_hostname,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_sender_domain,
reject_unauth_pipelining,
smtpd_helo_restrictions = permit_mynetworks,
reject_invalid_helo_hostname,
reject_unknown_helo_hostname,
reject_non_fqdn_helo_hostname
mtpd_recipient_restrictions = permit_mynetworks,
reject_unauth_destination,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain
data_directory = /var/lib/postfix

Paso 2: Epel

yum install epel-release

Paso 3: Clamav (Antivirus de Servidor de Correo)

yum –enablerepo=epel -y install clamav clamav-update
sed -i -e “s/^Example/#Example/” /etc/freshclam.conf
freshclam (Actualizar la db del servidor) añadirlo en el crond cada semana
Quieres escanear un directorio :
clamscan –infected –remove –recursive /data/mail
[root@ns ~]# clamscan –infected –remove –recursive /data/mail

/data/mail/root: Win.Trojan.Downloader-64860 FOUND
/data/mail/root: Removed.
/data/mail/galania: Win.Trojan.Upatre-354 FOUND
/data/mail/galania: Removed.
/data/mail/linux: Win.Trojan.Upatre-355 FOUND
/data/mail/linux: Removed.

———– SCAN SUMMARY ———–
Known viruses: 3758556
Engine version: 0.98.6
Scanned directories: 1
Scanned files: 4
Infected files: 4
Data scanned: 7.07 MB
Data read: 17.84 MB (ratio 0.40:1)
Time: 23.041 sec (0 m 23 s)
[root@ns ~]#

Paso 4: Amavis , Clamav-server

yum –enablerepo=epel -y install amavisd-new clamav-server clamav-server-systemd
cp /usr/share/doc/clamav-server*/clamd.sysconfig /etc/sysconfig/clamd.amavisd

Luego editar el:
nano /etc/sysconfig/clamd.amavisd

CLAMD_CONFIGFILE=/etc/clamd.d/amavisd.conf
CLAMD_SOCKET=/var/run/clamd.amavisd/clamd.sock

Añadir : /etc/tmpfiles.d/clamd.amavisd.conf

d /var/run/clamd.amavisd 0755 amavis amavis –

Añadir: /usr/lib/systemd/system/clamd@.service

[Install]
WantedBy=multi-user.target

Habilitar el servicio::

systemctl start clamd@amavisd
systemctl enable clamd@amavisd

Paso 5:
Configurar amavis

Editar :: /etc/amavisd/amavisd.conf

# Línea 20: cambio en el nombre de dominio propio
$ mydomain = ‘server.world’;
# Line 152: cambio en el propio nombre de host
$ myhostname = ‘mail.server.world’;
# Line 154: descomentar
$ notify_method = “smtp: [127.0.0.1]: 10025 ‘;
$ forward_method = “smtp: [127.0.0.1]: 10025 ‘;

Paso 6 : Activar amavis y spamassassin

systemctl start amavisd
systemctl enable amavisd
systemctl start spamassassin
systemctl enable spamassassin

Paso 7: finalmente editar postfix

Editar: /etc/postfix/main.cf

Añadir :
content_filter=smtp-amavis:[127.0.0.1]:10024

Editar : /etc/postfix/master.cf

Añadir::

smtp-amavis unix – – n – 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
127.0.0.1:10025 inet n – n – – smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o strict_rfc821_envelopes=yes
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000

Responder

Por favor, inicia sesión con uno de estos métodos para publicar tu comentario:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión /  Cambiar )

Google photo

Estás comentando usando tu cuenta de Google. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )

Conectando a %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.