~ubuntu-branches/ubuntu/maverick/cryptsetup/maverick-proposed

« back to all changes in this revision

Viewing changes to debian/README.remote

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-11-11 15:04:27 UTC
  • mfrom: (0.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091111150427-elb822l63lnihaue
Tags: 2:1.1.0~rc2-1ubuntu1
* Merge with Debian testing. Remaining Ubuntu changes:
  - debian/rules: cryptsetup is linked dynamically against libgcrypt and
    libgpg-error.
  - Upstart migration:
    + Add debian/cryptdisks-enable.upstart.
    + debian/cryptdisks{,-early}.init: Make the 'start' action of the init
      script a no-op, this should be handled entirely by the upstart job.
      (LP #473615)
    + debian/cryptsetup.postinst: Remove any symlinks from /etc/rcS.d on
      upgrade. 
    + debian/rules: Do not install start symlinks for those two, and install
      debian/cryptdisks-enable.upstart scripts.
  - Add debian/cryptsetup.apport: Apport package hook. Install in
    debian/rules, and create dir in debian/cryptsetup.dirs.
  - Start usplash in initramfs, since we need it for fancy passphrase input:
    + debian/initramfs/cryptroot-conf, debian/initramfs-conf.d: USPLASH=y
    + debian/control: Bump initramfs-tools Suggests to Depends:.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
unlocking rootfs via ssh login in initramfs
 
2
-------------------------------------------
 
3
 
 
4
You can unlock your rootfs on bootup from remote, using ssh to log in to the
 
5
booting system while it's running with the initramfs mounted.
 
6
 
 
7
 
 
8
Setup
 
9
-----
 
10
 
 
11
For remote unlocking to work, the following packages have to be installed
 
12
before building the initramfs: dropbear busybox
 
13
 
 
14
The file /etc/initramfs-tools/initramfs.conf holds the configuration options
 
15
used when building the initramfs. It should contain BUSYBOX=y (this is set as
 
16
the default when the busybox package is installed) to have busybox installed
 
17
into the initramfs, and should not contain DROPBEAR=n, which would disable
 
18
installation of dropbear to initramfs. If set to DROPBEAR=y, dropbear will
 
19
beinstalled in any case; if DROPBEAR isn't set at all, then dropbear will only
 
20
be installed in case of an existing cryptroot setup.
 
21
 
 
22
The host keys used for the initramfs are dropbear_dss_host_key and
 
23
dropbear_rsa_host_key, both located in/etc/initramfs-tools/etc/dropbear/.
 
24
If they do not exist when the initramfs is compiled, they will be created
 
25
automatically. Following are the commands to create them manually:
 
26
 
 
27
# dropbearkey -t dss -f /etc/initramfs-tools/etc/dropbear/dropbear_dss_host_key
 
28
# dropbearkey -t rsa -f /etc/initramfs-tools/etc/dropbear/dropbear_rsa_host_key
 
29
 
 
30
As the initramfs will not be encrypted, publickey authentication is assumed.
 
31
The key(s) used for that will be taken from
 
32
/etc/initramfs-tools/root/.ssh/authorized_keys.
 
33
If this file doesn't exist when the initramfs is compiled, it will be created
 
34
and /etc/initramfs-tools/root/.ssh/id_rsa.pub will be added to it.
 
35
If the latter file doesn't exist either, it will be generated automatically -
 
36
you will find the matching private key which you will later need to log in to
 
37
the initramfs under /etc/initramfs-tools/root/.ssh/id_rsa (or id_rsa.dropbear
 
38
in case you need it in dropbear format). Following are the commands to do the
 
39
respective steps manually:
 
40
 
 
41
To create a key (in dropbear format):
 
42
 
 
43
# dropbearkey -t rsa -f /etc/initramfs-tools/root/.ssh/id_rsa.dropbear
 
44
 
 
45
To convert the key from dropbear format to openssh format:
 
46
 
 
47
# /usr/lib/dropbear/dropbearconvert dropbear openssh \
 
48
        /etc/initramfs-tools/root/.ssh/id_rsa.dropbear \
 
49
        /etc/initramfs-tools/root/.ssh/id_rsa
 
50
 
 
51
To extract the public key:
 
52
 
 
53
# dropbearkey -y -f /etc/initramfs-tools/root/.ssh/id_rsa.dropbear | \
 
54
        grep "^ssh-rsa " > /etc/initramfs-tools/root/.ssh/id_rsa.pub
 
55
 
 
56
To add the public key to the authorized_keys file:
 
57
 
 
58
# cat /etc/initramfs-tools/root/.ssh/id_rsa.pub >> /etc/initramfs-tools/root/.ssh/authorized_keys
 
59
 
 
60
In case you want some interface to get configured using dhcp, setting DEVICE= in
 
61
/etc/initramfs-tools/initramfs.conf should be sufficient.  The initramfs should
 
62
also honour the ip= kernel parameter.
 
63
In case you use grub, you probably might want to set it in /boot/grub/menu.lst,
 
64
either in the '# kopt=' line or appended to specific 'kernel' line(s).
 
65
The ip= kernel parameter is documented in Documentation/nfsroot.txt in the
 
66
kernel source tree.
 
67
 
 
68
 
 
69
Issues
 
70
------
 
71
 
 
72
Don't forget to run update-initramfs when you changed the config to make it
 
73
effective!
 
74
 
 
75
Collecting enough entropy for the ssh daemon sometimes seems to be an issue.
 
76
Startup of the ssh daemon might be delayed until enough entropy has been
 
77
retrieved. This is non-blocking for the startup process, so when you are at the
 
78
console you won't have to wait for the sshd to complete its startup.
 
79
 
 
80
 
 
81
Unlocking procedure
 
82
-------------------
 
83
 
 
84
To unlock from remote, you could do something like this:
 
85
 
 
86
# ssh -o "UserKnownHostsFile=~/.ssh/known_hosts.initramfs" \
 
87
        -i "~/id_rsa.initramfs" root@initramfshost.example.com \
 
88
        "echo -ne \"secret\" >/lib/cryptsetup/passfifo"
 
89
 
 
90
This example assumes that you have an extra known_hosts file 
 
91
"~/.ssh/known_hosts.initramfs" which hold's the cryptroot system's host-key,
 
92
that you have a file "~/id_rsa.initramfs" which holds the authorized-key for
 
93
the cryptroot system, that the cryptroot system's name is
 
94
"initramfshost.example.com", and that the cryptroot passphrase is "secret"
 
95
 
 
96
-- <debian@x.ray.net>, Wed, 30 Sep 2009