viernes, 31 de octubre de 2014

Script para Restore de informix con ontape y expect en Solaris

#!/opt/csw/bin/expect -f
set timeout -1
spawn /usr/local/apps/informix/bin/ontape -r
expect "Please mount tape 1 on /ruta/de/informix/bkp.full and press Return to continue ..."
send -- "\r"
expect "Continue restore? (y/n)"
send -- "y\r"
expect "Do you want to back up the logs? (y/n)"
send -- "n\r"
expect "Restore a level 1 archive (y/n)"
send -- "n\r"
expect "Do you want to restore log tapes? (y/n)"
send -- "n\r"
expect eof

Reinstalando expect on solaris 10 -bash: /usr/local/bin/expect: Invalid argument

Al obtener el siguiente error y no poder arreglarlo:

server pkg# expect
-bash: /usr/local/bin/expect: Invalid argument


Me decidí a reistalarlo, buscamos el paquete con pkgutil:
(Si no tenemos instalado pkgutil consultar en este enlace: http://redes-seguridad.blogspot.com.ar/2012/05/instalar-paquetes-y-dependencias.html)

server pkg# /opt/csw/bin/pkgutil -a expect
=> Fetching new catalog and descriptions (http://mirror.opencsw.org/opencsw/testing/i386/5.10) if available ...
==> 3612 packages loaded from /var/opt/csw/pkgutil/catalog.mirror.opencsw.org_opencsw_testing_i386_5.10
common               package              catalog                        size
expect               CSWexpect            5.45,REV=2013.04.10        218.6 KB
pm_expect            CSWpm-expect         1.21,REV=2013.08.18         49.7 KB
pm_expect_simple     CSWpm-expect-simple  0.04,REV=2013.08.18         14.3 KB
py_pexpect           CSWpy-pexpect        2.3,REV=2013.09.10          68.0 KB


Lo instalamos:

server pkg# /opt/csw/bin/pkgutil -i CSWexpect
Solving needed dependencies ...
Solving dependency order ...
1 CURRENT packages:
        CSWcommon-1.5,REV=2010.12.11
Install 4 NEW packages:
        CSWexpect-5.45,REV=2013.04.10 (opencsw/testing)
        CSWlibtcl8-5-8.5.15,REV=2013.10.09 (opencsw/testing)
        CSWsunmath-2007.08.04 (opencsw/testing)
        CSWtcl8-tclmodules-8.5.15,REV=2013.10.09 (opencsw/testing)
Total size: 2.2 MB
4 packages to fetch. Do you want to continue? ([y],n,auto)
=> Fetching CSWsunmath-2007.08.04 (1/4) ...
=> Fetching CSWtcl8-tclmodules-8.5.15,REV=2013.10.09 (2/4) ...
...
...
Installation of was successful.


Lo ejecutamos:

server pkg# /opt/csw/bin/expect


jueves, 23 de octubre de 2014

Instalando Webmin en Debian 7



Editamos el source list para agregar un nuevo repositorio:

root@Server:~# vi /etc/apt/sources.list
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib


Actualizamos para que tome el cambio el nuevo repositorio, pero nos indica que no está disponible la key pública:

root@Server:~# apt-get update
....
Reading package lists... Done
W: GPG error: http://webmin.mirror.somersettechsolutions.co.uk sarge Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D97A3AE911F63C51
W: GPG error: http://download.webmin.com sarge Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D97A3AE911F63C51
....


Vamos a la ruta donde queremos descargar la key:

root@Server:~# cd /root

root@Server:~# wget http://www.webmin.com/jcameron-key.asc
--2014-10-20 12:01:48--  http://www.webmin.com/jcameron-key.asc
Resolving www.webmin.com (www.webmin.com)... 216.34.181.97
Connecting to www.webmin.com (www.webmin.com)|216.34.181.97|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1320 (1.3K) [text/plain]
Saving to: `jcameron-key.asc'
100%[=======================================================================================================================================>] 1,320       --.-K/s   in 0s
2014-10-20 12:01:48 (71.9 MB/s) - `jcameron-key.asc' saved [1320/1320]


Agregamos la key:

root@Server:~# apt-key add jcameron-key.asc
OK


Esta vez si nos dejará actualizar:

root@Server:~# apt-get update
Get:1 http://ftp.ccc.uba.ar wheezy Release.gpg [1,655 B]
Get:2 http://ftp.ccc.uba.ar wheezy-updates Release.gpg [836 B]
Get:3 http://ftp.ccc.uba.ar wheezy Release [168 kB]
Get:4 http://ftp.ccc.uba.ar wheezy-updates Release [124 kB]
Get:5 http://ftp.ccc.uba.ar wheezy/main Sources [5,955 kB]
Get:6 http://download.webmin.com sarge Release.gpg [189 B]
Hit http://security.debian.org wheezy/updates Release.gpg
Get:7 http://webmin.mirror.somersettechsolutions.co.uk sarge Release.gpg [189 B]
Hit http://security.debian.org wheezy/updates Release
Hit http://webmin.mirror.somersettechsolutions.co.uk sarge Release
Hit http://download.webmin.com sarge Release
Hit http://webmin.mirror.somersettechsolutions.co.uk sarge/contrib amd64 Packages
Hit http://download.webmin.com sarge/contrib amd64 Packages
Hit http://security.debian.org wheezy/updates/main Sources
Hit http://security.debian.org wheezy/updates/main amd64 Packages
Hit http://security.debian.org wheezy/updates/main Translation-en
Ign http://webmin.mirror.somersettechsolutions.co.uk sarge/contrib Translation-en_US
Ign http://webmin.mirror.somersettechsolutions.co.uk sarge/contrib Translation-en
Ign http://download.webmin.com sarge/contrib Translation-en_US
Ign http://download.webmin.com sarge/contrib Translation-en
Get:8 http://ftp.ccc.uba.ar wheezy/main amd64 Packages [5,841 kB]
Get:9 http://ftp.ccc.uba.ar wheezy/main Translation-en [3,846 kB]
Get:10 http://ftp.ccc.uba.ar wheezy-updates/main Sources [14 B]
Get:11 http://ftp.ccc.uba.ar wheezy-updates/main amd64 Packages/DiffIndex [1,609 B]
Get:12 http://ftp.ccc.uba.ar wheezy-updates/main Translation-en/DiffIndex [1,057 B]
Fetched 15.9 MB in 25s (620 kB/s)
Reading package lists... Done
root@Server:~#


Instalamos el webmin, le damos a 'Y' para confirmar:

root@Server:~# apt-get install webmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libdbi-perl libodbc1
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  apt-show-versions libapt-pkg-perl libauthen-pam-perl libio-pty-perl
The following NEW packages will be installed:
  apt-show-versions libapt-pkg-perl libauthen-pam-perl libio-pty-perl webmin
0 upgraded, 5 newly installed, 0 to remove and 22 not upgraded.
Need to get 22.1 MB of archives.
After this operation, 141 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y

Get:1 http://ftp.ccc.uba.ar/pub/linux/debian/debian/ wheezy/main libauthen-pam-perl amd64 0.16-2+b2 [31.3 kB]
Get:2 http://ftp.ccc.uba.ar/pub/linux/debian/debian/ wheezy/main libio-pty-perl amd64 1:1.08-1+b2 [40.0 kB]
Get:3 http://ftp.ccc.uba.ar/pub/linux/debian/debian/ wheezy/main libapt-pkg-perl amd64 0.1.26+b1 [84.7 kB]
1% [Connecting to download.webmin.com]
Get:4 http://ftp.ccc.uba.ar/pub/linux/debian/debian/ wheezy/main apt-show-versions all 0.20 [34.9 kB]
Get:5 http://download.webmin.com/download/repository/ sarge/contrib webmin all 1.710 [21.9 MB]
Fetched 22.1 MB in 1min 16s (288 kB/s)
Selecting previously unselected package libauthen-pam-perl.
(Reading database ... 45191 files and directories currently installed.)
Unpacking libauthen-pam-perl (from .../libauthen-pam-perl_0.16-2+b2_amd64.deb) ...
Selecting previously unselected package libio-pty-perl.
Unpacking libio-pty-perl (from .../libio-pty-perl_1%3a1.08-1+b2_amd64.deb) ...
Selecting previously unselected package libapt-pkg-perl.
Unpacking libapt-pkg-perl (from .../libapt-pkg-perl_0.1.26+b1_amd64.deb) ...
Selecting previously unselected package apt-show-versions.
Unpacking apt-show-versions (from .../apt-show-versions_0.20_all.deb) ...
Selecting previously unselected package webmin.
Unpacking webmin (from .../archives/webmin_1.710_all.deb) ...
Processing triggers for man-db ...
Setting up libauthen-pam-perl (0.16-2+b2) ...
Setting up libio-pty-perl (1:1.08-1+b2) ...
Setting up libapt-pkg-perl (0.1.26+b1) ...
Setting up apt-show-versions (0.20) ...
** initializing cache. This may take a while **
Setting up webmin (1.710) ...
Webmin install complete. You can now login to https://Server:10000/
as root with your root password, or as any user who can use sudo
to run commands as root.

miércoles, 22 de octubre de 2014

Script para copiar y verificar la copia de archivos con MD5 en Solaris

#!/bin/bash

echo "Verifico el tamaño del archivo local:"
VAR1=`du -sk /ruta/al/archivo`

echo "Copiando el archivo al servidor remoto:"
scp /ruta/al/archivo server:/ruta/remota/al/archivo

echo "Verifico el tamaño del archivo remoto:"
VAR2=`ssh server du -sk /ruta/remota/al/archivo`

echo "Verifico el md5 del archivo local:"
VAR3=`digest -v -a md5 /ruta/al/archivo | cut -d "=" -f2`

echo "Verifico el md5 del archivo remoto"
VAR4=`ssh server digest -v -a md5 /ruta/al/archivo | cut -d "=" -f2`

if [ "$VAR1" = "$VAR2" ];
then
 echo "Tamanos iguales."
else
 echo "Tamano incorrecto - Copia incorrecta !!"
fi

if [ "$VAR3" = "$VAR4" ];
then
 echo "Hashes iguales."
 echo "La copia ha finalizado correctamente."
else
 echo "Tamano incorrecto - Copia incorrecta !!"
fi

martes, 21 de octubre de 2014

UX: useradd: ERROR: Inconsistent password files. See pwconv(1M).

Al querer agregar un nuevo usuario me aparecía el siguiente mensaje:

UX: useradd: ERROR: Inconsistent password files. See pwconv(1M).


Parece que alguien previamente editó el /etc/passwd y había inconsistencia el archivo passwd y el shadow.

Ejecutar el pwconf para actualizarlo:

# pwconv



martes, 14 de octubre de 2014

Administrator Password No Expires on VMware vCenter

Loguearnos al VCenter Server con el siguiente link, reemplazar ip ó el nombre del server:

https://VCenterServer:5480/


Ingresamos usuario y password del VCenter:



Vamos a la solapa de administración, tildamos la opción NO y luego submit:



Aparecerá en verde que fue satisfactoria como muestra la imagen:



Solaris 32 ó 64 bits?

server /# isainfo -kv
64-bit amd64 kernel modules