MTA: servidor que envia y recibe correos
MDA: distribuye el correo: lo deja en el inbox del uuario.
MUA: webmail, outlook
Instalar el paquete postfix
[root@gcepedar named]# yum install postfix
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* rpmforge: fr2.rpmfind.net
* base: mirror.netglobalis.net
* updates: mirror.netglobalis.net
* addons: mirror.netglobalis.net
* extras: mirror.netglobalis.net
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package postfix.i386 2:2.3.3-2.3.el5_6 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================
Package Arch Version Repository Size
==================================================================================
Installing:
postfix i386 2:2.3.3-2.3.el5_6 updates 3.5 M
Transaction Summary
==================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 3.5 M
Is this ok [y/N]: y
Downloading Packages:
postfix-2.3.3-2.3.el5_6.i386.rpm | 3.5 MB 00:18
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : postfix [1/1]
Installed: postfix.i386 2:2.3.3-2.3.el5_6
Complete!
[root@gcepedar named]#
Comprobar que sendmail esta funcionando:
[root@gcepedar named]# netstat -atunp | grep 25
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3290/sendmail: acce
[root@gcepedar named]#
PostFix y sendmail no puede estar activados al mismo tiempo. Para eso de desactiva Sendmail.
Configurar inicio de servicio sendmail en el server para que no se inicie nunca mas
[root@gcepedar named]# /etc/init.d/sendmail stop
Shutting down sm-client: [ OK ]
Shutting down sendmail: [ OK ]
[root@gcepedar named]# chkconfig sendmail off
Setear postfix para que quede por defecto para el MTA
[root@gcepedar named]# alternatives --config mta
There are 2 programs which provide 'mta'.
Selection Command
-----------------------------------------------
*+ 1 /usr/sbin/sendmail.sendmail
2 /usr/sbin/sendmail.postfix
Enter to keep the current selection[+], or type selection number: 2
[root@gcepedar named]#
El archivo principal de configuracion es.
[root@gcepedar named]# cat /etc/postfix/main.cf
Editar los siguientes bloques del archivo de configuracion:
Linea 70: myhostname = mail.gcepeda.cl
linea 77: mydomain = gcepeda.cl
linea 93: myorigin = $mydomain (solo se descomenta la linea)
linea 107: inet_interfaces = all (solo se descomenta la linea)
linea 110: #inet_interfaces = localhost (se comenta la linea)
linea 155: mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain (se agrega ", $mydomain")
linea 255: mynetworks = 192.168.100.0/24, 127.0.0.0/8
linea 417: mail_spool_directory = /var/spool/mail (solo se descomenta la linea)
Respaldar el archivo con utilitario postconf
[root@gcepedar named]# postconf -n > respaldo
Iniciar servidor de correo postfix
[root@gcepedar named]# /etc/init.d/postfix restart
Shutting down postfix: [FAILED]
Starting postfix: [ OK ]
[root@gcepedar named]#
Verificar el puerto
[root@gcepedar named]# netstat -atunp | grep :25
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 5388/master
[root@gcepedar named]#
Verificar el log de mail
[root@gcepedar named]# tail /var/log/maillog
Aug 23 14:37:17 gcepedar postfix/postfix-script: fatal: the Postfix mail system is not running
Aug 23 14:37:17 gcepedar postfix/postfix-script: starting the Postfix mail system
Aug 23 14:37:17 gcepedar postfix/master[5388]: daemon started -- version 2.3.3, configuration /etc/postfix
[root@gcepedar named]#
En este caso la ip actua como nic 192.168.100.18, por lo que se configura para que vaya a buscar el nic a esa ip.
[root@gcepedar named]# cat /etc/resolv.conf
; generated by /sbin/dhclient-script
search it-wall.com
nameserver 192.168.100.18
[root@gcepedar named]#
Enviar un correo
[root@gcepedar named]# echo holas | mail -s "testing" root@mostr0.cl
[root@gcepedar named]# tail -f /var/log/maillog
Aug 23 15:00:37 gcepedar postfix/pickup[5389]: B9BE8118063: uid=0 from=
Aug 23 15:00:37 gcepedar postfix/cleanup[5488]: B9BE8118063: message-id=<20110823210037.B9BE8118063@mail.gcepeda.cl>
Aug 23 15:00:37 gcepedar postfix/qmgr[5390]: B9BE8118063: from=
Aug 23 15:00:38 gcepedar postfix/smtp[5490]: B9BE8118063: to=
Aug 23 15:00:38 gcepedar postfix/qmgr[5390]: B9BE8118063: removed
[root@gcepedar ~]#
Cuando se recibe un correo, se usa el cliente de correo
[root@gcepedar ~]# mutt -f /var/spool/mail/root
Aparece una bandeja de entrada:
q:Quit d:Del u:Undel s:Save m:Mail r:Reply g:Group ?:Help
1 Aug 21 root ( 1) test
presionar "Enter"
i:Exit -:PrevPg
X-Original-To: root@gcepeda.cl
Delivered-To: root@gcepeda.cl
To: root@gcepeda.cl
Subject: test
Date: Sun, 21 Aug 2011 01:36:34 -0400 (CLT)
From: root@mostr0.cl (root)
holas
Indicar la ip del servidor nic.
[root@gcepedar ~]# vi /etc/resolv.conf
[root@gcepedar ~]# cat /etc/resolv.conf
; generated by /sbin/dhclient-script
search it-wall.com
nameserver 192.168.100.18
[root@gcepedar ~]#
Reiniciar servicio named
[root@gcepedar ~]# /etc/init.d/named restart
Stopping named: [ OK ]
Starting named: [ OK ]
[root@gcepedar ~]#
Reiniciar el servicio postfix
[root@gcepedar ~]# /etc/init.d/postfix restart
Shutting down postfix: [ OK ]
Starting postfix: [ OK ]
[root@gcepedar ~]# chkconfig postfix on
[root@gcepedar ~]#
------------------------------------------------------
POP3, IMAP, webmail
------------------------------------------------------
Instalar pop3, imap: dovecot
[root@gcepedar ~]# yum install dovecot squirremail
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* rpmforge: fr2.rpmfind.net
* base: mirror.gtdinternet.com
* updates: mirror.gtdinternet.com
* addons: mirror.netglobalis.net
* extras: mirror.gtdinternet.com
rpmforge | 1.1 kB 00:00
base | 1.1 kB 00:00
updates | 1.9 kB 00:00
addons | 951 B 00:00
extras | 2.1 kB 00:00
Setting up Install Process
Parsing package install arguments
No package squirremail available.
Resolving Dependencies
--> Running transaction check
---> Package dovecot.i386 0:1.0.7-7.el5 set to be updated
--> Processing Dependency: libmysqlclient.so.15 for package: dovecot
--> Processing Dependency: libmysqlclient.so.15(libmysqlclient_15) for package: dovecot
--> Running transaction check
---> Package mysql.i386 0:5.0.77-4.el5_6.6 set to be updated
--> Processing Dependency: perl(DBI) for package: mysql
--> Running transaction check
---> Package perl-DBI.i386 0:1.52-2.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================
Package Arch Version Repository Size
========================================================================================
Installing:
dovecot i386 1.0.7-7.el5 base 1.6 M
Installing for dependencies:
mysql i386 5.0.77-4.el5_6.6 updates 4.8 M
perl-DBI i386 1.52-2.el5 base 600 k
Transaction Summary
========================================================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 7.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): perl-DBI-1.52-2.el5.i386.rpm | 600 kB 00:01
(2/3): dovecot-1.0.7-7.el5.i386.rpm | 1.6 MB 00:03
(3/3): mysql-5.0.77-4.el5_6.6.i386.rpm | 4.8 MB 00:07
----------------------------------------------------------------------------------------
Total 599 kB/s | 7.0 MB 00:11
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : perl-DBI [1/3]
Installing : mysql [2/3]
Installing : dovecot [3/3]
Installed: dovecot.i386 0:1.0.7-7.el5
Dependency Installed: mysql.i386 0:5.0.77-4.el5_6.6 perl-DBI.i386 0:1.52-2.el5
Complete!
[root@gcepedar ~]#
instalar squirrelmail
[root@gcepedar ~]# yum install squirrelmail
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* rpmforge: apt.sw.be
* base: mirror.gtdinternet.com
* updates: mirror.gtdinternet.com
* addons: mirror.netglobalis.net
* extras: mirror.gtdinternet.com
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package squirrelmail.noarch 0:1.4.8-5.el5.centos.10 set to be updated
--> Processing Dependency: php >= 4.0.4 for package: squirrelmail
--> Processing Dependency: php-mbstring for package: squirrelmail
--> Running transaction check
---> Package php.i386 0:5.1.6-27.el5_5.3 set to be updated
--> Processing Dependency: php-common = 5.1.6-27.el5_5.3 for package: php
--> Processing Dependency: php-cli = 5.1.6-27.el5_5.3 for package: php
---> Package php-mbstring.i386 0:5.1.6-27.el5_5.3 set to be updated
--> Running transaction check
---> Package php-cli.i386 0:5.1.6-27.el5_5.3 set to be updated
---> Package php-common.i386 0:5.1.6-27.el5_5.3 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================
Package Arch Version Repository Size
========================================================================================
Installing:
squirrelmail noarch 1.4.8-5.el5.centos.10 base 4.2 M
Installing for dependencies:
php i386 5.1.6-27.el5_5.3 base 2.3 M
php-cli i386 5.1.6-27.el5_5.3 base 2.1 M
php-common i386 5.1.6-27.el5_5.3 base 153 k
php-mbstring i386 5.1.6-27.el5_5.3 base 995 k
Transaction Summary
========================================================================================
Install 5 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 9.8 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): php-common-5.1.6-27.el5_5.3.i386.rpm | 153 kB 00:00
(2/5): php-mbstring-5.1.6-27.el5_5.3.i386.rpm | 995 kB 00:01
(3/5): php-cli-5.1.6-27.el5_5.3.i386.rpm | 2.1 MB 00:03
(4/5): php-5.1.6-27.el5_5.3.i386.rpm | 2.3 MB 00:03
(5/5): squirrelmail-1.4.8-5.el5.centos.10.noarch.rpm | 4.2 MB 00:06
----------------------------------------------------------------------------------------
Total 630 kB/s | 9.8 MB 00:15
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : php-common [1/5]
Installing : php-cli [2/5]
Installing : php [3/5]
Installing : php-mbstring [4/5]
Installing : squirrelmail [5/5]
Installed: squirrelmail.noarch 0:1.4.8-5.el5.centos.10
Dependency Installed: php.i386 0:5.1.6-27.el5_5.3 php-cli.i386 0:5.1.6-27.el5_5.3 php-common.i386 0:5.1.6-27.el5_5.3 php-mbstring.i386 0:5.1.6-27.el5_5.3
Complete!
[root@gcepedar ~]#
Configurar squirremail
[root@gcepedar ~]# vi /etc/dovecot.conf
linea 20: protocols = imap imaps pop3 pop3s (solo descomentar)
reiniciar servicio dovecot (nunca se habia iniciado por aparece error al detener)
[root@gcepedar ~]# /etc/init.d/dovecot restart
Stopping Dovecot Imap: [FAILED]
Starting Dovecot Imap: [ OK ]
[root@gcepedar ~]#
Configurar arranque permanente de dovecot
[root@gcepedar ~]# chkconfig dovecot on
verificar
[root@gcepedar ~]# netstat -atunp | grep -i list
Squirremail
Reiniciar servidor apache para squirremail
[root@gcepedar ~]# /etc/init.d/httpd restart
Stopping httpd: [FAILED]
Starting httpd: [ OK ]
[root@gcepedar ~]#
[root@gcepedar ~]# chkconfig httpd on
Verificar a través de un navegador web
http://192.168.100.170/
webmail:
http://192.168.100.170/webmail
Configuracion de squirrelmail
[root@gcepedar ~]# cd /usr/share/squirrelmail/config/
[root@gcepedar config]# ./conf.pl
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 off
S Save data
Q Quit
Command >>
Alias de servidor de correo: una lista de correo.
[root@gcepedar config]# vi /etc/aliases
You have new mail in /var/spool/mail/root
[root@gcepedar config]# tail /etc/aliases
support: postmaster
ventas: juan,pedro
marketing: pedro,root
# trap decode to catch security attacks
decode: root
# Person who should get root's mail
#root: marc
[root@gcepedar config]#
[root@gcepedar config]# newaliases
[root@gcepedar config]#
[root@gcepedar config]# /etc/init.d/postfix restart
Shutting down postfix: [ OK ]
Starting postfix: [ OK ]
[root@gcepedar config]#
------------------------------------------------------
Servidor Apache
------------------------------------------------------
Para que aparesca un mensaje en el navegador web
http://192.168.100.170/
[root@gcepedar config]# vi /var/www/html/index.html
[root@gcepedar config]# cat /var/www/html/index.html
bienvenido a gcepeda.cl
[root@gcepedar config]#
Cambiar direcotrio /var/www/html
[root@gcepedar config]# cat /etc/httpd/conf/httpd.conf | grep -i "Documentroot"
# DocumentRoot: The directory out of which you will serve your
DocumentRoot "/var/www/html"
[root@gcepedar config]#
[root@gcepedar config]# vi /etc/httpd/conf/httpd.conf
linea 972: NameVirtualHost *:80 (solo descomentar)
Agregar el siguiente bloque al final del archivo
DocumentRoot /var/www/html/sitio1
ServerName www.gcepeda.cl
Crear el archivo index.html dentro de sitio1
[root@gcepedar config]# vi /var/www/html/sitio1/index.html
[root@gcepedar config]# apachectl -t
Syntax OK
[root@gcepedar config]#
Reiniciar httpd
[root@gcepedar config]# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@gcepedar config]#
Comprobar en el navegador
http://192.168.100.170/
debe aparecer la frase incluida en el archivo /var/www/html/sitio1/index.html
"este es el sitio1 del server gcepeda.cl"
configurar la interfaz de entrada de mail.host.cl
Cuando se accese a mail.gcepeda.cl va a invocar al archivo que esta en /var/www/html/sitio2
[root@gcepedar config]# vi /etc/httpd/conf/httpd.conf
Agregar el siguiente bloque al final del archivo
DocumentRoot /var/www/html/sitio2
ServerName mail.gcepeda.cl
Crear nuevo directorio y archivo
[root@gcepedar config]# mkdir -p /var/www/html/sitio2
[root@gcepedar config]# vi /var/www/html/sitio2/index.cl
[root@gcepedar config]# cat /var/www/html/sitio2/index.cl
bienvenido al server mail de gcepeda
[root@gcepedar config]#
Comprobar sintaxis del archivo.
[root@gcepedar config]# apachectl -t
Syntax OK
[root@gcepedar config]#
------------------------------------------------------
Añadir un directorio con seguridad para que sea visible desde la web.
[root@gcepedar config]# vi /var/www/html/sitio2/index.html
Al final del archivo editar el ultimo bloque generado incluyendo el contenido del tag
DocumentRoot /var/www/html/sitio2
ServerName mail.gcepeda.cl
Authname "seguridad"
Authtype Basic
AuthUserFile /etc/claves
require valid-user
Crear un password para un usuario para el servicio http.
[root@gcepedar config]# htpasswd -c /etc/claves juan
New password:
Re-type new password:
Adding password for user juan
[root@gcepedar config]#
Revisar sintaxys y crear directorio de seguridad: rpm
[root@gcepedar config]# apachectl -t
Syntax OK
[root@gcepedar config]# mkdir /var/www/html/sitio2/rpm
[root@gcepedar config]#
Reiniciar
[root@gcepedar config]# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@gcepedar config]#
http://mail.gcepeda.cl/rpm/
solicita el user/pass configurado: juan/juan1
añadir seguridad
editar el archivo /etc/httpd/conf/httpd.conf
Para que no permita navegar desde uun directorio.
Esta opcion fuerza a que exista un archivo index.html para que se cargue el navegador.
añadir la opcion Options en el bloque Directory
Options -indexes
Authname "seguridad"
Authtype Basic
AuthUserFile /etc/claves
require valid-user
Ya no sera posible que aparesca la ventana de navegacion.
http://mail.gcepeda.cl/rpm/
Index of /rpm
[ICO] Name Last modified Size Description
[DIR] Parent Directory -
Apache/2.2.3 (CentOS) Server at mail.gcepeda.cl Port 80
ServerAlias
DocumentRoot /var/www/html/sitio2
ServerAlias w3.gcepeda.cl
ServerName mail.gcepeda.cl
Options -indexes
Authname "seguridad"
Authtype Basic
AuthUserFile /etc/claves
require valid-user
Se puede acceder por: mail.gcepeda.cl o por w3.gcepeda.cl
------------------------------------------------------
Redireccionar
[root@gcepedar ~]# vi /etc/httpd/conf/httpd.conf
DocumentRoot /var/www/html/sitio1
ServerName www.gcepeda.cl
redirect /paso http://www.google.cl
Comprobar sisntais y reciniciar http:
[root@gcepedar ~]# apachectl -t
Syntax OK
[root@gcepedar ~]# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@gcepedar ~]#
En el navegador se accede por www.gcepeda.cl/paso y redirecciona a www.google.cl
------------------------------------------------------
Alias
Se usa para redireccionar de un directorio a otro dentro del mismo server.
[root@gcepedar ~]# vi /etc/httpd/conf/httpd.conf
DocumentRoot /var/www/html/sitio1
ServerName www.gcepeda.cl
redirect /paso http://www.google.cl
alias /paso /ventas
En el navegador se accede por www.gcepeda.cl/paso y redirecciona a www.gcepeda.cl/ventas
------------------------------------------------------
Tunel emulando proxy
Mantiene la barra de direcciones intacta sin actulizar la redireccion.
[root@gcepedar ~]# vi /etc/httpd/conf/httpd.conf
DocumentRoot /var/www/html/sitio1
ServerName www.gcepeda.cl
ProxyPass / http://www.google.cl
No hay comentarios:
Publicar un comentario