Scripts Vmware PowerCLI

Buscar MAC dentro de un Cluster

#====================================================================#
#   SCRIPT:        Find_VM_by_MAC_address_menu.ps1                   #
#   FUNCTION:      Find VM (+ adapter) by MAC address with easy menu #
#   OWNER:         Sander Daems                                      #
#   CREATED:       11/01/2011                                        #
#   MODIFIED:      11/01/2011                                        #
#   VERSION:       v.1.0                                             #
#====================================================================#
#   CHANGELOG:                                                       #
#                                                                    #
#    v.1.0                                                           #
#    - Created script;                                               #
#                                                                    #
#====================================================================#
#   HOST - CUSTOM DEFINITIONS                                        #
#====================================================================#
Write-Host "Let's find that damn address" -foregroundcolor green
#====================================================================#
$cluster = read-host "Select Cluster name"
$macaddress = read-host "Select MAC Address to find"
#====================================================================#
#   Script                                                           #
#====================================================================#
Get-Cluster $cluster | Get-VM | Get-NetworkAdapter | Where-Object {$_.MacAddress -eq "$macaddress"} | Format-List -Property *
#====================================================================#
Gracias A , link original http://blog.vmpros.nl/2011/11/01/vmware-easy-menu-to-find-vm-adapter-by-mac-address/
Actualizar Vmware-tools
#Enter your vCenter Host below
$vcenter= "your_vcenter_server"
################################
#Load the VMware Powershell Module
Add-PSsnapinVMware.VimAutomation.Core
#Connect to the vCenter server defined above. Ignore certificate errors
Connect-VIServer$vcenter-wa0
#Get the folder name from the user. Update all VM's if blank
$folder= Read-Host"Which folder would you like to update? (Leave blank to update all VM's)"
#Check if the user entered a folder. If a folder was provided return only the VM's for that folder
If($folder)
{
Write-Host"Updating VM's in $folder"
#Get all VM's for a specified folder and return only their names
$virtualmachines= Get-Folder$folder| Get-VM| select-expandpropertyName
}
#Else if the user left the folder blank, get all VM's
Else
{
Write-Host"Updating all VM's"
#Get all VM's in the vCenter and return only their names
$virtualmachines= Get-VM| select-expandpropertyName
}
#Perform the following for each VM returned
ForEach($vmin $virtualmachines)
{
Write-Host"Updating VMware Tools on $VM"
#Update VMware tools without rebooting the VM
Update-Tools$vm-NoReboot
}
Gracias a  Matt Bradford en http://www.vmspot.com/using-powershell-to-update-vmware-tools-on-vms-2/

SSL Offloading Citrix Netscaler

Este post no viene a ser una receta a seguir sino una guia que se puede utilizar e ir cambiando configuración según las necesidades de quien lee el mismo.

SSL Offloading es una característica que nos permite eliminar la carga que nos conlleva realizar el proceso de encriptacion y decriptacion en el server http, este proceso sera realizado por el appliance con posee procesadores dedicados para tal funcion y asi poder aliviar la carga del procesador del servidor.

Existen diferentes tipos de configuracion del SSL Offloading, la que realizaremos en este post será la configuración simple con la creación de una autoridad certificadora (CA) en el mismo Netscaler que detallaremos a continuación:

SSL Offloading  simple

El flujo del trafico es de la siguiente  forma, el cliente se conecta via https hacia el virtual server y del virtual server hacia los servidores HTTP van en texto simple.

requisitos:

  1. Necesitamos contar con un servidor web para probar el uso del ssl offloading.
  2. Citrix Netscaler

Pasos:

1.Habilitar SSL Offloading

  1. Ingresar al appliance a traves de la interface web
  2. Ir a Configuration -> settings -> Configure basic features y alli hacer check en la opcion SSL Offloading (con esto no tendras que reiniciar el appliance)

2.Debemos tener creados los server de no ser así crearlos

3.Crear los Services

  1. Ir a Configuration -> SSL Offloading -> Services alli hacemos click en ADD, esto nos desplegara una ventana donde se deben llenar El nombre del Services, seleccionar el server hacia el cual se dirige el trafico colocar el tipo de tráfico (HTTP) y el número de puerto que será el por defecto (80)
  2. Realizar el paso anterior tantas veces como server tengamos para balancear.

4. Configuracion del virtual server basado en SSL

  1. Ir a Configuration -> SSL Offloading -> Virtual Server, allí haremos click en ADD lo que nos desplegara la ventana para la creacion del mismo, en la que llenaremos los siguientes campos: Name: Nombre del virtaul server, Protocol: protocolo a balancear (SSL), IP Address: Ip por la cual se publicará el servicio, Port: puerto port el cual escucha el servicio (443), en la pestaña services ubicada en la parte inferior seleccionaremos los recientemente creados.
  2. Al terminar esta configuracion verá el services Down pero eso es por la ausencia de certificado que resolveremos en pasos siguientes.

