Thursday, December 17, 2015

ofa to ovf for vmware import follies

let's dance, shall we?

it all started out with:
ResourceType instance ID 3 no support ofr hardware device type 20

from: http://www.itsecurenet.com/virtualbox-ova-to-vsphere-ovf/

How to convert VirtualBox OVA to Vsphere OVF
2. Microsoft Checksum Verify utilityhttp://support.microsoft.com/kb/841290 (Need to check SHA1)
3. Text editor.

First of all, export your virtual machine from Virtualbox. Give the location for the file and save as ova file
VirtualBox Ova Export
After, Install the VMware OVF Tool. I am using the version 3.0.1
Once, the file has been created and the tool is installed.
Open the command line and navigate to the OVF tool folder.
Type the command below : ovftool.exe –lax <source.ova>  <destination.ovf> 
ovftool.exe –lax “C:\Users\ygotame\Desktop\Asterix Now.ova” “C:\Users\ygotame\Desktop\Asterix Now.ovf”
OVF Tool Export
Once the command is complete, you will see three files :
1. Asterix Now.mf  SHA1 Info File
2. Asterix Now.ovf   Configuration file
3. Asterix Now-disk.vmdk   Virtual Hard drive
Now open, Vsphere client and click to deploy ovf file.
vSphere OVF Deploy
Give the OVF file location and try to upload to the server.
You might this error : Unsupported hardware family virtualbox-2.2
Error: OVF Package is not supported by target:
 Line 25: Unsupported hardware family 'virtualbox-2.2'.
vSphere OVF Deploy Family 2.2 ErrorNote : The image is in French
If it is the case for you, open the ovf file with your favorite text editor.
And, change the line :
<vssd:VirtualSystemType>virtualbox-2.2</vssd:VirtualSystemType>
with this
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>  
To avoid the error message : Line 66: OVF hardware element ‘ResourceType’ with instance ID ‘5’: No support for the virtual hardware device type ’20’
In the same file, modify the item Instance 5:
<Item>
<rasd:Address>0</rasd:Address>
<rasd:Caption>sataController0</rasd:Caption>
<rasd:Description>SATA Controller</rasd:Description>
<rasd:ElementName>sataController0</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:ResourceSubType>AHCI</rasd:ResourceSubType>
<rasd:ResourceType>20</rasd:ResourceType>
</Item>
With this
<Item>
<rasd:Address>0</rasd:Address>
<rasd:Caption>SCSIController</rasd:Caption>
<rasd:Description>SCSI Controller</rasd:Description>
<rasd:ElementName>SCSIController</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
<rasd:ResourceType>6</rasd:ResourceType>
</Item>
Save the change and try again to deploy
At this time, you will get the error saying the file fail the control of integrity and could be corrupted. As the vpshere sever check the <file>.mf to verify the integrity. We will modify that to make sure the correct information is enter.
Integrity Error Vsphere
For that, download the Microsoft toll that I mention above and extract the file where you prepare. I will dump it at C:\Temp
Now, we need to find out new SHA1 key for <file>.ovf because we made some change.  Therefore, open command line and navigate to the place where you had extracted the Microsoft tool.
Execute the command : fciv.exe -sha1 <filename.ovf>
fciv.exe C:\Users\ygotame\Desktop\ItSecure\OVF file new SHA1.png
OVF file new SHA1
Now, copy the new SHA1 key 51bd98… and open <filename>.mf
Paste the new value in the file and save it.
Modify SHA1 Key

Once that has been done,  try one more time to deploy the vm machine. This time, it should be working without any issue.
Deploy Finish Step

Tuesday, December 15, 2015

vnc for mac control-alt-delete

of course...

Laptop keyboard: fn+control+command+delete
Full-size keyboard: control+option+delete

Thursday, December 10, 2015

reset admin pass on win2k8 r2 when erd 6.5 doesn't work


How to Reset Your Forgotten Domain Admin Password on Server 2008 R2


image
Forgetting your password is always a pain, but luckily there’s an easy way to reset your Domain Administrator password. All you need is a copy of the Windows Server 2008 R2 installation disk and one simple command line trick.

Replacing Utilman.exe

Boot off the Windows disk and select the “Repair your computer” option from the lower left-hand corner.
image
Follow through until you get to the option to open the Command Prompt, which you’ll want to select.
image
First you’ll want to type in the following command to backup the utilman.exe file:
MOVE C:\Windows\System32\Utilman.exe C:\Windows\System32\Utilman.exe.bak
image
Now you will need to copy cmd.exe and rename it Utilman.exe:
COPY C:\Windows\System32\cmd.exe C:\Windows\System32\Utilman.exe
image
Now you can go ahead and reboot your machine. When its done booting up again and you are at the Logon screen click on the Ease of access icon.
image
I bet you weren’t expecting that open a command prompt  Smile To change the password type:
net user administrator *
Once you press enter you will asked to set a new password and then confirm it, when entering your new password don’t worry if you can’t see them as you type, they are invisible, they are however being remembered.
image
Once you’re logged in again don’t forget to delete Utilman.exe and then rename Utilman.exe.bak back to plain old Utilman.exe.
from here: http://www.howtogeek.com/106333/how-to-reset-your-forgotten-domain-admin-password-on-server-2008-r2/

Thursday, December 3, 2015

