diff options
author | Scott Bonds <scott@ggr.com> | 2016-10-12 10:09:21 -0700 |
---|---|---|
committer | Scott Bonds <scott@ggr.com> | 2016-10-12 10:09:21 -0700 |
commit | 98cc00d45b3bdf62ab4b1cbe813d95aea4f8c9f9 (patch) | |
tree | b1cbe76cc70aa42cb1e92ea0bfb3718b9d1e9f37 /docs/bsd/encrypted_parabola.html | |
parent | 739b2d948b461053832d69fab3f2f60c9f51a3a6 (diff) | |
download | librebootfr-98cc00d45b3bdf62ab4b1cbe813d95aea4f8c9f9.tar.gz librebootfr-98cc00d45b3bdf62ab4b1cbe813d95aea4f8c9f9.zip |
cleaned up the OpenBSD docs
Diffstat (limited to 'docs/bsd/encrypted_parabola.html')
-rw-r--r-- | docs/bsd/encrypted_parabola.html | 872 |
1 files changed, 0 insertions, 872 deletions
diff --git a/docs/bsd/encrypted_parabola.html b/docs/bsd/encrypted_parabola.html deleted file mode 100644 index a68b2baf..00000000 --- a/docs/bsd/encrypted_parabola.html +++ /dev/null @@ -1,872 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - - <style type="text/css"> - @import url('../css/main.css'); - </style> - - <title>Installing Parabola or Arch GNU/Linux with full disk encryption (including /boot)</title> -</head> - -<body> - <div class="section"> - <h1>Installing Parabola or Arch GNU/Linux with full disk encryption (including /boot)</h1> - <p> - Libreboot on x86 uses the GRUB <a href="http://www.coreboot.org/Payloads#GRUB_2">payload</a> - by default, which means that the GRUB configuration file - (where your GRUB menu comes from) is stored directly alongside libreboot - and it's GRUB payload executable, inside - the flash chip. In context, this means that installing distributions and managing them - is handled slightly differently compared to traditional BIOS systems. - </p> - - <p> - On most systems, the /boot partition has to be left unencrypted while the others are encrypted. - This is so that GRUB, and therefore the kernel, can be loaded and executed since the firmware - can't open a LUKS volume. Not so with libreboot! Since GRUB is already included directly as a - payload, even /boot can be encrypted. This protects /boot from tampering by someone with physical - access to the system. - </p> - <p> - <b>This guide is *only* for the GRUB payload. If you use the depthcharge payload, ignore this section entirely.</b> - </p> - <p> - This guide is intended for the Parabola distribution, but it should also work (with some adaptation) - for <em>Arch</em>. - We recomend using Parabola, which is a version of Arch that removes all - proprietary software, both in the default installation and in the package repositories. It usually lags - behind Arch by only a day or two, so it is still usable for most people. - See <a href="https://wiki.parabola.nu/index.php?title=Migration_from_the_GNU/Linux_distribution_of_Arch&redirect=no">Arch to Parabola migration guide</a>. - </p> - - <p> - Note: on some thinkpads, a faulty DVD drive can cause the cryptomount -a step during boot to fail. If this happens to you, try removing the drive. - </p> - <p> - <a href="index.html">Back to previous index</a> - </p> - </div> - - <div class="section"> - - <p> - Boot Parabola's install environment. <a href="grub_boot_installer.html">How to boot a GNU/Linux installer</a>. - </p> - - <p> - For this guide I used the 2015 08 01 image to boot the live installer and install the system. - This is available at <a href="https://wiki.parabola.nu/Get_Parabola#Main_live_ISO">this page</a>. - </p> - - <p> - This guide will go through the installation steps taken at the time of writing, which may or may not change due to - the volatile nature of Parabola (it changes all the time). In general most of it should remain the same. If you spot mistakes, - 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 - the Parabola wiki. This guide essentially cherry picks the useful information (valid at the - time of writing: 2015-08-25). - </p> - - </div> - - <div class="section"> - - <p> This section deals with wiping the storage device on which you plan to install Parabola - GNU/Linux. Follow these steps, but if you use an SSD, also: - - <p> - - beware there are issues with TRIM (not enabled through luks) and security issues if you do enable it. - See <a href="https://wiki.archlinux.org/index.php/Dm-crypt/Specialties#Discard.2FTRIM_support_for_solid_state_drives_.28SSD.29">this page</a> - for more info. - </p> - - <p> - make sure it's brand-new (or barely used). Or, otherwise, be sure that it never previously contained plaintext copies of your data. - </p> - - <p> - make sure to read <a href="https://wiki.archlinux.org/index.php/Solid_State_Drives">this article</a>. Edit /etc/fstab later on when - chrooted into your install. Also, read the whole article and keep all points in mind, adapting them for this guide. - </p> - - <p> - Securely wipe the drive:<br/> - # <b>dd if=/dev/urandom of=/dev/sda; sync</b><br/> - NOTE: If you have an SSD, only do this the first time. If it was already LUKS-encrypted before, - use the info below to wipe the LUKS header. Also, check online for your SSD what the recommended - erase block size is. For example if it was 2MiB:<br/> - # <b>dd if=/dev/urandom of=/dev/sda bs=2M; sync</b> - </p> - <p> - If your drive was already LUKS encrypted (maybe you are re-installing your distro) then - it is already 'wiped'. You should just wipe the LUKS header. - <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> - showed me how to do this. It recommends doing the first 3MiB. Now, that guide is recommending putting zero there. I'm going to use urandom. Do this:<br/> - # <b>head -c 3145728 /dev/urandom > /dev/sda; sync</b><br/> - (Wiping the LUKS header is important, since it has hashed passphrases and so on. It's 'secure', but 'potentially' a risk). - </p> - - </div> - - <div class="section"> - - <h2> - Change keyboard layout - </h2> - <p> - Parabola live shell assumes US Qwerty. If you have something different, list the available keymaps and use yours:<br/> - # <b>localectl list-keymaps</b><br/> - # <b>loadkeys LAYOUT</b><br/> - For me, LAYOUT would have been dvorak-uk. - </p> - - </div> - - <div class="section"> - - <h2>Establish an internet connection</h2> - <p> - Refer to <a href="https://wiki.parabola.nu/Beginners%27_guide#Establish_an_internet_connection">this guide</a>. Wired is recommended, - but wireless is also explained there. - </p> - - </div> - - <div class="section"> - - <h2>Getting started</h2> - <p> - The beginning is based on <a href="https://wiki.parabolagnulinux.org/Installation_Guide">https://wiki.parabolagnulinux.org/Installation_Guide</a>. - Then I referred to <a href="https://wiki.archlinux.org/index.php/Partitioning">https://wiki.archlinux.org/index.php/Partitioning</a> at first. - </p> - - </div> - - <div class="section"> - - <h2>dm-mod</h2> - <p> - device-mapper will be used - a lot. Make sure that the kernel module is loaded:<br/> - # <b>modprobe dm-mod</b> - </p> - - <h2>Create LUKS partition</h2> - <p> - Note that the default iteration time is 2000ms (20 seconds) if not specified - in cryptsetup. You should set a lower time than this, otherwise there will be - an approximate 20 second delay when booting your system. - We recommend 500ms (5 seconds), and this is included in the prepared - cryptsetup command below. - Note that the iteration time is for security purposes (mitigates - brute force attacks), so anything lower than 5 seconds is probably - not ok. - </p> - <p> - I am using MBR partitioning, so I use cfdisk:<br/> - # <b>cfdisk /dev/sda</b> - </p> - <p> - I create a single large sda1 filling the whole drive, leaving it as the default type 'Linux' (83). - </p> - <p> - 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/> - 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>. - </p> - <p> - Parabola forces you to RTFM. Do that. - </p> - <p> - It tells me to run:<br/> - # <b>cryptsetup benchmark</b> (for making sure the list below is populated)<br/> - Then:<br/> - # <b>cat /proc/crypto</b><br/> - 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). - To gain a better understanding, I am also reading:<br/> - # <b>man cryptsetup</b> - </p> - <p> - 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>. - Reading through, it seems like Serpent (encryption) and Whirlpool (hash) is the best option. - </p> - <p> - I am initializing LUKS with the following:<br/> - # <b>cryptsetup -v --cipher serpent-xts-plain64 --key-size 512 --hash whirlpool --iter-time 500 --use-random --verify-passphrase luksFormat /dev/sda1</b> - Choose a <b>secure</b> passphrase here. Ideally lots of lowercase/uppercase numbers, letters, symbols etc all in a random pattern. The - password length should be as long as you are able to handle without writing it down or storing it anywhere. - </p> - - <p> - Use of the <i>diceware method</i> is recommended, for generating secure passphrases (instead of passwords). - </p> - - </div> - - <div class="section"> - - <h2>Create LVM</h2> - <p> - Now I refer to <a href="https://wiki.archlinux.org/index.php/LVM">https://wiki.archlinux.org/index.php/LVM</a>. - </p> - <p> - Open the LUKS partition:<br/> - # <b>cryptsetup luksOpen /dev/sda1 lvm</b><br/> - (it will be available at /dev/mapper/lvm) - </p> - <p> - Create LVM partition:<br/> - # <b>pvcreate /dev/mapper/lvm</b><br/> - Show that you just created it:<br/> - # <b>pvdisplay</b> - </p> - <p> - Now I create the volume group, inside of which the logical volumes will be created:<br/> - # <b>vgcreate matrix /dev/mapper/lvm</b><br/> - (volume group name is 'matrix' - choose your own name, if you like) - Show that you created it:<br/> - # <b>vgdisplay</b> - </p> - <p> - Now create the logical volumes:<br/> - # <b>lvcreate -L 2G matrix -n swapvol</b> (2G swap partition, named <u>swapvol</u>)<br/> - Again, choose your own name if you like. Also, make sure to choose a swap size of your own needs. It basically depends on how much RAM - you have installed. I refer to <a -href="http://www.linux.com/news/software/applications/8208-all-about-linux-swap-space">http://www.linux.com/news/software/applications/8208-all-about-linux-swap-space</a>.<br/> - # <b>lvcreate -l +100%FREE matrix -n root</b> (single large partition in the rest of the space, named <u>root</u>)<br/> - You can also be flexible here, for example you can specify a /boot, a /, a /home, a /var, a /usr, etc. For example, - 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). - For a home/laptop system (typical use case), a root and a swap will do (really). - </p> - <p> - Verify that the logical volumes were created, using the following command:<br/> - # <b>lvdisplay</b> - </p> - - </div> - - <div class="section"> - - <h2>Create / and swap partitions, and mount</h2> - <p> - For the swapvol LV I use:<br/> - # <b>mkswap /dev/mapper/matrix-swapvol</b><br/> - Activate swap:<br/> - # <b>swapon /dev/matrix/swapvol</b> - </p> - <p> - For the root LV I use:<br/> - # <b>mkfs.btrfs /dev/mapper/matrix-root</b> - </p> - <p> - Mount the root (/) partition:<br/> - # <b>mount /dev/matrix/root /mnt</b> - </p> - - </div> - - <div class="section"> - - <h2>Continue with Parabola installation</h2> - <p> - This guide is really about GRUB, Parabola and cryptomount. I have to show how to install Parabola - so that the guide can continue. - </p> - <p> - Now I am following the rest of <a href="https://wiki.parabolagnulinux.org/Installation_Guide">https://wiki.parabolagnulinux.org/Installation_Guide</a>. - I also cross referenced <a href="https://wiki.archlinux.org/index.php/Installation_guide">https://wiki.archlinux.org/index.php/Installation_guide</a>. - </p> - <p> - Create /home and /boot on root mountpoint:<br/> - # <b>mkdir -p /mnt/home</b><br/> - # <b>mkdir -p /mnt/boot</b> - </p> - <p> - Once all the remaining partitions, if any, have been mounted, the devices are ready to install Parabola. - </p> - - <p> - In <b>/etc/pacman.d/mirrorlist</b>, comment out all lines except the Server line closest to where you are (I chose the UK Parabola - server (main server)) and then did:<br/> - # <b>pacman -Syy</b><br/> - # <b>pacman -Syu</b><br/> - # <b>pacman -Sy pacman</b> (and then I did the other 2 steps above, again)<br/> - In my case I did the steps in the next paragraph, and followed the steps in this paragraph again. - </p> - <p> - <troubleshooting><br/> - The following is based on 'Verification of package signatures' in the Parabola install guide.<br/> - Check there first to see if steps differ by now.<br/> - Now you have to update the default Parabola keyring. This is used for signing and verifying packages:<br/> - # <b>pacman -Sy parabola-keyring</b><br/> - It says that if you get GPG errors, then it's probably an expired key and, therefore, you should do:<br/> - # <b>pacman-key --populate parabola</b><br/> - # <b>pacman-key --refresh-keys</b><br/> - # <b>pacman -Sy parabola-keyring</b><br/> - To be honest, you should do the above anyway. Parabola has a lot of maintainers, and a lot of keys. Really!<br/> - If you get an error mentioning dirmngr, do:<br/> - # <b>dirmngr </dev/null</b><br/> - Also, it says that if the clock is set incorrectly then you have to manually set the correct time <br/> - (if keys are listed as expired because of it):<br/> - # <b>date MMDDhhmm[[CC]YY][.ss]</b><br/> - I also had to install:<br/> - # <b>pacman -S archlinux-keyring</b><br/> - # <b>pacman-key --populate archlinux</b><br/> - In my case I saw some conflicting files reported in pacman, stopping me from using it.<br/> - I deleted the files that it mentioned - and then it worked. Specifically, I had this error:<br/> - <i>licenses: /usr/share/licenses/common/MPS exists in filesystem</i><br/> - I rm -Rf'd the file and then pacman worked. I'm told that the following would have also made it work:<br/> - # <b>pacman -Sf licenses</b><br/> - </troubleshooting><br/> - </p> - <p> - I also like to install other packages (base-devel, compilers and so on) and wpa_supplicant/dialog/iw/wpa_actiond are needed for wireless after the install:<br/> - # <b>pacstrap /mnt base base-devel wpa_supplicant dialog iw wpa_actiond</b> - </p> - - </div> - - <div class="section"> - - <h2>Configure the system</h2> - <p> - Generate an fstab - UUIDs are used because they have certain advantages (see <a href="https://wiki.parabola.nu/Fstab#Identifying_filesystems">https://wiki.parabola.nu/Fstab#Identifying_filesystems</a>. - If you prefer labels instead, replace the -U option with -L):<br/> - # <b>genfstab -U -p /mnt >> /mnt/etc/fstab</b><br/> - Check the created file:<br/> - # <b>cat /mnt/etc/fstab</b><br/> - (If there are any errors, edit the file. Do <b>NOT</b> run the genfstab command again!) - </p> - <p> - Chroot into new system:<br/> - # <b>arch-chroot /mnt /bin/bash</b> - </p> - <p> - It's a good idea to have this installed:<br/> - # <b>pacman -S linux-libre-lts</b> - </p> - <p> - It was also suggested that you should install this kernel (read up on what GRSEC is):<br/> - # <b>pacman -S linux-libre-grsec</b> - </p> - <p> - This is another kernel that sits inside /boot, which you can use. LTS means 'long-term support'. These are so-called 'stable' kernels - that can be used as a fallback during updates, if a bad kernel causes issues for you. - </p> - <p> - Parabola does not have wget. This is sinister. Install it:<br/> - # <b>pacman -S wget</b> - </p> - <p> - Locale:<br/> - # <b>nano /etc/locale.gen</b><br/> - Uncomment your needed localisations. For example en_GB.UTF-8 (UTF-8 is highly recommended over other options).<br/> - # <b>locale-gen</b><br/> - # <b>echo LANG=en_GB.UTF-8 > /etc/locale.conf</b><br/> - # <b>export LANG=en_GB.UTF-8</b> - </p> - <p> - Console font and keymap:<br/> - # <b>nano /etc/vconsole.conf</b><br/> - In my case: - </p> -<pre> -KEYMAP=dvorak-uk -FONT=lat9w-16 -</pre> - <p> - Time zone:<br/> - # <b>ln -s /usr/share/zoneinfo/Europe/London /etc/localtime</b><br/> - (Replace Zone and Subzone to your liking. See /usr/share/zoneinfo) - </p> - <p> - Hardware clock:<br/> - # <b>hwclock --systohc --utc</b> - </p> - <p> - Hostname: - Write your hostname to /etc/hostname. For example, if your hostname is parabola:<br/> - # <b>echo parabola > /etc/hostname</b><br/> - Add the same hostname to /etc/hosts:<br/> - # <b>nano /etc/hosts</b><br/> - </p> -<pre> -#<ip-address> <hostname.domain.org> <hostname> -127.0.0.1 localhost.localdomain localhost parabola -::1 localhost.localdomain localhost parabola -</pre> - <p> Configure the network: - Refer to <a href="https://wiki.parabola.nu/Beginners%27_guide#Configure_the_network">https://wiki.parabola.nu/Beginners%27_guide#Configure_the_network</a>. - </p> - <p> Mkinitcpio: - Configure /etc/mkinitcpio.conf as needed (see <a href="https://wiki.parabola.nu/Mkinitcpio">https://wiki.parabola.nu/Mkinitcpio</a>). - Runtime modules can be found in /usr/lib/initcpio/hooks, and build hooks can be found in /usr/lib/initcpio/install. (# <b>mkinitcpio -H hookname</b> gives information about each hook.) - Specifically, for this use case:<br/> - # <b>nano /etc/mkinitcpio.conf</b><br/> - Then modify the file like so: - </p> - <ul> - <li>MODULES="i915"</li> - <li>This forces the driver to load earlier, so that the console font isn't wiped out after getting to login). Macbook21 users will also need <strong>hid-generic, hid and hid-apple to have a working keyboard when asked to enter the LUKS password.</strong></li> - <li>HOOKS="base udev autodetect modconf block keyboard keymap consolefont encrypt lvm2 filesystems fsck shutdown"</li> - <li>Explanation:</li> - <li>keymap adds to initramfs the keymap that you specified in /etc/vconsole.conf</li> - <li>consolefont adds to initramfs the font that you specified in /etc/vconsole.conf</li> - <li>encrypt adds LUKS support to the initramfs - needed to unlock your disks at boot time</li> - <li>lvm2 adds LVM support to the initramfs - needed to mount the LVM partitions at boot time</li> - <li>shutdown is needed according to Parabola wiki for unmounting devices (such as LUKS/LVM) during shutdown)</li> - </ul> - <p> - 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/> - # <b>mkinitcpio -p linux-libre</b><br/> - Also do it for linux-libre-lts:<br/> - # <b>mkinitcpio -p linux-libre-lts</b><br/> - Also do it for linux-libre-grsec:<br/> - # <b>mkinitcpio -p linux-libre-grsec</b> - </p> - <p> - Set the root password: - At the time of writing, Parabola used SHA512 by default for its password hashing. I referred to <a href="https://wiki.archlinux.org/index.php/SHA_password_hashes">https://wiki.archlinux.org/index.php/SHA_password_hashes</a>.<br/> - # <b>nano /etc/pam.d/passwd</b><br/> - Add rounds=65536 at the end of the uncommented 'password' line.<br/> - # <b>passwd root</b><br/> - Make sure to set a secure password! Also, it must never be the same as your LUKS password. - </p> - - <p> - Use of the <i>diceware method</i> is recommended, for generating secure passphrases (instead of passwords). - </p> - - </div> - - <div class="section"> - - <h2>Extra security tweaks</h2> - <p> - Based on <a href="https://wiki.archlinux.org/index.php/Security">https://wiki.archlinux.org/index.php/Security</a>. - </p> - <p> - Restrict access to important directories:<br/> - # <b>chmod 700 /boot /etc/{iptables,arptables}</b> - </p> - <p> - Lockout user after three failed login attempts:<br/> - Edit the file /etc/pam.d/system-login and comment out that line:<br/> - <i># auth required pam_tally.so onerr=succeed file=/var/log/faillog</i><br/> - Or just delete it. Above it, put:<br/> - <i>auth required pam_tally.so deny=2 unlock_time=600 onerr=succeed file=/var/log/faillog</i><br/> - To unlock a user manually (if a password attempt is failed 3 times), do:<br/> - # <b>pam_tally --user <i>theusername</i> --reset</b> - What the above configuration does is lock the user out for 10 minutes, if they make 3 failed login attempts. - </p> - <p> - Configure sudo - not covered here. Will be covered post-installation in another tutorial, at a later date. - If this is a single-user system, you don't really need sudo. - </p> - - </div> - - <div class="section"> - - <h2>Unmount, reboot!</h2> - <p> - Exit from chroot:<br/> - # <b>exit</b> - </p> - <p> - unmount:<br/> - # <b>umount -R /mnt</b><br/> - # <b>swapoff -a</b> - </p> - <p> - deactivate the lvm lv's:<br/> - # <b>lvchange -an /dev/matrix/root</b><br/> - # <b>lvchange -an /dev/matrix/swapvol</b><br/> - </p> - <p> - Lock the encrypted partition (close it):<br/> - # <b>cryptsetup luksClose lvm</b> - </p> - <p> - # <b>shutdown -h now</b><br/> - Remove the installation media, then boot up again. - </p> - - </div> - - <div class="section"> - - <h2>Booting from GRUB</h2> - <p> - Initially you will have to boot manually. Press C to get to the GRUB command line. The underlined parts are optional - (using those 2 underlines will boot lts kernel instead of normal). - </p> - <p> - grub> <b>cryptomount -a</b><br/> - grub> <b>set root='lvm/matrix-root'</b><br/> - grub> <b>linux /boot/vmlinuz-linux-libre<u>-lts</u> root=/dev/matrix/root cryptdevice=/dev/sda1:root</b><br/> - grub> <b>initrd /boot/initramfs-linux-libre<u>-lts</u>.img</b><br/> - grub> <b>boot</b><br/> - </p> - <p> - You could also make it load /boot/vmlinuz-linux-libre-grsec and /boot/initramfs-linux-libre-grsec.img - </p> - - </div> - - <div class="section"> - - <h2>Follow-up tutorial: configuring Parabola</h2> - <p> - We will modify grub.config inside the ROM and do all kinds of fun stuff, but I recommend that you first transform the current bare-bones Parabola install into a more useable system. - Doing so will make the upcoming ROM modifications MUCH easier to perform and less risky! - <a href="configuring_parabola.html">configuring_parabola.html</a> shows my own notes post-installation. Using these, you can get a basic - system similar to the one that I chose for myself. You can also cherry pick useful notes and come up with your own system. - 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> - (Parabola also follows it). - </p> - - </div> - - <div class="section"> - - <h2>Modify grub.cfg inside the ROM</h2> - - <p> - (Re-)log in to your system, pressing C, so booting manually from GRUB (see above). You need to modify the ROM, so that Parabola can boot automatically with this configuration. - <a href="grub_cbfs.html">grub_cbfs.html</a> shows you how. Follow that guide, using the configuration details below. - If you go for option 2 (re-flash), promise to do this on grubtest.cfg first! We can't emphasise this enough. This is to reduce the possibility of bricking your device! - </p> - - <p> - I will go for the re-flash option here. Firstly, cd to the libreboot_util/cbfstool/{armv7l i686 x86_64} directory. - Dump the current firmware - where <i>libreboot.rom</i> is an example: make sure to adapt:<br/> - # <b>flashrom -p internal -r libreboot.rom</b><br/> - If flashrom complains about multiple flash chips detected, add a <i>-c</i> option at the end, with the name of your chosen chip is quotes.<br/> - You can check if everything is in there (<i>grub.cfg</i> and <i>grubtest.cfg</i> would be really nice):<br/> - $ <b>./cbfstool libreboot.rom print</b><br/> - Extract grubtest.cfg:<br/> - $ <b>./cbfstool libreboot.rom extract -n grubtest.cfg -f grubtest.cfg</b><br/> - And modify:<br/> - $ <b>nano grubtest.cfg</b> - </p> - - <p> - In grubtest.cfg, inside the 'Load Operating System' menu entry, change the contents to: - </p> -<pre> -cryptomount -a<br/> -set root='lvm/matrix-root'<br/> -linux /boot/vmlinuz-linux-libre<u>-lts</u> root=/dev/matrix/root cryptdevice=/dev/sda1:root<br/> -initrd /boot/initramfs-linux-libre<u>-lts</u>.img -</pre> - - <p> - Note: the underlined parts above (-lts) can also be removed, to boot the latest kernel instead of LTS (long-term support) kernels. - You could also copy the menu entry and in one have -lts, and without in the other menuentry. - You could also create a menu entry to load /boot/vmlinuz-linux-libre-grsec and /boot/initramfs-linux-libre-grsec.img - The first entry will load by default. - </p> - - <p> - Without specifying a device, the <i>-a</i> parameter tries to unlock all detected LUKS volumes. - You can also specify -u UUID or -a (device). - </p> - - <p> - Now, to protect your system from an attacker simply booting a live usb distro and re-flashing the boot firmware, we are going to add a password for GRUB. - In a new terminal window, if you are not yet online, start dhcp on ethernet:<br/> - # <b>systemctl start dhcpcd.service</b> - Or make sure to get connected to the internet in any other way you prefer, at least. - </p> - - <p> - Use of the <i>diceware method</i> is recommended, for generating secure passphrases (instead of passwords). - </p> - - <p style="font-size:2em;"> - AGAIN: MAKE SURE TO DO THIS WHOLE SECTION ON grubtest.cfg *BEFORE* DOING IT ON grub.cfg. - (When we get there, upon reboot, select the menu entry that says <i>Switch to grubtest.cfg</i> and test that it works. - Only once you are satisfied, copy that to grub.cfg. Only a few steps to go, though.) - WHY? BECAUSE AN INCORRECTLY SET PASSWORD CONFIG MEANS YOU CAN'T AUTHENTICATE, WHICH MEANS 'BRICK'. - </p> - - <p> - (emphasis added, because it's needed: this is a common roadblock for users.) - </p> - - <p> - We need a utility that comes with GRUB, so we will download it temporarily. (Remember that GRUB isn't needed for booting, since it's already included as a payload in libreboot.) - Also, we will use flashrom, and I installed dmidecode. You 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/> - # <b>pacman -S grub flashrom dmidecode base-devel</b><br/> - Next, do:<br/> - # <b>grub-mkpasswd-pbkdf2</b><br/> - Enter your chosen password at the prompt and your hash will be shown. Copy this string - you will add it to your grubtest.cfg. - </p> - - <p> - The password below (it's <b>password</b>, by the way) after <i>'password_pbkdf2 root'</i> <i>should be changed</i> to your own. - Make sure to specify a password that is different from both your LUKS *and* your root/user password. - Obviously, do not simply copy and paste the examples shown here... - </p> - - <p> - Next, back in grubtest.cfg, above the first 'Load Operating System' menu entry, you should now add your GRUB password, like so - (replace with your own name (I used <b>root</b> on both lines, feel free to choose another one) and the password hash which you copied): - </p> -<pre> -set superusers="root" -password_pbkdf2 root grub.pbkdf2.sha512.10000.711F186347156BC105CD83A2ED7AF1EB971AA2B1EB2640172F34B0DEFFC97E654AF48E5F0C3B7622502B76458DA494270CC0EA6504411D676E6752FD1651E749.8DD11178EB8D1F633308FD8FCC64D0B243F949B9B99CCEADE2ECA11657A757D22025986B0FA116F1D5191E0A22677674C994EDBFADE62240E9D161688266A711 -</pre> - - <p> - Save your changes in grubtest.cfg, then delete the unmodified config from the ROM image:<br/> - $ <b>./cbfstool libreboot.rom remove -n grubtest.cfg</b><br/> - and insert the modified grubtest.cfg:<br/> - $ <b>./cbfstool libreboot.rom add -n grubtest.cfg -f grubtest.cfg -t raw</b><br/> - </p> - - <p> - Now refer to <a href="http://libreboot.org/docs/install/index.html#flashrom">http://libreboot.org/docs/install/index.html#flashrom</a>. - Cd (up) to the libreboot_util directory and update the flash chip contents:<br/> - # <b>./flash update libreboot.rom</b><br/> - Ocassionally, coreboot changes the name of a given board. If flashrom complains about a board mismatch, but you are sure that you chose the correct ROM image, then run this alternative command:<br/> - # <b>./flash forceupdate libreboot.rom</b><br/> - You should see "Verifying flash... VERIFIED." written at the end of the flashrom output. - </p> - - <p> - With this new configuration, Parabola can boot automatically and 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. - Let's test it out: reboot and choose grubtest.cfg from the GRUB menu, using the arrow keys on your keyboard. - Enter the name you chose, the GRUB password, your LUKS passphrase and login as root/your user. All went well? Great! - </p> - - <p> - If it does not work like you want it to, if you are unsure or sceptical in any way, don't despair: you have been wise and did not brick your device! Reboot and login the default way, and then modify - your grubtest.cfg until you get it right! - <b>Do *not* proceed past this point unless you are 100% sure that your new configuration is safe (or desirable) to use.</b> - </p> - - <p> - Now, we can easily and safely create a copy of grubtest.cfg, called grub.cfg. This will be the same except for one difference: the menuentry 'Switch to grub.cfg' is changed to 'Switch to grubtest.cfg' - and, inside it, all instances of grub.cfg to grubtest.cfg. This is so that the main config still links (in the menu) to grubtest.cfg, so that you don't have to manually switch to it, in case you ever - want to follow this guide again in the future (modifying the already modified config). - Inside libreboot_util/cbfstool/{armv7l i686 x86_64}, we can do this with the following command:<br/> - $ <b>sed -e 's:(cbfsdisk)/grub.cfg:(cbfsdisk)/grubtest.cfg:g' -e 's:Switch to grub.cfg:Switch to grubtest.cfg:g' < grubtest.cfg > grub.cfg</b><br/> - Delete the grub.cfg that remained inside the ROM:<br/> - $ <b>./cbfstool libreboot.rom remove -n grub.cfg</b><br/> - Add the modified version that you just made:<br/> - $ <b>./cbfstool libreboot.rom add -n grub.cfg -f grub.cfg -t raw</b><br/> - </p> - - <p> - Now you have a modified ROM. Once more, refer to <a href="http://libreboot.org/docs/install/index.html#flashrom">http://libreboot.org/docs/install/index.html#flashrom</a>. - Cd to the libreboot_util directory and update the flash chip contents:<br/> - # <b>./flash update libreboot.rom</b><br/> - And wait for the "Verifying flash... VERIFIED." Once you have done that, shut down and then boot up with your new configuration. - </p> - - <p> - When done, delete GRUB (remember, we only needed it for the <i>grub-mkpasswd-pbkdf2</i> utility; - GRUB is already part of libreboot, flashed alongside it as a <i>payload</i>):<br/> - # <b>pacman -R grub</b> - </p> - - </div> - - <div class="section"> - - <p> - If you followed all that correctly, you should now have a fully encrypted Parabola installation. - Refer to the wiki for how to do the rest. - </p> - - </div> - - <div class="section"> - <h2>Bonus: Using a key file to unlock /boot/</h2> - <p> - By default, you will have to enter your LUKS passphrase twice; once in GRUB, and once when booting the kernel. - GRUB unlocks the encrypted partition and then loads the kernel, but the kernel is not aware of the fact - that it is being loaded from an encrypted volume. Therefore, you will be asked to enter your passphrase a second time. - A workaround is to put a keyfile inside initramfs, with instructions for the kernel to use it when - booting. This is safe, because /boot/ is encrypted (otherwise, putting a keyfile inside initramfs would be a bad idea).<br/> - - Boot up and login as root or your user. Then generate the key file:<br/> - # <b>dd bs=512 count=4 if=/dev/urandom of=/etc/mykeyfile iflag=fullblock</b><br/> - Insert it into the luks volume:<br/> - # <b>cryptsetup luksAddKey /dev/sdX /etc/mykeyfile</b><br/> - and enter your LUKS passphrase when prompted. - Add the keyfile to the initramfs by adding it to FILES in /etc/mkinitcpio.conf. For example:<br/> - # <b>FILES="/etc/mykeyfile"</b><br/> - Create the initramfs image from scratch:<br/> - # <b>mkinitcpio -p linux-libre</b><br/> - # <b>mkinitcpio -p linux-libre-lts</b><br/> - # <b>mkinitcpio -p linux-libre-grsec</b><br/> - Add the following to your grub.cfg - you are now able to do that, see above! -, or add it in the kernel command line for GRUB:<br/> - # <b>cryptkey=rootfs:/etc/mykeyfile</b><br/> - <br/> - You can also place this inside the grub.cfg that exists in CBFS: <a href="grub_cbfs.html">grub_cbfs.html</a>. - </p> - - </div> - - <div class="section"> - - <h2>Further security tips</h2> - <p> - <a href="https://wiki.archlinux.org/index.php/Security">https://wiki.archlinux.org/index.php/Security</a>.<br/> - <a href="https://wiki.parabolagnulinux.org/User:GNUtoo/laptop">https://wiki.parabolagnulinux.org/User:GNUtoo/laptop</a> - </p> - - </div> - - <div class="section"> - - <h1 id="troubleshooting">Troubleshooting</h1> - - <p> - A user reported issues when booting with a docking station attached - on an X200, when decrypting the disk in GRUB. The error - <i>AHCI transfer timed out</i> was observed. The workaround - was to remove the docking station. - </p> - - <p> - Further investigation revealed that it was the DVD drive causing problems. - Removing that worked around the issue. - </p> - -<pre> - -"sudo wodim -prcap" shows information about the drive: -Device was not specified. Trying to find an appropriate drive... -Detected CD-R drive: /dev/sr0 -Using /dev/cdrom of unknown capabilities -Device type : Removable CD-ROM -Version : 5 -Response Format: 2 -Capabilities : -Vendor_info : 'HL-DT-ST' -Identification : 'DVDRAM GU10N ' -Revision : 'MX05' -Device seems to be: Generic mmc2 DVD-R/DVD-RW. - -Drive capabilities, per MMC-3 page 2A: - - Does read CD-R media - Does write CD-R media - Does read CD-RW media - Does write CD-RW media - Does read DVD-ROM media - Does read DVD-R media - Does write DVD-R media - Does read DVD-RAM media - Does write DVD-RAM media - Does support test writing - - Does read Mode 2 Form 1 blocks - Does read Mode 2 Form 2 blocks - Does read digital audio blocks - Does restart non-streamed digital audio reads accurately - Does support Buffer-Underrun-Free recording - Does read multi-session CDs - Does read fixed-packet CD media using Method 2 - Does not read CD bar code - Does not read R-W subcode information - Does read raw P-W subcode data from lead in - Does return CD media catalog number - Does return CD ISRC information - Does support C2 error pointers - Does not deliver composite A/V data - - Does play audio CDs - Number of volume control levels: 256 - Does support individual volume control setting for each channel - Does support independent mute setting for each channel - Does not support digital output on port 1 - Does not support digital output on port 2 - - Loading mechanism type: tray - Does support ejection of CD via START/STOP command - Does not lock media on power up via prevent jumper - Does allow media to be locked in the drive via PREVENT/ALLOW command - Is not currently in a media-locked state - Does not support changing side of disk - Does not have load-empty-slot-in-changer feature - Does not support Individual Disk Present feature - - Maximum read speed: 4234 kB/s (CD 24x, DVD 3x) - Current read speed: 4234 kB/s (CD 24x, DVD 3x) - Maximum write speed: 4234 kB/s (CD 24x, DVD 3x) - Current write speed: 4234 kB/s (CD 24x, DVD 3x) - Rotational control selected: CLV/PCAV - Buffer size in KB: 1024 - Copy management revision supported: 1 - Number of supported write speeds: 4 - Write speed # 0: 4234 kB/s CLV/PCAV (CD 24x, DVD 3x) - Write speed # 1: 2822 kB/s CLV/PCAV (CD 16x, DVD 2x) - Write speed # 2: 1764 kB/s CLV/PCAV (CD 10x, DVD 1x) - Write speed # 3: 706 kB/s CLV/PCAV (CD 4x, DVD 0x) - -Supported CD-RW media types according to MMC-4 feature 0x37: - Does write multi speed CD-RW media - Does write high speed CD-RW media - Does write ultra high speed CD-RW media - Does not write ultra high speed+ CD-RW media - -</pre> - - </div> - - <div class="section"> - - <p> - Copyright © 2014, 2015, 2016 Leah Rowe <info@minifree.org><br/> - Copyright © 2015 Jeroen Quint <jezza@diplomail.ch><br/> - Permission is granted to copy, distribute and/or modify this document - under the terms of the Creative Commons Attribution-ShareAlike 4.0 International license - or any later version published by Creative Commons; - - A copy of the license can be found at <a href="../cc-by-sa-4.0.txt">../cc-by-sa-4.0.txt</a> - </p> - - <p> - Updated versions of the license (when available) can be found at - <a href="https://creativecommons.org/licenses/by-sa/4.0/legalcode">https://creativecommons.org/licenses/by-sa/4.0/legalcode</a> - </p> - - <p> - UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE - EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS - AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF - ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, - IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, - WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, - ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT - KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT - ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. - </p> - <p> - TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE - TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, - NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, - INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, - COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR - USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN - ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR - DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR - IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. - </p> - <p> - The disclaimer of warranties and limitation of liability provided - above shall be interpreted in a manner that, to the extent - possible, most closely approximates an absolute disclaimer and - waiver of all liability. - </p> - - </div> - -</body> -</html> |