5. Crear la llave RSA (CA)

  1. Ir a Configuration -> SSL hacer click en Create RSA Key, allí se desplegará una ventana donde nos pedirá los datos Key filename: Aquí le colocaremos el nombre que queramos que tenga la llave, Key size: colocaremos la longitud de la llave.

6. Crear el Certificate Signing request (CSR) para (CA)

  1.   Ir a Configuration -> SSL hacer click en Create CSR, aquí llenaremos los campos de la siguiente forma, Request File Name: colocaremos el nombre del archivo donde se alojara el CSR, Key file name: colocaremos el nombre de la llave que creamos en el paso 5, adicionamente hay que llenar campos que corresponden a datos d la organizacion

7. Crear el certificado de la autoridad certificadora (CA)

  1. Ir a Configuration -> SSL hacer click en Create Certificate, se selecciona root en la seccion certificate type luego llenaremos los siguientes campos, Certificate File Name: se coloca el nombre que llevara el certificado, Certificate Request File Name: aqui colocamos elarchivo creado en el paso 6, Key File Name: aquí solocamos el archivo creado en el paso 5, Valid period: colocaremos el tiempo en que este certificado será valido y hacemos click en aceptar.

8. Instalar Certificado

  1. hacer click en Configuration -> SSL -> certificate luego hacer click en install, alli colocar el nombre que se le quiere dar al certificate-key par y seleccionar los archivos anteriormente creados en los campos donde nos solicitan el certificado y la llave de la autoridad certificadora

9. Crear la llave RSA (CA)

  1. Ir a Configuration -> SSL hacer click en Create RSA Key, allí se desplegará una ventana donde nos pedirá los datos Key filename: Aquí le colocaremos el nombre que queramos que tenga la llave, Key size: colocaremos la longitud de la llave.

10. Crear el Certificate Signing request (CSR) para el servidor

  1.   Ir a Configuration -> SSL hacer click en Create CSR, aquí llenaremos los campos de la siguiente forma, Request File Name: colocaremos el nombre del archivo donde se alojara el CSR, Key file name: colocaremos el nombre de la llave que creamos en el paso 5, adicionamente hay que llenar campos que corresponden a datos d la organizacion

11. Crear el certificado para el vserver

  1. Ir a Configuration -> SSL hacer click en Create Certificate, se selecciona server en la seccion certificate type luego llenaremos los siguientes campos, Certificate File Name: se coloca el nombre que llevara el certificado, Certificate Request File Name: aqui colocamos elarchivo creado en el paso 6, Key File Name: aquí solocamos el archivo creado en el paso 5, Valid period: colocaremos el tiempo en que este certificado será valido y hacemos click en aceptar.

12. Instalar Certificado

  1. hacer click en Configuration -> SSL -> certificate luego hacer click en install, alli colocar el nombre que se le quiere dar al certificate-key par y seleccionar los archivos anteriormente creados en los campos donde nos solicitan el certificado y la llave de la autoridad certificadora

13. Enlazar Virtual Server con el certificado creado.

  1. Ir a SSL Offloading -> virtual server se hace click en el virtual server creado y se selecciona open
  2. ya en la ventana de edicion se va hacia la pestaña SSL settings
  3. En la parte izquierda de la pantalla se desplega una columna donde se verá certificado creado para el servidor se selecciona y se hace click en add.
  4. hacer click en aceptar y ya estará configurado nuestro vserver con un certificado creado por nosotros

 

error: sync has files ssl Warning: Command failed on secondary node, but succeeded on primary node. Configuration will be synchronized to ensure secondary and primary have same configuration

Fuentes:

http://docs.citrix.com/en-us/netscaler/10-1/ns-tmg-wrapper-10-con/ns-ssl-wrapper-con-10/ns-ssl-config-secure-cs-vserver-tsk.html

Pfsense error al instalar

Configuración de Switch 3Com 4500

Esta es una guía de configuración:

Se ha utilizado el programa «minicom» para la conexión hacia el switch.

A continuación se mostrarán algunos pasos básicos para la configuración del switch:

1.- Ingresamos al terminal utilizando el usuario admin y la contraseña en blanco. (configuración por defecto)

2.-Luego ejecutamos el comando system-view ##aquí ingresamos en el modo configuración del switch