no ldapsearch for me

 oh come on. no ldapsearch? for serious now?  
   
 on a nice box:  
 # rpm -q --whatprovides /usr/bin/ldapsearch  
 openldap-clients  
   
 oh okay.  
    
 # yum install openldap-clients  
    
 let's try something simple...  
   
 authenticated bind:  
 ldapsearch -h ldap.no.where.org -p 389 -x -D "cn=admin,dc=no,dc=where,dc=org" -b "dc=no,dc=where,dc=org" -w comp\!\!plex  
   
 stupid admin and his bangs in passwords <- oh wait. that's me. heh.  
   
 unauthenticated bind  
 ldapsearch -h ldap.no.where.org -p 389 -x -b "dc=no,dc=where,dc=org"  

 oh hey, what's up with no lsof on these systems... you know who you are.

Wednesday, December 2, 2015

sles 11 enterprise to a vm hillarity

 damn you old suse 10 enterprise system that i just virtualized.  
   
 1. first i get scsi ioc errors.  
 2. i fix that and get gdm can't start.  
 3. oh, and then i try to log the eff in and i get module not found or some crap.  
 4. and then i try to use yast and you barf.  
 5. and then i try to fix your ethernet card to the vmware one and no dice.  
   
 i want to call it a day, but i can't. you will not win. oh. you have reiserfs*.
 r e i s e r f s.  for serious?  
   
 1. After conversion, change the VMWare SCSI controller from LSI Logic Parallel to LSI Logic SAS.  
   
 2. Easy. Use your favorite LiveCD, boot up and edit /etc/inittab . 
    Change from 5 to 3. Servers should not have GUIs.  
   
 3. Someone installed an Oracle DB. I check /var/log/messages and see:  
    login: PAM [error: /lib/security/pam_limits.so: wrong ELF class: ELFCLASS32]  
   
 This is a x64 bit system. I head to /etc/pam.d/login and see this line:  
 session required    /lib/security/pam_limits.so  
   
 No no. The PAM stack is controlled via /lib64/security . Remove that preceeding PATH.  
   
 4. The VM is on a SAN. Apparently YAST likes to do things too quickly.  
   
 # find /sys/class/scsi_generic/*/device/timeout -exec grep -H . '{}' \;  
   
 okay  
   
 # echo 180 > /sys/block/sd{a|b}/device/timeout  
   
 That's temporary.  
   
 Make it permanent:  
   
 # touch /etc/udev/rules.d/99-vmware-scsi-udev.rules  
   
 put this in the file:  
 ACTION=="add", SUBSYSTEMS=="scsi", ATTRS{vendor}=="VMware, " , ATTRS{model}=="VMware Virtual S", RUN+="/bin/sh -c 'echo 180 >/sys$DEVPATH/device/timeout'"  
   
 5. VMWare isn't very smart when dealing with those NICs, huh?  
   
 edit:  
   
 /etc/udev/rules.d/30-net_persistent_names.rules  
   
 VMWare commented out stuff hoping YAST would do stuff. Yast didn't. Put this in:  
   
 SUBSYSTEM=="net", ACTION=="add", SYSFS{address}=="00:50:56:98:66:5a", IMPORT="/lib/udev/rename_netiface %k eth0"  
   
 The {address} can be found on your VMWare VM properties.  
   
 # cd /etc/sysconfig/network/  
 # cp ifcfg-eth-id-whateveritisnow ifcfg-eth-id-00\:50\:56\:98\:66\:5a  
   
 edit ifcfg-eth-id-00\:50\:56\:98\:66\:5a  
   
 NAME='VMWare 82545EM Gigabit Ethernet Controller (Copper)'  
 
 *reiserfs murders your wife.  

Wednesday, November 25, 2015

appstore id and updates

for applications that are pestering you for an update on mac & you have a greyed-out appstore id, do this:

* right-click the app, and select "show package contents" and then browse to: _MASReceipt
* delete receipt

now, the deal is, if you haven't purchased said application, it will not be re-registered to you. this merely allows you to update packages that don't require purchase.

where's my ~ osx?

* Press CMD+SHIFT+H to enter your home folder in Finder.
* Press CMD+ArrowUp to get into the Users folder, drag the folder with your UID to the Sidebar.

NB: ~ is located inside Macintosh HD/Users .

Monday, November 23, 2015

i forgot my pwm config password

 go here:  
 /var/lib/tomcat7/webapps/pwm/WEB-INF  
   
 edit:  
 PwmConfiguration.xml  
   
 find:  
 <property key="configPasswordHash">  
   
 put it:  
 $2a$10$AjxdO5TY95CtcxjU8Y832e1mV8wBqtltKTnOjWw9jIzoxceXIPmby  
   
 that's test  

Thursday, November 19, 2015

windows server 2012 r2 limited connectivity

nope, this is not some boutique offering.  well eff you windows server 2012 r2.  maybe i do not want to join a domain to get network connectivity.

  • "Server Manager" | "Tools" | "Local Security policy".
  • Select "Network List manager policies".
  • Open "All Networks" properties.
  • Radio-button "Network location" to "User can change location"
  • reboot and rejoice.
Get-NetConnectionProfile
Set-NetConnectionProfile -InterfaceIndex seeabove# -NetworkCategory Private

kvm lv to vmdk

kvm vm is on an lvm and i need it as a vmware vmdk. sigh.
 # qemu-img convert -O vmdk /dev/vg_name/lv_name/ vmname.vmdk  
 # vmkfstools -i /vmfs/volumes/something/vmname.vmdk -d thin /vmfs/volumes/something/vmname/vmname-thin.vmdk  
 # vi vmname-thin.vmdk  
 change ddb.adapterType=ide to ddb.adapterType=lsilogic  

Tuesday, November 17, 2015

