aboutsummaryrefslogtreecommitdiffstats
path: root/pre-partman.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pre-partman.sh')
-rwxr-xr-xpre-partman.sh24
1 files changed, 15 insertions, 9 deletions
diff --git a/pre-partman.sh b/pre-partman.sh
index 79436ee..c0cebee 100755
--- a/pre-partman.sh
+++ b/pre-partman.sh
@@ -9,16 +9,18 @@
# Licensed under the GNU GPL version 3 or higher.
set -ue
+root=/cdrom
. /usr/share/debconf/confmodule
-debconf-loadtemplate fripost-install /cdrom/preseed/fripost-install.template
+debconf-loadtemplate fripost-install $root/preseed/fripost-install.template
db_input high fripost-install/full-disk-encryption || true
db_go
db_get fripost-install/full-disk-encryption
[ x"${RET:-true}" = x"false" ] && exit 0
+##############################################################################
# Crypto, disk and network modules, required to unlock the system from
# our initramfs.
# TODO: should probably be stored in debconf, since we'll need the
@@ -29,14 +31,19 @@ while read k rest; do /sbin/modinfo -F filename "$k"; done < /proc/modules \
anna-install cryptsetup-udeb
+
+##############################################################################
+# Slurp encryption key
+
db_input high fripost-install/full-disk-encryption-password || true
db_go
db_get fripost-install/full-disk-encryption-password
+keyfile=~root/root.key
if [ -n "$RET" ]; then
- touch ~root/root.key
- chmod 0644 ~root/root.key
- echo $RET >> ~root/root.key #TODO we don't want echo there
+ touch "$keyfile"
+ chmod 0644 "$keyfile"
+ echo $RET >> "$keyfile"
# TODO: remove passord from debconf
else
anna-install openssh-server-udeb
@@ -60,14 +67,13 @@ else
AllowUsers root
StrictModes yes
- ForceCommand /bin/sh -c 'umask 0077; cat > ~root/root.key'
+ #ForceCommand /bin/sh -c 'umask 0077; cat > $keyfile'
EOF
- # Populate the authorized keys. TODO: make something more generic
+ # Populate the authorized keys.
test -d ~root/.ssh || mkdir -m 0700 ~root/.ssh
- cat > ~root/.ssh/authorized_keys <<- EOF
- no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa ...
- EOF
+ sed 's/^/no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding /' \
+ $root/preseed/authorized_keys > ~root/.ssh/authorized_keys
chmod og-rwx ~root/.ssh/authorized_keys
# Start the SSH daemon