GNU/Linux >> Tutoriales Linux >  >> Panels >> Panels

El servidor perfecto - Ubuntu 11.04 [ISPConfig 3]

El Servidor Perfecto - Ubuntu 11.04 [ISPConfig 3]

Este tutorial muestra cómo preparar un servidor Ubuntu 11.04 (Natty Narwhal) para la instalación de ISPConfig 3 y cómo instalar ISPConfig 3. ISPConfig 3 es un panel de control de alojamiento web que le permite configurar los siguientes servicios a través de un navegador web:Apache web servidor, servidor de correo Postfix, MySQL, servidor de nombres BIND o MyDNS, PureFTPd, SpamAssassin, ClamAV y muchos más.

Tenga en cuenta que esta configuración no funciona para ISPConfig 2 ! ¡Es válido solo para ISPConfig 3!

¡No emito ninguna garantía de que esto funcione para usted!

Manual de ISPConfig 3

Para aprender a usar ISPConfig 3, recomiendo descargar el Manual de ISPConfig 3.

En aproximadamente 300 páginas, cubre el concepto detrás de ISPConfig (administrador, revendedores, clientes), explica cómo instalar y actualizar ISPConfig 3, incluye una referencia para todos los formularios y campos de formulario en ISPConfig junto con ejemplos de entradas válidas y proporciona tutoriales para las tareas más comunes en ISPConfig 3. También explica cómo hacer que su servidor sea más seguro y viene con una sección de solución de problemas al final.

Aplicación ISPConfig Monitor para Android

Con la aplicación ISPConfig Monitor, puede verificar el estado de su servidor y averiguar si todos los servicios funcionan como se espera. Puede verificar los puertos TCP y UDP y hacer ping a sus servidores. Además de eso, puede usar esta aplicación para solicitar detalles de los servidores que tienen instalado ISPConfig (tenga en cuenta que la versión mínima instalada de ISPConfig 3 compatible con la aplicación ISPConfig Monitor es 3.0.3.3! ); estos detalles incluyen todo lo que sabe del módulo Monitor en el Panel de control de ISPConfig (por ejemplo, servicios, registros de correo y del sistema, cola de correo, información de CPU y memoria, uso del disco, cuota, detalles del sistema operativo, registro de RKHunter, etc.), y por supuesto , como ISPConfig tiene capacidad para varios servidores, puede verificar todos los servidores que están controlados desde su servidor maestro ISPConfig.

Para obtener instrucciones de uso y descarga, visite http://www.ispconfig.org/ispconfig-3/ispconfig-monitor-app-for-android/.

1 Requisitos

Para instalar dicho sistema, necesitará lo siguiente:

  • el CD del servidor Ubuntu 11.04, disponible aquí:http://releases.ubuntu.com/releases/11.04/ubuntu-11.04-server-i386.iso (i386) o http://releases.ubuntu.com/releases /11.04/ubuntu-11.04-servidor-amd64.iso (x86_64)
  • una conexión rápida a Internet.

2 Nota Preliminar

En este tutorial utilizo el nombre de host server1.example.com con la dirección IP 192.168.0.100 y la puerta de enlace 192.168.0.1. Estas configuraciones pueden diferir para usted, por lo que debe reemplazarlas cuando corresponda.

3 El Sistema Base

Inserte su CD de instalación de Ubuntu en su sistema y arranque desde él. Seleccione su idioma:

Luego seleccione Instalar Servidor Ubuntu:

Elige tu idioma de nuevo (?):

Luego seleccione su ubicación:

Si ha seleccionado una combinación poco común de idioma y ubicación (como inglés como idioma y Alemania como ubicación, como en mi caso), el instalador podría indicarle que no hay una configuración regional definida para esta combinación; en este caso, debe seleccionar la configuración regional manualmente. Selecciono en_US.UTF-8 aquí:

Elija una distribución de teclado (se le pedirá que presione algunas teclas y el instalador intentará detectar su distribución de teclado en función de las teclas que presionó):

El instalador comprueba el CD de instalación, su hardware y configura la red con DHCP si hay un servidor DHCP en la red:

El servidor perfecto - Ubuntu 11.04 [ISPConfig 3] - Página 2

Introduzca el nombre de host. En este ejemplo, mi sistema se llama server1.example.com , así que ingreso server1 :

Compruebe si el instalador detectó su zona horaria correctamente. Si es así, seleccione Sí, de lo contrario No:

Ahora tienes que particionar tu disco duro. En aras de la simplicidad, selecciono Guiado:use todo el disco y configure LVM; esto creará un grupo de volúmenes con dos volúmenes lógicos, uno para el sistema de archivos / y otro para el intercambio (por supuesto, la partición depende totalmente de usted, si sabe lo que está haciendo, también puede configurar sus particiones manualmente).

