Thursday, March 18, 2010

Avira Antivir Rescue over PXE


What you need:
  • A working PXE system with PXELinux
  • A linux environment (a live cd will do)
  • 7zip

Now, here's what you need to do! Don't worry, those are easy steps. I've included too many rather that not enough, along with comments so you understand each one of them. If all goes well, you'll be done in 15 minutes.
  1. Download rescue_system-common-en.exe from Avira website (unless you can download the ISO, in this case download it and go to step 4)

  2. Use 7zip to extract the content of rescue_system-common-en.exe to a temporary folder.

  3. There should be a large file in ".rsrc\RCDATA". This is an ISO file.

  4. Use 7zip to extract the content of the large file to another temporary folder (rename the file with the ".iso" extention if needed)

    Avira Rescue scans for its scanner files on local devices (such as CD) and copies them to its local filesystem. But with PXE, the only thing available is vmlinuz and initrd.gz. We'll be tweaking the latter to include those files as Avira Rescue does not support NFS (although it does support wget but that's another story and needs a web server).

    Now, start your Linux environment and get access to the extracted iso files, where initrd.gz is located. We need to unzip it, resize it so there's space left for updates, mount it, include the needed files in it, unmount it, and zip it back.

  5. Everything should be done as root
    su

  6. Unzip initrd
    gzip -d initrd.gz

  7. Add 50MB of free space to initrd
    dd if=/dev/zero bs=1M count=50 >> initrd

  8. Check the file to make sure everything's fine and fix anything wrong
    e2fsck -fp initrd

  9. Make the filesystem included in initrd use the extra space
    resize2fs initrd

  10. Make a temporary mount location
    mkdir iso

  11. Mounts the initrd filesystem to iso
    mount -o loop initrd iso

  12. Go into the iso folder and there, make this directory tree (Case sensitive):
    media/Devices/pxe

  13. In the extracted ISO files, there should be a folder named "Antivir". Always as root, copy the entire content of this folder to the pxe folder you just made.

  14. In the pxe folder, do the following to make sure the antivir file locaded in the pxe folder is executable!
    chmod a+x antivir

  15. Now leave the iso folder

  16. Unmount the filesystem
    umount iso

  17. This will tell you the size of initrd. Take note of it.
    ls -lk initrd

  18. Zip the initrd file using maximum compression.
    gzip -9 initrd

  19. Now, copy the newly tweaked initrd.gz file, AND the original vmlinuz file form the extracted iso files to your PXE server.

  20. edit your pxelinux.cfg/default (or whatever) file and add an entry based on this one:
    label 1
    MENU LABEL ^Antivir Rescue System
    KERNEL antivir/vmlinuz
    APPEND vga=769 initrd=antivir/initrd.gz ramdisk_size=185000 root=/dev/ram0 rw console=/dev/vc/4

  21. Change the value of "ramdisk_size" to the value noted at step 17 plus a few. I had 184747 so I put 185000.
    Note: At this stage, you could also look at the isolinux.cfg file located in the extracted iso for some more boot options.

And voilĂ , you should have a working Antivir Rescue working over PXE!

Thanks go to:
NiteHawk for helping me out in this thread
Avira for choosing Linux as a base system for your tool! FREEDOM!!! :thumbsup:

1 comment:

W5LMM said...

with the latest Avira rescue PXE boot, I get:
"self check failed! The FIle failed the check. Press OK to shutdown the system."