Introducion:
Instalar PHP5 en FreeBSD para Apache
Requerimientos:
* Conexion a Internet
* FreeBSD instalado
* Apache instalado
* Leer este manual
El proceso:
Actualizar el arbol de ports
# csup -h cvsup16.us.FreeBSD.org -g -L 2 /usr/share/examples/cvsup/ports-supfile
Instalar el por php5
# cd /usr/ports/lang/php5
# make config
Activar la opcion
[X] APACHE Build Apache module
[ OK ]
# make install clean
Crear el archivo test.php
# edit /usr/local/www/apache22/data/test.php
Agregar las siguientes lineas:
<?php
phpinfo();
?>
Gerenar el archivo de configuracion a partir del de ejemplo
# cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
Editar el archivo de apache para activarle PHP
# edit /usr/local/etc/apache22/httpd.conf
Desactivo las siguientes lineas:
#<IfModule dir_module>
#DirectoryIndex index.html
#</IfModule>
Agregamos las nuevas:
# Lineas agregadas para PHP inicio
<IfModule mod_php5.c>
DirectoryIndex default.php index.html index.php login.php
</IfModule>
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfModule>
# Lineas agregadas para PHP fin
Reiniciar Apache
# /usr/local/etc/rc.d/apache22 restart
Verificar el soporte de PHP en Apache
Entrar con el navegador a:
http://<serverip>/test.php
2012/05/22
2012/05/19
Apache
Introduccion:
Instalar Apache en FreeBSD
Requerimientos:
* Conexion a Internet
* FreeBSD instalado
* Leer este manual
El proceso:
Actualizar el arbol de ports
# csup -h cvsup15.us.FreeBSD.org -g -L 2 /usr/share/examples/cvsup/ports-supfile
Instalar el port de Apache
# cd /usr/ports/www/apache22
# make config
Desactive esta opcion, es un modulo tocapelotas (quite la X), queda asi:
[ ] UNIQUE_ID Enable mod_unique_id
# make install clean
Activar el inicio de Apache con el sistema editando /etc/rc.conf
# edit /etc/rc.conf
Agregar la linea
apache22_enable="YES"
Iniciar apache
# /usr/local/etc/rc.d/apache22 start
El archivo de configuracion donde se crean los sitios
# edit /usr/local/etc/apache22/httpd.conf
Los comandos de apache son:
# /usr/local/etc/rc.d/apache22 start|stop|restart
Otro comando muy util para hacer que apache relea el httpd.conf luego de hacer un cambio
# apachectl graceful
Los logs de apache los puede ver asi
# tail -f /var/log/httpd-error.log
# tail -f /var/log/httpd-access.log
Ahora vamos a crear nuestro primer sitio en apache, crearemos misitio
Editamos el archivo httpd.conf de apache
# edit /usr/local/etc/apache22/httpd.conf
Al final del archivo agregamos
# Modificacion para MISITIO inicio
<Directory /usr/local/www/misitio>
Order deny,allow
Options -Indexes
Deny from all
Allow from all
Alias /misitio /usr/local/www/misitio/
# Modificacion para MISITIO fin
Reiniciamos apache
# /usr/local/etc/rc.d/apache22 restart
Creamos el directorio
# mkdir /usr/local/www/misitio
Creamos un codigo html basico dentro de misitio
# edit /usr/local/www/misitio/index.html
Le agregamos un contenido muy basico
<p>Hola mundo!</p>
Le asignamos el usuario www y grupo www al directorio y su contenido
# chown -R www:www /usr/local/www/misitio
Le damos los permisos correctos al directorio y su contenido
# chmod -R 0755 /usr/local/www/misitio
# chmod 0644 /usr/local/www/misitio/index.html
Aqui hay mas informacion sobre los permisos
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/permissions.html
Para verificar que el sitio este funcionando, entramos a
http://<IPSERVER>/misitio
Listo, al entrar debemos ver nuestro Hola mundo!
Instalar Apache en FreeBSD
Requerimientos:
* Conexion a Internet
* FreeBSD instalado
* Leer este manual
El proceso:
Actualizar el arbol de ports
# csup -h cvsup15.us.FreeBSD.org -g -L 2 /usr/share/examples/cvsup/ports-supfile
Instalar el port de Apache
# cd /usr/ports/www/apache22
# make config
Desactive esta opcion, es un modulo tocapelotas (quite la X), queda asi:
[ ] UNIQUE_ID Enable mod_unique_id
# make install clean
Activar el inicio de Apache con el sistema editando /etc/rc.conf
# edit /etc/rc.conf
Agregar la linea
apache22_enable="YES"
Iniciar apache
# /usr/local/etc/rc.d/apache22 start
El archivo de configuracion donde se crean los sitios
# edit /usr/local/etc/apache22/httpd.conf
Los comandos de apache son:
# /usr/local/etc/rc.d/apache22 start|stop|restart
Otro comando muy util para hacer que apache relea el httpd.conf luego de hacer un cambio
# apachectl graceful
Los logs de apache los puede ver asi
# tail -f /var/log/httpd-error.log
# tail -f /var/log/httpd-access.log
Ahora vamos a crear nuestro primer sitio en apache, crearemos misitio
Editamos el archivo httpd.conf de apache
# edit /usr/local/etc/apache22/httpd.conf
Al final del archivo agregamos
# Modificacion para MISITIO inicio
<Directory /usr/local/www/misitio>
Order deny,allow
Options -Indexes
Deny from all
Allow from all
Alias /misitio /usr/local/www/misitio/
# Modificacion para MISITIO fin
Reiniciamos apache
# /usr/local/etc/rc.d/apache22 restart
Creamos el directorio
# mkdir /usr/local/www/misitio
Creamos un codigo html basico dentro de misitio
# edit /usr/local/www/misitio/index.html
Le agregamos un contenido muy basico
<p>Hola mundo!</p>
Le asignamos el usuario www y grupo www al directorio y su contenido
# chown -R www:www /usr/local/www/misitio
Le damos los permisos correctos al directorio y su contenido
# chmod -R 0755 /usr/local/www/misitio
# chmod 0644 /usr/local/www/misitio/index.html
Aqui hay mas informacion sobre los permisos
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/permissions.html
Para verificar que el sitio este funcionando, entramos a
http://<IPSERVER>/misitio
Listo, al entrar debemos ver nuestro Hola mundo!
2012/05/18
Proxy Squid-cache
Introduccion:
Instalar Squid-cache en FreeBSD y dejarlo trabajando en modo intercept (transparente)
Requerimientos:
* Conexion a Internet
* FreeBSD instalado
* Firewall PF (para proxy transparente)
* Leer este manual
El proceso:
Actualizar el arbol de ports
# csup -h cvsup15.us.FreeBSD.org -g -L 2 /usr/share/examples/cvsup/ports-supfile
# cd /usr/ports/www/squid32
# make config
IMPORTANTE!
Para usar proxy transparente se deben desactivar AUTHENTICATION e IPv6
Options for squid 3.2.3_2
[X] ARP_ACL Enable ARP/MAC/EUI based authentification
[X] FS_AUFS Enable AUFS (async-io) support
[X] HTCP Enable HTCP support
[X] IDENT Enable Ident lookups (RFC 931)
[X] KQUEUE Enable kqueue(2) support
[X] SNMP Enable SNMP support
[X] TP_PF Enable transparent proxying with PF
[X] WCCP Enable Web Cache Coordination Protocol
[X] WCCPV2 Enable Web Cache Coordination Protocol v2
[ OK ]
# make install clean
Para que Squid-cache pueda trabajar en modo intercept necesita poder leer /dev/pf
Por defecto /dev/pf solo es accesible para el usuario root
Verificamos los permisos actuales de /dev/pf
# ls -al /dev/pf
crw------- 1 root wheel 0, 108 Oct 26 11:01 /dev/pf
Para darle acceso a Squid-cache
# edit /etc/devfs.conf
Agregamos la linea
# Allow Squid read acess to /dev/pf
own pf root:squid
perm pf 0640
Reiniciamos devfs
# /etc/rc.d/devfs restart
Verificamos los permisos nuevos de /dev/pf
# ls -al /dev/pf
crw-r----- 1 root squid 0, 108 Oct 26 11:01 /dev/pf
El archivo de configuracion se ve asi:
# grep -vE '^#|^;|^$' /usr/local/etc/squid/squid.conf
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow localhost manager
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access deny all
http_port 3128
http_port 3129 intercept
cache_dir ufs /var/squid/cache/squid 1000 16 256
coredump_dir /var/squid/cache/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
access_log daemon:/var/log/squid/access.log squid
Crear el directorio
# mkdir -p /var/squid/cache/squid
Asignar el directorio al usuario squid
# chown -R squid:squid /var/squid
Inicializar el cache
# squid -z
# 2012/12/04 14:04:45 kid1| Creating Swap Directories
2012/12/04 14:04:45 kid1| /var/squid/cache/squid exists
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/00
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/01
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/02
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/03
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/04
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/05
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/06
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/07
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/08
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/09
2012/12/04 14:04:46 kid1| Making directories in /var/squid/cache/squid/0A
2012/12/04 14:04:46 kid1| Making directories in /var/squid/cache/squid/0B
2012/12/04 14:04:46 kid1| Making directories in /var/squid/cache/squid/0C
2012/12/04 14:04:46 kid1| Making directories in /var/squid/cache/squid/0D
2012/12/04 14:04:46 kid1| Making directories in /var/squid/cache/squid/0E
2012/12/04 14:04:47 kid1| Making directories in /var/squid/cache/squid/0F
Poner la linea para que squid inicie con el sistema
# echo '# Squid-cache' >> /etc/rc.conf
# echo 'squid_enable="YES"' >> /etc/rc.conf
Verificar el squid.conf
# squid -k parse
Iniciar squid
# /usr/local/etc/rc.d/squid start
Ver opciones de squid
# squid -v
Un ejemplo para PF en FreeBSD
Colocar la linea en la seccion de NAT de nuestro firewall PF:
# Redirect and allow outgoing to WWW requests to the squid, but
# not from LAN to my server
rdr pass on $int_if proto tcp from any to !$int_if port www \
-> 127.0.0.1 port 3129
Para ver el log de navegacion de squid use el comando:
# tail -f /var/log/squid/access.log
Para verificar otras cosas, por ejemplo si squid inicia bien
# tail -f /var/log/squid/cache.log
Los comandos de squid son:
# /usr/local/etc/rc.d/squid stop|start|restart|reload
Si quiere aqui estan los archivos de configuracion:
Google Drive
Instalar Squid-cache en FreeBSD y dejarlo trabajando en modo intercept (transparente)
Requerimientos:
* Conexion a Internet
* FreeBSD instalado
* Firewall PF (para proxy transparente)
* Leer este manual
El proceso:
Actualizar el arbol de ports
# csup -h cvsup15.us.FreeBSD.org -g -L 2 /usr/share/examples/cvsup/ports-supfile
# cd /usr/ports/www/squid32
# make config
IMPORTANTE!
Para usar proxy transparente se deben desactivar AUTHENTICATION e IPv6
Options for squid 3.2.3_2
[X] ARP_ACL Enable ARP/MAC/EUI based authentification
[X] FS_AUFS Enable AUFS (async-io) support
[X] HTCP Enable HTCP support
[X] IDENT Enable Ident lookups (RFC 931)
[X] KQUEUE Enable kqueue(2) support
[X] SNMP Enable SNMP support
[X] TP_PF Enable transparent proxying with PF
[X] WCCP Enable Web Cache Coordination Protocol
[X] WCCPV2 Enable Web Cache Coordination Protocol v2
[ OK ]
# make install clean
Para que Squid-cache pueda trabajar en modo intercept necesita poder leer /dev/pf
Por defecto /dev/pf solo es accesible para el usuario root
Verificamos los permisos actuales de /dev/pf
# ls -al /dev/pf
crw------- 1 root wheel 0, 108 Oct 26 11:01 /dev/pf
Para darle acceso a Squid-cache
# edit /etc/devfs.conf
Agregamos la linea
# Allow Squid read acess to /dev/pf
own pf root:squid
perm pf 0640
Reiniciamos devfs
# /etc/rc.d/devfs restart
Verificamos los permisos nuevos de /dev/pf
# ls -al /dev/pf
crw-r----- 1 root squid 0, 108 Oct 26 11:01 /dev/pf
El archivo de configuracion se ve asi:
# grep -vE '^#|^;|^$' /usr/local/etc/squid/squid.conf
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow localhost manager
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access deny all
http_port 3128
http_port 3129 intercept
cache_dir ufs /var/squid/cache/squid 1000 16 256
coredump_dir /var/squid/cache/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
access_log daemon:/var/log/squid/access.log squid
Crear el directorio
# mkdir -p /var/squid/cache/squid
Asignar el directorio al usuario squid
# chown -R squid:squid /var/squid
Inicializar el cache
# squid -z
# 2012/12/04 14:04:45 kid1| Creating Swap Directories
2012/12/04 14:04:45 kid1| /var/squid/cache/squid exists
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/00
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/01
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/02
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/03
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/04
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/05
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/06
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/07
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/08
2012/12/04 14:04:45 kid1| Making directories in /var/squid/cache/squid/09
2012/12/04 14:04:46 kid1| Making directories in /var/squid/cache/squid/0A
2012/12/04 14:04:46 kid1| Making directories in /var/squid/cache/squid/0B
2012/12/04 14:04:46 kid1| Making directories in /var/squid/cache/squid/0C
2012/12/04 14:04:46 kid1| Making directories in /var/squid/cache/squid/0D
2012/12/04 14:04:46 kid1| Making directories in /var/squid/cache/squid/0E
2012/12/04 14:04:47 kid1| Making directories in /var/squid/cache/squid/0F
Poner la linea para que squid inicie con el sistema
# echo '# Squid-cache' >> /etc/rc.conf
# echo 'squid_enable="YES"' >> /etc/rc.conf
Verificar el squid.conf
# squid -k parse
Iniciar squid
# /usr/local/etc/rc.d/squid start
Ver opciones de squid
# squid -v
Un ejemplo para PF en FreeBSD
Colocar la linea en la seccion de NAT de nuestro firewall PF:
# Redirect and allow outgoing to WWW requests to the squid, but
# not from LAN to my server
rdr pass on $int_if proto tcp from any to !$int_if port www \
-> 127.0.0.1 port 3129
Para ver el log de navegacion de squid use el comando:
# tail -f /var/log/squid/access.log
Para verificar otras cosas, por ejemplo si squid inicia bien
# tail -f /var/log/squid/cache.log
Los comandos de squid son:
# /usr/local/etc/rc.d/squid stop|start|restart|reload
Si quiere aqui estan los archivos de configuracion:
Google Drive
Firewall PF
Introduccion:
Requerimientos:
* Conexion a Internet
* FreeBSD instalado
* Leer este manual
Diagrama:
ISP---(ext_if)-[FreeBSD]-(int_if)---Switch---LAN
\
'-(dmz_if)
El proceso:
Hacer que PF se cargue con el sistema editando /etc/rc.conf
# edit /etc/rc.conf
Agregar las lineas
# Activamos OpenBSD Packet Filter (PF)
pf_enable="YES" # Enable PF (load module if required)
pf_rules="/etc/pf.conf" # rules definition file for pf
pf_flags="" # additional flags for pfctl startup
pflog_enable="YES" # start pflogd(8)
pflog_logfile="/var/log/pflog" # where pflogd should store the logfile
pflog_flags="" # additional flags for pflogd startup
gateway_enable="YES" # Enable as LAN gateway (PF)
Activar el enrutamiento en el FreeBSD
# sysctl net.inet.ip.forwarding=1
Crear el archivo con las politicas usando el de ejemplo
# cp /usr/share/examples/pf/pf.conf /etc
Editelo y ajuste las macros de red
# edit /etc/pf.conf
Debe quedar similar a este
# egrep -v '#|^ *$' /etc/pf.conf
ext_if="bge0"
int_if="bge1"
table <spamd-white> persist
set skip on lo
scrub in
nat-anchor "ftp-proxy/*"
rdr-anchor "ftp-proxy/*"
nat on $ext_if from !($ext_if) -> ($ext_if:0)
rdr pass on $int_if proto tcp to port ftp -> 127.0.0.1 port 8021
no rdr on $ext_if proto tcp from <spamd-white> to any port smtp
anchor "ftp-proxy/*"
block in
pass out
pass quick on $int_if no state
antispoof quick for { lo $int_if }
pass in on $ext_if proto tcp to ($ext_if) port ssh
pass in log on $ext_if proto tcp to ($ext_if) port smtp
pass out log on $ext_if proto tcp from ($ext_if) to port smtp
pass in on $ext_if inet proto icmp from any to ($ext_if) icmp-type { unreach, redir, timex }
Nota:
Al final de este manual esta el link para descargar un pf.conf muy completo
Cargar el modulo PF
# /etc/rc.d/pf start
Los comandos basicos son:
Verifica el archivo sin aplicar las reglas
# pfctl -nf /etc/pf.conf
Verifica el archivo y muestra como si aplicara las reglas sin hacerlo
# pfctl -nvf /etc/pf.conf
Cargar las reglas
# pfctl -f /etc/pf.conf
Muestra las reglas actuales de filtrado
# pfctl -sr
Muestra las reglas actuales de nat
# pfctl -sn
Recuerde que si hace cambios en /etc/pf.conf debe recargar PF
# pfctl -f /etc/pf.conf
Si quiere aqui estan los archivos de configuracion:
Google Drive
Requerimientos:
* Conexion a Internet
* FreeBSD instalado
* Leer este manual
Diagrama:
ISP---(ext_if)-[FreeBSD]-(int_if)---Switch---LAN
\
'-(dmz_if)
El proceso:
Hacer que PF se cargue con el sistema editando /etc/rc.conf
# edit /etc/rc.conf
Agregar las lineas
# Activamos OpenBSD Packet Filter (PF)
pf_enable="YES" # Enable PF (load module if required)
pf_rules="/etc/pf.conf" # rules definition file for pf
pf_flags="" # additional flags for pfctl startup
pflog_enable="YES" # start pflogd(8)
pflog_logfile="/var/log/pflog" # where pflogd should store the logfile
pflog_flags="" # additional flags for pflogd startup
gateway_enable="YES" # Enable as LAN gateway (PF)
Activar el enrutamiento en el FreeBSD
# sysctl net.inet.ip.forwarding=1
Crear el archivo con las politicas usando el de ejemplo
# cp /usr/share/examples/pf/pf.conf /etc
Editelo y ajuste las macros de red
# edit /etc/pf.conf
Debe quedar similar a este
# egrep -v '#|^ *$' /etc/pf.conf
ext_if="bge0"
int_if="bge1"
table <spamd-white> persist
set skip on lo
scrub in
nat-anchor "ftp-proxy/*"
rdr-anchor "ftp-proxy/*"
nat on $ext_if from !($ext_if) -> ($ext_if:0)
rdr pass on $int_if proto tcp to port ftp -> 127.0.0.1 port 8021
no rdr on $ext_if proto tcp from <spamd-white> to any port smtp
anchor "ftp-proxy/*"
block in
pass out
pass quick on $int_if no state
antispoof quick for { lo $int_if }
pass in on $ext_if proto tcp to ($ext_if) port ssh
pass in log on $ext_if proto tcp to ($ext_if) port smtp
pass out log on $ext_if proto tcp from ($ext_if) to port smtp
pass in on $ext_if inet proto icmp from any to ($ext_if) icmp-type { unreach, redir, timex }
Nota:
Al final de este manual esta el link para descargar un pf.conf muy completo
Cargar el modulo PF
# /etc/rc.d/pf start
Los comandos basicos son:
Verifica el archivo sin aplicar las reglas
# pfctl -nf /etc/pf.conf
Verifica el archivo y muestra como si aplicara las reglas sin hacerlo
# pfctl -nvf /etc/pf.conf
Cargar las reglas
# pfctl -f /etc/pf.conf
Muestra las reglas actuales de filtrado
# pfctl -sr
Muestra las reglas actuales de nat
# pfctl -sn
Recuerde que si hace cambios en /etc/pf.conf debe recargar PF
# pfctl -f /etc/pf.conf
Si quiere aqui estan los archivos de configuracion:
Google Drive
2012/05/15
Nagios
Introduccion:
Instalar Nagios en FreeBSD
Requerimientos:
* Conexion a Internet
* FreeBSD instalado
* Apache22 instalado
* PHP 5.4 instalado
* Leer este manual
El proceso:
Actualizar el arbol de ports
# csup -h cvsup16.us.FreeBSD.org -g -L 2 /usr/share/examples/cvsup/ports-supfile
Instalar el port de Nagios
# cd /usr/ports/net-mgmt/nagios
# make install clean
Hacer que inicie con el sistema editando /etc/rc.conf
# edit /etc/rc.conf
Agregar la linea
nagios_enable="YES"
Instalar los plugins de Nagios
# cd /usr/ports/net-mgmt/nagios-plugins
# make config
[X] NETSNMP SNMP support (check_snmp)
[X] IPv6 support
OK
# make install clean
Instalar los logos para Nagios
# cd /usr/local/www/nagios/images/logos
# wget --no-check-certificate https://www.monitoringexchange.org/attachment/download/Artwork/Image-Packs/Base-Images/imagepak-base.tar.tar
# tar -xvzf imagepak-base.tar.tar
# mv base/* /usr/local/www/nagios/images/logos/
# rm -rf base
# rm imagepak-base.tar.tar
Otros logos se pueden descargar de aqui
https://www.monitoringexchange.org/inventory/Artwork/Image-Packs
# cd /usr/ports/misc/nagios-base-logos
# make install clean
Nota:
De aqui se pueden bajar mas logos http://exchange.nagios.org/directory/Images-and-Logos
se deben descomprimir en la carpeta /usr/local/www/nagios/images/logos/
Crear el archivo htpasswd.users
# touch /usr/local/etc/nagios/htpasswd.users
Agregar los usuarios y las claves
# htpasswd -c /usr/local/etc/nagios/htpasswd.users nagiosadmin
New password: ******
Re-type new password: ******
Adding password for user nagiosadmin
# htpasswd /usr/local/etc/nagios/htpasswd.users guest
New password: ******
Re-type new password: ******
Adding password for user guest
Agregar las entradas en Apache en el archivo
# edit /usr/local/etc/apache22/httpd.conf
# Modificacion para NAGIOS inicio
<Directory /usr/local/www/nagios>
Order deny,allow
Options -Indexes
Deny from all
Allow from all
php_flag engine on
php_admin_value open_basedir /usr/local/www/nagios/:/var/spool/nagios/
# Autenticacion inicio
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/etc/nagios/htpasswd.users
Require valid-user
# Autenticacion fin
</Directory>
<Directory /usr/local/www/nagios/cgi-bin>
Options ExecCGI
# Autenticacion inicio
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/etc/nagios/htpasswd.users
Require valid-user
# Autenticacion fin
</Directory>
ScriptAlias /nagios/cgi-bin/ /usr/local/www/nagios/cgi-bin/
Alias /nagios/ /usr/local/www/nagios/
# Modificacion para NAGIOS fin
Reiniciar Apache para que tome los cambios
# /usr/local/etc/rc.d/apache22 restart
Creamos los archivos a partir de los de ejemplo
# cp /usr/local/etc/nagios/cgi.cfg-sample /usr/local/etc/nagios/cgi.cfg
# cp /usr/local/etc/nagios/resource.cfg-sample /usr/local/etc/nagios/resource.cfg
# cp /usr/local/etc/nagios/nagios.cfg-sample /usr/local/etc/nagios/nagios.cfg
# cp /usr/local/etc/nagios/objects/commands.cfg-sample /usr/local/etc/nagios/objects/commands.cfg
# cp /usr/local/etc/nagios/objects/contacts.cfg-sample /usr/local/etc/nagios/objects/contacts.cfg
# cp /usr/local/etc/nagios/objects/templates.cfg-sample /usr/local/etc/nagios/objects/templates.cfg
# cp /usr/local/etc/nagios/objects/timeperiods.cfg-sample /usr/local/etc/nagios/objects/timeperiods.cfg
Verificar las lineas o ajustarlas
# edit /usr/local/etc/nagios/cgi.cfg
authorized_for_all_services=nagiosadmin,guest
authorized_for_all_hosts=nagiosadmin,guest
Editar el archivo de Nagios
# edit /usr/local/etc/nagios/nagios.cfg
Comentar la linea colocando un # al inicio, queda asi:
#cfg_file=/usr/local/etc/nagios/objects/localhost.cfg
Agregar la linea al archivo de nuestros equipos
cfg_file=/usr/local/etc/nagios/objects/equipment.cfg
Crear el archivo con los equipos de nuestra compaƱia (al final del manual lo puede descargar)
# edit /usr/local/etc/nagios/objects/equipment.cfg
Editar el archivo de contactos de Nagios
# edit /usr/local/etc/nagios/objects/contacts.cfg
Ajustamos la linea
email nagios@localhost ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
Por un email valido
email micorreo@gmail.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
Nagios requiere un ajuste denominado timezones en php.ini
# edit /usr/local/etc/php.ini
Cambiar la linea
;date.timezone =
Por
date.timezone = America/Bogota
Reiniciar Apache22
# /usr/local/etc/rc.d/apache22 restart
Un listado completo de timezones http://co.php.net/manual/en/timezones.php
Iniciar Nagios
# /usr/local/etc/rc.d/nagios start
Para ver el log
# tail -f /var/spool/nagios/nagios.log
Caputuras de Nagios funcionando :-)
Nagios Tactical Overview
Nagios Map
Notas:
En nuestro archivo /usr/local/etc/nagios/objects/commands.cfg podemos agregar nuevos comandos
Si quiere aqui estan los archivos de configuracion:
Google Drive
Instalar Nagios en FreeBSD
Requerimientos:
* Conexion a Internet
* FreeBSD instalado
* Apache22 instalado
* PHP 5.4 instalado
* Leer este manual
El proceso:
Actualizar el arbol de ports
# csup -h cvsup16.us.FreeBSD.org -g -L 2 /usr/share/examples/cvsup/ports-supfile
Instalar el port de Nagios
# cd /usr/ports/net-mgmt/nagios
# make install clean
Hacer que inicie con el sistema editando /etc/rc.conf
# edit /etc/rc.conf
Agregar la linea
nagios_enable="YES"
Instalar los plugins de Nagios
# cd /usr/ports/net-mgmt/nagios-plugins
# make config
[X] NETSNMP SNMP support (check_snmp)
[X] IPv6 support
OK
# make install clean
Instalar los logos para Nagios
# cd /usr/local/www/nagios/images/logos
# wget --no-check-certificate https://www.monitoringexchange.org/attachment/download/Artwork/Image-Packs/Base-Images/imagepak-base.tar.tar
# tar -xvzf imagepak-base.tar.tar
# mv base/* /usr/local/www/nagios/images/logos/
# rm -rf base
# rm imagepak-base.tar.tar
Otros logos se pueden descargar de aqui
https://www.monitoringexchange.org/inventory/Artwork/Image-Packs
# cd /usr/ports/misc/nagios-base-logos
# make install clean
Nota:
De aqui se pueden bajar mas logos http://exchange.nagios.org/directory/Images-and-Logos
se deben descomprimir en la carpeta /usr/local/www/nagios/images/logos/
Crear el archivo htpasswd.users
# touch /usr/local/etc/nagios/htpasswd.users
Agregar los usuarios y las claves
# htpasswd -c /usr/local/etc/nagios/htpasswd.users nagiosadmin
New password: ******
Re-type new password: ******
Adding password for user nagiosadmin
# htpasswd /usr/local/etc/nagios/htpasswd.users guest
New password: ******
Re-type new password: ******
Adding password for user guest
Agregar las entradas en Apache en el archivo
# edit /usr/local/etc/apache22/httpd.conf
# Modificacion para NAGIOS inicio
<Directory /usr/local/www/nagios>
Order deny,allow
Options -Indexes
Deny from all
Allow from all
php_flag engine on
php_admin_value open_basedir /usr/local/www/nagios/:/var/spool/nagios/
# Autenticacion inicio
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/etc/nagios/htpasswd.users
Require valid-user
# Autenticacion fin
</Directory>
<Directory /usr/local/www/nagios/cgi-bin>
Options ExecCGI
# Autenticacion inicio
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/etc/nagios/htpasswd.users
Require valid-user
# Autenticacion fin
</Directory>
ScriptAlias /nagios/cgi-bin/ /usr/local/www/nagios/cgi-bin/
Alias /nagios/ /usr/local/www/nagios/
# Modificacion para NAGIOS fin
Reiniciar Apache para que tome los cambios
# /usr/local/etc/rc.d/apache22 restart
Creamos los archivos a partir de los de ejemplo
# cp /usr/local/etc/nagios/cgi.cfg-sample /usr/local/etc/nagios/cgi.cfg
# cp /usr/local/etc/nagios/resource.cfg-sample /usr/local/etc/nagios/resource.cfg
# cp /usr/local/etc/nagios/nagios.cfg-sample /usr/local/etc/nagios/nagios.cfg
# cp /usr/local/etc/nagios/objects/commands.cfg-sample /usr/local/etc/nagios/objects/commands.cfg
# cp /usr/local/etc/nagios/objects/contacts.cfg-sample /usr/local/etc/nagios/objects/contacts.cfg
# cp /usr/local/etc/nagios/objects/templates.cfg-sample /usr/local/etc/nagios/objects/templates.cfg
# cp /usr/local/etc/nagios/objects/timeperiods.cfg-sample /usr/local/etc/nagios/objects/timeperiods.cfg
Verificar las lineas o ajustarlas
# edit /usr/local/etc/nagios/cgi.cfg
authorized_for_all_services=nagiosadmin,guest
authorized_for_all_hosts=nagiosadmin,guest
Editar el archivo de Nagios
# edit /usr/local/etc/nagios/nagios.cfg
Comentar la linea colocando un # al inicio, queda asi:
#cfg_file=/usr/local/etc/nagios/objects/localhost.cfg
Agregar la linea al archivo de nuestros equipos
cfg_file=/usr/local/etc/nagios/objects/equipment.cfg
Crear el archivo con los equipos de nuestra compaƱia (al final del manual lo puede descargar)
# edit /usr/local/etc/nagios/objects/equipment.cfg
Editar el archivo de contactos de Nagios
# edit /usr/local/etc/nagios/objects/contacts.cfg
Ajustamos la linea
email nagios@localhost ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
Por un email valido
email micorreo@gmail.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
Nagios requiere un ajuste denominado timezones en php.ini
# edit /usr/local/etc/php.ini
Cambiar la linea
;date.timezone =
Por
date.timezone = America/Bogota
Reiniciar Apache22
# /usr/local/etc/rc.d/apache22 restart
Un listado completo de timezones http://co.php.net/manual/en/timezones.php
Iniciar Nagios
# /usr/local/etc/rc.d/nagios start
Para ver el log
# tail -f /var/spool/nagios/nagios.log
Caputuras de Nagios funcionando :-)
Nagios Tactical Overview
Nagios Map
Notas:
En nuestro archivo /usr/local/etc/nagios/objects/commands.cfg podemos agregar nuevos comandos
Si quiere aqui estan los archivos de configuracion:
Google Drive
2012/05/03
Ubuntu
Introduccion:
Instalar Ubuntu 12.04 LTS AMD64
Requerimientos:
* Conexion a Internet
* Disco de instalacion de Ubuntu
* Leer este tutorial
El proceso:
Iniciar el equipo con el disco de Ubuntu
Install Ubuntu
Continue
* Something else
Continue
/dev/sda
New Partition Table...
Continue
free space
Add...
* Primary
1024
* Beginning
Ext4 journaling file system
/boot
OK
free space
Add...
* Primary
10240
* Beginning
Ext4 journaling file system
/
OK
free space
Add...
* Primary
2048
* Beginning
Swap area
OK
free space
Add...
* Primary
8495
* Beginning
Ext4 journaling file system
/home
OK
Install Now
Bogota
Continue
Spanish / Spanish
Continue
angel
angel-Desktop
angel
********
********
* Require my password to log in
Continue
Installation is complete. You need to restart the computer in order to use the
new installation.
Restart Now
Actualizar las fuentes
En el terminal ejecutamos:
$ sudo su
*********
# sudo apt-get update
Instalar algun programa
En el terminal ejecutamos:
$ sudo su
*********
# apt-get install apache2
Do you want to continue [Y/n]? Y
Controlar un programa
Apache:
# /etc/init.d/apache2 start|stop|restart|status
Instalar Ubuntu 12.04 LTS AMD64
Requerimientos:
* Conexion a Internet
* Disco de instalacion de Ubuntu
* Leer este tutorial
El proceso:
Iniciar el equipo con el disco de Ubuntu
Install Ubuntu
Continue
* Something else
Continue
/dev/sda
New Partition Table...
Continue
free space
Add...
* Primary
1024
* Beginning
Ext4 journaling file system
/boot
OK
free space
Add...
* Primary
10240
* Beginning
Ext4 journaling file system
/
OK
free space
Add...
* Primary
2048
* Beginning
Swap area
OK
free space
Add...
* Primary
8495
* Beginning
Ext4 journaling file system
/home
OK
Install Now
Bogota
Continue
Spanish / Spanish
Continue
angel
angel-Desktop
angel
********
********
* Require my password to log in
Continue
Installation is complete. You need to restart the computer in order to use the
new installation.
Restart Now
Actualizar las fuentes
En el terminal ejecutamos:
$ sudo su
*********
# sudo apt-get update
Instalar algun programa
En el terminal ejecutamos:
$ sudo su
*********
# apt-get install apache2
Do you want to continue [Y/n]? Y
Controlar un programa
Apache:
# /etc/init.d/apache2 start|stop|restart|status
VirtualBox (Ubuntu)
Introduccion:
Instrucciones de como crear una maquina virtual para instalar Ubuntu 12.04 LTS correctamente.
Requerimientos:
* Descargar el instalador de VirtualBox https://www.virtualbox.org/wiki/Downloads
* Seguir estos pasos
El proceso:
Oracle VM VirtualBox Manager
New
Continue
Name
Ubuntu_Desktop_AMD64
OS Type
Operating System: Linux
Version: Ubuntu (64 bit)
Continue
Memory
512MB
Continue
* Start-up Disk
* Create new hard disk
Continue
* VDI (VirtualBox Disk Image)
Continue
* Fixed size
Continue
20.31 GB
Continue
Create
Create
Settings
Network
Adapter 1
* Enable Network Adpater
Attached to NAT
Adapter 2
* Enable Network Adpater
Attached to Internal Network
Adapter3
* Enable Network Adpater
Attached to Internal Network
Adapter 4
* Enable Network Adpater
Attached to Internal Network
OK
Si queremos que el Ubuntu se comporte como un equipo mas y use la tarjeta WiFi del host, cambiamos en VirtualBox las siguientes opciones:
Seleccionamos nuestra maquina virtual "Ubuntu_Desktop_AMD64", luego Settings / Network /
En Adapter 1, cambiamos NAT por Bridged Adapter y en Name: en1: WiFi (AirPort), OK.
Hay que notar que estamos usando en la red LAN un proxy transparente, por esto no hay que colocar ningun otro parametro.
Instrucciones de como crear una maquina virtual para instalar Ubuntu 12.04 LTS correctamente.
Requerimientos:
* Descargar el instalador de VirtualBox https://www.virtualbox.org/wiki/Downloads
* Seguir estos pasos
El proceso:
Oracle VM VirtualBox Manager
New
Continue
Name
Ubuntu_Desktop_AMD64
OS Type
Operating System: Linux
Version: Ubuntu (64 bit)
Continue
Memory
512MB
Continue
* Start-up Disk
* Create new hard disk
Continue
* VDI (VirtualBox Disk Image)
Continue
* Fixed size
Continue
20.31 GB
Continue
Create
Create
Settings
Network
Adapter 1
* Enable Network Adpater
Attached to NAT
Adapter 2
* Enable Network Adpater
Attached to Internal Network
Adapter3
* Enable Network Adpater
Attached to Internal Network
Adapter 4
* Enable Network Adpater
Attached to Internal Network
OK
Si queremos que el Ubuntu se comporte como un equipo mas y use la tarjeta WiFi del host, cambiamos en VirtualBox las siguientes opciones:
Seleccionamos nuestra maquina virtual "Ubuntu_Desktop_AMD64", luego Settings / Network /
En Adapter 1, cambiamos NAT por Bridged Adapter y en Name: en1: WiFi (AirPort), OK.
Hay que notar que estamos usando en la red LAN un proxy transparente, por esto no hay que colocar ningun otro parametro.
Subscribe to:
Posts (Atom)