Seleccione el disco que desea particionar:

Cuando se le pregunte ¿Escribir los cambios en los discos y configurar LVM?, seleccione Sí:

Si ha seleccionado Guiado:usar todo el disco y configurar LVM, el particionador creará un gran grupo de volúmenes que usa todo el espacio del disco. Ahora puede especificar la cantidad de ese espacio en disco que deben usar los volúmenes lógicos para / e intercambio. Tiene sentido dejar algo de espacio sin usar para que luego pueda expandir sus volúmenes lógicos existentes o crear nuevos; esto le brinda más flexibilidad.

Cuando haya terminado, presione Sí cuando se le pregunte ¿Escribir los cambios en los discos?:

Posteriormente, sus nuevas particiones se crearán y formatearán:

Ahora se está instalando el sistema base:

Cree un usuario, por ejemplo, el usuario Administrador con el nombre de usuario administrador (no use el nombre de usuario admin ya que es un nombre reservado en Ubuntu 11.04):

No necesito un directorio privado encriptado, así que elijo No aquí:

A continuación, se configura el administrador de paquetes apt. Deje la línea del proxy HTTP vacía a menos que esté utilizando un servidor proxy para conectarse a Internet:

Soy un poco anticuado y me gusta actualizar mis servidores manualmente para tener más control, por lo tanto, selecciono Sin actualizaciones automáticas. Por supuesto, depende de usted lo que seleccione aquí:

Necesitamos un servidor DNS, de correo y LAMP, pero sin embargo no selecciono ninguno de ellos ahora porque me gusta tener control total sobre lo que se instala en mi sistema. Instalaremos los paquetes necesarios manualmente más adelante. El único elemento que selecciono aquí es el servidor OpenSSH para que pueda conectarme inmediatamente al sistema con un cliente SSH como PuTTY una vez finalizada la instalación:

La instalación continúa:

El cargador de arranque GRUB se instala:

Seleccione Sí cuando se le pregunte ¿Instalar el cargador de arranque GRUB en el registro de arranque maestro?:

La instalación del sistema base ya ha finalizado. Retire el CD de instalación de la unidad de CD y presione Continuar para reiniciar el sistema:

Al siguiente paso...

El Servidor Perfecto - Ubuntu 11.04 [ISPConfig 3] - Página 3

4 Obtener privilegios de root

Después del reinicio, puede iniciar sesión con su nombre de usuario creado previamente (por ejemplo, administrador). Debido a que debemos ejecutar todos los pasos de este tutorial con privilegios de root, podemos anteponer todos los comandos en este tutorial con la cadena sudo, o convertirnos en root ahora mismo escribiendo

sudo su

