Friday, August 26, 2016

How to fix "This copy of the Install OS X Mavericks application can't be verified. It may have been corrupted or tampered with during downloading." message and install Mavericks or older operating system versions of OS X on VmWare Fusion application

It is very annoying to see  the message "This copy of the Install OS X Mavericks application can't be verified. It may have been corrupted or tampered with during downloading."  when you try to install old releases of Apple OS X operating systems such as Mountain Lion, Mavericks, Yosemite etc. If you are trying to install OS X Mavericks as virtual machine in VMWare fusion or in physical system, then follow below steps to successfully install the operating system.

In VMWARE Fusion.

  1. Create a OSX Mavericks VM by attaching OSX Mavericks Installer to the virtual machine.
  2. Do not Poweron the virtual machine. If powered on automatically after 1st step above then poweroff the VM.
  3. Open Virtual Machine Settings, Goto Advanced Section.
  4. Un check "Synchronize Time" setting.
  5. Start the Virtual Machine to install the OSX Mavericks.
  6. In the OSX Installer app , Launch Terminal.app.
  7. Set the system date to old date as date 102613152013 (Oct/26/2013 13:15).
  8. Quit the Terminal application.
  9. Continue with the installation.

In Physical System:

Prior starting the installation change the system date to old date as said above using terminal app launched from OS X Installer application.

 

Friday, June 10, 2016

Genrating MD5 for all files in the system


The following command will generate MD5 for all the files in the system.


sudo find ./ -type f -print0 | xargs -0 md5  >>  /tmp/checksums.md5

Wednesday, April 27, 2016

What is com.apple.Dont_Steal_Mac_OS_X (7.0.0) kext is doing on OS X systems ?

When you run kextstat command to see the list of kernel extensions loaded in the system, you might come across kext named com.apple.Dont_Steal_Mac_OS_X (7.0.0) being loaded all the time. You might me wondering what is the role of this kernel extension. com.apple.Dont_Steal_Mac_OS_X  prevents OS X from being used on non approved Intel hardware – as OS X is licensed only for use of approved Apple Intel hardware. This kext is used to control software piracy of OSX on non Apple supported hardwares. Hence its role is to detect and fail the OSX installation on non apple certified hardwares. 

Tuesday, February 23, 2016

How to disable default certificate verification in Python 2.7.9 and above permanently on Mac?

Python from 2.7.9 and above now verifies the SSL certificate prior establishing the connection to server. This might cause problem in few servers which do not support certificate validation yet. In these circumstances the HTTPS connection requests fails due to new changes in python. For more information on the new changes please read more at : https://www.python.org/dev/peps/pep-0476/. This link describes the ways to establish ssl connection without certificate verification. In my case i was not using the httplib modules API directly hence i had to find out a crude approach to disable the SSL certificate  verification. I would not recommend the below change unless it is really required to do it as you might be opening a set of vulnerabilities as specified in this article.  However the below sample code tells you how disable SSL certificate  verification completely on your system. 

1. Open Terminal
2. Open with sudo privileges the following file [ Note: You may be required to disable System Integrity Protection(SIP) on your mac to edit these files if your system is running OS X 10.11 + , Please read my post on How to Disable System Integrity Protection(SIP) ]


    sudo vim /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py


Look for following Piece of Code:

class HTTPSConnection(HTTPConnection):
        "This class allows communication via SSL."

        default_port = HTTPS_PORT

        def __init__(self, host, port=None, key_file=None, cert_file=None,
                     strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
                     source_address=None, context=None):
            HTTPConnection.__init__(self, host, port, strict, timeout,
                                    source_address)
            self.key_file = key_file
            self.cert_file = cert_file
            if context is None:
                context = ssl._create_default_https_context()
            if key_file or cert_file:
                context.load_cert_chain(cert_file, key_file)
            self._context = context


Comment the highlighted line and add following line below the commented line.

                context = ssl._create_unverified_context()



Finally the change should be reflected as below:


class HTTPSConnection(HTTPConnection):
        "This class allows communication via SSL."

        default_port = HTTPS_PORT

        def __init__(self, host, port=None, key_file=None, cert_file=None,
                     strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
                     source_address=None, context=None):
            HTTPConnection.__init__(self, host, port, strict, timeout,
                                    source_address)
            self.key_file = key_file
            self.cert_file = cert_file
            if context is None:
                #Comment the below line and un-comment the commented line to revert to original state.
                context = ssl._create_unverified_context()
                #context = ssl._create_default_https_context()
            if key_file or cert_file:
                context.load_cert_chain(cert_file, key_file)
            self._context = context




Note: Above change to the python source is not recommended unless required. Proceed with caution. 



Tuesday, February 09, 2016

How to disable USB ports on Mac OS X Mavericks, Yosemite or El Capitan ?

We might wonder how to disable the USB ports on Mac to prevent data copy to external USB mass storage devices. The USB kext on os x is loaded at the time of start of the system, this can be loaded / unloaded using kextload or kextunload command. To disable USB port on Mac , follow below steps:

On Macs running Mountain Lion, Mavericks  and Yosemite:

  1. Unmount any connected USB devices to the system by running below command                  $diskutil unmount /Volumes/USBDISK.
  2. Now unload the USB related kernel extensions in the following order using kextunload command.
           sudo kextunload -b com.apple.driver.AppleUSBCardReader

           sudo kextunload -b com.apple.driver.AppleUSBODD

           sudo kextunload -b com.apple.iokit.IOUSBMassStorageClass


       This will unload the USB kext and disable the USB ports for storage devices on Mountain Lion, Mavericks  and Yosemite.

On Mac running El Capitan:

  1. Unmount any connected USB devices to the system by running below command                  $diskutil unmount /Volumes/USBDISK.
  2. Now unload the USB related kernel extensions in the following order using kextunload command.
          sudo kextunload -b com.apple.iokit.IOUSBMassStorageDriver

      
      This should disable the USB ports for external storage devices.




To load back the USB kext or Enable USB ports follow below steps :

      On Macs running Mountain Lion, Mavericks  and Yosemite:

       1. Run the kextload command to load above unloaded kexts in reverse order of unload.

           sudo kextload -b com.apple.iokit.IOUSBMassStorageClass

           sudo kextload -b com.apple.driver.AppleUSBODD

           sudo kextload -b com.apple.driver.AppleUSBCardReader

      This will enable the USB port on the OSX system for storage devices.


    On Macs running El Capitan (11.0.x):

      1. Run the kextload command to load above unloaded kexts in reverse order of unload.
  
           sudo kextload -b com.apple.iokit.IOUSBMassStorageDriver

           sudo kextload -b com.apple.driver.AppleUSBCardReader (If your Mac has card reader)
           sudo kextload -b com.apple.driver.AppleUSBODD


        This will enable the USB port on the OSX system for storage devices.