grub2 follies

 blast --fs-uuid)  
   
 /etc/defaults/grub uncommented the line:  
   
 GRUB_DISABLE_LINUX_UUID=true  
   
 /usr/share/grub/grub-mkconfig_lib :  
   
  # If there's a filesystem UUID that GRUB is capable of identifying, use it;  
  # otherwise set root as per value in device.map.  
   fs_hint="`"${grub_probe}" --device $@ --target=compatibility_hint`"  
   if [ "x$fs_hint" != x ]; then  
    echo "set root='$fs_hint'"  
   fi  
   if fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then  
    hints="`"${grub_probe}" --device $@ --target=hints_string 2> /dev/null`" || hints=  
    echo "if [ x\$feature_platform_search_hint = xy ]; then"  
    echo " search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}"  
    echo "else"  
    echo " search --no-floppy --fs-uuid --set=root ${fs_uuid}"  
    echo "fi"  
  fi  
  IFS="$old_ifs"  
   
 and changed the following lines:  
   
   if fs_uuid="`"${grub_probe}" --device $@ --target=fs_label 2> /dev/null`" ; then  
   
   
    echo " search --no-floppy --label --set=root ${hints} ${fs_uuid}"  
   
   
    echo " search --no-floppy --label --set=root ${fs_uuid}"  
   
 run update2-grub --output=/boot/grub2/grub.cfg  
   

Friday, November 13, 2015

centos lvm to ext3 fs grub2 follies

dracut-initqueue[222]: Warning: Could not boot.
no

 sudo mount /dev/sda2 /mnt  
 sudo mount --bind /dev /mnt/dev  
 sudo mount --bind /sys /mnt/sys  
 sudo mount --bind /proc /mnt/proc  
 sudo mount /dev/sda1 /mnt/boot  
 sudo chroot /mnt  
   
 mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-oh_crud.img   
 dracut /boot/initramfs-$(uname -r).img $(uname -r)   

Friday, November 6, 2015

breaking raid1 for vmware converter and how i forgot to spell my name

Breaking a Linux Software RAID 1 for Import using VMware Converter

stolen from here: http://www.truk.com/ramble/2014/08/12/breaking-a-linux-software-raid-1-for-import-using-vmware-converter/
Linux has supported the idea of software RAID, particularly RAID 1 (or disk mirroring) for a long time. Disk mirroring is a great way to gain some insurance against a single disk failure bringing down a critical system, as everything rewritten to one disk is also written to the other disk. Many servers use hardware RAID, which mirrors the disks at a lower level than the operating system can see, making it easier to gain this redundancy. However, hardware RAID has always been more expensive than software RAID, and so there are quite a few servers out there using software RAID to protect their data.
This week, we had one of our last physical (non-virtual) server (RedHat Linux 4 AS) that needed to be virtualized. Due to the size of the data stored on that system and how it uses an external disk array, it was important that we virtualize it in place, using excellent VMware’s Converter Standalone to import the running machine, so that there was no downtime while importing the data. However, the Converter Standalone will not import Linux systems using software RAID, due to problems accessing the underlying data structures of the disk through the metadevices presented by the software RAID. (You know you are having this problem when the Converter complains about not being able to access the /boot partition.) The best solution was to break the mirrored software RAID and boot the system off of one disk, so that all of the necessary partitions could be imported and the system could be virtualized.
Unfortunately, as important and seemingly common as breaking a mirrored software RAID is in Linux, I couldn’t find any good, comprehensive, working instructions on how to do it, and breaking a software RAID is a tricky business. It is very, very easy to end up with a non-booting system and no easy way to repair it. So, to help out the next person that runs into it, I’m posting the steps that we did to break the mirrored software RAID and set the system to boot off of only one disk, so that VMware’s Converter Standalone would work on it.
First, get an idea of what you are dealing with. Logged in as root, inspect the system:
[root@cr2 cr]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/md2 456G 45G 389G 11% /
/dev/md0 487M 35M 427M 8% /boot
none 4.0G 0 4.0G 0% /dev/shm
/dev/sda1 2.0T 560G 1.4T 30% /archive
[root@cr2 cr]# more /etc/fstab
# This file is edited by fstab-sync - see 'man fstab-sync' for details
/dev/md2 / ext3 defaults 1 1
/dev/md0 /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /dev/shm tmpfs defaults 0 0
none /proc proc defaults 0 0
none /sys sysfs defaults 0 0
/dev/md1 swap swap defaults 0 0
/dev/sda1 /archive ext3 defaults 1 0
/dev/hda /media/cdrecorder auto pamconsole,exec,noauto,managed 0 0
[root@cr2 cr]# more /etc/mtab
/dev/md2 / ext3 rw 0 0
none /proc proc rw 0 0
none /sys sysfs rw 0 0
none /dev/pts devpts rw,gid=5,mode=620 0 0
usbfs /proc/bus/usb usbfs rw 0 0
/dev/md0 /boot ext3 rw 0 0
none /dev/shm tmpfs rw 0 0
/dev/sda1 /archive ext3 rw 0 0
none /proc/sys/fs/binfmt_misc binfmt_misc rw 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw 0 0
In this case, we have 3 metadevices (md0 as /boot, md1 as swap, and md2 as root /). You can get further details about your RAID configuration using the mdadm tool, as well as mdstat:
[root@cr2 cr]# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 sdc2[1] sdb2[0]
 2200832 blocks [2/2] [UU]
md2 : active raid1 sdc3[1] sdb3[0]
 485668928 blocks [2/2] [UU]
md0 : active raid1 sdc1[1] sdb1[0]
 513984 blocks [2/2] [UU]