(También puede habilitar el inicio de sesión raíz ejecutando

sudo passwd root

y dando a root una contraseña. Luego puede iniciar sesión directamente como root, pero los desarrolladores y la comunidad de Ubuntu lo desaprueban por varias razones. Consulte http://ubuntuforums.org/showthread.php?t=765414.)

5 Instalar el servidor SSH (opcional)

Si no instaló el servidor OpenSSH durante la instalación del sistema, puede hacerlo ahora:

apt-get install ssh openssh-server

A partir de ahora, puede usar un cliente SSH como PuTTY y conectarse desde su estación de trabajo a su servidor Ubuntu 11.04 y seguir los pasos restantes de este tutorial.

6 Instalar vim-nox (opcional)

Usaré vi como mi editor de texto en este tutorial. El programa vi predeterminado tiene un comportamiento extraño en Ubuntu y Debian; para arreglar esto, instalamos vim-nox:

apt-get install vim-nox

(No tienes que hacer esto si usas un editor de texto diferente como joe o nano).

7 Configurar la red

Debido a que el instalador de Ubuntu ha configurado nuestro sistema para obtener su configuración de red a través de DHCP, debemos cambiar eso ahora porque un servidor debe tener una dirección IP estática. Edite /etc/network/interfaces y ajústelo a sus necesidades (en este ejemplo de configuración usaré la dirección IP 192.168.0.100 ):

vi /etc/network/interfaces

Luego reinicie su red:

/etc/init.d/networking restart

Luego edite /etc/hosts. Haz que se vea así:

vi /etc/hosts
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.0.100
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1

Ahora corre

echo server1.example.com > /etc/hostname
/etc/init.d/hostname restart

Luego, corre

hostname
hostname -f

Ambos deberían mostrar server1.example.com ahora.

8 Edite /etc/apt/sources.list y actualice su instalación de Linux

Edite /etc/apt/sources.list. Comente o elimine el CD de instalación del archivo y asegúrese de que los repositorios Universe y Multiverse estén habilitados. Debería verse así:

vi /etc/apt/sources.list
127.0.0.1       localhost.localdomain   localhost
192.168.0.100   server1.example.com     server1

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Entonces corre

apt-get update

para actualizar la base de datos de paquetes apt y

apt-get upgrade

para instalar las últimas actualizaciones (si las hay). Si ve que se instala un nuevo kernel como parte de las actualizaciones, debe reiniciar el sistema después:

reboot

9 Cambiar el shell predeterminado

/bin/sh es un enlace simbólico a /bin/dash, sin embargo, necesitamos /bin/bash, no /bin/dash. Por lo tanto hacemos esto:

dpkg-reconfigure dash

¿Usar guión como shell del sistema predeterminado (/bin/sh)? <-- No

Si no hace esto, la instalación de ISPConfig fallará.

10 Deshabilitar AppArmor

AppArmor es una extensión de seguridad (similar a SELinux) que debería proporcionar seguridad extendida. En mi opinión, no lo necesitas para configurar un sistema seguro, y suele causar más problemas que ventajas (piensa en ello después de haber realizado una semana de resolución de problemas porque algún servicio no estaba funcionando como se esperaba, y luego descubra que todo estaba bien, solo AppArmor estaba causando el problema). Por lo tanto, lo deshabilito (esto es obligatorio si desea instalar ISPConfig más adelante).

Podemos desactivarlo así:

/etc/init.d/apparmor stop
update-rc.d -f apparmor remove
apt-get remove apparmor apparmor-utils

11 Sincronizar el reloj del sistema

Es una buena idea sincronizar el reloj del sistema con un NTP (n red t tiempo p rotocol) servidor a través de Internet. Simplemente ejecuta

apt-get install ntp ntpdate

y la hora de su sistema siempre estará sincronizada.

El Servidor Perfecto - Ubuntu 11.04 [ISPConfig 3] - Página 4

12 Instalar Postfix, Courier, Saslauthd, MySQL, rkhunter, binutils

Podemos instalar Postfix, Courier, Saslauthd, MySQL, rkhunter y binutils con un solo comando:

apt-get install postfix postfix-mysql postfix-doc mysql-client mysql-server courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl getmail4 rkhunter binutils maildrop

Se le harán las siguientes preguntas:

Nueva contraseña para el usuario "root" de MySQL:<-- yourrootsqlpassword
Repita la contraseña para el usuario "root" de MySQL:<-- yourrootsqlpassword
Tipo general de configuración de correo:<-- Sitio de Internet
Nombre de correo del sistema:<-- server1.example.com
¿Crear directorios para administración basada en web? <-- No
Certificado SSL requerido <-- Ok

Queremos que MySQL escuche en todas las interfaces, no solo en localhost, por lo tanto, editamos /etc/mysql/my.cnf y comentamos la línea bind-address =127.0.0.1:

vi /etc/mysql/my.cnf
#

# deb cdrom:[Ubuntu-Server 11.04 _Natty Narwhal_ - Release amd64 (20110426)]/ natty main restricted

#deb cdrom:[Ubuntu-Server 11.04 _Natty Narwhal_ - Release amd64 (20110426)]/ natty main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://de.archive.ubuntu.com/ubuntu/ natty main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ natty main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://de.archive.ubuntu.com/ubuntu/ natty-updates main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ natty-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://de.archive.ubuntu.com/ubuntu/ natty universe
deb-src http://de.archive.ubuntu.com/ubuntu/ natty universe
deb http://de.archive.ubuntu.com/ubuntu/ natty-updates universe
deb-src http://de.archive.ubuntu.com/ubuntu/ natty-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://de.archive.ubuntu.com/ubuntu/ natty multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ natty multiverse
deb http://de.archive.ubuntu.com/ubuntu/ natty-updates multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ natty-updates multiverse

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://de.archive.ubuntu.com/ubuntu/ natty-backports main restricted universe multiverse
# deb-src http://de.archive.ubuntu.com/ubuntu/ natty-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu natty-security main restricted
deb-src http://security.ubuntu.com/ubuntu natty-security main restricted
deb http://security.ubuntu.com/ubuntu natty-security universe
deb-src http://security.ubuntu.com/ubuntu natty-security universe
deb http://security.ubuntu.com/ubuntu natty-security multiverse
deb-src http://security.ubuntu.com/ubuntu natty-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu natty partner
# deb-src http://archive.canonical.com/ubuntu natty partner

## Uncomment the following two lines to add software from Ubuntu's
## 'extras' repository.
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
# deb http://extras.ubuntu.com/ubuntu natty main
# deb-src http://extras.ubuntu.com/ubuntu natty main

Luego reiniciamos MySQL:

/etc/init.d/mysql restart

Ahora verifique que la red esté habilitada. Ejecutar

netstat -tap | grep mysql

La salida debería verse así:

[email protected]:~# netstat -tap | grep mysql
tcp        0      0 *:mysql                 *:*                     LISTEN      9990/mysqld
[email protected]:~#

Durante la instalación, los certificados SSL para IMAP-SSL y POP3-SSL se crean con el nombre de host localhost. Para cambiar esto al nombre de host correcto (server1.example.com en este tutorial), elimine los certificados...

cd /etc/courier
rm -f /etc/courier/imapd.pem
rm -f /etc/courier/pop3d.pem

... y modifique los siguientes dos archivos; reemplace CN=localhost con CN=server1.example.com (también puede modificar los otros valores, si es necesario):

vi /etc/courier/imapd.cnf
[...]
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address           = 127.0.0.1
[...]
vi /etc/courier/pop3d.cnf
[...]
CN=server1.example.com
[...]

Luego vuelva a crear los certificados...

mkimapdcert
mkpop3dcert

... y reinicie Courier-IMAP-SSL y Courier-POP3-SSL:

/etc/init.d/courier-imap-ssl restart
/etc/init.d/courier-pop-ssl restart

13 Instale Amavisd-new, SpamAssassin y Clamav

Para instalar amavisd-new, SpamAssassin y ClamAV, ejecutamos

apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl

La configuración de ISPConfig 3 usa amavisd que carga la biblioteca de filtros SpamAssassin internamente, por lo que podemos detener SpamAssassin para liberar RAM:

/etc/init.d/spamassassin stop
update-rc.d -f spamassassin remove

14 Instale Apache2, PHP5, phpMyAdmin, FCGI, suExec, Pear y mcrypt

Apache2, PHP5, phpMyAdmin, FCGI, suExec, Pear y mcrypt se pueden instalar de la siguiente manera:

apt-get install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libruby libapache2-mod-ruby

Verá la siguiente pregunta:

Servidor web para reconfigurar automáticamente:<-- apache2
¿Configurar base de datos para phpmyadmin con dbconfig-common? <-- No

Luego ejecute el siguiente comando para habilitar los módulos de Apache suexec, rewrite, ssl, actions e include (además de dav, dav_fs y auth_digest si desea usar WebDAV):

a2enmod suexec rewrite ssl actions include
a2enmod dav_fs dav auth_digest

Reinicie Apache después:

/etc/init.d/apache2 restart

Si desea alojar archivos Ruby con la extensión .rb en sus sitios web creados a través de ISPConfig, debe comentar la línea application/x-ruby rb en /etc/mime.types:

vi /etc/mime.types
[...]
CN=server1.example.com
[...]

(Esto es necesario solo para archivos .rb; los archivos de Ruby con la extensión .rbx funcionan de inmediato).

Reinicie Apache después:

/etc/init.d/apache2 restart

15 Instalar PureFTPd y cuota

PureFTPd y la cuota se pueden instalar con el siguiente comando:

apt-get install pure-ftpd-common pure-ftpd-mysql quota quotatool

Edite el archivo /etc/default/pure-ftpd-common...

vi /etc/default/pure-ftpd-common

... y asegúrese de que el modo de inicio esté configurado como autónomo y establezca VIRTUALCHROOT=true:

[...]
#application/x-ruby                             rb
[...]

Ahora configuramos PureFTPd para permitir sesiones FTP y TLS. FTP es un protocolo muy inseguro porque todas las contraseñas y todos los datos se transfieren en texto claro. Mediante el uso de TLS, toda la comunicación se puede cifrar, lo que hace que el FTP sea mucho más seguro.

Si desea permitir sesiones FTP y TLS, ejecute

echo 1 > /etc/pure-ftpd/conf/TLS

Para usar TLS, debemos crear un certificado SSL. Lo creo en /etc/ssl/private/, por lo tanto, primero creo ese directorio:

mkdir -p /etc/ssl/private/

Posteriormente, podemos generar el certificado SSL de la siguiente manera:

openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem

Nombre del país (código de 2 letras) [AU]:<-- Ingrese el nombre de su país (por ejemplo, "DE").
Nombre del estado o provincia (nombre completo) [Algún estado]:<-- Ingrese su estado o Nombre de la provincia.
Nombre de la localidad (p. ej., ciudad) []:<-- Ingrese su ciudad.
Nombre de la organización (p. ej., empresa) [Internet Widgits Pty Ltd]:<-- Ingrese el nombre de su organización (p. ej., el nombre de su empresa).
Nombre de la unidad organizativa (p. ej., sección) []:<-- Ingrese el nombre de su unidad organizativa (p. ej., "Departamento de TI").
Nombre común (p. ej., SU nombre) []:<-- Ingrese el nombre de dominio completo del sistema (por ejemplo, "servidor1.ejemplo.com").
Dirección de correo electrónico []:<-- Ingrese su dirección de correo electrónico.

Cambiar los permisos del certificado SSL:

chmod 600 /etc/ssl/private/pure-ftpd.pem

Luego reinicie PureFTPd:

/etc/init.d/pure-ftpd-mysql restart

Edite /etc/fstab. El mío se ve así (agregué, usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0 a la partición con el punto de montaje /):

vi /etc/fstab
[...]
STANDALONE_OR_INETD=standalone
[...]
VIRTUALCHROOT=true
[...]

Para habilitar la cuota, ejecute estos comandos:

mount -o remount /
quotacheck -avugm
quotaon -avug

16 Instalar servidor BIND DNS

BIND se puede instalar de la siguiente manera:

apt-get install bind9 dnsutils

17 Instalar Vlogger, Webalizer y AWstats

Vlogger, webalizer y AWstats se pueden instalar de la siguiente manera:

apt-get install vlogger webalizer awstats geoip-database

Abra /etc/cron.d/awstats luego...

vi /etc/cron.d/awstats

... y comente ambos trabajos cron en ese archivo:

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
/dev/mapper/server1-root /               ext4    errors=remount-ro,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0 0       1
# /boot was on /dev/sda1 during installation
UUID=deae7cd1-b106-47aa-9a7c-512f046d2ebf /boot           ext2    defaults        0       2
/dev/mapper/server1-swap_1 none            swap    sw              0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0

18 Instalar Jailkit

Solo se necesita Jailkit si desea chrootear a los usuarios de SSH. Se puede instalar de la siguiente manera (importante:Jailkit se debe instalar antes de ISPConfig - ¡no se puede instalar después!):

apt-get install build-essential autoconf automake1.9 libtool flex bison debhelper
cd /tmp
wget http://olivier.sessink.nl/jailkit/jailkit-2.14.tar.gz
tar xvfz jailkit-2.14.tar.gz
cd jailkit-2.14
./debian/rules binary
cd ..
dpkg -i jailkit_2.14-1_*.deb
rm -rf jailkit-2.14*

El Servidor Perfecto - Ubuntu 11.04 [ISPConfig 3] - Página 5

19 Instalar fail2ban

Esto es opcional pero recomendado, porque el monitor ISPConfig intenta mostrar el registro fail2ban:

apt-get install fail2ban

Para hacer que fail2ban monitoree PureFTPd, SASL y Courier, cree el archivo /etc/fail2ban/jail.local:

vi /etc/fail2ban/jail.local
#*/10 * * * * www-data [ -x /usr/share/awstats/tools/update.sh ] && /usr/share/awstats/tools/update.sh

# Generate static reports:
#10 03 * * * www-data [ -x /usr/share/awstats/tools/buildstatic.sh ] && /usr/share/awstats/tools/buildstatic.sh

Luego cree los siguientes cinco archivos de filtro:

vi /etc/fail2ban/filter.d/pureftpd.conf
[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
vi /etc/fail2ban/filter.d/courierpop3.conf
[Definition]
failregex = .*pure-ftpd: \(.*@<HOST>\) \[WARNING\] Authentication failed for user.*
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 "<HOST>" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>\S+)
# Values:  TEXT
#
failregex = pop3d: LOGIN FAILED.*ip=\[.*:<HOST>\]

# 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 "<HOST>" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>\S+)
# Values:  TEXT
#
failregex = pop3d-ssl: LOGIN FAILED.*ip=\[.*:<HOST>\]

# 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 "<HOST>" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>\S+)
# Values:  TEXT
#
failregex = imapd: LOGIN FAILED.*ip=\[.*:<HOST>\]

# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =

Reinicie fail2ban después:

/etc/init.d/fail2ban restart

20 Instalar SquirrelMail

Para instalar el cliente de correo web SquirrelMail, ejecute

apt-get install squirrelmail

Luego crea el siguiente enlace simbólico...

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

... and configure SquirrelMail:

squirrelmail-configure

We must tell SquirrelMail that we are using Courier-IMAP/-POP3:

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color on
S   Save data
Q   Quit

Command >> <-- D


SquirrelMail Configuration : Read: config.php
---------------------------------------------------------
While we have been building SquirrelMail, we have discovered some
preferences that work better with some servers that don't work so
well with others.  If you select your IMAP server, this option will
set some pre-defined settings for that server.

Please note that you will still need to go through and make sure
everything is correct.  This does not change everything.  There are
only a few settings that this will change.

Please select your IMAP server:
    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        = Do not change anything
Command >> <-- courier


SquirrelMail Configuration : Read: config.php
---------------------------------------------------------
While we have been building SquirrelMail, we have discovered some
preferences that work better with some servers that don't work so
well with others.  If you select your IMAP server, this option will
set some pre-defined settings for that server.

Please note that you will still need to go through and make sure
everything is correct.  This does not change everything.  There are
only a few settings that this will change.

Please select your IMAP server:
    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

    quit        = Do not change anything
Command >> courier

              imap_server_type = courier
         default_folder_prefix = INBOX.
                  trash_folder = Trash
                   sent_folder = Sent
                  draft_folder = Drafts
            show_prefix_option = false
          default_sub_of_inbox = false
show_contain_subfolders_option = false
            optional_delimiter = .
                 delete_folder = true

Press any key to continue... <-- ENTER


SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color on
S   Save data
Q   Quit

Command >> <-- S


SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color on
S   Save data
Q   Quit

Command >> S

Data saved in config.php
Press enter to continue... <-- ENTER


SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color on
S   Save data
Q   Quit

Command >> <-- Q

Afterwards you can access SquirrelMail under http://server1.example.com/webmail or http://192.168.0.100/webmail:

The Perfect Server - Ubuntu 11.04 [ISPConfig 3] - Page 6

21 Install ISPConfig 3

To install ISPConfig 3 from the latest released version, do this:

cd /tmp
wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz
tar xfz ISPConfig-3-stable.tar.gz
cd ispconfig3_install/install/

The next step is to run

php -q install.php

This will start the ISPConfig 3 installer. The installer will configure all services like Postfix, SASL, Courier, etc. for you. A manual setup as required for ISPConfig 2 (perfect setup guides) is not necessary.

[email protected]:/tmp/ispconfig3_install/install# php -q install.php


--------------------------------------------------------------------------------
 _____ ___________   _____              __ _         ____
|_   _/  ___| ___ \ /  __ \            / _(_)       /__  \
  | | \ `--.| |_/ / | /  \/ ___  _ __ | |_ _  __ _    _/ /
  | | `--. \  __/  | | / _ \| '_ \| _| |/ _` | |_ |
 _| |_/\__/ / | | \__/\ (_) | | | | | | | (_| | ___\ \
 \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, | \____/
                                              __/ |
                                             |___/
--------------------------------------------------------------------------------


>> Initial configuration

Operating System: Debian 6.0 (Squeeze/Sid) or compatible

    Following will be a few questions for primary configuration so be careful.
    Default values are in [brackets] and can be accepted with .
    Tap in "quit" (without the quotes) to stop the installer.


Select language (en,de) [en]: <-- ENTER

Installation mode (standard,expert) [standard]: <-- ENTER

Full qualified hostname (FQDN) of the server, eg server1.domain.tld  [server1.example.com]: <-- ENTER

MySQL server hostname [localhost]: <-- ENTER

MySQL root username [root]: <-- ENTER

MySQL root password []: <-- yourrootsqlpassword

MySQL database to create [dbispconfig]: <-- ENTER

MySQL charset [utf8]: <-- ENTER

Generating a 2048 bit RSA private key
....+++
..+++
writing new private key to 'smtpd.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]: <-- ENTER
State or Province Name (full name) [Some-State]: <-- ENTER
Locality Name (eg, city) []: <-- ENTER
Organization Name (eg, company) [Internet Widgits Pty Ltd]: <-- ENTER
Organizational Unit Name (eg, section) []: <-- ENTER
Common Name (eg, YOUR name) []: <-- ENTER
Email Address []: <-- ENTER
Configuring Jailkit
Configuring SASL
Configuring PAM
Configuring Courier
Configuring Spamassassin
Configuring Amavisd
Configuring Getmail
Configuring Pureftpd
Configuring BIND
Configuring Apache
Configuring Vlogger
Configuring Apps vhost
Configuring Firewall
Installing ISPConfig
ISPConfig Port [8080]: <-- ENTER

Configuring DBServer
Installing ISPConfig crontab
no crontab for root
no crontab for getmail
Restarting services ...
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop mysql ; start mysql. The restart(8) utility is also available.
mysql stop/waiting
mysql start/running, process 27585
 * Stopping Postfix Mail Transport Agent postfix
   ...done.
 * Starting Postfix Mail Transport Agent postfix
   ...done.
 * Stopping SASL Authentication Daemon saslauthd
   ...done.
 * Starting SASL Authentication Daemon saslauthd
   ...done.
Stopping amavisd: amavisd-new.
Starting amavisd: amavisd-new.
 * Stopping ClamAV daemon clamd
   ...done.
 * Starting ClamAV daemon clamd
   ...done.
 * Stopping Courier authentication services authdaemond
   ...done.
 * Starting Courier authentication services authdaemond
   ...done.
 * Stopping Courier IMAP server imapd
   ...done.
 * Starting Courier IMAP server imapd
   ...done.
 * Stopping Courier IMAP-SSL server imapd-ssl
   ...done.
 * Starting Courier IMAP-SSL server imapd-ssl
   ...done.
 * Stopping Courier POP3 server...
   ...done.
 * Starting Courier POP3 server...
   ...done.
 * Stopping Courier POP3-SSL server...
   ...done.
 * Starting Courier POP3-SSL server...
   ...done.
 * Restarting web server apache2
 ... waiting . ...done.
Restarting ftp server: Running: /usr/sbin/pure-ftpd-mysql-virtualchroot -l mysql:/etc/pure-ftpd/db/mysql.conf -l pam -E -Y 1 -8 UTF-8 -H -A -O clf:/var/log/pure-ftpd/transfer.log -D -b -u 1000 -B
Installation completed.
[email protected]:/tmp/ispconfig3_install/install#

The installer automatically configures all underlying services, so no manual configuration is needed.

Afterwards you can access ISPConfig 3 under http://server1.example.com:8080/ or http://192.168.0.100:8080/. Inicie sesión con el nombre de usuario admin y la contraseña admin (debe cambiar la contraseña predeterminada después de su primer inicio de sesión):

The system is now ready to be used.

21.1 ISPConfig 3 Manual

In order to learn how to use ISPConfig 3, I strongly recommend to download the ISPConfig 3 Manual.

On about 300 pages, it covers the concept behind ISPConfig (admin, resellers, clients), explains how to install and update ISPConfig 3, includes a reference for all forms and form fields in ISPConfig together with examples of valid inputs, and provides tutorials for the most common tasks in ISPConfig 3. It also lines out how to make your server more secure and comes with a troubleshooting section at the end.

21.2 ISPConfig Monitor App For Android

With the ISPConfig Monitor App, you can check your server status and find out if all services are running as expected. You can check TCP and UDP ports and ping your servers. In addition to that you can use this app to request details from servers that have ISPConfig installed (please note that the minimum installed ISPConfig 3 version with support for the ISPConfig Monitor App is 3.0.3.3! ); these details include everything you know from the Monitor module in the ISPConfig Control Panel (e.g. services, mail and system logs, mail queue, CPU and memory info, disk usage, quota, OS details, RKHunter log, etc.), and of course, as ISPConfig is multiserver-capable, you can check all servers that are controlled from your ISPConfig master server.

For download and usage instructions, please visit http://www.ispconfig.org/ispconfig-3/ispconfig-monitor-app-for-android/.

22 Additional Notes

22.1 OpenVZ

If the Ubuntu server that you've just set up in this tutorial is an OpenVZ container (virtual machine), you should do this on the host system (I'm assuming that the ID of the OpenVZ container is 101 - replace it with the correct VPSID on your system):

VPSID=101
for CAP in CHOWN DAC_READ_SEARCH SETGID SETUID NET_BIND_SERVICE NET_ADMIN SYS_CHROOT SYS_NICE CHOWN DAC_READ_SEARCH SETGID SETUID NET_BIND_SERVICE NET_ADMIN SYS_CHROOT SYS_NICE
do
  vzctl set $VPSID --capability ${CAP}:on --save
done

22.2 SquirrelMail

Lots of people have reported problems (such as getting 404 Not Found errors) using the SquirrelMail webmail package in their web sites created through ISPConfig 3. This guide explains how to configure SquirrelMail on an Ubuntu 11.04 server so that you can use it from within your web sites (created through ISPConfig).

SquirrelMail's Apache configuration is in the file /etc/squirrelmail/apache.conf, but this file isn't loaded by Apache because it is not in the /etc/apache2/conf.d/ directory. Therefore we create a symlink called squirrelmail.conf in the /etc/apache2/conf.d/ directory that points to /etc/squirrelmail/apache.conf and reload Apache afterwards:

cd /etc/apache2/conf.d/
ln -s ../../squirrelmail/apache.conf squirrelmail.conf
/etc/init.d/apache2 reload

Now open /etc/apache2/conf.d/squirrelmail.conf...

vi /etc/apache2/conf.d/squirrelmail.conf

... and add the following lines to the container that make sure that mod_php is used for accessing SquirrelMail, regardless of what PHP mode you select for your website in ISPConfig:

# 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 "<HOST>" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P<host>\S+)
# Values:  TEXT
#
failregex = imapd-ssl: LOGIN FAILED.*ip=\[.*:<HOST>\]

# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =

Create the directory /var/lib/squirrelmail/tmp...

mkdir /var/lib/squirrelmail/tmp

... and make it owned by the user www-data:

chown www-data /var/lib/squirrelmail/tmp

Reload Apache again:

/etc/init.d/apache2 reload

That's it already - /etc/apache2/conf.d/squirrelmail.conf defines an alias called /squirrelmail that points to SquirrelMail's installation directory /usr/share/squirrelmail.

You can now access SquirrelMail from your web site as follows:

http://www.example.com/squirrelmail

You can also access it from the ISPConfig control panel vhost as follows (this doesn't need any configuration in ISPConfig):

http://server1.example.com:8080/squirrelmail

If you'd like to use the alias /webmail instead of /squirrelmail, simply open /etc/apache2/conf.d/squirrelmail.conf...

vi /etc/apache2/conf.d/squirrelmail.conf

... and add the line Alias /webmail /usr/share/squirrelmail:

[...]
<Directory /usr/share/squirrelmail>
  Options FollowSymLinks
  <IfModule mod_php5.c>
    AddType application/x-httpd-php .php
    php_flag magic_quotes_gpc Off
    php_flag track_vars On
    php_admin_flag allow_url_fopen Off
    php_value include_path .
    php_admin_value upload_tmp_dir /var/lib/squirrelmail/tmp
    php_admin_value open_basedir /usr/share/squirrelmail:/etc/squirrelmail:/var/lib/squirrelmail:/etc/hostname:/etc/mailname:/var/spool/squirrelmail
    php_flag register_globals off
  </IfModule>
  <IfModule mod_dir.c>
    DirectoryIndex index.php
  </IfModule>
  # access to configtest is limited by default to prevent information leak
  <Files configtest.php>
    order deny,allow
    deny from all
    allow from 127.0.0.1
  </Files>
</Directory>
[...]

Then reload Apache:

/etc/init.d/apache2 reload

Now you can access Squirrelmail as follows:

http://www.example.com/webmail
http://server1.example.com:8080/webmail

If you'd like to define a vhost like webmail.example.com where your users can access SquirrelMail, you'd have to add the following vhost configuration to /etc/apache2/conf.d/squirrelmail.conf:

vi /etc/apache2/conf.d/squirrelmail.conf
Alias /squirrelmail /usr/share/squirrelmail
Alias /webmail /usr/share/squirrelmail
[...]

Make sure you replace 1.2.3.4 with the correct IP address of your server. Of course, there must be a DNS record for webmail.example.com that points to the IP address that you use in the vhost configuration. Also make sure that the vhost webmail.example.com does not exist in ISPConfig (otherwise both vhosts will interfere with each other!).

Now reload Apache...

/etc/init.d/apache2 reload

... and you can access SquirrelMail under http://webmail.example.com!

  • Ubuntu:http://www.ubuntu.com/
  • ISPConfig:http://www.ispconfig.org/

Panels
  1. Cómo actualizar un servidor Ubuntu 7.10 ("La configuración perfecta" + ISPConfig) a Ubuntu 8.04 LTS

  2. Cómo actualizar un servidor Ubuntu 7.04 ("La configuración perfecta" + ISPConfig) a Ubuntu 7.10

  3. El servidor perfecto - Fedora 15 x86_64 [ISPConfig 2]

  4. El servidor perfecto - Fedora 15 x86_64 [ISPConfig 3]

  5. El servidor perfecto - Ubuntu Natty Narwhal (Ubuntu 11.04) [ISPConfig 2]

El servidor perfecto - CentOS 6.0 x86_64 [ISPConfig 2]

El servidor perfecto - CentOS 6.0 x86_64 [ISPConfig 3]

El servidor perfecto - Ubuntu 12.04 LTS (Apache2, BIND, Dovecot, ISPConfig 3)

El servidor perfecto:CentOS 6.2 x86_64 con nginx [ISPConfig 3]

El servidor perfecto - Ubuntu 12.10 (Apache2, BIND, Dovecot, ISPConfig 3)

El servidor perfecto - Ubuntu 13.04 (Apache2, BIND, Dovecot, ISPConfig 3)

    [...]
    <VirtualHost 1.2.3.4:80>
      DocumentRoot /usr/share/squirrelmail
      ServerName webmail.example.com
    </VirtualHost>