Exemplo n.º 1
0
 def escrowKey(self, key, username, runtype):
     #self.progressText.setStringValue_("Sending encryption key to the server...")
     if runtype == 'initial':
         NSApp.beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo_(self.progressPanel, self.window, self, None, None)
         self.progressIndicator.startAnimation_(self)
     ##submit this to the server fv_status['recovery_password']
     FVUtils.escrow_key(key, username, runtype)
Exemplo n.º 2
0
 def escrowKey(self, key, username, runtype):
     #self.progressText.setStringValue_("Sending encryption key to the server...")
     if runtype == 'initial':
         NSApp.beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo_(self.progressPanel, self.window, self, None, None)
         self.progressIndicator.startAnimation_(self)
     ##submit this to the server fv_status['recovery_password']
     FVUtils.escrow_key(key, username, runtype)
Exemplo n.º 3
0
 def applicationDidFinishLaunching_(self, sender):
     # Prevent automatic relaunching at login on Lion
     if NSApp.respondsToSelector_('disableRelaunchOnLogin'):
         NSApp.disableRelaunchOnLogin()
     # Quit if filevault is already enabled, encrypting or decrypting.
     if FVUtils.filevaultStatus():
         NSApp.terminate_(self)
     # Quit if the server isn't available
     if not FVUtils.internet_on():
         NSApp.terminate_(self)
Exemplo n.º 4
0
 def applicationDidFinishLaunching_(self, sender):
     # Prevent automatic relaunching at login on Lion
     if NSApp.respondsToSelector_('disableRelaunchOnLogin'):
         NSApp.disableRelaunchOnLogin()
     # Quit if filevault is already enabled, encrypting or decrypting.
     if FVUtils.filevaultStatus():
         NSApp.terminate_(self)
     # Quit if the server isn't available
     if not FVUtils.internet_on():
         NSApp.terminate_(self)
Exemplo n.º 5
0
    def encrypt_(self,sender):
        fvprefspath = "/Library/Preferences/FVServer.plist"
        serial = FVUtils.GetMacSerial()
        serverURL = FVUtils.pref("ServerURL")
        NSLog(u"%s" % serverURL)
        if serverURL == "":
            self.errorField.setStringValue_("ServerURL isn't configured")
            self.userName.setEnabled_(False)
            self.password.setEnabled_(False)
            self.encryptButton.setEnabled_(False)
        username_value = self.userName.stringValue()
        password_value = self.password.stringValue()
        self.userName.setEnabled_(False)
        self.password.setEnabled_(False)
        self.encryptButton.setEnabled_(False)
        
        def enable_inputs(self):
            self.userName.setEnabled_(True)
            self.password.setEnabled_(True)
            self.encryptButton.setEnabled_(True)
    
        if username_value == "" or password_value == "":
            self.errorField.setStringValue_("You need to enter your username and password")
            self.userName.setEnabled_(True)
            self.password.setEnabled_(True)
            self.encryptButton.setEnabled_(True)

        if username_value != "" and password_value !="":
            self.userName.setEnabled_(False)
            self.password.setEnabled_(False)
            self.encryptButton.setEnabled_(False)
            
            #NSLog(u"csfde results: %s" % fv_status)
            recovery_key, encrypt_error = FVUtils.encryptDrive(password_value, username_value)
            if encrypt_error:
                NSLog(u"%s" % encrypt_error)
                ##write the key to a plist
                ##load a launch daemon - touch a file maybe?
                ##submit the key
                alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
                                                                                                                          NSLocalizedString(u"Something went wrong", None),
                                                                                                                          NSLocalizedString(u"Aww, drat", None),
                                                                                                                          objc.nil,
                                                                                                                          objc.nil,
                                                                                                                          NSLocalizedString(u"There was a problem with enabling encryption on your Mac. Please take sure your are using your short username and that your password is correct. Please contact IT Support if you need help.", None))
                alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
                                                                                             self.window, self, enable_inputs(self), objc.nil)
            if recovery_key:
                FVUtils.escrowKey(recovery_key, username_value, 'initial')