unused devices: 
You can also run these commands:
cat /proc/mdstat
mdadm --detail /dev/md2     (to inquire about the disk members of the /dev/md2 metadevice)
When you are finally ready to do this, make sure you have a full backup of your system, and then stop all running services, especially any that would possibly write data, such as databases.
Next, we need to use mdadm to set one of the disks (we chose /dev/sdc) to be set as “failed” and removed from the RAID array. To do this, we ran these commands:
mdadm --fail /dev/md2 /dev/sdc3
mdadm --remove /dev/md2 /dev/sdc3
mdadm --zero-superblock /dev/sdc3
mdadm --fail /dev/md1 /dev/sdc2
mdadm --remove /dev/md1 /dev/sdc2
mdadm --zero-superblock /dev/sdc2
mdadm --fail /dev/md0 /dev/sdc1
mdadm --remove /dev/md0 /dev/sdc1
mdadm --zero-superblock /dev/sdc1
At this point, the software RAID still exists, but the /dev/sdc disk has been removed from it. All of the data on /dev/sdc is set as standalone.
Next, we need to modify the partition table on /dev/sdc to change it from software RAID to standard Linux partitions.
fdisk /dev/sdc
Select “p” to change the partition table, then “t” to change the type of partition. Select the partition number from the list. We changed /boot and / to be standard ext3 partitions, which is code 83, and the swap partition was changed to 82. Be sure to select “w” at the end to write all of these changes to the /dev/sdc disk when you are done.
Next, we need to mount the / and /boot partitions of /dev/sdc so that we can change files on that filesystem, so that a reboot on /dev/sdc is possible.
mkdir /mntboot
mkdir /mntroot
mount /dev/sdc3 /mntroot/
mount /dev/sdc1 /mntboot/
vi /mntroot/etc/fstab
Change fstab to so that /dev/sdc partitions will be automounted upon boot, rather than the /dev/md devices. Also, move the mdadm.conf file on /dev/sdc out of the way, so that it cannot be used when booting /dev/sdc.
mv /mntroot/etc/mdadm.conf /mntroot/etc/mdadm.bak
Now, we need to modify grub so that the bootloader will load Linux using /dev/sdc and not the /dev/md device. Notice that I will be doing this on the existing /dev/md running filesystem.
vi /etc/grub.conf
Replace the /dev/md2 (or whatever your root partition is) references with /dev/sdc3 (in our case). Save the file and close it.
Also change /mntroot/boot/grub/grub.conf with the same information.
Next, we need to run mkinitrd to use grub to update the bootloader, so that /dev/sdc will be used on boot. To do this look at the kernel you are booting from in /etc/grub.conf. For us, the mdkinitrd command looked like this:
mkinitrd -f -v /boot/initrd-2.6.9-103.ELsmp.img 2.6.9-103.ELsmp
After you run that, you will the bootloader being reconfigured. When it is complete, you are ready to reboot the server. You should boot up on /dev/sdc and be ready to do the VMware Converter Standalone importer.

Thursday, October 8, 2015

vmware esx vm ip address and mac address

 three scripts. data oh so differs.  
   
 script1  
   
 $LOG_FILE = "C:\machines.txt"  
 get-vm | %{ $_ | select Name, @{N="IP Address";E={@($_.guest.IPAddress[0])}} | out-file -filepath $LOG_FILE -append; $_ | Get-NetworkAdapter | out-file -filepath $LOG_FILE -append }  
   
 script2  
   
 $VMs = get-vmhost | Get-VM  
 foreach ($VM in $VMs){  
   $VMx = Get-View $VM.ID  
    $HW = $VMx.guest.net  
    foreach ($dev in $HW)  
   {  
     foreach ($ip in $dev.ipaddress)  
     {  
       $dev | select  
       @{Name = "Name"; Expression = {$vm.name}},  
       @{Name = "IP"; Expression = {$ip}},  
       @{Name = "MAC"; Expression = {$dev.macaddress}} |  
       Export-CSV C:\vmwaremacip2.csv -NoTypeInfo  
         
    
     }  
   }  
 }  
   
 script3  
   
 Get-View -ViewType virtualmachine |   
 Select Name, @{N="MAC";E={((Get-VM $_.Name).NetworkAdapters).MacAddress}},  
  @{N="IP";E={$_.Summary.Guest.IpAddress}} |  
 Export-Csv -NoTypeInformation -UseCulture -Path C:\vmwaremacip3.csv  
   

Wednesday, September 30, 2015

hudson hate me

hudson hates me.

in husdon-security.xml , change:

true
to:

false
voila!  everyone and their brother can go whatever.

not good enough?

fine.

mv initSetup.xml to initSetup.xml.o
and now you're at state zero.  go ahead hudson.  hate me.

This could be interesting...


  
  1.534
2 NORMAL true class="hudson.security.GlobalMatrixAuthorizationStrategy"> hudson.model.Hudson.Administer:foo-jenkins hudson.model.Hudson.Administer:foo-ma-admins hudson.model.Hudson.Read:anonymous hudson.model.Item.Read:anonymous hudson.model.View.Read:anonymous

Friday, September 18, 2015

vmware vm file extensions revealed

what are all those files in a vmware vm's directory?

Extension
File Name
Description

.log

.log

or

vmware.log

This is the file that keeps a log of key VMware Workstation activity. This file can be useful in troubleshooting if you encounter problems. This file is stored in the directory that holds the configuration (.vmx) file of the virtual machine.

.nvram

.nvram

or

nvram

This is the file that stores the state of the virtual machine's BIOS.

.vmdk

.vmdk

This is a virtual disk file, which stores the contents of the virtual machine's hard disk drive.

