macOS and Security

The Mac has a spectacular reputation for stability and security. You hardly ever hear of a Mac virus. There’s also no Windows-esque plague of spyware (downloaded programs that do something sneaky behind your back).

Here are a few of macOS’s big-ticket defenses.

These days, having a complicated password isn’t enough to protect you from the bad guys. Even if your password is é$*@çg45e$+!!!>?!+r6ü, someone can still steal it. (There are all kinds of ways. An inside job. An FBI demand. Poor security on a company’s servers. Social engineering, where someone calls up pretending to be you and saying, “I forgot my password.”)

Impressively enough, security experts have come up with a way to keep baddies out of your account even if they’ve got your password.

Here’s how it works: The first time you try to access your account using a new gadget (a new laptop or phone, for example) or a new web browser, the company instantly sends a special, one-time code to a phone, tablet, or computer that it knows you own. You need that code to get into your account.

If some Russian hacker does get your password, you won’t care! He still can’t get into your account, because the code will be sent to your machine, not his.

This ingenious system has earned the awful name two-factor authentication. (Let’s call it 2FA to save paper.)

Now, 2FA is available for your iCloud account. If you turn it on, the odds of someone else being able to access your account (email, calendar, messages, movies, music, backups, photos) drop close to zero. They’d have to have your password and steal your phone or laptop and know your account password on that device.

To turn on this feature on your Mac, open System Preferences→iCloud. Click Account Details, then Security. At this point, you’re offered the chance to set up 2FA. You’re asked for your phone number, and you’re sent one of the verification codes to type in.

Each time you use a new Apple device, or a new web browser, for the first time, you’ll go through this setup process (just once). Each time, you’re adding to your list of trusted devices. At any time, you can look over a list of them in System Preferences→iCloud→Account Details.

Note

All of this works pretty smoothly on gadgets and programs made by Apple. But other companies’ programs—like non-Apple calendar and email programs—aren’t part of it. They’re locked out of your iCloud account just as though they were hackers.

Fortunately, you can go to https://appleid.apple.com/account/manage to generate an app-specific password. If you enter this 16-character password as your iCloud account password in your third-party calendar or email program, it will now be able to access your iCloud account as it did before.

This security feature sends Eastern European teenage hackers into therapy.

Nasty programs aren’t very common on the Mac to begin with. But unless you turn Gatekeeper off, downloading a program that’s secretly designed to damage your Mac is virtually impossible. Gatekeeper won’t even let you install programs that haven’t been proved to be safe (Figure 13-13).

To find Gatekeeper, you open System Preferences→Security & Privacy→General. At the bottom of this screen (Figure 13-13, top), you see three options. These three humble buttons are Gatekeeper.

Click the and enter your password to unlock this panel. Here are your choices, under “Allow apps downloaded from”:

Gatekeeper is a pretty powerful disincentive for the world’s bad eggs; if millions of people leave Gatekeeper turned on, the bad guys might as well not even bother. Their apps will never be downloaded and can therefore never spread.

There are, however, some important limitations to note:

Overall, Gatekeeper is a pretty convincing barrier to a Windows-like nightmare scenario, where some virus breaks out into the wild and takes down hundreds of thousands of computers. If most people leave the factory setting selected—and they will—that outcome is virtually impossible.

FileVault is one of macOS’s most powerful security features. Understanding what it does, however, may take a little slogging.

As you know, the accounts system is designed to keep people out of one another’s stuff. Ordinarily, for example, Chris isn’t allowed to go rooting through Robin’s email and files.

Until FileVault came along, though, there were ways to circumvent this protection system. A sneak or a show-off could start up the Mac in FireWire disk mode, for example, or even remove the hard drive and hook it up to a Linux machine or another Mac.

In each case, he’d then be able to run rampant through everybody’s files, changing or trashing them with abandon. For people with sensitive or private files, the result was a security hole bigger than Kim Kardashian’s bank account.

FileVault is an extra line of defense. When you turn on this feature, your Mac automatically encrypts (scrambles) everything on your startup hard drive—not just what’s in your Home folder. Every time you create or save a new file, it, too, is insta-encrypted.

This means that unless someone knows (or can figure out) your password, FileVault renders your files unreadable for anyone but you and your computer’s administrator—no matter what sneaky tricks they try to pull. (You can, if you like, authorize other account holders to get in, too.)

You won’t notice much difference when FileVault is turned on. You log in as usual, clicking your name and typing your password. Only a slight pause as you log out indicates that macOS is doing some housekeeping on the encrypted files: freeing up some space and/or backing up your home directory with Time Machine.

Here are some things you should know about FileVault’s protection:

