encrypted_parabola.html 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <style type="text/css">
  7. @import url('../css/main.css');
  8. </style>
  9. <title>Installing Parabola GNU/Linux with full disk encryption (including /boot)</title>
  10. </head>
  11. <body>
  12. <div class="section">
  13. <h1>Installing Parabola GNU/Linux with full disk encryption (including /boot)</h1>
  14. <p>
  15. Libreboot uses the GRUB <a href="http://www.coreboot.org/Payloads#GRUB_2">payload</a>
  16. by default, which means that the GRUB configuration file
  17. (where your GRUB menu comes from) is stored directly alongside libreboot
  18. and it's GRUB payload executable, inside
  19. the flash chip. In context, this means that installing distributions and managing them
  20. is handled slightly differently compared to traditional BIOS systems.
  21. </p>
  22. <p>
  23. On most systems, the /boot partition has to be left unencrypted while the others are encrypted.
  24. This is so that GRUB, and therefore the kernel, can be loaded and executed since the firmware
  25. can't open a LUKS volume. Not so with libreboot! Since GRUB is already included directly as a
  26. payload, even /boot can be encrypted. This protects /boot from tampering by someone with physical
  27. access to the machine.
  28. </p>
  29. <p>
  30. <a href="index.html">Back to previous index</a>
  31. </p>
  32. </div>
  33. <div class="section">
  34. <p>
  35. Boot Parabola's install environment. <a href="grub_boot_installer.html">How to boot a GNU/Linux installer</a>.
  36. </p>
  37. <p>
  38. For this guide I used the 2013 09 01 image to boot the live installer and install the system.
  39. </p>
  40. <p>
  41. This guide will go through the installation steps taken at the time of writing, which may or may not change due to
  42. the volatile nature of Parabola (it changes all the time). In general most of it should remain the same. If you spot mistakes,
  43. please say so! This guide will be ported to the Parabola wiki at a later date. For up to date Parabola install guide, go to
  44. the Parabola wiki. This guide essentially cherry picks the useful information (valid at the time of writing: 2014-09-15).
  45. </p>
  46. </div>
  47. <div class="section">
  48. <p>
  49. Firstly if you use an SSD, beware there are issues with TRIM (not enabled through luks) and security issues if you do enable it.
  50. See <a href="https://wiki.archlinux.org/index.php/Dm-crypt/Specialties#Discard.2FTRIM_support_for_solid_state_drives_.28SSD.29">this page</a>
  51. for more info.
  52. </p>
  53. <p>
  54. <b>If you are using an SSD for this, make sure it's brand-new (or barely used). Or, otherwise, be sure that it never previously
  55. contained plaintext copies of your data.</b>
  56. </p>
  57. <p>
  58. Wipe the MBR (if you use MBR):<br/>
  59. # <b>lsblk</b><br/>
  60. Your HDD is probably /dev/sda:
  61. # <b>dd if=/dev/zero of=/dev/sda bs=446 count=1; sync</b><br/>
  62. Never use SeaBIOS! The MBR section can easily be changed with malicious code, which SeaBIOS will blindly execute.
  63. This guide is for libreboot with GRUB-as-payload only.
  64. </p>
  65. <p>
  66. Securely wipe the drive:<br/>
  67. # <b>dd if=/dev/urandom of=/dev/sda; sync</b><br/>
  68. NOTE: If you have an SSD, only do this the first time. If it was already LUKS-encrypted before,
  69. use the info below to wipe the LUKS header. Also, check online for your SSD what the recommended
  70. erase block size is. For example if it was 2MiB:<br/>
  71. # <b>dd if=/dev/urandom of=/dev/sda bs=2M; sync</b>
  72. </p>
  73. <p>
  74. If your drive was already LUKS encrypted (maybe you are re-installing your distro) then
  75. it is already 'wiped'. You should just wipe the LUKS header.
  76. <a href="https://www.lisenet.com/2013/luks-add-keys-backup-and-restore-volume-header/">https://www.lisenet.com/2013/luks-add-keys-backup-and-restore-volume-header/</a>
  77. showed me how to do this. It recommends doing the first 3MiB. Now, that guide is recommending putting zero there. I'm doing to use urandom. Do this:<br/>
  78. # <b>head -c 3145728 /dev/urandom &gt; /dev/sda; sync</b><br/>
  79. (wiping the LUKS header is important, since it has hashed passphrases and so on. It's 'secure', but 'potentially' a risk).
  80. </p>
  81. <p>
  82. <b>
  83. If you do plan to use an SSD, make sure to read
  84. <a href="https://wiki.archlinux.org/index.php/Solid_State_Drives">https://wiki.archlinux.org/index.php/Solid_State_Drives</a><br/>
  85. Edit /etc/fstab later on when chrooted into your install. Also, read the whole article and keep all points in mind, adapting
  86. them for this guide.
  87. </b>
  88. </p>
  89. </div>
  90. <div class="section">
  91. <h2>
  92. Change keyboard layout
  93. </h2>
  94. <p>
  95. Parabola live shell assumes US Qwerty. If you have something different, use:<br/>
  96. # <b>loadkeys LAYOUT</b><br/>
  97. For me, LAYOUT would have been dvorak-uk.
  98. </p>
  99. </div>
  100. <div class="section">
  101. <h2>Getting started</h2>
  102. <p>
  103. The beginning is based on <a href="https://wiki.parabolagnulinux.org/Installation_Guide">https://wiki.parabolagnulinux.org/Installation_Guide</a>.
  104. Then I referred to <a href="https://wiki.archlinux.org/index.php/Partitioning">https://wiki.archlinux.org/index.php/Partitioning</a> at first.
  105. </p>
  106. </div>
  107. <div class="section">
  108. <h2>dm-mod</h2>
  109. <p>
  110. device-mapper will be used - a lot. Make sure that the kernel module is loaded:<br/>
  111. # <b>modprobe dm-mod</b>
  112. </p>
  113. <h2>Create LUKS partition</h2>
  114. <p>
  115. I am using MBR partitioning, so I use cfdisk:<br/>
  116. # <b>cfdisk /dev/sda</b>
  117. </p>
  118. <p>
  119. I create a single large sda1 filling the whole drive, leaving it as the default type 'Linux' (83).
  120. </p>
  121. <p>
  122. Now I refer to <a href="https://wiki.archlinux.org/index.php/Dm-crypt/Drive_preparation#Partitioning">https://wiki.archlinux.org/index.php/Dm-crypt/Drive_preparation#Partitioning</a>:<br/>
  123. I am then directed to <a href="https://wiki.archlinux.org/index.php/Dm-crypt/Device_encryption">https://wiki.archlinux.org/index.php/Dm-crypt/Device_encryption</a>.
  124. </p>
  125. <p>
  126. Parabola forces you to RTFM.
  127. </p>
  128. <p>
  129. It tells me to run:<br/>
  130. # <b>cryptsetup benchmark</b> (for making sure the list below is populated)<br/>
  131. Then:<br/>
  132. # <b>cat /proc/crypto</b><br/>
  133. This gives me crypto options that I can use. It also provides a representation of the best way to set up LUKS (in this case, security is a priority; speed, a distant second).
  134. To gain a better understanding, I am also reading:<br/>
  135. # <b>man cryptsetup</b>
  136. </p>
  137. <p>
  138. Following that page, based on my requirements, I do the following based on <a href="https://wiki.archlinux.org/index.php/Dm-crypt/Device_encryption#Encryption_options_for_LUKS_mode">https://wiki.archlinux.org/index.php/Dm-crypt/Device_encryption#Encryption_options_for_LUKS_mode</a>.
  139. Reading through, it seems like Serpent (encryption) and Whirlpool (hash) is the best option.
  140. </p>
  141. <p>
  142. I am initializing LUKS with the following:<br/>
  143. # <b>cryptsetup -v --cipher serpent-xts-plain64 --key-size 512 --hash whirlpool --use-random --verify-passphrase luksFormat /dev/sda1</b>
  144. -- choose a <b>secure</b> passphrase here. Ideally lots of lowercase/uppercase numbers, letters, symbols etc all in a random pattern. The password
  145. length should be as long as you are able to handle without writing it down or storing it anywhere.
  146. </p>
  147. </div>
  148. <div class="section">
  149. <h2>Create LVM</h2>
  150. <p>
  151. Now I refer to <a href="https://wiki.archlinux.org/index.php/LVM">https://wiki.archlinux.org/index.php/LVM</a>.
  152. </p>
  153. <p>
  154. Open the LUKS partition:<br/>
  155. # <b>cryptsetup open --type luks /dev/sda1 lvm</b><br/>
  156. (it will be available at /dev/mapper/lvm)<br/>
  157. I'm told that the above is old syntax, which is what I did anyway. You could also try:<br/>
  158. # <b>cryptsetup luksOpen /dev/sda1 lvm</b>
  159. </p>
  160. <p>
  161. Create LVM partition:<br/>
  162. # <b>pvcreate /dev/mapper/lvm</b><br/>
  163. Show that you just created it:<br/>
  164. # <b>pvdisplay</b>
  165. </p>
  166. <p>
  167. Now I create the volume group, inside of which the logical volumes will be created:<br/>
  168. # <b>vgcreate matrix /dev/mapper/lvm</b> (volume group name is 'matrix')<br/>
  169. Show that you created it:<br/>
  170. # <b>vgdisplay</b>
  171. </p>
  172. <p>
  173. Now create the logical volumes:<br/>
  174. # <b>lvcreate -L 2G matrix -n swapvol</b> (2G swap partition, named <u>swapvol</u>)<br/>
  175. # <b>lvcreate -l +100%FREE matrix -n rootvol</b> (single large partition in the rest of the space, named <u>rootvol</u>)<br/>
  176. You can also be flexible here, for example you can specify a /boot, a /, a /home, a /var, a /usr, etc. For example,
  177. if you will be running a web/mail server then you want /var in its own partition (so that if it fills up with logs, it won't crash your system).
  178. For a home/laptop system (typical use case), a root and a swap will do (really).
  179. </p>
  180. <p>
  181. Verify that the logical volumes were created, using the following command:<br/>
  182. # <b>lvdisplay</b>
  183. </p>
  184. </div>
  185. <div class="section">
  186. <h2>Create / and swap partitions</h2>
  187. <p>
  188. For the swapvol LV I use:<br/>
  189. # <b>mkswap /dev/mapper/matrix-swapvol</b>
  190. </p>
  191. <p>
  192. For the rootvol LV I use:<br/>
  193. # <b>mkfs.ext4 /dev/mapper/matrix-rootvol</b>
  194. </p>
  195. </div>
  196. <div class="section">
  197. <h2>Continue with Parabola installation</h2>
  198. <p>
  199. Mount the root (/) partition:<br/>
  200. # <b>mount /dev/matrix/rootvol /mnt</b><br/>
  201. </p>
  202. <p>
  203. This guide is really about GRUB, Parabola and cryptomount. I have to show how to install Parabola
  204. so that the guide can continue.
  205. </p>
  206. <p>
  207. Now I am following the rest of <a href="https://wiki.parabolagnulinux.org/Installation_Guide">https://wiki.parabolagnulinux.org/Installation_Guide</a>.
  208. I also cross referenced <a href="https://wiki.archlinux.org/index.php/Installation_guide">https://wiki.archlinux.org/index.php/Installation_guide</a>.
  209. </p>
  210. <p>
  211. Create /home and /boot on rootvol mountpoint:<br/>
  212. # <b>mkdir /mnt/home</b><br/>
  213. # <b>mkdir /mnt/boot</b>
  214. </p>
  215. <p>
  216. The wiki says to enable the swap so that it can be detected by 'genfstab':<br/>
  217. # <b>swapon /dev/matrix/swapvol</b>
  218. </p>
  219. <p>
  220. DHCP was already working for me, so I had internet during the install. Therefore, I ignore the 'Connect to the Internet' section of the install guide.
  221. I also ignore wifi, since I can set that up after the install. For now, I am just using ethernet.
  222. Otherwise, refer to <a href="https://wiki.archlinux.org/index.php/Configuring_Network">https://wiki.archlinux.org/index.php/Configuring_Network</a>.
  223. You can test to see if internet is already working by pinging a few domains.
  224. </p>
  225. <p>
  226. I commented out all lines except the Server line for the UK Parabola server (main server) in <b>/etc/pacman.d/mirrorlist</b> and then did:<br/>
  227. # <b>pacman -Syy</b><br/>
  228. # <b>pacman -Syu</b><br/>
  229. # <b>pacman -Sy pacman</b> (and then I did the other 2 steps above, again)<br/>
  230. In my case I did the steps in the next paragraph, and followed the steps in this paragraph again.
  231. </p>
  232. <p>
  233. &lt;troubleshooting&gt;<br/>
  234. &nbsp;&nbsp;&nbsp;The following is based on 'Verification of package signatures' in the Parabola install guide.<br/>
  235. &nbsp;&nbsp;&nbsp;Check there first to see if steps differ by now.<br/>
  236. &nbsp;&nbsp;&nbsp;Now you have to update the default Parabola keyring. This is used for signing and verifying packages:<br/>
  237. &nbsp;&nbsp;&nbsp;# <b>pacman -Sy parabola-keyring</b><br/>
  238. &nbsp;&nbsp;&nbsp;It says that if you get GPG errors, then it's probably an expired key and, therefore, you should do:<br/>
  239. &nbsp;&nbsp;&nbsp;# <b>pacman-key --populate parabola</b><br/>
  240. &nbsp;&nbsp;&nbsp;# <b>pacman-key --refresh-keys</b><br/>
  241. &nbsp;&nbsp;&nbsp;# <b>pacman -Sy parabola-keyring</b><br/>
  242. &nbsp;&nbsp;&nbsp;To be honest, you should do the above anyway. Parabola has a lot of maintainers, and a lot of keys. Really!<br/>
  243. &nbsp;&nbsp;&nbsp;Also, it says that if the clock is set incorrectly then you have to manually set the correct time <br/>
  244. &nbsp;&nbsp;&nbsp;(if keys are listed as expired because of it):<br/>
  245. &nbsp;&nbsp;&nbsp;# <b>date MMDDhhmm[[CC]YY][.ss]</b><br/>
  246. &nbsp;&nbsp;&nbsp;I also had to install:<br/>
  247. &nbsp;&nbsp;&nbsp;# <b>pacman -S archlinux-keyring</b><br/>
  248. &nbsp;&nbsp;&nbsp;# <b>pacman-key --populate archlinux</b><br/>
  249. &nbsp;&nbsp;&nbsp;In my case I saw some conflicting files reported in pacman, stopping me from using it.<br/>
  250. &nbsp;&nbsp;&nbsp;I deleted the files that it mentioned
  251. and then it worked. Specifically, I had this error:<br/>
  252. &nbsp;&nbsp;&nbsp;<i>licenses: /usr/share/licenses/common/MPS exists in filesystem</i><br/>
  253. &nbsp;&nbsp;&nbsp;I rm -Rf'd the file and then pacman worked. I'm told that the following would have also made it work:<br/>
  254. &nbsp;&nbsp;&nbsp;# <b>pacman -Sf licenses</b><br/>
  255. &lt;/troubleshooting&gt;<br/>
  256. </p>
  257. <p>
  258. I also like to install other packages (base-devel, compilers and so on) and wpa_supplicant/dialog are needed for wireless after the install:<br/>
  259. # <b>pacstrap /mnt base base-devel wpa_supplicant dialog</b>
  260. </p>
  261. </div>
  262. <div class="section">
  263. <h2>Configure the system</h2>
  264. <p>
  265. From the Parabola installation guide (Arch's one was identical):<br/>
  266. # <b>genfstab -p /mnt &gt;&gt; /mnt/etc/fstab</b>
  267. </p>
  268. <p>
  269. Chroot into new system:<br/>
  270. # <b>arch-chroot /mnt</b>
  271. </p>
  272. <p>
  273. It's a good idea to have this installed:<br/>
  274. # <b>pacman -S linux-libre-lts</b>
  275. </p>
  276. <p>
  277. It was also suggested that you should install this kernel (read up on what GRSEC is):<br/>
  278. # <b>pacman -S linux-libre-grsec</b>
  279. </p>
  280. <p>
  281. This is another kernel that sits inside /boot, which you can use. LTS means 'long-term support'. These are so-called 'stable' kernels
  282. that can be used as a fallback during updates, if a bad kernel causes issues for you.
  283. </p>
  284. <p>
  285. Parabola does not have wget. This is sinister. Install it:<br/>
  286. # <b>pacman -S wget</b>
  287. </p>
  288. <ul>
  289. <li>Write your hostname to /etc/hostname</li>
  290. <li>
  291. Symlink /etc/localtime to /usr/share/zoneinfo/Zone/SubZone. Replace Zone and Subzone to your liking. For example:
  292. <ul>
  293. <li># <b>ln -s /usr/share/zoneinfo/Europe/London /etc/localtime</b></li>
  294. </ul>
  295. </li>
  296. <li>
  297. Set <a href="https://wiki.parabolagnulinux.org/Locale#Setting_system-wide_locale">locale</a> preferences in /etc/locale.conf. In my case, I did:<br/>
  298. <i>
  299. LANG="en_GB.UTF-8"<br/>
  300. # Keep the default sort order (e.g. files starting with a '.'<br/>
  301. # should appear at the start of a directory listing.)<br/>
  302. LC_COLLATE="C"<br/>
  303. # Set the short date to YYYY-MM-DD (test with "date +%c")<br/>
  304. LC_TIME="en_GB.UTF-8"
  305. </i>
  306. </li>
  307. <li>
  308. Add <a href="https://wiki.parabolagnulinux.org/KEYMAP">console keymap and font</a> preferences in /etc/vconsole.conf. In my case:<br/>
  309. <i>
  310. KEYMAP=dvorak-uk<br/>
  311. FONT=Lat2-Terminus16
  312. </i>
  313. </li>
  314. <li>
  315. Uncomment the selected locale (same as what you specified in /etc/locale.conf) in /etc/locale.gen and generate it with:
  316. <ul>
  317. <li># <b>locale-gen</b></li>
  318. </ul>
  319. </li>
  320. <li>
  321. Configure /etc/mkinitcpio.conf as needed (see <a href="https://wiki.parabolagnulinux.org/Mkinitcpio">mkinitcpio</a>)
  322. Specifically, for this use case:<br/>
  323. <ul>
  324. <li>
  325. add <b>i915</b> to the MODULES array (forces the driver to load earlier, so that the consolefont isn't wiped out after getting to login).<br/>
  326. add <b>encrypt</b> and <b>lvm2</b> in that order, before the 'filesystems' entry in the HOOKS array.<br/>
  327. add <b>keymap</b>, <b>consolefont</b> and <b>shutdown</b> to the end of the HOOKS array in that order.<br/>
  328. move <b>keyboard</b>, <b>keymap</b> and <b>consolefont</b> in that order, to go before 'encrypt' in the HOOKS array.<br/>
  329. At the end your HOOKS array will look like this:<br/>
  330. <i>HOOKS=&quot;base udev autodetect modconf block keyboard keymap consolefont encrypt lvm2 filesystems fsck shutdown&quot;</i>
  331. <ul>
  332. <li>keymap adds to initramfs the keymap that you specified in /etc/vconsole.conf</li>
  333. <li>consolefont adds to initramfs the font that you specified in /etc/vconsole.conf</li>
  334. <li>encrypt adds LUKS support to the initramfs - needed to unlock your disks at boot time</li>
  335. <li>lvm2 adds LVM support to the initramfs - needed to mount the LVM partitions at boot time</li>
  336. <li>shutdown is needed according to Parabola wiki for unmounting devices (such as LUKS/LVM) during shutdown</li>
  337. <li>
  338. Runtime modules can be found in /usr/lib/initcpio/hooks, and build hooks can be found in
  339. /usr/lib/initcpio/install.
  340. </li>
  341. <li><b>mkinitcpio -H hookname</b> gives information about each hook.</li>
  342. </ul>
  343. </li>
  344. </ul>
  345. </li>
  346. <li>
  347. Now using mkinitcpio, you can create the kernel and ramdisk for booting with (this is different from Arch, specifying linux-libre instead of linux):<br/>
  348. # <b>mkinitcpio -p linux-libre</b><br/>
  349. Also do it for linux-libre-lts:<br/>
  350. # <b>mkinitcpio -p linux-libre-lts</b><br/>
  351. Also do it for linux-libre-grsec:<br/>
  352. # <b>mkinitcpio -p linux-libre-grsec</b>
  353. </li>
  354. </ul>
  355. </div>
  356. <div class="section">
  357. <h2>Set a root password</h2>
  358. <p>
  359. At the time of writing, Parabola used SHA512 by default for it's password hashing.
  360. </p>
  361. <p>
  362. I referred to <a href="https://wiki.archlinux.org/index.php/SHA_password_hashes">https://wiki.archlinux.org/index.php/SHA_password_hashes</a>.
  363. </p>
  364. <p>
  365. Open /etc/pam.d/passwd and add rounds=65536 at the end of the uncommented 'password' line.
  366. </p>
  367. <p>
  368. # <b>passwd root</b><br/>
  369. Make sure to set a secure password! Also, it must never be the same as your LUKS password.
  370. </p>
  371. </div>
  372. <div class="section">
  373. <h2>Extra security tweaks</h2>
  374. <p>
  375. Based on <a href="https://wiki.archlinux.org/index.php/Security">https://wiki.archlinux.org/index.php/Security</a>.
  376. </p>
  377. <p>
  378. Restrict access to important directories:<br/>
  379. # <b>chmod 700 /boot /etc/{iptables,arptables}</b>
  380. </p>
  381. <p>
  382. Lockout user after three failed login attempts:<br/>
  383. Edit the file /etc/pam.d/system-login and comment out that line:<br/>
  384. <i># auth required pam_tally.so onerr=succeed file=/var/log/faillog</i><br/>
  385. Or just delete it. Above it, put:<br/>
  386. <i>auth required pam_tally.so deny=2 unlock_time=600 onerr=succeed file=/var/log/faillog</i><br/>
  387. To unlock a user manually (if a password attempt is failed 3 times), do:<br/>
  388. # <b>pam_tally --user <i>theusername</i> --reset</b>
  389. What the above configuration does is lock the user out for 10 minutes, if they make 3 failed login attempts.
  390. </p>
  391. <p>
  392. Configure sudo - not covered here. Will be covered post-installation in another tutorial, at a later date.
  393. If this is a single-user system, you don't really need sudo.
  394. </p>
  395. </div>
  396. <div class="section">
  397. <h2>Unmount, reboot!</h2>
  398. <p>
  399. Exit from chroot:<br/>
  400. # <b>exit</b>
  401. </p>
  402. <p>
  403. unmount:<br/>
  404. # <b>umount /mnt</b><br/>
  405. # <b>swapoff -a</b>
  406. </p>
  407. <p>
  408. deactivate the lvm lv's:<br/>
  409. # <b>lvchange -an /dev/matrix/rootvol</b><br/>
  410. # <b>lvchange -an /dev/matrix/swapvol</b><br/>
  411. </p>
  412. <p>
  413. Lock the encrypted partition (close it):<br/>
  414. # <b>cryptsetup luksClose lvm</b>
  415. </p>
  416. <p>
  417. # <b>shutdown -h now</b><br/>
  418. Then boot up again.
  419. </p>
  420. </div>
  421. <div class="section">
  422. <h2>Booting from GRUB</h2>
  423. <p>
  424. Initially you will have to boot manually. Press C to get to the GRUB command line. The underlined parts are optional
  425. (using those 2 underlines will boot lts kernel instead of normal).
  426. </p>
  427. <p>
  428. grub> <b>cryptomount -a (ahci0,msdos1)</b><br/>
  429. grub> <b>set root='lvm/matrix-rootvol'</b><br/>
  430. grub> <b>linux /boot/vmlinuz-linux-libre<u>-lts</u> root=/dev/matrix/rootvol cryptdevice=/dev/sda1:root</b><br/>
  431. grub> <b>initrd /boot/initramfs-linux-libre<u>-lts</u>.img</b><br/>
  432. grub> <b>boot</b><br/>
  433. </p>
  434. <p>
  435. You could also make it load /boot/vmlinuz-linux-libre-grsec and /boot/initramfs-linux-libre-grsec.img
  436. </p>
  437. </div>
  438. <div class="section">
  439. <h2>Modify grub.cfg inside the ROM</h2>
  440. <p>
  441. Now you need to modify the ROM, so that Parabola can boot automatically with this configuration.
  442. <a href="grub_cbfs.html">grub_cbfs.html</a> shows you how. Follow that guide, using the configuration details below.
  443. </p>
  444. <p>
  445. Inside the 'Load Operating System' menu entry, change the contents to:<br/>
  446. <b><i>
  447. cryptomount -a (ahci0,msdos1)<br/>
  448. set root='lvm/matrix-rootvol'<br/>
  449. linux /boot/vmlinuz-linux-libre<u>-lts</u> root=/dev/matrix/rootvol cryptdevice=/dev/sda1:root<br/>
  450. initrd /boot/initramfs-linux-libre<u>-lts</u>.img
  451. </i></b>
  452. </p>
  453. <p>
  454. Note: the underlined parts above (-lts) can also be removed, to boot the latest kernel instead of LTS (long-term support) kernels.
  455. You could also copy the menu entry and in one have -lts, and without in the other menuentry.
  456. You could also create a menu entry to load /boot/vmlinuz-linux-libre-grsec and /boot/initramfs-linux-libre-grsec.img
  457. </p>
  458. <p>
  459. Personally, I opted to have the entry for linux-libre-grsec at the top, so that it would load by default.
  460. </p>
  461. <p>
  462. Above the 'Load Operating System' menu entry you should also add a GRUB password, like so:
  463. </p>
  464. <pre><b><i>set superusers=&quot;root&quot;
  465. password_pbkdf2 root grub.pbkdf2.sha512.10000.711F186347156BC105CD83A2ED7AF1EB971AA2B1EB2640172F34B0DEFFC97E654AF48E5F0C3B7622502B76458DA494270CC0EA6504411D676E6752FD1651E749.8DD11178EB8D1F633308FD8FCC64D0B243F949B9B99CCEADE2ECA11657A757D22025986B0FA116F1D5191E0A22677674C994EDBFADE62240E9D161688266A711
  466. </i></b></pre>
  467. <p>
  468. Note that the above entry specifies user 'root'; this is just a username for GRUB. You don't even need to use root.
  469. Change root on both of those 2 lines to whatever you want.
  470. </p>
  471. <p>
  472. Start dhcp on ethernet:<br/>
  473. # <b>systemctl start dhcpcd.service</b>
  474. This is just for the step below. I won't cover network configuration here. That is for another Parabola article.
  475. </p>
  476. <p>
  477. The password hash (it's <b>password</b>, by the way) after <i>'password_pbkdf2 root'</i> <i>should be changed</i> and is created by the <b>grub-mkpasswd-pbkdf2</b> utility, which you need to install or otherwise compile,
  478. like so:<br/>
  479. # <b>pacman -S grub</b>
  480. </p>
  481. <p>
  482. GRUB isn't needed for booting, since it's already included as a payload in libreboot. This is only so that the utility needed becomes available. Get your hash
  483. by entering your chosen password at the prompt, when running this command:<br/>
  484. # <b>grub-mkpasswd-pbkdf2</b>
  485. </p>
  486. <p>
  487. It will output the hash for the password that you entered. Make sure to specify a password that is different from both your LUKS *and* your root/user password.
  488. Use it to replace the default hash mentioned above.
  489. </p>
  490. <p>
  491. With this setup, you will have to enter a password at boot time, in GRUB, before being able to use any of the menu entries or switch to the terminal.
  492. This protects your system from an attacker simply booting a live usb distro and re-flashing the boot firmware.
  493. </p>
  494. <p>
  495. You probably only need base-devel (compilers and so on) to build and use cbfstool. It was already installed if you followed this tutorial, but here it is:<br/>
  496. # <b>pacman -S base-devel</b>
  497. </p>
  498. <p>
  499. For flashing the modified ROM, I just used flashrom from the Parabola repo's:<br/>
  500. # <b>pacman -S flashrom</b><br/>
  501. I also installed dmidecode:<br/>
  502. # <b>pacman -S dmidecode</b>
  503. </p>
  504. <p>
  505. When done, deleted GRUB (remember, we only needed it for the <i>grub-mkpasswd-pbkdf2</i> utility;
  506. GRUB is already part of libreboot, flashed alongside it as a <i>payload</i>):<br/>
  507. # <b>pacman -R grub</b>
  508. </p>
  509. </div>
  510. <div class="section">
  511. <p>
  512. If you followed all that correctly, you should now have a fully encrypted Parabola installation.
  513. This is a very barebones Parabola install (the default one). Refer to the wiki for how to do the rest
  514. (desktop, etc).
  515. </p>
  516. </div>
  517. <div class="section">
  518. <h2>Optional: Use Keyfile in Initramfs to unlock encrypted root</h2>
  519. <p>
  520. Using the above installation method, you will have to unlock the encrypted file system twice
  521. (once in GRUB, and again when booting Parabola).
  522. To circumvent this, you can insert a keyfile into the initramfs. This is generally safe, because the /boot/ directory is encrypted.<br/>
  523. First create a keyfile:<br/>
  524. # <b>dd bs=512 count=4 if=/dev/urandom of=/etc/mykeyfile iflag=fullblock</b><br/>
  525. Add the keyfile to the Luks Device:<br/>
  526. # <b>cryptsetup luksAddKey /dev/sdX /etc/mykeyfile</b><br/>
  527. Add the keyfile to the initramfs by adding it to FILES in /etc/mkinitcpio.conf. For example:<br/>
  528. # <b>FILES="/etc/mykeyfile"</b><br/>
  529. Re-create the initramfs image:<br/>
  530. # <b>mkinitcpio -p linux-libre</b><br/>
  531. Reboot and add the following to the kernel command line in GRUB:<br/>
  532. # <b>cryptkey=rootfs:/etc/mykeyfile</b><br/>
  533. <br/>
  534. If everything works as expected, permanently add the kernel parameter to the GRUB config using
  535. the instructions at <a href="grub_cbfs.html">grub_cbfs.html</a>.
  536. </p>
  537. </div>
  538. <div class="section">
  539. <h2>Further security tips</h2>
  540. <p>
  541. <a href="https://wiki.archlinux.org/index.php/Security">https://wiki.archlinux.org/index.php/Security</a>.<br/>
  542. <a href="https://wiki.parabolagnulinux.org/User:GNUtoo/laptop">https://wiki.parabolagnulinux.org/User:GNUtoo/laptop</a>
  543. </p>
  544. </div>
  545. <div class="section">
  546. <h2>Follow-up tutorial: configuring Parabola</h2>
  547. <p>
  548. <a href="configuring_parabola.html">configuring_parabola.html</a> shows my own notes post-installation. Using these, you can get a basic
  549. system similar to the one that I chose for myself. You can also cherry pick useful notes and come up with your own system.
  550. Parabola is user-centric, which means that you are in control. For more information, read <a href="https://wiki.archlinux.org/index.php/The_Arch_Way">The Arch Way</a>
  551. (Parabola also follows it).
  552. </p>
  553. </div>
  554. <div class="section">
  555. <p>
  556. Copyright &copy; 2014, 2015 Francis Rowe &lt;info@gluglug.org.uk&gt;<br/>
  557. Copyright &copy; 2015 Thomas Zelch &lt;tze@xenlab.de&gt;<br/>
  558. Copyright &copy; 2015 Arthur Heymans &lt;arthur@aheymans.xyz&gt;<br/>
  559. This document is released under the Creative Commons Attribution-ShareAlike 4.0 International Public License and all future versions.
  560. A copy of the license can be found at <a href="../cc-by-sa-4.txt">../cc-by-sa-4.txt</a>.
  561. </p>
  562. <p>
  563. This document is distributed in the hope that it will be useful,
  564. but WITHOUT ANY WARRANTY; without even the implied warranty of
  565. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See <a href="../cc-by-sa-4.txt">../cc-by-sa-4.txt</a> for more information.
  566. </p>
  567. </div>
  568. </body>
  569. </html>