A virtual disk is made up of one or more .vmdk files. If you have specified that the virtual disk should be split into 2GB chunks, the number of .vmdk files depends on the size of the virtual disk. As data is added to a virtual disk, the .vmdk files grow in size, to a maximum of 2GB each. (If you specify that all space should be allocated when you create the disk, these files start at the maximum size and do not grow.) Almost all of a .vmdk file's content is the virtual machine's data, with a small portion allotted to virtual machine overhead.

If the virtual machine is connected directly to a physical disk, rather than to a virtual disk, the .vmdk file stores information about the partitions the virtual machine is allowed to access.

Earlier VMware products used the extension .dsk for virtual disk files.

-<###>.vmdk

This is a redo-log file, created automatically when a virtual machine has one or more snapshots. This file stores changes made to a virtual disk while the virtual machine is running. There may be more than one such file. The ### indicates a unique suffix added automatically by VMware Workstation to avoid duplicate file names.

.vmsd

.vmsd

This is a centralized file for storing information and metadata about snapshots.

.vmsn

-Snapshot.vmsn

This is the snapshot state file, which stores the running state of a virtual machine at the time you take that snapshot

-Snapshot<###>.vmsn

This is the file which stores the state of a snapshot

.vmss

.vmss

This is the suspended state file, which stores the state of a suspended virtual machine

.Some earlier VMware products used the extension .std for suspended state files

.vmtm

.vmtm

This is the configuration file containing team data.

.vmx

.vmx

This is the primary configuration file, which stores settings chosen in the New Virtual Machine Wizard or virtual machine settings editor. If you created the virtual machine under an earlier version of VMware Workstation on a Linux host, this file may have a .cfg extension

This may be edited by hand (or programmatically).

.vmxf

.vmxf

This is a supplemental configuration file for virtual machines that are in a team. Note that the .vmxf file remains if a virtual machine is removed from the team.

Wednesday, September 9, 2015

libpst and ost conversion

crap. i have an ost file and i need to pick through it for messages.

i could go to one of those creepy websites and pay for some application to convert my ost to pst and have a nice day. or. i could use something on my centos 6 linux box to do the same.
hmm.

linux solution it is! let's install libpst. it has something called readpst which can convert an
ost to mbox (eml) format... perfect for grepping or importing into mailarchiva. oh yes.

 [natas@hell ~]# cd /usr/local/src/  
 [natas@hell ~]# wget http://www.five-ten-sg.com/libpst/packages/libpst-0.6.64-1.el6.src.rpm  
 [natas@hell ~]# wget http://www.five-ten-sg.com/libpst/packages/centos6/libpst-0.6.64-1.el6.x86_64.rpm  
 [natas@hell ~]# wget http://www.five-ten-sg.com/libpst/packages/centos6/libpst-debuginfo-0.6.64-1.el6.x86_64.rpm  
 [natas@hell ~]# wget http://www.five-ten-sg.com/libpst/packages/centos6/libpst-devel-0.6.64-1.el6.x86_64.rpm  
 [natas@hell ~]# wget http://www.five-ten-sg.com/libpst/packages/centos6/libpst-devel-doc-0.6.64-1.el6.x86_64.rpm  
 [natas@hell ~]# wget http://www.five-ten-sg.com/libpst/packages/centos6/libpst-doc-0.6.64-1.el6.x86_64.rpm  
 [natas@hell ~]# wget http://www.five-ten-sg.com/libpst/packages/centos6/libpst-libs-0.6.64-1.el6.x86_64.rpm  
 [natas@hell ~]# wget http://www.five-ten-sg.com/libpst/packages/centos6/libpst-python-0.6.64-1.el6.x86_64.rpm  
 [natas@hell ~]# yum install ImageMagick  
 [natas@hell ~]# yum install libgsf  
 [natas@hell ~]# yum install libgd  
 [natas@hell ~]# yum install libgsf  
 [natas@hell ~]# yum install boost-python-1.41.0  
   
 later...  
   
 [natas@hell ~]# readpst -D -M -e thedamned\@purgatory.com.ost   
 [natas@hell ~]# cd thedamned\@purgatory.com.ost1  
 [natas@hell ~]# ls  
   
 Inbox   Calendar Deleted Items   Sent Items  
   
 [natas@hell ~/thedamned\@purgatory.com.ost1 ]# grep -r Nortel *  
   
 Calendar/423.ics:DESCRIPTION:When: Friday\, November 06\, 2009 11:00 AM-11:30 AM (GMT-05:00) Eastern Time (US & Canada).  
 \nWhere: purgatory \n\n*~*~*~*~*~*~*~*~*~*\n\nthedamned – Avaya has purchased Nortel (and our   
 Meridian phone system). This person says our phone system will no longer be supported in a few months and is coming in   
 to discuss this. I̢۪d like you to be in the meeting with me to discuss options.\n\n  

Friday, September 4, 2015

vmware esxi 4.0 i barf on you.

   
 1. Run this command to set the IP address:  
   
 [root@server root]# esxcfg-vswif -i a.b.c.d -n w.x.y.z vswif0  
   
 where a.b.c.d is the IP address and w.x.y.z is the subnet mask.  
   
 Note: In this example, vswif0 is the Service Console adapter that is the interface to which you are applying the IP address change.  
   
 2. Open the /etc/hosts file with a text editor and modify it so that it reflects the correct IP address and hostname.  
   
 Note: You are required to edit files on an ESX host. For more information, see Editing files on an ESX host using vi or nano (1020302).  
   
 Note: You may also need to verify and change the file /etc/vmware/esx.conf file for the hostname and IP address.  
   
 3. To change the default gateway address and the hostname, edit the /etc/sysconfig/network file and change the GATEWAY and HOSTNAME parameters to the proper values.  
   
 For the changes to take effect, restart the network service with the command:  
   
 [root@server root]# service network restart  