To turn FileVault on, proceed like this:

  1. In System Preferences, click Security & Privacy, and then click FileVault. Click the , authenticate yourself, and then click Turn On FileVault.

    Now, remember, FileVault encrypts all your files. If you forget your Mac account password—well, that would be bad.

    Yeah, yeah, the peons with Standard accounts forget their account passwords all the time. But with FileVault, a forgotten password would mean the entire hard drive is locked forever. So Apple gives you, the technically savvy administrator, a back door, for use in that situation.

    It offers to let you use your iCloud password (your Apple ID password) as the back door. That’s a much more reasonable one than the alternative, the recovery key.

    The recovery key is a long, complicated override password like UK84-LVT5-YFX9-XN3K-LT53-PL9N. It gives you another way to unlock the encrypted drive, even without knowing the account holder’s password.

  2. Choose the backdoor method you prefer: “my iCloud account” or “recovery key.” Click Continue.

    If you chose the recovery key, the Mac now shows it to you: a long, complicated string of numbers and letters and hyphens. Write it down in a place you’ll never lose it! Then click Continue.

    Either way, a list of account holders now appears (Figure 13-14, top). The button next to each one, Enable User, might sound like you’re about to lead someone into drug addiction, but it’s actually your chance to specify who else can unlock the disk by logging in.

  3. For each person you want to be able to log into this Mac with her own password, click Enable User. Type in that person’s password and click OK. When you’re finished, click Continue.

    (Anyone to whom you don’t give access can still use the Mac—but only after persuading an administrator to come over and type in his name and password.)

  4. Click Restart.

    When you log in again, the Mac begins the process of encrypting your entire hard drive. This process takes a long time (the FileVault pane in System Preferences shows you the estimated remaining time), but you can keep using your Mac in the meantime. In theory, you won’t feel much of a slowdown at all while the encrypting is going on. You can even restart or shut down the computer.

    You shouldn’t notice any speed hit as you work with an encrypted disk, either. You’ll notice only a few small security-related changes. For example, you’ll be asked for your password every time you wake the computer or exit the screensaver.

If you have a broadband, always-on connection, you’re open to the Internet 24 hours a day. It’s theoretically possible for some cretin to use automated hacking software to flood you with data packets or to take control of your machine. MacOS’s firewall feature puts up a barrier to such mischief. To turn it on, click the on the Firewall pane in the Security & Privacy section of System Preferences, authenticate yourself, and then click Start.

Fortunately, it’s not a complete barrier. One of the great joys of having a computer is the ability to connect to other computers. Living in a cement crypt is one way to avoid getting infected, but it’s not much fun.

Therefore, you can turn the firewall on by opening System Preferences→Security→Firewall tab, authenticating, and then clicking Turn On Firewall. But you can also fine-tune the blockade.

To do that, click Firewall Options; you see something like Figure 13-15 at bottom. As you can sort of tell, macOS lets you allow or block Internet connections individually for each program on your Mac. Here’s what you’ll find there:

Plenty of software features require you to make up a password: websites, accounts, networked disks, and so on. No wonder most people wind up trying to use the same password in as many situations as possible. Worse, they use something easily guessable like their names, kids’ names, spouse’s names, and so on. Even regular English words aren’t very secure, because hackers routinely use dictionary attacks—software that tries to guess your password by running through every word in the dictionary—to break in.

To prevent evildoers from guessing your passwords, macOS comes with a good-password suggestion feature called the Password Assistant (Figure 13-16). It cheerfully generates one suggestion after another for impossible-to-guess passwords (recharges8@exchangeability, anyone?).

Fortunately, you won’t have to remember most of them, thanks to the Keychain password-memorizing feature described next. The only password you have to memorize is your account password.

The information explosion of the computer age may translate into bargains, power, and efficiency, but it carries with it a colossal annoyance: the proliferation of passwords we have to memorize. Shared folders on the network, websites, FTP sites—each requires another password.

Apple has done the world a mighty favor with its Keychain feature. (It’s an earlier, not-Internet-based version of the iCloud Keychain described in Tip.) Whenever you log into macOS and type in your password, you’ve typed the master code that tells the computer, “It’s really me. I’m at my computer now.” From that moment on, the Mac automatically fills in every password blank you encounter, whether it’s a website in Safari, a shared disk on your network, a wireless network, an encrypted disk image, or an FTP (File Transfer Protocol) program like Transmit or Cyberduck. With only a few exceptions, you can safely forget all your passwords except your login password.

All kinds of programs and services know about the Keychain and offer to store your passwords there. For example:

If you work alone, the Keychain is automatic, invisible, and generally wonderful. Login is the only time you have to type a password. After that, the Mac figures, “Hey, I know it’s you; your password proved it. I’ll fill in all your other passwords automatically.” In Apple parlance, you’ve unlocked your Keychain by logging in.

But there may be times when you want the Keychain to stop filling in all your passwords, perhaps only temporarily. Maybe you work in an office where someone else might sit down at your Mac while you’re getting a candy bar.

Of course, you can have macOS lock your Mac—Keychain and all—after a specified period of inactivity (Gem in the Rough: Automatic Login with the Apple Watch). But if you want to lock the Keychain manually, so that no passwords are autofilled until you unlock it again, you can use any of these methods. Each requires the Keychain Access program (in your Applications→Utilities folder):

Whenever the Keychain is locked, macOS no longer fills in your passwords.