Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fedora - Thunderbolt – how to use keyboard during boot time

#1
Thunderbolt – how to use keyboard during boot time

<div style="margin: 5px 5% 10px 5%;"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/01/thunderbolt-how-to-use-keyboard-during-boot-time.jpg" width="1024" height="165" title="" alt="" /></div><div><h2>Problem statement</h2>
<p>Imagine you bought a new laptop with a shiny new USB-C docking station. You install fresh Fedora, encrypt your hard drive because laptop is a travel equipment and you do not want to travel around with non-ecrypted hard drive. You finish the installation, close the lid because you have external monitor, reboot the machine, and finally you would like to enter the LUKS password using the external keyboard attached using USB 2.0 to the USB-C docking station but it does not work!</p>
<p>The keyboard does not respond at all. So you open the lid, try the built-in keyboard which works just fine and once the machine boots the external keyboard works just fine as well. What is the problem?</p>
<p> <span id="more-30236"></span> </p>
<h2>What is this Thunderbolt anyway and why would anyone want it?</h2>
<p>Thunderbolt is a hardware interface to connect peripherals such as monitors, external network cards [1] or even graphic cards [1]. The physical connector is the same as USB-C, but there is usually a label with a little lightning right next to the port to differentiate “plain” USB-C from Thunderbolt ports.</p>
<figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/01/thunderbolt-how-to-use-keyboard-during-boot-time.jpg" alt="" class="wp-image-30237" /></figure>
<p>Of course it comes with very high transmission speed to support such demanding peripherals, but it also comes with a certain security risks. To achieve transmission speed like this, Thunderbolt uses Direct Memory Access (DMA) for the peripheral devices. As the name suggests, this method allows the external device to read and write memory directly without talking to the running operating system.</p>
<p>I guess you can already spot the problem here. If some stranger is walking around my laptop (even with the screen locked), is it really possible to just attach a device and read content of my computer memory? Let’s discuss it in more detail.</p>
<h2>User facing solution for Thunderbolt security</h2>
<p>In the recent versions, Gnome settings include a tab for Thunderbolt device configuration. You can enable and disable DMA access for external devices and you can also verify identity of the devices.</p>
<figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/01/thunderbolt-how-to-use-keyboard-during-boot-time.png" alt="" class="wp-image-30257" /></figure>
<p><em>bolt</em> is the component responsible for managing thunderbolt devices. See <em>man 8 boltd </em>for more information.</p>
<h2>CLI tools</h2>
<p>Of course it is possible to control the same via command line. I suggest you to read <em>man boltctl</em> or check the upstream repository directly: <a href="https://gitlab.freedesktop.org/bolt/bolt">https://gitlab.freedesktop.org/bolt/bolt</a></p>
<h2>Pre-boot support – solution to the keyboard problem</h2>
<p>In pre-boot environment, the situation is slightly different. The userspace service responsible for device verification is not yet running so if a device is to be allowed, the firmware must to it. In order to enable this feature go to your BIOS and look for “support in pre boot environment”. For example this is how it looks on a Lenovo laptop:</p>
<figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/01/thunderbolt-how-to-use-keyboard-during-boot-time-1.jpg" alt="" class="wp-image-30239" /></figure>
<p>Once you enable this feature, bolt will add any verified device to a list of allowed devices. The next time you boot your machine, you should be able to use your external keyboard.</p>
<p>Run <em>boltctl</em> a look for “bootacl”. Make sure that the list of allowed devices contains the one you wish to use.</p>
<figure class="wp-block-image size-large"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/01/thunderbolt-how-to-use-keyboard-during-boot-time-1.png" alt="" class="wp-image-30258" /></figure>
<p>Also note the “security: secure” line. If you see anything else, for instance “security: user” I recommend to reconfigure BIOS.</p>
<h2>Technical details of the pre-boot support</h2>
<p>There is one unfortunate technical detail about this solution. Thunderbolt support different security levels. For running Fedora, I recommend you to use “secure” level to verify that the device is indeed the one that it claims to be by using a per-device key generated by the host and stored in the device. Firmware, on the other hand, will only use “user” level which uses simple UUID that is provided by the device. The difference is that a malicious device could claim to be a different one by providing the same UUID as a legitimate one. Anyway this should not be a problem as the memory does not contain any sensitive data yet.</p>
<p>You can find more technical details in this blog post: <a href="https://christian.kellner.me/2019/02/11/thunderbolt-preboot-access-control-list-support-in-bolt/">https://christian.kellner.me/2019/02/11/thunderbolt-preboot-access-control-list-support-in-bolt/</a></p>
<h2>Conclusion</h2>
<p>As you can see, in recent enough Fedora version the solution is a simple switch in BIOS. So if you are still opening your laptop during boot, go ahead and configure it so you don’t have to do it next time. Meanwhile<strong> check that the default security level is “secure”</strong> instead of “user” [5].</p>
<h2>Sources:</h2>
<p>[1] <a href="https://www.intel.com/content/www/us/en/products/docs/io/thunderbolt/thunderbolt-technology-developer.html">https://www.intel.com/content/www/us/en/products/docs/io/thunderbolt/thunderbolt-technology-developer.html</a></p>
<p>[2] <a href="https://christian.kellner.me/2019/02/11/thunderbolt-preboot-access-control-list-support-in-bolt/">https://christian.kellner.me/2019/02/11/thunderbolt-preboot-access-control-list-support-in-bolt/</a></p>
<p>[3] <a href="https://gitlab.freedesktop.org/bolt/bolt">https://gitlab.freedesktop.org/bolt/bolt</a></p>
<p>[4] <a href="https://wiki.gnome.org/Design/Whiteboards/ThunderboltAccess">https://wiki.gnome.org/Design/Whiteboards/ThunderboltAccess</a></p>
<p>[5] <a href="https://christian.kellner.me/2019/02/27/thunderclap-and-linux/">https://christian.kellner.me/2019/02/27/thunderclap-and-linux/</a></p>
</div>


https://www.sickgaming.net/blog/2020/01/...boot-time/
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016