miércoles, 7 de enero de 2009

Algunas variables del Bash

HISTSIZE Limita el número de instrucciones que tendra el archivo historico de comandos (almacenado en la variable $HISTFILE, normalmente es .bash_history). Su valor default es 500.

HISTFILE Nombre del archivo donde se guardara el historial.

HOSTNAME El nombre del host actual ( similar a uname -n).

LANG Usada para determinar el idioma.

LOGNAME Almacena el nombre de login.

MAILCHECK La frecuencia en segundos con que el Shell verificara correo en los archivos indicados por las variables $MAILPATH o $MAIL.

PATH Rutas que se usaran para localizar archivos.

PS1 Es el prompt principal.

PS2 Prompt de continuacion, es aquel signo que aparece despues de un cuando un comando no ha finalizado.

PWD Ruta completa del directorio actual ( similar a pwd ).

BASH_VERSION Imprime la version de bash

HISTCMD Imprime el numero en el indice del historial del comando actual.

HOSTTYPE Imprime el tipo de sistema en el que se esta ejecutando. Ejemplo de salida: i486, x86_64

OLDPWD El directorio anterior al actual ( similar a cd - ).

PPID EL PID del padre del proceso de shell. Es de solo lectura este valor.

UID EL UID del usuario, es de solo lectura esta variable.

HOME La ruta del directorio HOME del usuario (similar a cd )

IFS El separador interno. El valor default es ‘‘’’

TMOUT El tiempo que esperara el comando read antes de dar por terminada.

TMPDIR Ruta que tendra bash para generar archivos temporales necesarios para la ejecucion de comandos. No tiene un valor por default.

viernes, 26 de diciembre de 2008

Estructura de postfix...

La imagen clasica de las relaciones procesos-tablas del postfix ...


miércoles, 10 de diciembre de 2008

Amavis + postfix

Cuando se tiene un esquema de gateway de correo con postfix, en ocasiones es aconsejable que el nodo interno de correo no haga nuevamente un analisis con amavis.

1) El gateway analiza con spamassassin y clamav utilizando amavis-new

2) En nodo interno de correo en el archivo de configuracion main.cf

smtpd_recipient_restrictions
check_client_access cidr:/etc/postfix/filter.cidr


El contenido de filter.cidr es:

x.x.x.x OK # Ip del gateway de correo
x.x.x.x OK
0.0.0.0/0 FILTER smtp-amavis:[127.0.0.1]:10024

jueves, 27 de noviembre de 2008

Script de Perl para renombrar archivos...

#/usr/bin/perl

@files=`ls -1 *.jpg`;
foreach $file ( @files ){
chomp($file);
$newfile=$file;
$newfile=~ s/name\_old/name\_new/;
if (-e $newfile) {
warn "No se puede renombrar $file a $newfile: $newfile ya existe\n";
}
elsif (rename $file, $newfile) {
}
else {
warn "Fallo $file a $newfile $!\n";
}
}

NOTA: Cortesia de Learning Perl.

miércoles, 12 de noviembre de 2008

vsftpd

1) apt-get install vsftpd

2) cp /etc/vsftpd.conf /etc/vsftpd.conf-dist

3) > /etc/vsftpd.conf

4) vi /etc/vsftpd.conf


# Example config file /etc/vsftpd.conf
#
#
##### GENERAL #####
# vsftpd will run in standalone mode
listen=YES

# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
pasv_min_port=20000
pasv_max_port=21000
tcp_wrappers=YES

# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
nopriv_user=ftp

# You may fully customise the login banner string:
ftpd_banner=Welcome to OllinStudio FTP service.

# Time out an idle session.
idle_session_timeout=600

# Time out a data connection.
data_connection_timeout=120

# maximum number of clients which may be connected
max_clients=10

# maximum number of clients which may be connected from the
# same source internet address
max_per_ip=3

##### USER #####
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=no

# Uncomment this to allow local users to log in.
local_enable=YES

# Uncomment this to enable any form of FTP write command.
write_enable=YES

# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022

# messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES

# You may restrict local users to their home directories.
chroot_local_user=YES

# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_list_enable=YES

# (default follows)
chroot_list_file=/etc/vsftpd.chroot_list

# all user and group information in directory listings
# will be displayed as “ftp”
hide_ids=YES


# If userlist_deny=NO, only allow users in the file /etc/vsftpd.user_list
userlist_deny=NO


##### LOG's #########
# Activate logging of uploads/downloads.
xferlog_enable=YES

# the log file
xferlog_file=/var/log/vsftpd.log

# If you want, you can have your log file in standard ftpd xferlog format
xferlog_std_format=YES

##### Debian customization #####
#
# Some of vsftpd's settings don't fit the Debian filesystem layout by
# default. These settings are more Debian-friendly.
#
# This option should be the name of a directory which is empty. Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/vsftpd.pem





5) vi /etc/vsftpd.chroot_list
usuarios permitidos

6) vi /etc/vsftpd.ftpusers
usuarios locales no permitidos, normalmente root, admin, etc.

7) /etc/init.d/vsftpd start


NOTA:

Un error asi:

# /usr/sbin/vsftpd
500 OOPS: missing value in config file for:

Lo solucione verificando que en archivo de configuracion las lineas en blanco fueran eso lineas en blanco y no lineas con un espacio.

viernes, 7 de noviembre de 2008

Webcollab...

Webcollab es una herramienta para la administracion de proyectos.


Instalacion:

1. apt-get install mysql-server-5.0 php5-mysql apache2 libapache2-mod-php5 postfix
2. Bajar la version mas reciente
3. # cd /var/www/
# tar -zxvf webcollab-*.**.tar.gz
# ln -s webcollab-X.XX webcollab
# chmod 666 webcollab/config/config.php
4. En un webbrowser accesar a:
http://your_site/webcollab/setup.php
5. Siga las instrucciones
6. # chmod 444 webcollab/config/config.php


PD: Espero algun dia saber como integrarlo con ldap para asi no tener otra base para usuarios.

miércoles, 5 de noviembre de 2008

Herramientas de monitoreo...

Casi siempre existe la duda de que software usar para monitoreo, quiza este link te pueda ayudar a determinar cual es mejor para tu caso en particular.

http://en.wikipedia.org/wiki/Comparison_of_network_monitoring_systems

Uso Nagios(monitoreo servidores) y Ganglia(nodos de una granja), por ser simples de configurar, mantener y la interfaz sencilla.