diff --git a/homepage/knowledge/cryptography.html b/homepage/knowledge/cryptography.html index 2384a84..1e35964 100644 --- a/homepage/knowledge/cryptography.html +++ b/homepage/knowledge/cryptography.html @@ -16,11 +16,37 @@
This information is not authoritative, nor from a place of deep knowledge.
+
+To format a partition for LUKS, use lsblk
to determine the physical block device location for that partition and run cryptsetup luksFormat [partition]
.
+The passphrase used can be changed or removed after creation.
+
+To open a LUKS partition, use cryptsetup luksOpen [partition] [name]
.
+This name is the name the decrypted block device location will take in /dev/mapper/
.
+Before the decrypted block device has a filesystem it'll just be cleared space - use mkfs.[filesystem] /dev/mapper/[name]
.
+
+To mount an opened LUKS partition, use mount(8)
as normal, just with the decrypted block device location.
+
+To close an open LUKS partition, umount(8)
it if it's open and cryptsetup luksClose [name]
.
+
+To make the LUKS partition openable via keyfile, first make a keyfile (dd if=/dev/urandom of=/root/keyfile bs=1024 count=4
seems to work), and optionally make it readable by root only (chmod 0400 [keyfile]
).
+Then add the keyfile to the partition's LUKS header with cryptsetup luksAddKey [physical partition block device] [keyfile]
.
+
I bought a SAMSUNG EVO Select 128GB New Generation card (apologies for the Amazon link, it isn't an associate link though), wiped it, and put one partition on it that spanned the whole drive. +See cryptography#LUKS partitioning for how to make a LUKS partition.
-To format a partition for LUKS, use lsblk
to determine the block device location for that partition and run cryptsetup luksFormat [partition]
.
-The passphrase used can be changed or removed after creation.
-
-To open a LUKS partition, use cryptsetup luksOpen [partition] [name]
.
-This name is the name the decrypted block device location will take in /dev/mapper/
.
-Before the decrypted block device has a filesystem it'll just be cleared space.
-Use mkfs.ext4 /dev/mapper/[name]
to create an ext4 filesystem on the decrypted volume.
-
-To mount an opened LUKS partition, use mount(8)
as normal, just with the block device location /dev/mapper/[name]
.
-
-To close an open LUKS partition, umount(8)
it if it's open and cryptsetup luksClose [name]
.
-
-To make the LUKS partition openable via keyfile, first make a keyfile (dd if=/dev/urandom of=/root/keyfile bs=1024 count=4
seems to work), and optionally make it readable by root only (chmod 0400 [keyfile]
).
-Then add the keyfile to the partition's LUKS header with cryptsetup luksAddKey [physical partition block device] [keyfile]
.
-Physical partition block device refers to the same partition openable with cryptsetup luksOpen
, but is called such here to disambiguate from the decrypted block device (at /dev/mapper/
).
-
-To have the SD card auto-mount at boot, add an fstab(5)
line for the decrypted block device.
-In blkid(8)
's output, this will be the line that starts with /dev/mapper/[name]
.
+To have the SD card auto-mount at boot, add an fstab(5)
line for the decrypted block device.
+The localmount
OpenRC service will also have to be enabled for the system to read fstab(5)
- rc-update add localmount
.
Then, rc-update add dmcrypt boot
and add an entry in /etc/conf.d/dmcrypt
to automatically luksOpen the volume.
dm-crypt
will need the UUID of the physical block device; in blkid(8)
this will be the line that starts with /dev/mmcblk
or /dev/sd[X]
.
-The localmount
OpenRC service will also have to be enabled for the system to read fstab(5)
.
-