Beispiel #1
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')
Beispiel #2
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')