jueves, 26 de marzo de 2009

BBDD: Dump y Restore PostgreSQL

Hay veces que es necesario hacer un volcado de toda la información de un servidor a otro, o simplemente hacer un copia de seguridad total. Para ello en Postgres igual que en MySQL hay los "dumps" y se exporta y se importa de la siguiente manera.

Dump

pgsqldump=backupPSQL`date +%d%m%Y`.dump
su postgres -c "pg_dumpall > $pgsqldump"


Restore
psql -f infile postgres

lunes, 23 de marzo de 2009

Postfix como cliente SMTP SASL

Hay veces que por necesidad hay que autentificar un servidor de correo contra otro servidor. En ese caso, posftix se puede configurar para validarse contra otra servidor y utilizar ese como smarthost.

creamos el fichero: /etc/postfix/password
Y ponemos la información del usuario que va hacer el relay
smtp.isp.com username:password

Asignamos los permisos correctos para mayor seguridad

chown root:root /etc/postfix/password
chmod 0600 /etc/postfix/password
postmap hash:/etc/postfix/password

En el main.cf ponemos
relayhost = smtp.isp.com
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/password
smtp_sasl_security_options =

sábado, 21 de marzo de 2009

VSFTPD + SSL TLS

Primero cramos el certificado:

[root@vps] openssl req -x509 -nodes -days 365 -newkey rsa:1024 \
-keyout /etc/vsftpd/vsftpd.pem \
-out /etc/vsftpd/vsftpd.pem

Añadimos las siguientes linias al fichero /etc/vsftpd.conf


ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=NO
force_local_logins_ssl=NO
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
rsa_cert_file=/etc/vsftpd/vsftpd.pem

lunes, 16 de marzo de 2009

QMAIL - RBLS Añade seguridad Antispam

root@$ cat /etc/xinetd.d/smtp_psa

service smtp
{
socket_type = stream
protocol = tcp
wait = no
disable = no
user = root
instances = UNLIMITED
server = /var/qmail/bin/tcp-env
server_args = -Rt0 /usr/sbin/rblsmtpd -r sbl-xbl.spamhaus.org -r bl.spamcop.net /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true
}

martes, 10 de marzo de 2009

HOWTO: ESXi and SSH

By default this isn’t possible. But there’s a way to get this working, just do the following:
  1. Go to the ESXi console and press alt+F1
  2. Type: unsupported
  3. Enter the root password
  4. At the prompt type “vi /etc/inetd.conf”
  5. Look for the line that starts with “#ssh” (you can search with pressing “/”)
  6. Remove the “#” (press the “x” if the cursor is on the character)
  7. Save “/etc/inetd.conf” by typing “:wq!”
  8. Restart the management service “/sbin/services.sh restart”

jueves, 5 de marzo de 2009

SAMBA Integrado con OpenLDAP

al final de la config en smb.conf
ldap admin dn = cn=Administrator,dc=dominio,dc=com
ldap delete dn = No
ldap group suffix = ou=group
ldap passwd sync = No
ldap replication sleep = 1000
#ldap ssl = Start_tls
ldap suffix = dc=dominio,dc=com
ldap timeout = 5
ldap user suffix = ou=people
passdb backend = ldapsam:ldap://ldap.dominio


fichero entero:

[global]
workgroup = dynamics
#Impresores
printing = cups
printcap name = cups
printcap cache time = 750
cups options = raw
load printers = yes
use client driver = yes
map to guest = Bad User
logon path = \\%L\profiles\.msprofile
logon home = \\%L\%U\.9xprofile
logon drive = P:
usershare allow guests = Yes
add machine script = /usr/sbin/useradd -c Machine -d /var/lib/nobody -s /bin/false %m$
domain logons = Yes
domain master = Yes
local master = Yes
os level = 65
preferred master = Yes

#FSM - Seguretat i LDAP
security = user
ldap admin dn = cn=Administrator,dc=dynamics-research,dc=com
ldap delete dn = No
ldap group suffix = ou=group
ldap passwd sync = No
ldap replication sleep = 1000
#ldap ssl = Start_tls
ldap suffix = dc=dynamics-research,dc=com
ldap timeout = 5
ldap user suffix = ou=people
passdb backend = ldapsam:ldap://ldap.dynamics-research.com
wins proxy = No
wins support = Yes
netbios name = dynamics

#FSM - PARAMETRES ADDICIONALS
server string = dynamics-PDC
log level = 2
max log size = 50

#Castellanitzacio
dos charset = 850
unix charset = iso-8859-15


[homes]

comment = Home Directories
valid users = %S, %D%w%S
browseable = No
read only = No
inherit acls = Yes
[profiles]
comment = Network Profiles Service
path = %H
read only = No
store dos attributes = Yes
create mask = 0600
directory mask = 0700
[users]
comment = All users
path = /home
read only = No
inherit acls = Yes
veto files = /aquota.user/groups/shares/
[grups]
comment = grups
inherit acls = Yes
path = /srv/samba/departaments
read only = No
[soft]
comment = software
inherit acls = Yes
path = /srv/samba/software
read only = No


Le pasamos el password del admin
smbpasswd -w 

Replicación OpenLdap Master -> Slave

Master:

index ...
replogfile /var/lib/ldap/openldap-master-replog
replica host=IP_SLAVE:389 binddn=cn=Administrator,dc=midominio,dc=com bindmethod=simple credentials=password

Tiene que estar arrancado el servicio slurpd

SLAVE:
database bdb
suffix ".."
rootdn ".."
rootpw ".."
updatedn "cn=Administrator,dc=midominio,dc=com"
updateref "ldap://172.26.0.90"

Debian - There is no public key available for the following key IDs

gpg --keyserver subkeys.pgp.net --recv-keys 4D270D06F42584E6
gpg --armor --export 4D270D06F42584E6 apt-key add -