Exemplo n.º 6
0
    def encrypt_(self,sender):
        fvprefspath = "/Library/Preferences/FVServer.plist"
        the_command = "ioreg -c \"IOPlatformExpertDevice\" | awk -F '\"' '/IOPlatformSerialNumber/ {print $4}'"
        serial = subprocess.Popen(the_command,shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0]
        serial = re.sub(r'\s', '', serial)
        serverURL = FVUtils.pref("ServerURL")
        NSLog(u"%s" % serverURL)
        if serverURL == "":
            self.errorField.setStringValue_("ServerURL isn't configured")
            self.userName.setEnabled_(False)
            self.password.setEnabled_(False)
            self.encryptButton.setEnabled_(False)
        username_value = self.userName.stringValue()
        password_value = self.password.stringValue()
        self.userName.setEnabled_(False)
        self.password.setEnabled_(False)
        self.encryptButton.setEnabled_(False)
        
        def enable_inputs(self):
            self.userName.setEnabled_(True)
            self.password.setEnabled_(True)
            self.encryptButton.setEnabled_(True)
        
        if username_value == "" or password_value == "":
            self.errorField.setStringValue_("You need to enter your username and password")
            self.userName.setEnabled_(True)
            self.password.setEnabled_(True)
            self.encryptButton.setEnabled_(True)

        if username_value != "" and password_value !="":
            self.userName.setEnabled_(False)
            self.password.setEnabled_(False)
            self.encryptButton.setEnabled_(False)
            
            #NSLog(u"csfde results: %s" % fv_status)
            recovery_key, encrypt_error = FVUtils.encryptDrive(password_value, username_value)
            if encrypt_error:
                FVAlerts.crypt_error(self,encrypt_error)
                ##write the key to a plist
                ##load a launch daemon - touch a file maybe?
                ##submit the key
                
            if recovery_key:
                FVUtils.escrowKey(recovery_key, username_value, 'initial')
Exemplo n.º 7
0
    def encrypt_(self,sender):
        fvprefspath = "/Library/Preferences/FVServer.plist"
        serial = FVUtils.GetMacSerial()
        serverURL = FVUtils.pref("ServerURL")
        NSLog(u"%s" % serverURL)
        if serverURL == "":
            self.errorField.setStringValue_("ServerURL isn't configured")
            self.userName.setEnabled_(False)
            self.password.setEnabled_(False)
            self.encryptButton.setEnabled_(False)
        username_value = self.userName.stringValue()
        password_value = self.password.stringValue()
        self.userName.setEnabled_(False)
        self.password.setEnabled_(False)
        self.encryptButton.setEnabled_(False)

        def enable_inputs(self):
            if self.autoUsername == True:
                self.userName.setEnabled_(False)
            else:
                self.userName.setEnabled_(True)
            self.password.setEnabled_(True)
            self.encryptButton.setEnabled_(True)

        if username_value == "" or password_value == "":
            self.errorField.setStringValue_("You need to enter your username and password")
            if self.autoUsername == True:
                self.userName.setEnabled_(False)
            else:
                self.userName.setEnabled_(True)
            self.password.setEnabled_(True)
            self.encryptButton.setEnabled_(True)

        if username_value != "" and password_value !="":
            self.userName.setEnabled_(False)
            self.password.setEnabled_(False)
            self.encryptButton.setEnabled_(False)

            # Open the progress sheet
            NSApp.beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo_(self.progressPanel, self.window, self, None, None)
            self.progressIndicator.startAnimation_(self)
            self.encryptDrive(password_value, username_value)
Exemplo n.º 8
0
 def awakeFromNib(self):
     if not FVUtils.root_user():
         NSApp.terminate_(self)
     if FVUtils.driveIsEncrypted(self):
         return True
Exemplo n.º 9
0
 def applicationDidFinishLaunching_(self, sender):
     # Prevent automatic relaunching at login on Lion
     if NSApp.respondsToSelector_('disableRelaunchOnLogin'):
         NSApp.disableRelaunchOnLogin()
     if not FVUtils.internet_on():
         NSApp.terminate_(self)