Blame 0002-crypt-gpg-Add-README-describing-the-procedure-of-mov.patch

Harald Hoyer 3763a8
From 98047e08d02b91f632ec8554fc02af05069216dd Mon Sep 17 00:00:00 2001
Harald Hoyer 3763a8
From: Moritz Maxeiner <moritz@ucworks.org>
Harald Hoyer 3763a8
Date: Mon, 13 Jul 2015 17:53:29 +0200
Harald Hoyer 3763a8
Subject: [PATCH] crypt-gpg: Add README describing the procedure of moving from
Harald Hoyer 3763a8
            password-only gpg keyfile to password/smartcard gpg keyfile
Harald Hoyer 3763a8
Harald Hoyer 3763a8
---
Harald Hoyer 3763a8
 modules.d/91crypt-gpg/README | 50 ++++++++++++++++++++++++++++++++++++++++++++
Harald Hoyer 3763a8
 1 file changed, 50 insertions(+)
Harald Hoyer 3763a8
 create mode 100644 modules.d/91crypt-gpg/README
Harald Hoyer 3763a8
Harald Hoyer 3763a8
diff --git a/modules.d/91crypt-gpg/README b/modules.d/91crypt-gpg/README
Harald Hoyer 3763a8
new file mode 100644
Harald Hoyer 3763a8
index 00000000..be6df55a
Harald Hoyer 3763a8
--- /dev/null
Harald Hoyer 3763a8
+++ b/modules.d/91crypt-gpg/README
Harald Hoyer 3763a8
@@ -0,0 +1,50 @@
Harald Hoyer 3763a8
+# Directions for changing a system from password-based gpg keyfile
Harald Hoyer 3763a8
+# to smartcard-based gpg keyfile
Harald Hoyer 3763a8
+
Harald Hoyer 3763a8
+# Be sure that you meet the following requirements:
Harald Hoyer 3763a8
+#  1. GnuPG >= 2.1 installed with
Harald Hoyer 3763a8
+#     * Smartcard support enabled (scdaemon must be built)
Harald Hoyer 3763a8
+#     * Direct CCID access built into scdaemon
Harald Hoyer 3763a8
+#  2. A password-based gpg keyfile ${KEYFILE} (e.g. "keyfile.gpg"):
Harald Hoyer 3763a8
+#     That is, a file containing the slot key for LUKS, which
Harald Hoyer 3763a8
+#     has been encrypted symmetrically with GnuPG using
Harald Hoyer 3763a8
+#     a password.
Harald Hoyer 3763a8
+#  3. Your public OpenPGP identity ${RECIPIENT} (e.g. "3A696356")
Harald Hoyer 3763a8
+#  4. An OpenPGP smartcard holding the decryption key associated
Harald Hoyer 3763a8
+#     with your public identity
Harald Hoyer 3763a8
+#  5. A CCID smartcard reader
Harald Hoyer 3763a8
+
Harald Hoyer 3763a8
+#  Notes: Requirement 4. and 5. can of course be one device, e.g.
Harald Hoyer 3763a8
+#         a USB token with an integrated OpenPGP smartcard
Harald Hoyer 3763a8
+
Harald Hoyer 3763a8
+# Make a backup of your keyfile (assuming it lies on the boot partition)
Harald Hoyer 3763a8
+$ cp /boot/${KEYFILE} /safe/place/keyfile.bak.gpg
Harald Hoyer 3763a8
+
Harald Hoyer 3763a8
+# Change your keyfile from purely password-based to both
Harald Hoyer 3763a8
+# password-based and key-based (you can then decrypt the keyfile
Harald Hoyer 3763a8
+# with either method). As an example aes256 is chosen, the cipher
Harald Hoyer 3763a8
+# is not important to this guide, but do note that your kernel
Harald Hoyer 3763a8
+# must support it at boot time (be it built into the kernel image
Harald Hoyer 3763a8
+# or loaded as a module from the initramfs).
Harald Hoyer 3763a8
+$ cat /safe/place/keyfile.bak.gpg | gpg -d | gpg --encrypt --recipient ${RECIPIENT} --cipher-algo aes256 --armor -c > /safe/place/keyfile_sc.gpg
Harald Hoyer 3763a8
+
Harald Hoyer 3763a8
+# Verify that you can decrypt your new keyfile both with the password
Harald Hoyer 3763a8
+# and your smartcard.
Harald Hoyer 3763a8
+# (with smartcard inserted, you should be prompted for your PIN, unless
Harald Hoyer 3763a8
+#  you already did so and have not yet timed out)
Harald Hoyer 3763a8
+$ gpg -d /safe/place/keyfile_sc.gpg
Harald Hoyer 3763a8
+# (with smartcard disconnected, you should be prompted for your password)
Harald Hoyer 3763a8
+$ gpg -d /safe/place/keyfile_sc.gpg
Harald Hoyer 3763a8
+
Harald Hoyer 3763a8
+# After verification, replace your old keyfile with your new one
Harald Hoyer 3763a8
+$ su -c 'cp /safe/place/keyfile_sc.gpg /boot/${KEYFILE}'
Harald Hoyer 3763a8
+
Harald Hoyer 3763a8
+# Export your public key to where crypt-gpg can find it
Harald Hoyer 3763a8
+$ gpg --armor --export-options export-minimal --export ${RECIPIENT} > /safe/place/crypt-public-key.gpg
Harald Hoyer 3763a8
+$ su -c 'cp /safe/place/crypt-public-key.gpg /etc/dracut.conf.d/crypt-public-key.gpg'
Harald Hoyer 3763a8
+
Harald Hoyer 3763a8
+# Rebuild your initramfs as usual
Harald Hoyer 3763a8
+# When booting with any of the requirements not met, crypt-gpg will default to password-based keyfile unlocking.
Harald Hoyer 3763a8
+# If all requirements are met and smartcard support is not disabled by setting the kernel option "rd.luks.smartcard=0"
Harald Hoyer 3763a8
+# crypt-gpg will try find and use a connected OpenPGP smartcard by prompting you for the PIN and then
Harald Hoyer 3763a8
+# unlocking the gpg keyfile with the smartcard.