{"id":6705,"date":"2017-01-17T17:34:57","date_gmt":"2017-01-17T22:34:57","guid":{"rendered":"https:\/\/www.zdziarski.com\/blog\/?p=6705"},"modified":"2020-09-25T10:48:18","modified_gmt":"2020-09-25T15:48:18","slug":"configuring-the-touch-bar-for-instant-lockdown","status":"publish","type":"post","link":"https:\/\/www.zdziarski.com\/blog\/?p=6705","title":{"rendered":"Configuring the Touch Bar for System Lockdown"},"content":{"rendered":"<p>The new Touch Bar is often marketed as a gimmick, but one powerful\u00a0capability it has is to function as a lockdown mechanism for your machine in the event of a physical breach. By changing a few power management settings and customizing the Touch Bar, you can add a button that will instantly lock the machine&#8217;s screen\u00a0and\u00a0then begin a countdown (that&#8217;s configurable, e.g. 5 minutes) to lock down the entire system, which will disable the fingerprint reader, remove power to the RAM, and\u00a0discard your FileVault keys, effectively locking the encryption, protecting you from cold boot attacks, and prevent the system from being unlocked by a fingerprint.<\/p>\n<p>One of the reasons you may\u00a0want to do this is to allow the system to remain live while you step away, answer the door, or run to the bathroom, but in the event that you don&#8217;t come back within a few minutes, lock things down. It can be ideal for the office, hotels, or anywhere you feel that you feel your system may become physically compromised. This technique offers the convenience of being able to unlock the system with your fingerprint if you come back quickly, but the safety of having the system secure itself if you don&#8217;t.<\/p>\n<p><!--more--><\/p>\n<p>To configure this, we&#8217;ll first add a sleep button to the Touch Bar, then look to command-line power management settings to customize its behavior.<\/p>\n<p>Adding a sleep button to the Touch Bar is pretty straight forward. Launch<em> System Preferences<\/em>, then click on\u00a0<em>Keyboard<\/em>. At the bottom of the window is a button labeled\u00a0<em>Customize Control Strip<\/em>.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.zdziarski.com\/blog\/wp-content\/uploads\/2017\/01\/Screen-Shot-2017-01-17-at-4.46.55-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-6706\" src=\"https:\/\/www.zdziarski.com\/blog\/wp-content\/uploads\/2017\/01\/Screen-Shot-2017-01-17-at-4.46.55-PM-1024x297.png\" alt=\"\" width=\"525\" height=\"152\" srcset=\"https:\/\/www.zdziarski.com\/blog\/wp-content\/uploads\/2017\/01\/Screen-Shot-2017-01-17-at-4.46.55-PM-1024x297.png 1024w, https:\/\/www.zdziarski.com\/blog\/wp-content\/uploads\/2017\/01\/Screen-Shot-2017-01-17-at-4.46.55-PM-300x87.png 300w, https:\/\/www.zdziarski.com\/blog\/wp-content\/uploads\/2017\/01\/Screen-Shot-2017-01-17-at-4.46.55-PM-768x223.png 768w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/a><\/p>\n<p>To add a sleep button to the Touch Bar, choose which of the four existing buttons you can live without. Most people choose the <em>Siri<\/em> button, because it&#8217;s accessible from both the dock and the menubar as well. Drag the icon labeled\u00a0<em>Sleep<\/em> from the window onto the\u00a0<em>Siri<\/em> button on the Touch Bar, and the button will turn into a sleep button. If you would also like a screen lock that does <em>not\u00a0<\/em>perform any lockdown function while on AC power, you can also drag the <em>Screen Lock<\/em> button onto the Touch Bar, and use that for when you don&#8217;t want lock down (it may still lock down on battery, as the system will sleep whenever it&#8217;s on battery).\u00a0Once you&#8217;re finished customizing the Touch Bar, click\u00a0<em>Done<\/em>.<\/p>\n<p>OK! So we&#8217;ve got a sleep button on the Touch Bar &#8211; this is our future lockdown button; it can be triggered a lot faster than holding in the power button, and even better, will be able to lock down the system without losing all your work.<\/p>\n<p>By default, however, putting the machine to sleep on its own doesn&#8217;t really lock anything down, and you can still unlock it with your fingerprint when it wakes, so next we&#8217;re going to need to change the system&#8217;s sleep behavior. There are a number of hidden knobs that can be set on the command-line to change how power management behaves on sleep.<\/p>\n<p>We need to set a few different options.\u00a0First, we need the system to go from\u00a0sleep<em>\u00a0<\/em>mode into a hibernation mode after a preset period\u00a0of time. In our example, we&#8217;ll use 300 seconds (five minutes). Hibernate mode is a deeper sleep, where the system commits its memory contents to disk and shuts down the processor. Until the system is in hibernate mode, you&#8217;ll be able to unlock the device with your fingerprint, which we don&#8217;t want. From a terminal window, run the following commands to adjust the various sleep and hibernate timers:<\/p>\n<pre>sudo pmset -a standbydelay 300\r\nsudo pmset -a standby 1\r\nsudo pmset -a networkoversleep 0\r\nsudo pmset -a sleep 0\r\nsudo pmset -a autopoweroffdelay 300\r\nsudo pmset -a autopoweroff 1\r\nsudo pmset -a womp 0<\/pre>\n<p>Also setting <em>womp<\/em> to 0 keeps network from keeping the system awake.<\/p>\n<p>Next, there is a parameter named\u00a0<em>hibernatemode\u00a0<\/em>that is a bit of a misnomer; it more or less determines how sleep behaves, rather than how hibernate behaves. Changing this\u00a0alters the behavior of sleep mode\u00a0in a wonderful way if you want the computer to almost instantly enter hibernate mode (&lt; 60 seconds).. When set to the value\u00a0<em>25<\/em>, this parameter will cause macOS to remove power to\u00a0the RAM to go into a &#8220;safe sleep&#8221; mode instead of regular sleep mode, which thwarts future cold boot attacks against the system.<\/p>\n<pre>sudo pmset -a hibernatemode 25<\/pre>\n<p>Only do this if you want to enter hibernation in around 60 seconds, instead of 5 or 10 minutes. If you want the longer grace period, use the default value of 3.<\/p>\n<pre>sudo pmset -a hibernatemode 3<\/pre>\n<p>The default does not remove power to the RAM during sleep, but will still cut power to it\u00a0for hibernate mode, which is what you&#8217;ll want if you need a five or ten minute grace period. During the grace period, your system will still be getting juice to the RAM (so that you can unlock with your fingerprint, and quickly restore state), so it&#8217;ll be susceptible to a cold boot attack until it hits hibernate later on. A firmware password can help mitigate this concern.<\/p>\n<p>Lastly, a hidden setting named\u00a0<em>DestroyFVKeyOnStandby<\/em> can be set that will cause hibernate mode to destroy the File Vault keys from memory (or stored memory), effectively locking the encryption of the system.<\/p>\n<pre>sudo pmset -a DestroyFVKeyOnStandby 1<\/pre>\n<p>With all of these put into place, you can now put your system on a timed lockdown. Here&#8217;s how it works:<\/p>\n<ol>\n<li>The user presses the sleep button on the Touch Bar<\/li>\n<li>The screen immediately locks, the system goes to sleep and a five minute timer starts<\/li>\n<li>If the user unlocks the machine within the five minute period, all services are restored and they can use their fingerprint to authenticate<\/li>\n<li>Once the timer expires, the system transitions from sleep mode to hibernate mode<\/li>\n<li>Upon entering hibernate mode, power is removed from the RAM and the File Vault keys are destroyed in memory<\/li>\n<li>When the user wakes the machine, they will be prompted for their password in order to unlock File Vault<\/li>\n<li>Once the user has authenticated with a password, they will be prompted a second time to authenticate with their fingerprint (or password); this is the restored state from when the system was first locked<\/li>\n<\/ol>\n<p>This type of setup works well in the workplace, where you may walk away from your machine often, or while in public or any other venue where you may temporarily leave your system for a short period, but are concerned about physical security. If you are a political dissident or someone else who may be targeted, using this system provides a convenient way to manage your system to keep the fingerprint reader useful, but also lock down if an unexpected\u00a0event occurs and your devices are physically compromised.<\/p>\n<p>You can restore all power management defaults in<em>\u00a0<\/em><em>System Preferences<\/em> if you decide to back out of this configuration, and of course depending on your level of paranoia, you may wish to adjust the hibernate timer to one minute or ten, to your liking.<\/p>\n<p>If you don&#8217;t have a Touch Bar, no sweat. You can configure sleep using hot corners or a hotkey. It&#8217;s not quite as easily accessible in an emergency, but does the job. This also works by simply closing the lid.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The new Touch Bar is often marketed as a gimmick, but one powerful\u00a0capability it has is to function as a lockdown mechanism for your machine in the event of a physical breach. By changing a few power management settings and customizing the Touch Bar, you can add a button that will instantly lock the machine&#8217;s screen\u00a0and\u00a0then begin a countdown (that&#8217;s configurable, e.g. 5 minutes) to lock down the entire system, which will disable the fingerprint reader, remove power to the RAM, and\u00a0discard your FileVault keys, effectively locking the encryption, protecting you from cold boot attacks, and prevent the system from being unlocked by a fingerprint.<\/p>\n<p>One of the reasons you may\u00a0want to do this is to allow the system to remain live while you step away, answer the door, or run to the bathroom, but in the event that you don&#8217;t come back within a few minutes, lock things down. It can be ideal for the office, hotels, or anywhere you feel that you feel your system may become physically compromised. This technique offers the convenience of being able to unlock the system with your fingerprint if you come back quickly, but the safety of having the system secure itself if you don&#8217;t.<\/p>\n<p><a class=\"read-more\" href=\"https:\/\/www.zdziarski.com\/blog\/?p=6705\" title=\"Read More\"> <span class=\"button \">Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,14],"tags":[],"class_list":["post-6705","post","type-post","status-publish","format-standard","hentry","category-apple","category-security"],"_links":{"self":[{"href":"https:\/\/www.zdziarski.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6705","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zdziarski.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zdziarski.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zdziarski.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zdziarski.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6705"}],"version-history":[{"count":0,"href":"https:\/\/www.zdziarski.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6705\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zdziarski.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zdziarski.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zdziarski.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}