diff options
author | Alyssa Rosenzweig <alyssa@rosenzweig.io> | 2017-04-03 09:54:31 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <alyssa@rosenzweig.io> | 2017-04-03 09:54:31 -0700 |
commit | a19ff95539b0f9df2a59abef64f0decf999103f2 (patch) | |
tree | 0e591af379687513a0850167b316618781349948 /docs/gnulinux/encrypted_parabola.md | |
parent | a23830654fa620d3982d851c9f8f0f99d282575d (diff) | |
download | librebootfr-a19ff95539b0f9df2a59abef64f0decf999103f2.tar.gz librebootfr-a19ff95539b0f9df2a59abef64f0decf999103f2.zip |
Fix another class of code block bugs
Diffstat (limited to 'docs/gnulinux/encrypted_parabola.md')
-rw-r--r-- | docs/gnulinux/encrypted_parabola.md | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/docs/gnulinux/encrypted_parabola.md b/docs/gnulinux/encrypted_parabola.md index f17fa10e..2771bf34 100644 --- a/docs/gnulinux/encrypted_parabola.md +++ b/docs/gnulinux/encrypted_parabola.md @@ -83,7 +83,7 @@ header. 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:\ -\# **head -c 3145728 /dev/urandom > /dev/sda; sync**\ + # head -c 3145728 /dev/urandom > /dev/sda; sync (Wiping the LUKS header is important, since it has hashed passphrases and so on. It's 'secure', but 'potentially' a risk). @@ -94,8 +94,8 @@ Change keyboard layout Parabola live shell assumes US Qwerty. If you have something different, list the available keymaps and use yours:\ -\# **localectl list-keymaps**\ -\# **loadkeys LAYOUT**\ + # localectl list-keymaps + # loadkeys LAYOUT For me, LAYOUT would have been dvorak-uk. @@ -123,7 +123,7 @@ dm-mod device-mapper will be used - a lot. Make sure that the kernel module is loaded:\ -\# **modprobe dm-mod** + # modprobe dm-mod Create LUKS partition --------------------- @@ -137,7 +137,7 @@ security purposes (mitigates brute force attacks), so anything lower than 5 seconds is probably not ok. I am using MBR partitioning, so I use cfdisk:\ -\# **cfdisk /dev/sda** + # cfdisk /dev/sda I create a single large sda1 filling the whole drive, leaving it as the default type 'Linux' (83). @@ -150,15 +150,15 @@ I am then directed to Parabola forces you to RTFM. Do that. It tells me to run:\ -\# **cryptsetup benchmark** (for making sure the list below is + # cryptsetup benchmark (for making sure the list below is populated)\ Then:\ -\# **cat /proc/crypto**\ + # cat /proc/crypto 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:\ -\# **man cryptsetup** + # man cryptsetup Following that page, based on my requirements, I do the following based on @@ -185,29 +185,29 @@ Create LVM Now I refer to <https://wiki.archlinux.org/index.php/LVM>. Open the LUKS partition:\ -\# **cryptsetup luksOpen /dev/sda1 lvm**\ + # cryptsetup luksOpen /dev/sda1 lvm (it will be available at /dev/mapper/lvm) Create LVM partition:\ -\# **pvcreate /dev/mapper/lvm**\ + # pvcreate /dev/mapper/lvm Show that you just created it:\ -\# **pvdisplay** + # pvdisplay Now I create the volume group, inside of which the logical volumes will be created:\ -\# **vgcreate matrix /dev/mapper/lvm**\ + # vgcreate matrix /dev/mapper/lvm (volume group name is 'matrix' - choose your own name, if you like) Show that you created it:\ -\# **vgdisplay** + # vgdisplay Now create the logical volumes:\ -\# **lvcreate -L 2G matrix -n swapvol** (2G swap partition, named + # lvcreate -L 2G matrix -n swapvol (2G swap partition, named swapvol)\ 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 <http://www.linux.com/news/software/applications/8208-all-about-linux-swap-space>.\ -\# **lvcreate -l +100%FREE matrix -n root** (single large partition in + # lvcreate -l +100%FREE matrix -n root (single large partition in the rest of the space, named root)\ 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 @@ -217,7 +217,7 @@ system (typical use case), a root and a swap will do (really). Verify that the logical volumes were created, using the following command:\ -\# **lvdisplay** + # lvdisplay @@ -225,15 +225,15 @@ Create / and swap partitions, and mount --------------------------------------- For the swapvol LV I use:\ -\# **mkswap /dev/mapper/matrix-swapvol**\ + # mkswap /dev/mapper/matrix-swapvol Activate swap:\ -\# **swapon /dev/matrix/swapvol** + # swapon /dev/matrix/swapvol For the root LV I use:\ -\# **mkfs.btrfs /dev/mapper/matrix-root** + # mkfs.btrfs /dev/mapper/matrix-root Mount the root (/) partition:\ -\# **mount /dev/matrix/root /mnt** + # mount /dev/matrix/root /mnt @@ -248,8 +248,8 @@ Now I am following the rest of referenced <https://wiki.archlinux.org/index.php/Installation_guide>. Create /home and /boot on root mountpoint:\ -\# **mkdir -p /mnt/home**\ -\# **mkdir -p /mnt/boot** + # mkdir -p /mnt/home + # mkdir -p /mnt/boot Once all the remaining partitions, if any, have been mounted, the devices are ready to install Parabola. @@ -257,9 +257,9 @@ devices are ready to install Parabola. In **/etc/pacman.d/mirrorlist**, comment out all lines except the Server line closest to where you are (I chose the UK Parabola server (main server)) and then did:\ -\# **pacman -Syy**\ -\# **pacman -Syu**\ -\# **pacman -Sy pacman** (and then I did the other 2 steps above, + # pacman -Syy + # pacman -Syu + # pacman -Sy pacman (and then I did the other 2 steps above, again)\ In my case I did the steps in the next paragraph, and followed the steps in this paragraph again. @@ -311,21 +311,21 @@ Configure the system Generate an fstab - UUIDs are used because they have certain advantages (see <https://wiki.parabola.nu/Fstab#Identifying_filesystems>. If you prefer labels instead, replace the -U option with -L):\ -\# **genfstab -U -p /mnt >> /mnt/etc/fstab**\ + # genfstab -U -p /mnt >> /mnt/etc/fstab Check the created file:\ -\# **cat /mnt/etc/fstab**\ + # cat /mnt/etc/fstab (If there are any errors, edit the file. Do **NOT** run the genfstab command again!) Chroot into new system:\ -\# **arch-chroot /mnt /bin/bash** + # arch-chroot /mnt /bin/bash It's a good idea to have this installed:\ -\# **pacman -S linux-libre-lts** + # pacman -S linux-libre-lts It was also suggested that you should install this kernel (read up on what GRSEC is):\ -\# **pacman -S linux-libre-grsec** + # pacman -S linux-libre-grsec This is another kernel that sits inside /boot, which you can use. LTS means 'long-term support'. These are so-called 'stable' kernels that @@ -333,35 +333,35 @@ can be used as a fallback during updates, if a bad kernel causes issues for you. Parabola does not have wget. This is sinister. Install it:\ -\# **pacman -S wget** + # pacman -S wget Locale:\ -\# **vi /etc/locale.gen**\ + # vi /etc/locale.gen Uncomment your needed localisations. For example en\_GB.UTF-8 (UTF-8 is highly recommended over other options).\ -\# **locale-gen**\ -\# **echo LANG=en\_GB.UTF-8 > /etc/locale.conf**\ -\# **export LANG=en\_GB.UTF-8** + # locale-gen + # echo LANG=en\_GB.UTF-8 > /etc/locale.conf + # export LANG=en\_GB.UTF-8 Console font and keymap:\ -\# **vi /etc/vconsole.conf**\ + # vi /etc/vconsole.conf In my case: KEYMAP=dvorak-uk FONT=lat9w-16 Time zone:\ -\# **ln -s /usr/share/zoneinfo/Europe/London /etc/localtime**\ + # ln -s /usr/share/zoneinfo/Europe/London /etc/localtime (Replace Zone and Subzone to your liking. See /usr/share/zoneinfo) Hardware clock:\ -\# **hwclock --systohc --utc** + # hwclock --systohc --utc Hostname: Write your hostname to /etc/hostname. For example, if your hostname is parabola:\ -\# **echo parabola > /etc/hostname**\ + # echo parabola > /etc/hostname Add the same hostname to /etc/hosts:\ -\# **vi /etc/hosts**\ + # vi /etc/hosts #<ip-address> <hostname.domain.org> <hostname> 127.0.0.1 localhost.localdomain localhost parabola @@ -375,7 +375,7 @@ Mkinitcpio: Configure /etc/mkinitcpio.conf as needed (see /usr/lib/initcpio/hooks, and build hooks can be found in /usr/lib/initcpio/install. (\# **mkinitcpio -H hookname** gives information about each hook.) Specifically, for this use case:\ -\# **vi /etc/mkinitcpio.conf**\ + # vi /etc/mkinitcpio.conf Then modify the file like so: - MODULES="i915" @@ -400,18 +400,18 @@ Then modify the file like so: Now using mkinitcpio, you can create the kernel and ramdisk for booting with (this is different from Arch, specifying linux-libre instead of linux):\ -\# **mkinitcpio -p linux-libre**\ + # mkinitcpio -p linux-libre Also do it for linux-libre-lts:\ -\# **mkinitcpio -p linux-libre-lts**\ + # mkinitcpio -p linux-libre-lts Also do it for linux-libre-grsec:\ -\# **mkinitcpio -p linux-libre-grsec** + # mkinitcpio -p linux-libre-grsec Set the root password: At the time of writing, Parabola used SHA512 by default for its password hashing. I referred to <https://wiki.archlinux.org/index.php/SHA_password_hashes>.\ -\# **vi /etc/pam.d/passwd**\ + # vi /etc/pam.d/passwd Add rounds=65536 at the end of the uncommented 'password' line.\ -\# **passwd root**\ + # passwd root Make sure to set a secure password! Also, it must never be the same as your LUKS password. @@ -426,7 +426,7 @@ Extra security tweaks Based on <https://wiki.archlinux.org/index.php/Security>. Restrict access to important directories:\ -\# **chmod 700 /boot /etc/{iptables,arptables}** + # chmod 700 /boot /etc/{iptables,arptables} Lockout user after three failed login attempts:\ Edit the file /etc/pam.d/system-login and comment out that line:\ @@ -436,7 +436,7 @@ Or just delete it. Above it, put:\ file=/var/log/faillog*\ To unlock a user manually (if a password attempt is failed 3 times), do:\ -\# **pam\_tally --user *theusername* --reset** What the above + # pam\_tally --user *theusername* --reset What the above configuration does is lock the user out for 10 minutes, if they make 3 failed login attempts. @@ -450,20 +450,20 @@ Unmount, reboot! ---------------- Exit from chroot:\ -\# **exit** + # exit unmount:\ -\# **umount -R /mnt**\ -\# **swapoff -a** + # umount -R /mnt + # swapoff -a deactivate the lvm lv's:\ -\# **lvchange -an /dev/matrix/root**\ -\# **lvchange -an /dev/matrix/swapvol**\ + # lvchange -an /dev/matrix/root + # lvchange -an /dev/matrix/swapvol Lock the encrypted partition (close it):\ -\# **cryptsetup luksClose lvm** + # cryptsetup luksClose lvm -\# **shutdown -h now**\ + # shutdown -h now Remove the installation media, then boot up again. @@ -519,7 +519,7 @@ 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 *libreboot.rom* is an example: make sure to adapt:\ -\# **flashrom -p internal -r libreboot.rom**\ + # flashrom -p internal -r libreboot.rom If flashrom complains about multiple flash chips detected, add a *-c* option at the end, with the name of your chosen chip is quotes.\ You can check if everything is in there (*grub.cfg* and *grubtest.cfg* @@ -528,7 +528,7 @@ would be really nice): Extract grubtest.cfg: $ ./cbfstool libreboot.rom extract -n grubtest.cfg -f grubtest.cfg\ And modify:\ -\$ **vi grubtest.cfg** + $ vi grubtest.cfg In grubtest.cfg, inside the 'Load Operating System' menu entry, change the contents to: @@ -557,18 +557,18 @@ hardening your GRUB configuration, for security purposes. Save your changes in grubtest.cfg, then delete the unmodified config from the ROM image:\ -\$ **./cbfstool libreboot.rom remove -n grubtest.cfg**\ + $ ./cbfstool libreboot.rom remove -n grubtest.cfg and insert the modified grubtest.cfg:\ \$ **./cbfstool libreboot.rom add -n grubtest.cfg -f grubtest.cfg -t raw**\ Now refer to <http://libreboot.org/docs/install/#flashrom>. Cd (up) to the libreboot\_util directory and update the flash chip contents:\ -\# **./flash update libreboot.rom**\ + # ./flash update libreboot.rom 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:\ -\# **./flash forceupdate libreboot.rom**\ + # ./flash forceupdate libreboot.rom You should see "Verifying flash\... VERIFIED." written at the end of the flashrom output. @@ -599,21 +599,21 @@ with the following command:\ 's:Switch to grub.cfg:Switch to grubtest.cfg:g' < grubtest.cfg > grub.cfg**\ Delete the grub.cfg that remained inside the ROM:\ -\$ **./cbfstool libreboot.rom remove -n grub.cfg**\ + $ ./cbfstool libreboot.rom remove -n grub.cfg Add the modified version that you just made:\ -\$ **./cbfstool libreboot.rom add -n grub.cfg -f grub.cfg -t raw**\ + $ ./cbfstool libreboot.rom add -n grub.cfg -f grub.cfg -t raw Now you have a modified ROM. Once more, refer to <http://libreboot.org/docs/install/#flashrom>. Cd to the libreboot\_util directory and update the flash chip contents:\ -\# **./flash update libreboot.rom**\ + # ./flash update libreboot.rom And wait for the "Verifying flash\... VERIFIED." Once you have done that, shut down and then boot up with your new configuration. When done, delete GRUB (remember, we only needed it for the *grub-mkpasswd-pbkdf2* utility; GRUB is already part of libreboot, flashed alongside it as a *payload*):\ -\# **pacman -R grub** + # pacman -R grub @@ -638,17 +638,17 @@ Boot up and login as root or your user. Then generate the key file:\ \# **dd bs=512 count=4 if=/dev/urandom of=/etc/mykeyfile iflag=fullblock**\ Insert it into the luks volume:\ -\# **cryptsetup luksAddKey /dev/sdX /etc/mykeyfile**\ + # cryptsetup luksAddKey /dev/sdX /etc/mykeyfile and enter your LUKS passphrase when prompted. Add the keyfile to the initramfs by adding it to FILES in /etc/mkinitcpio.conf. For example:\ -\# **FILES="/etc/mykeyfile"**\ + # FILES="/etc/mykeyfile" Create the initramfs image from scratch:\ -\# **mkinitcpio -p linux-libre**\ -\# **mkinitcpio -p linux-libre-lts**\ -\# **mkinitcpio -p linux-libre-grsec**\ + # mkinitcpio -p linux-libre + # mkinitcpio -p linux-libre-lts + # mkinitcpio -p linux-libre-grsec 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:\ -\# **cryptkey=rootfs:/etc/mykeyfile**\ + # cryptkey=rootfs:/etc/mykeyfile \ You can also place this inside the grub.cfg that exists in CBFS: [grub\_cbfs.html](grub_cbfs.html). |