3.-Debemos configurarle una dirección IP al switch para hacer posible la administración remota del dispositivo, en este punto debemos tener claro ciertos puntos acerca de nuestra red, dirección IP que se le colocara al switch, VLAN de administración del switch, mascara de red a utilizar, se utilizará la VLAN 1 que es la que la mayoría de las marcas traen por defecto para la administración.

Configuración IP

[4500] interface Vlan-interface 1 ###aquí ingresamos a la VLAN que deseamos configurar

[4500-Vlan-interface1]ip address 192.168.1.2 255.255.255.0 ###colocamos la Ip deseada.

[4500-Vlan-interface1] quit  ###salimos de el prompt

Configuración de troncal

[4500]interface Ethernet 1/0/48 #### ingresamos a la interface que será nuestra troncal.

[4500-Ethernet1/0/48]port link-type trunk ##### Configuramos la interface para que sea capaz de transportar varias VLAN, esta interface será utilizada para conexión entre switch.

[4500-Ethernet1/0/48]port trunk pvid vlan 1 ### aquí se configura la VLAN por defecto del puerto

[4500-Ethernet1/0/48]port trunk permit vlan all ### en este paso colocamos las VLAN que queremos que tengan acceso a este trunk

Configuración de VLAN

[4500]vlan 2 ## de esta forma pueden ser creadas todas las VLAN que necesitemos.

[4500-vlan2]port ethernet 1/0/1 ### aquí ingresamos a la interface en la VLAN correspondiente

Cambio de contraseña de admin

  1. [4500] local-user admin  #### seleccionamos el usuario al que le queremos cambiar la contraseña
    [4500-luser-admin] password simple xxxxx ### donde están las x debe de ir la contraseña
    [4500-luser-admin] quit ###salimos de este prompt

FreePBX DAHDI Trunk Routing with DID fuente:joekane.eu

HowTo: Elastix DAHDI Trunk Routing with DID

If you have multiple FXO (PSTN) lines into your PBX, it is always nice to be able to route these in-bound calls based on the physical line they arrive upon.  Getting this working with DAHDI in Elastix has been driving me up the wall!

 

This issue has been bugging me for over a week now and I have finally got it to work.  I have two trunks connected via FXO modules on a TDM400 card, but I could not get the DID working with them (CLI with BT sorted).  But once Asterisk had the call, I could not make Asterisk make a decision with call based on which number/line the caller called.  Not the number the caller is calling from, this is CLI or CID, but the number they dialled to make your line ‘ring’.

Asterisk was either saying there was no route and answering the call to say the number you have called is not in service, or just handling the 2 lines in the same way – i.e. it could not tell them apart.  Here I detail my findings so you can process lines automatically.

I had most of the configuration right, but I had to hand edit another configuration file to actually to get the changes made via the web interface actually working.  Trying to find this last little bit of information on the forums has been maddening to say the least.

Changing the route

First you need to correct the router handler, by changing a setting in a configuration file.  There is no graphical interface for this I’m afraid and it is the only file you need to manually edit by a suitable means.

The default setting in this configuration file is ‘from-pstn’ and this needs to be changed to ‘from-zaptel’.  You need to edit:

/etc/asterisk/dahdi-channels.conf

You need to find the correct section for your line connection.  For me this was lines 3 & 4.  Below is the example original settings for my channel 3:

;;; line=”3 WCTDM/4/2 FXSKS”
signalling=fxs_ks
callerid=asreceived
group=0
context=from-pstn
channel => 3
callerid=
group=
context=default

And you need to edit this for each channel to become like this:

;;; line=”3 WCTDM/4/2 FXSKS”
signalling=fxs_ks
callerid=asreceived
group=0
context=from-zaptel
channel => 3
callerid=
group=
context=default

Then save the file back and restart Asterisk.

Marking the Channel DID

The next stage is to assign DID numbers to these channels so a decision can be made on how to process the call based on line ID.

Elastix does not have an interface to the required facility, so you need to un-embed the FreePBX console, details are here.

Once in the FreePBX console, you need to choose ‘ZAP Channel DIDs’ from the menu on the left.  You should get a screen similar to:

ZAP DIDs

ZAP DIDs

It is quite simple to complete, needing only 3 bits of information:

  • Channel – The DAHDI channel you are assigning the DID to.
  • Description – Your description for this allocation.  I would suggest an name and a summary of the DID you will be allocating.
  • DID: The DID number need to call to make this channel ‘ring’.

An example UK configuration might look like this for channel 3, used to be routed (Inbound Routes) to the sales department for the number: 01234-123456:

ZAP DID Sample

ZAP DID Sample

Once completed, you can click ‘Submit Changes’.  You need to repeat this for each FXO port you have for inbound calls.