Thursday, September 3, 2015

copy of an svn hotcopy

after your nightly svn hotcopy issue an rsync to plop data someplace else quick fast.
 #!/bin/bash  
   
 repos=( repo1 repo2 repo3 )  
 opath=/tmp/svn  
 dpath=/backup/svn  
 suffix=$(date +%Y-%m-%d)  
 options= --verbose -c --update --recursive --ignore-existing --delete --exclude lost+found --perms --owner --group --times  
   
 for (( i = 0 ; i < ${#repos[@]} ; i++ ))  
 do  
   
 rsync $options user@svnserver:${opath}/${repos[$i]}_$suffix.hotcopy/ $dpath/${repos[$i]}  
   
 done  

Monday, August 24, 2015

last file modified

 last file modified  
   
 # ls -lrt * |tail -l  
   
 -rw-r--r-- 1 root root 2060 2013-01-18 02:09 pre-lock.tmpl  
 -rwxr-xr-- 1 root root 2764 2013-01-18 02:09 pre-revprop-change  
 -rw-r--r-- 1 root root 2764 2013-01-18 02:09 pre-revprop-change.tmpl  
 -rw-r--r-- 1 root root 2001 2013-01-18 02:09 pre-unlock.tmpl  
 -rw-r--r-- 1 root root 2137 2013-01-18 02:09 start-commit.tmpl  
   
 locks:  
 total 8  
 -rw-r--r-- 1 root root 139 2013-01-18 02:09 db-logs.lock  
 -rw-r--r-- 1 root root 139 2013-01-18 02:09 db.lock  
   
 guess what i'm looking at.  

 this is a recursive search using stat

 # find $1 -type d -print0 | xargs -0 stat --format '%Y :%y %n' | sort -nr | cut -d: -f2- | head

Tuesday, August 18, 2015

how not to go to hell or run named commands


some times is to good to named-checkzone before you commit those changes to bind.
  
i have a little script that issues named-checkzone on my zone off of the db. 
i do this for forward and reverse zones.  
   
 ...  
 #!/bin/bash  
   
 echo aplace forward  
 named-checkzone aplace.calledhell.com db.aplace.calledhell.com  
   
 echo anotherplace forward  
 named-checkzone anotherplace.calledhell.com db.anotherplace.calledhell.com  
   
 echo 6.66 reverse  
 named-checkzone 66.6.10.in-addr.arpa db.10.6.66  
   
 echo 6.67 reverse  
 named-checkzone 67.6.10.in-addr.arpa db.10.6.67  
 ...  
   
 and then i will load everything and tail my syslog for any lingering errors in another terminal.  
   
 ...  
   
 #!/bin/bash  
   
 echo 6.66 reverse  
 rndc reload 66.6.10.in-addr.arpa  
   
 echo 6.67 reverse  
 rndc reload 67.6.10.in-addr.arpa  
   
 echo aplace forward  
 rndc reload aplace.calledhell.com  
   
 echo anotherplace forward  
 rndc reload anotherplace.calledhell.com  
   
 ...  
   
i heart doing this domain by domain and subnet by subnet so i am not in a place called hell.
i mentioned keep another terminal open, right?  

Tuesday, August 11, 2015

 crap.  
   
 my nfs mount keeps not mounting when i reboot my system. oh, hey, just add _netdev .  
   
 exoticnfsserver:/somewhere/nice     /localmountpoint     nfs   rsize=8192,wsize=8192,soft,_netdev   0 0  
   
 yissss.  

Wednesday, July 29, 2015

hp c3000 risc workstation beeping

 knock it the eff off already.  
 yes, i know you are a workstation and don't want to be a headless server. kthx.  
   
 error message: Run F21F?  
   
 That means CDE desktop is trying to find a display for dtlogin. As root:  
   
 /sbin/init.d/dtlogin.rc stop_msg  
 /sbin/init.d/dtlogin.rc stop  
 ch_rc -a -pDESKTOP=none /etc/rc.config.d/desktop  

Thursday, July 9, 2015

list full last modification time

 ls -l --time-style=+%Y%m%d%H%M%S   
 ls -l --time-style=+%Y%m%d%H%M%S | awk '{print $6 " " $7}'  
 stat is nice, too.  

locations of ip information for centos & windows

this is a followup to the "problem"
 centos:  
 IP  
 cat /etc/sysconfig/network-scripts/ifcfg* |grep IPADDR  
   
 Name  
 cat /etc/sysconfig/network  
   
 Mac  
 cat /sys/class/net/eth*/address  
   
 ubuntu:  
 IP  
 cat /etc/network/interfaces  
   
 Name  
 cat /etc/hostname  
   
 Mac  
 cat /etc/udev/rules.d/70-persistent-net.rules  
   
   
 windows  
   
 IP  
 \ControlSet001\services\Tcpip\Parameters\Interfaces   
 between brackets...  
 IPAddress, SubnetMask, DefaultGateway, NameServer  
   
 Name  
 \ControlSet001\Control\ComputerName\ComputerName  
 ComputerName  
   
 Mac  
 \ControlSet001\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}  
 0000-?...  
 NetworkAddress  

Tuesday, July 7, 2015

virsh script to enumerate all disks

and this is useful.
 #!/bin/bash  
   
 for name in `virsh list --all | grep -i -e running -e shut |  
 awk '{ print $2 }'`  
   
 do  
  virsh dumpxml $name | grep -i -e "source file" -e "source dev" |  
  grep -v .iso |  
  sed -e 's/source file=//g' |  
  sed -e 's/source dev=//g' |  
  sed -e "s/'//g" |  
  sed -e "s/<//g" | sed -e "s/\/>//g" | while read -r result; do  
  echo $name $result  
  done  
 done  
   

Monday, July 6, 2015

find kvm vm system name on their raw disks

 I have a problem.  
   
 Someone not me installed a bunch of Linux KVM Servers and didn't bother to name the VMs something sane. That someone also didn't bother to keep note of VM to canonical DNS name or even IP.  
 What a drag.  
   
 virsh isn't much use.  
   
 I need to access the raw disks and grep around.  
   
 Did I mention these were Linux and Windows KVM VMs? Yeah. My KVM server farm is all CentOS 6 x86_64.  
   
 Install guestfish  
   
 [root@kvmserver ~]# yum install guestfish  
 [root@kvmserver ~]# yum install libguestfs-winsupport  
   
 Yay.  
   
 Let's find the vms on the system.  
   
 [root@kvmserver ~]# virsh list --all  
   
  Id  Name              State  
 ----------------------------------------------------  
  1   poc19          running     <--- windows
  -   poc20          shut off    <--- linux
   
 Let's find the VMs disk.  
   
 [root@kvmserver ~]# virsh dumpxml poc20 | grep 'source file'  
    <source file='/home/vm-disk/poc20.img'/>  
   
 Let's create a place to mount the disk and where we're going to do our work:  
   
 [root@kvmserver ~]# mkdir /mnt/poc20  
 [root@kvmserver ~]# guestmount -a /home/vm-disk/poc20.img -i --ro /mnt/poc20/  
 [root@kvmserver ~]# ls /mnt/poc20/  
   
 bin boot dev etc home lib lib64 lost+found media mnt opt proc root sbin selinux srv sys tmp usr var  
   
 cat /mnt/poc20/etc/sysconfig/network  
   
 poc20  
   
 Now, let's umount the work directory. to unmount you'd figure you'd use guestumount /mountpoint  
   
 [root@kvmserver ~]# guestunmount   
   
 -bash: guestunmount: command not found  
   
 nope. bad man bad bad.  
   
 try:  
   
 [root@kvmserver ~]# fusermount -u /tmp/mount  
   
 [root@kvmserver ~]# cd /mnt/poc20/  
 [root@kvmserver poc20]# ls  
   
 <tumbleweeds>  
   
 Super.   
   
 For the Windows system (poc19) you may do the same disk mount procedure. And you can walk around the filesystem no problem.  
 And yes, you may do this on a live, running VM.  
   
 I want that hostname. And you know and I know that Windows 7 has its hostname here:  
 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName  
   
 We already yum install libguestfs-winsupport  
   
 Now, get chntpw (a Linux-based Windows registry editor)  
 per: http://pkgs.org/download/chntpw do stuff for your distro.  
   
 [root@kvmserver ~]# cd /usr/local/src  
 [root@kvmserver src]# wget http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm  
 [root@kvmserver src]# rpm -Uvh nux-dextop-release*rpm  
 [root@kvmserver src]# yum install chntpw  
   
 Do the whole mount thing. Then run chntpw.  
   
 [root@kvmserver ~]# cd /mnt/poc19/Windows/System32/config  
   
 [root@kvmserver config]# chntpw SYSTEM  
 chntpw version 0.99.6 110511 , (c) Petter N Hagen  
 openHive(SYSTEM) failed: Read-only file system, trying read-only  
 Hive <SYSTEM> name (from header): <SYSTEM>  
 ROOT KEY at offset: 0x001020 * Subkey indexing type is: 686c <lh>  
 File size 10223616 [9c0000] bytes, containing 2166 pages (+ 1 headerpage)  
 Used for data: 150888/9612696 blocks/bytes, unused: 4820/177064 blocks/bytes.  
   
 Simple registry editor. ? for help.  
   
 > ls          
 Node has 8 subkeys and 0 values  
  key name  
  <ControlSet001>  
  <ControlSet002>  
  <MountedDevices>  
  <RNG>  
  <Select>  
  <Setup>  
  <Software>  
  <WPA>  
   
 > cd ControlSet001\Control\ComputerName\ComputerName  
   
 (...)\Control\ComputerName\ComputerName> cat ComputerName  
 Value <ComputerName> of type REG_SZ, data length 20 [0x14]  
 POC19  
   
   
 (...)\Control\ComputerName\ComputerName> q  
   
 Yay. We have a name.  

Thursday, June 11, 2015

olchash uses a lot of dish space

why is my lovely ubuntu box no longer serving pages?
are the processes going wild?
no.

hmm.

df -h shows me that / is full.  why?

dispus to the rescue.

/var/logs and /usr/local/src are to blame.

zap apache logs gone.
hmm.  what's this in the /usr/local/src/ directory?
olchash

what's that?

"advanced password recovery"

eh?

oh... password cracking.

yeah.  that's me.  whoopsies.

rm -rf *

no one will know except the internet.

Thursday, May 28, 2015

reverse tunnel transfer to aserverinhell

nasty satan.
 today i was looking at some odd behavior on a server.  
 and look what i found... a reverse tunnel and data syncs every hour.  
   
 satan 8287 0.0 0.0 10840  584 ?    S   2014  0:01 /bin/bash ./tun1  
 satan 17363 0.0 0.0 40896 2652 ?    S  10:33  0:00 ssh -c arcfour,blowfish-cbc -R 8000:localhost:22 -i /home/satan/stairwaytoheaven/  
   
 i decided to check and see if satan has a scheduled task. he does.  
   
 crontab -l -u satan  
   
 @hourly bash -c "cd /home/satan/stairwaytoheaven; get pull >> stairwaytoheaven.log 2>> stairwaytoheaven.err && ./hellSync.sh"  
 @monthly bash -c "cd /home/satan/stairwaytoheaven; rm stairwaytoheaven.err; rm stairwaytoheaven.log"  
   
 crontab                    a copy of the above   
 stairwaytoheaven.err          a file with errors resultant from stairwaytoheaven.sh  
 stairwaytoheaven.log          a log of what's going on  
 manifest               a list of files generated from get pull command  
 satan.pem               satan's key  
 stairwaytoheaven.sh          rsync job going over a reverse tunnel to aserverinhell  
   
 tun1  
 #!/bin/bash  
 sleep 2  
 while true; do  
 echo Starting connection 1 on `date`  
 ssh -c arcfour,blowfish-cbc -R 8000:localhost:22 -i /home/satan/stairwaytoheaven/satan.pem lucifer@aserverinhell -N  
 echo Connection 1 died on `date`  
 sleep 15  
 done  
   
 hellSync.sh  
 #!/bin/bash  
 chmod 600 /home/satan/stairwaytoheaven/satan.pem  
 echo -n "--- START " >> stairwaytoheaven.log 2>> stairwaytoheaven.err < /dev/null  
 date >> stairwaytoheaven.log 2>> stairwaytoheaven.err < /dev/null  
 rsync -avz -r --recursive --delete --files-from=./manifest -e "ssh -i /home/satan/stairwaytoheaven/satan.pem" / lucifer@aserverinhell:/ >> stairwaytoheaven.log 2>> stairwaytoheaven.err < /dev/null  
 echo "--- END" >> stairwaytoheaven.log 2>> stairwaytoheaven.err < /dev/null  
   

Wednesday, May 27, 2015

na_admin gone! from netapp after factory reset

Do I care? Minimally. Let's see if we can make this happen.
 I reinstalled my Netapp 2240-4. Yes!  
   
 I go here:  
   
 http://filer/na_admin/  
   
 And I see:  
   
 Error 500, Servlets not enabled.  
   
 FFS.  
   
 filer> options http  
   
 la la la set them to be:  
   
 httpd.access         legacy  
 httpd.admin.access      legacy  
 httpd.admin.enable      on  
 httpd.admin.ssl.enable    on  
 httpd.enable         on  
 httpd.rootdir        /vol/vol0/home/http  
   
 filer> option httpd.admin.enable on  
 &c.  
   
 Step 2.  
 download the appropriate DATA ONTAP version from NetApp and place it on a web server. Say, apache. I like apache.  
   
 I'm putting it on the local filesystem:  
 server:/store/netapp/  
   
 Edit /etc/apache/available-sites/000-default  
   
   Alias /netapp "/store/netapp/"      
   <Directory "/store/netapp/">  
     Options Indexes MultiViews FollowSymLinks  
     DirectoryIndex README  
     AllowOverride None  
     Order deny,allow  
     Deny from all  
     Allow from 127.0.0.0/255.0.0.0 ::1/128  
     Allow from 6.6.6.0/255.255.255.0  
   </Directory>  
   
 Restart apache.  
   
 See if your link works:  
   
 http://server/netapp/814P1_q_image.tgz  
   
 Of course it does.  
   
 Step 4.  
 On the console issue an update request:  
   
 filer> software update http://server/netapp/814P1_q_image.tgz -f -R  
   
 Nice things will scroll by. The most important is:  
 software: installation of 814P1_q_image.tgz completed  
   
 filer> reboot  
Still nope. Sigh.
Update from NetApp:

FilerView is no longer available on systems running Data ONTAP 8.1 or later releases. You can use System Manager as a web-based graphical management interface to manage common storage system functions from a web browser.

For more information about System Manager, see the NetApp Support Site.

Reference KB Article: FilerView error: Error 500: Servlets not enabled
https://kb.netapp.com/support/index?page=content&id=2013472
And there we go.

Thursday, May 21, 2015

vmware virtual center db queries

i need to move vms and templates. but i need to know where they are.
 i want to know what is where. like really what and really where.  
 connect to the vmware virtual center db via ms sql server manangement studio  
   
 DNS Name     IP Address     PRODUCT FULLNAME  
 vmhost          6.6.6.6          VMware ESX Server 3.5.0 build-317866  
   
 via query:  
 select DNS_Name, IP_Address, PRODUCT_FULLNAME from vpx_host Order by DNS_Name  
   
 VM/Template Name                    Storage LUN  
 sillyvmtmp                         vmhost:storage1  
 sillyvm                              vmhost:storage1  
 sillyvm2                         NAS  
   
 via query:  
 select VMS.Name, TDS.Name from vpxv_vms VMS   
 inner join vpxv_vm_datastore VVMDS on VMS.VMID = VVMDS.VM_ID   
 inner join vpx_datastore TDS on VVMDS.DS_ID = TDS.ID Order by VMS.Name  
   
 VM/Template Name                    File Path  
 sillyvmtmp                         sanfs://vmfs_uuid:666/sillyvmtmp/sillvmtemp.vmtx  
 sillyvm                              sanfs://vmfs_uuid:666/sillyvm/sillyvm.vmx  
 sillyvm2                         netfs://6.6.6.7//mnt/hellData/sillyvm2/sillyvm2.vmx  
   
 via query:  
 select VPX_ENTITY.NAME as "VM Name", VPX_VM.FILE_NAME as "File Name / Path"   
 From VPX_VM inner join VPX_Entity    
 on vpx_vm.ID = vpx_entity.ID    
 order by VPX_entity.name