Servidor Debian · 5 min read · Sep 27, 2025

O Servidor Perfeito - Debian Squeeze (Debian 6.0) Com BIND & Courier [ISPConfig 3] - Página 5

17 Instalar fail2ban

Isso é opcional, mas recomendado, porque o monitor do ISPConfig tenta mostrar o log:

apt-get install fail2ban

Para fazer o fail2ban monitorar PureFTPd, SASL e Courier, crie o arquivo /etc/fail2ban/jail.local:

vi /etc/fail2ban/jail.local

| [pureftpd] enabled = true port = ftp filter = pureftpd logpath = /var/log/syslog maxretry = 3 [sasl] enabled = true port = smtp filter = sasl logpath = /var/log/mail.log maxretry = 5 [courierpop3] enabled = true port = pop3 filter = courierpop3 logpath = /var/log/mail.log maxretry = 5 [courierpop3s] enabled = true port = pop3s filter = courierpop3s logpath = /var/log/mail.log maxretry = 5 [courierimap] enabled = true port = imap2 filter = courierimap logpath = /var/log/mail.log maxretry = 5 [courierimaps] enabled = true port = imaps filter = courierimaps logpath = /var/log/mail.log maxretry = 5 |

Depois crie os seguintes cinco arquivos de filtro:

vi /etc/fail2ban/filter.d/pureftpd.conf

| [Definition] failregex = .*pure-ftpd: \(.*@\) \[WARNING\] Authentication failed for user.* ignoreregex = |

vi /etc/fail2ban/filter.d/courierpop3.conf

| # Fail2Ban configuration file # # $Revision: 100 $ # [Definition] # Option: failregex # Notes.: regex to match the password failures messages in the logfile. The # host must be matched by a group named "host". The tag "" can # be used for standard IP/hostname matching and is only an alias for # (?:::f{4,6}:)?(?P\S+) # Values: TEXT # failregex = pop3d: LOGIN FAILED.*ip=\[.*:\] # Option: ignoreregex # Notes.: regex to ignore. If this regex matches, the line is ignored. # Values: TEXT # ignoreregex = |

vi /etc/fail2ban/filter.d/courierpop3s.conf

| # Fail2Ban configuration file # # $Revision: 100 $ # [Definition] # Option: failregex # Notes.: regex to match the password failures messages in the logfile. The # host must be matched by a group named "host". The tag "" can # be used for standard IP/hostname matching and is only an alias for # (?:::f{4,6}:)?(?P\S+) # Values: TEXT # failregex = pop3d-ssl: LOGIN FAILED.*ip=\[.*:\] # Option: ignoreregex # Notes.: regex to ignore. If this regex matches, the line is ignored. # Values: TEXT # ignoreregex = |

vi /etc/fail2ban/filter.d/courierimap.conf

| # Fail2Ban configuration file # # $Revision: 100 $ # [Definition] # Option: failregex # Notes.: regex to match the password failures messages in the logfile. The # host must be matched by a group named "host". The tag "" can # be used for standard IP/hostname matching and is only an alias for # (?:::f{4,6}:)?(?P\S+) # Values: TEXT # failregex = imapd: LOGIN FAILED.*ip=\[.*:\] # Option: ignoreregex # Notes.: regex to ignore. If this regex matches, the line is ignored. # Values: TEXT # ignoreregex = |

vi /etc/fail2ban/filter.d/courierimaps.conf

| # Fail2Ban configuration file # # $Revision: 100 $ # [Definition] # Option: failregex # Notes.: regex to match the password failures messages in the logfile. The # host must be matched by a group named "host". The tag "" pode # ser usado para correspondência padrão de IP/nome de host e é apenas um alias para # (?:::f{4,6}:)?(?P\S+) # Values: TEXT # failregex = imapd-ssl: LOGIN FAILED.*ip=\[.*:\] # Option: ignoreregex # Notes.: regex to ignore. If this regex matches, the line is ignored. # Values: TEXT # ignoreregex = |

Reinicie o fail2ban depois:

/etc/init.d/fail2ban restart  

18 Instalar SquirrelMail

Para instalar o cliente de webmail SquirrelMail, execute

apt-get install squirrelmail

Em seguida, crie o seguinte link simbólico…

ln -s /usr/share/squirrelmail/ /var/www/webmail

… e configure o SquirrelMail:

squirrelmail-configure

Devemos informar ao SquirrelMail que estamos usando Courier-IMAP/-POP3:

Configuração do SquirrelMail : Ler: config.php (1.4.0)

Menu Principal –

  1. Preferências da Organização
  2. Configurações do Servidor
  3. Padrões de Pasta
  4. Opções Gerais
  5. Temas
  6. Catálogos de Endereços
  7. Mensagem do Dia (MOTD)
  8. Plugins
  9. Banco de Dados
  10. Idiomas

D. Definir configurações pré-definidas para servidores IMAP específicos

C Ativar cor
S Salvar dados
Q Sair

Comando >> <– D

Configuração do SquirrelMail : Ler: config.php

Enquanto estávamos construindo o SquirrelMail, descobrimos algumas
preferências que funcionam melhor com alguns servidores que
não funcionam tão bem com outros. Se você selecionar seu
servidor IMAP, esta opção definirá algumas configurações
padrão para esse servidor.

Por favor, note que você ainda precisará passar por e
certificar-se de que tudo está correto. Isso não
muda tudo. Existem apenas algumas configurações
que isso mudará.

Por favor, selecione seu servidor IMAP:
bincimap = Binc IMAP server
courier = Courier IMAP server
cyrus = Cyrus IMAP server
dovecot = Dovecot Secure IMAP server
exchange = Microsoft Exchange IMAP server
hmailserver = hMailServer
macosx = Mac OS X Mailserver
mercury32 = Mercury/32
uw = University of Washington’s IMAP server
gmail = IMAP access to Google mail (Gmail) accounts

quit = Não mudar nada
Comando >> <– courier

Configuração do SquirrelMail : Ler: config.php

Enquanto estávamos construindo o SquirrelMail, descobrimos algumas
preferências que funcionam melhor com alguns servidores que
não funcionam tão bem com outros. Se você selecionar seu
servidor IMAP, esta opção definirá algumas configurações
padrão para esse servidor.

Por favor, note que você ainda precisará passar por e
certificar-se de que tudo está correto. Isso não
muda tudo. Existem apenas algumas configurações
que isso mudará.

Por favor, selecione seu servidor IMAP:
bincimap = Binc IMAP server
courier = Courier IMAP server
cyrus = Cyrus IMAP server
dovecot = Dovecot Secure IMAP server
exchange = Microsoft Exchange IMAP server
hmailserver = hMailServer
macosx = Mac OS X Mailserver
mercury32 = Mercury/32
uw = University of Washington’s IMAP server
gmail = IMAP access to Google mail (Gmail) accounts

quit = Não mudar nada
Comando >> courier

imap_server_type = courier
default_folder_prefix = INBOX.
trash_folder = Lixo
sent_folder = Enviados
draft_folder = Rascunhos
show_prefix_option = false
default_sub_of_inbox = false
show_contain_subfolders_option = false
optional_delimiter = .
delete_folder = true

Pressione qualquer tecla para continuar… <– pressione uma tecla

Configuração do SquirrelMail : Ler: config.php (1.4.0)

Menu Principal –

  1. Preferências da Organização
  2. Configurações do Servidor
  3. Padrões de Pasta
  4. Opções Gerais
  5. Temas
  6. Catálogos de Endereços
  7. Mensagem do Dia (MOTD)
  8. Plugins
  9. Banco de Dados
  10. Idiomas

D. Definir configurações pré-definidas para servidores IMAP específicos

C Ativar cor
S Salvar dados
Q Sair

Comando >> <– S

Configuração do SquirrelMail : Ler: config.php (1.4.0)

Menu Principal –

  1. Preferências da Organização
  2. Configurações do Servidor
  3. Padrões de Pasta
  4. Opções Gerais
  5. Temas
  6. Catálogos de Endereços
  7. Mensagem do Dia (MOTD)
  8. Plugins
  9. Banco de Dados
  10. Idiomas

D. Definir configurações pré-definidas para servidores IMAP específicos

C Ativar cor
S Salvar dados
Q Sair

Comando >> <– Q

Depois você pode acessar o SquirrelMail em http://server1.example.com/webmail ou http://192.168.0.100/webmail:

Share: X/Twitter LinkedIn

Receba novas postagens na sua caixa de entrada

Sem spam. Cancele a assinatura a qualquer momento.