You can then save the changes back and configure the ‘Inbound Routes’ to actually ‘route’ the calls where you want them.

You can actually use almost any number in the DID, but I suggest you use the full number, including the STD, in case you have any ‘out of area’ number.  And it generally reduces confusion in the future.

Mounting HFS+ with Write Access in Debian fuente:raamdev.com

Menu

Mounting HFS+ with Write Access in Debian

 

When I decided to reformat and install my Mac Mini with the latest testing version of Debian (lenny, at the time of this writing) I discovered that I couldn’t mount my HFS+ OS X backup drive with write access:

erin:/# mount -t hfsplus /dev/sda /osx-backup
[ 630.769804] hfs: write access to a journaled filesystem is not supported, use the force option at your own risk, mounting read-only.

This warning puzzled me because I was able to mount fine before the reinstall and, since the external drive is to be used as the bootable backup for my MBP, anything with “at your own risk” was unacceptable.

I had already erased my previous Linux installation so I had no way of checking what might have previously given me write access to the HFS+ drive. A quick apt-cache search hfs revealed a bunch of packages related to the HFS filesystem. I installed the two that looked relevant to what I was trying to do:

hfsplus - Tools to access HFS+ formatted volumes
hfsutils - Tools for reading and writing Macintosh volumes

No dice. I still couldn’t get write access without that warning. I tried loading the hfsplus module and then adding it to /etc/modules to see if that would make a difference. As I expected, it didn’t. I was almost ready to give up but there was another HFS package in the list that, even though it seemed unrelated to what was trying to do, seemed worth a shot:

hfsprogs - mkfs and fsck for HFS and HFS+ file systems

It worked! I have no idea how or why (and I’m not interested enough to figure it out), but after installing the hfsprogs package I was able to mount my HFS+ partition with write access.

Update:

As Massimiliano and Matthias have confirmed in the comments below, the following solution seems to work with Ubuntu 8.04:

From Linux, after installing the tools suggested before, you must run:
mount -o force /dev/sdx /mnt/blabla

Otherwise, in my fstab, I have an entry like this:
UUID=489276e8-7f9b-3ae6-8c73-69b99ccaab9c /media/Leopard hfsplus defaults,force 0 0

 

Quitar Journaling en disco

HFS+ is the files system used on many Apple Macintosh computers by Mac OS. You can mount this filesystem in Ubuntu with read only access by default. If you need read/write access then you have to disable journaling with OS X before you can continue.

In OS X, open a terminal and type:

 

diskutil list

You will obtain an output similar to the following:

 

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *256.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            230.0 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:       Microsoft Basic Data                         25.2 GB    disk0s4

Note down the identifier of your OS X partition. It is of type «Apple_HFS» and usually named «Macintosh HD». In our example, it is disk0s2.

To disable journaling, type the following in the terminal:

 

sudo diskutil disableJournal volumeName

Where volumeName is the previously discovered identifier for OS X partition (disk0s2 in our example).

There was a bug in certain versions of OS X that would allow this command to complete successfully, but still not disable journaling. In order to fix this issue, you may need to enable journaling first with the command:

sudo diskutil enableJournal volumeName

Disabling journaling on your main OS X partition is not recommended however as journaling is an important feature of any filesystem that can prevent damage and data loss: http://en.wikipedia.org/wiki/Journaling_file_system

Other information which may be useful can be found here: http://en.gentoo-wiki.com/wiki/Hfsplus

Fuente: https://help.ubuntu.com/community/hfsplus

blacklist zimbra

# cd /opt/zimbra/conf/
# chmod 644 salocal.cf.in
esto se realiza solo la primera vez para otorgarle permisos de escritura al archivo, luego editamos
con vi, mc, nano
ya sea de alguna de las siguientes maneras
# vi salocal.cf.in
#nano salocal.cf.in
# mc
Para añadir entradas a el archivo salocal.cf.in basta con añadir las líneas en el
siguiente formato:
blacklist_from sales@viagra.com
whitelist_from bill@yahoo.net
blacklist_from *@peru69.com
Tenga en cuenta que es un comodín. En este ejemplo * @ peru69.com indica todos los mensajes de
correo electrónico de cualquier usuario en peru69.com
Cuando haya terminado de editar el archivo salocal.cf.in, reinicie Zimbra spamassassin mediante los siguientes comandos (como usuario Zimbra):
# su zimbra
> zmamavisdctl restart
Killing amavisd with pid zzzz done.
Started amavisd: pid zzzz

 

fuente: http://jap99.blogspot.com/2009/07/blacklist-and-whitelist-zimbra.html