Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 186909 | Differences between
and this patch

Collapse All | Expand All

(-)catalyst/trunk/modules/livecd_stage2_target.py (-1 / +3 lines)
Lines 22-28 Link Here
22
			"livecd/root_overlay","livecd/devmanager","livecd/users",\
22
			"livecd/root_overlay","livecd/devmanager","livecd/users",\
23
			"portage_overlay","livecd/cdfstype","livecd/fstype","livecd/fsops",\
23
			"portage_overlay","livecd/cdfstype","livecd/fstype","livecd/fsops",\
24
			"livecd/linuxrc","livecd/bootargs","gamecd/conf","livecd/xdm",\
24
			"livecd/linuxrc","livecd/bootargs","gamecd/conf","livecd/xdm",\
25
			"livecd/xsession","livecd/volid"])
25
			"livecd/xsession","livecd/volid","encryption/method",\
26
			"encryption/key","encryption/keypath","encryption/keysize",\
27
			"encryption/options"])
26
		
28
		
27
		generic_stage_target.__init__(self,spec,addlargs)
29
		generic_stage_target.__init__(self,spec,addlargs)
28
		if not self.settings.has_key("livecd/type"):
30
		if not self.settings.has_key("livecd/type"):
(-)catalyst/trunk/targets/livecd-stage2/livecd-stage2-controller.sh (-1 / +6 lines)
Lines 102-110 Link Here
102
		;;
102
		;;
103
	bootloader)
103
	bootloader)
104
		shift
104
		shift
105
		# Here is where we poke in our identifier
105
		# Here is where we poke in our identifier and the key (if existent)
106
		touch $1/livecd
106
		touch $1/livecd
107
		
107
		
108
		if [ "${clst_encryption_keypath}" ]
109
		then
110
			echo "${clst_encryption_keypath}" > $1/livecd
111
		fi
112
		
108
		# Move over the readme (if applicable)
113
		# Move over the readme (if applicable)
109
		if [ -n "${clst_livecd_readme}" ]
114
		if [ -n "${clst_livecd_readme}" ]
110
		then
115
		then
(-)catalyst/trunk/targets/support/target_image_setup.sh (-1 / +8 lines)
Lines 1-6 Link Here
1
1
2
. ${clst_sharedir}/targets/support/functions.sh
2
. ${clst_sharedir}/targets/support/functions.sh
3
. ${clst_sharedir}/targets/support/filesystem-functions.sh
3
. ${clst_sharedir}/targets/support/filesystem-functions.sh
4
. ${clst_sharedir}/targets/support/encryption-functions.sh
4
5
5
# Make the directory if it doesnt exist
6
# Make the directory if it doesnt exist
6
mkdir -p $1
7
mkdir -p $1
Lines 41-44 Link Here
41
then
42
then
42
	die "Filesystem not setup"
43
	die "Filesystem not setup"
43
fi
44
fi
44
exit $loopret
45
46
if [ -n "${clst_encryption_method}" ]
47
then
48
	start_encryption $1/${loopname}
49
fi
50
51
exit $?
(-)catalyst/trunk/targets/support/functions.sh (+4 lines)
Lines 190-195 Link Here
190
			cmdline_opts="${cmdline_opts} ${x}"
190
			cmdline_opts="${cmdline_opts} ${x}"
191
		done
191
		done
192
	fi
192
	fi
193
	if [ "${clst_encryption_method}" ]
194
	then
195
		cmdline_opts="${cmdline_opts} crypt_root=livecd"
196
	fi
193
}
197
}
194
198
195
check_filesystem_type(){
199
check_filesystem_type(){
(-)catalyst/trunk/targets/support/kmerge.sh (+5 lines)
Lines 48-53 Link Here
48
	then
48
	then
49
		GK_ARGS="${GK_ARGS} --linuxrc=/tmp/linuxrc"
49
		GK_ARGS="${GK_ARGS} --linuxrc=/tmp/linuxrc"
50
	fi
50
	fi
51
52
	if [ "${clst_encryption_method}" ]
53
	then
54
		GK_ARGS="${GK_ARGS} --luks"
55
	fi
51
}
56
}
52
57
53
genkernel_compile(){
58
genkernel_compile(){
(-)catalyst/trunk/targets/support/mips-arcload_conf.sh (+3 lines)
Lines 1-6 Link Here
1
#!/bin/bash
1
#!/bin/bash
2
2
3
# This file needs to be updated, the cdroot boot argument
4
# isn't read by genkernel's init for some time
3
5
6
4
#// Variables holding the data of the arcload config file, arc.cf
7
#// Variables holding the data of the arcload config file, arc.cf
5
#//-----------------------------------------------------------------------------
8
#//-----------------------------------------------------------------------------
6
9
(-)catalyst/trunk/targets/support/encryption-functions.sh (+110 lines)
Line 0 Link Here
1
. ${clst_sharedir}/targets/support/functions.sh
2
3
devices_off(){
4
	cryptsetup luksClose catalyst
5
	losetup -d ${clst_encryption_loop}
6
}
7
8
free_loop(){
9
	echo "Searching for a free loop from /dev/loop0..."
10
	local loop=0
11
	while true
12
	do
13
		if [ ! -b "/dev/loop${loop}" ]
14
		then
15
			exit 1
16
		fi
17
		# If the loop-device is "free" then break
18
		losetup "/dev/loop${loop}" &>/dev/null || break
19
		let loop=loop+1
20
	done
21
	export clst_encryption_loop="/dev/loop${loop}"
22
}
23
	
24
25
encrypt_loop(){
26
27
# $1 = loop file address
28
# $2 = loop device
29
# $3 = encryption method
30
# $4 = keyfile
31
# $5 = clst_encryption_options
32
# $6 = keysize
33
34
echo "Encrypting the cd using $2 and /dev/mapper/catalyst"	
35
36
local luks_block_size=$(stat -c "%B" $1)
37
38
local luks_size=$(($(stat -c "%b" $1)+8+8*${6}))
39
# Normal size plus space for luks (linear in the keysize)
40
41
echo "Creating empty container..."
42
dd if=/dev/zero of=$1_crypt.img count=${luks_size} bs=${luks_block_size} conv=notrunc \
43
		|| die "Could not create container file with dd, disk full?"
44
45
echo "Placing container in loop $2"
46
losetup $2 $1_crypt.img || die "Couldn't setup the loop. Do you have loop support in the kernel?"
47
48
# Do not remove the previous 'die', it would format an occupied loop
49
50
case "$3" in
51
	manual)
52
		echo 'Creating LUKS image'
53
		cat $4 | cryptsetup -s ${6} ${5} luksFormat $2 \
54
			|| (devices_off; die "Failed to luksFormat. Is Luks configured and are kernel requirements met?")
55
		echo 'Opening LUKS image'
56
		cat $4 | cryptsetup luksOpen $2 catalyst \
57
			|| (devices_off; die "Failed to open the luks device")
58
		;;
59
	keyfile)
60
		echo 'Creating LUKS image'
61
		echo 'YES' | cryptsetup ${5} luksFormat $2 $4 \
62
			|| (devices_off; die "Failed to luksFormat. Is Luks configured and are kernel requirements met?")
63
		echo 'Opening LUKS image'
64
		cryptsetup --key-file $4 luksOpen $2 catalyst \
65
			|| (devices_off; die "Failed to open the luks device")
66
		;;
67
	*)
68
		devices_off
69
		die 'Option for encrypt/method not recognized'
70
		;;		
71
esac
72
73
echo 'Copying root filesystem to container'
74
75
dd if=$1 of=/dev/mapper/catalyst conv=notrunc \
76
	|| (devices_off; die "dd failed to put loop contents in Luks image. Could be bad container size estimative, or loops wrongly detached.")
77
78
cryptsetup luksClose catalyst || \
79
	die "Luks image could not br closed, and loop will be left open. Unknown error occurred"
80
81
losetup -d $2 || die "Loop not closed. Unknown error occurred"
82
83
echo 'Loop was closed, encryption terminated'
84
85
rm $1
86
mv $1_crypt.img $1
87
}
88
89
90
start_encryption(){
91
	# $1 = loop image
92
93
	local keysize
94
95
	if [ ! -s "${clst_encryption_key}" ]
96
		then die "Key wasn't found"
97
	fi
98
	#otherwise luks keeps waiting for stdin
99
100
	if [ "${clst_encryption_keysize}" ]
101
        then keysize=${clst_encryption_keysize}
102
        else keysize=256
103
        fi
104
105
        free_loop || die "Couldn't find available loop"
106
	encrypt_loop $1 "${clst_encryption_loop}" "${clst_encryption_method}" "${clst_encryption_key}" "${clst_encryption_options}" "${keysize}"
107
	loopret=$?
108
	unset clst_encryption_loop
109
	exit $loopret
110
}
(-)catalyst/trunk/examples/livecd-stage2_template.spec (+23 lines)
Lines 85-90 Link Here
85
# zisofs - This uses in-kernel compression and is supported on all platforms.
85
# zisofs - This uses in-kernel compression and is supported on all platforms.
86
# normal - This creates a loop without compression.
86
# normal - This creates a loop without compression.
87
# noloop - This copies the files to the CD directly, withuot using a loopback.
87
# noloop - This copies the files to the CD directly, withuot using a loopback.
88
# (but encryption is only supported with loops)
88
# example:
89
# example:
89
# livecd/fstype: squashfs
90
# livecd/fstype: squashfs
90
livecd/fstype:
91
livecd/fstype:
Lines 361-363 Link Here
361
# example:
362
# example:
362
# livecd/rm: /lib/*.a /usr/lib/*.a /usr/lib/gcc-lib/*/*/libgcj* /etc/dispatch-conf.conf /etc/etc-update.conf /etc/*- /etc/issue* /etc/make.conf /etc/man.conf /etc/*.old /root/.viminfo /usr/sbin/bootsplash* /usr/sbin/fb* /usr/sbin/fsck.cramfs /usr/sbin/fsck.minix /usr/sbin/mkfs.minix /usr/sbin/mkfs.bfs /usr/sbin/mkfs.cramfs /lib/security/pam_access.so /lib/security/pam_chroot.so /lib/security/pam_debug.so /lib/security/pam_ftp.so /lib/security/pam_issue.so /lib/security/pam_mail.so /lib/security/pam_motd.so /lib/security/pam_mkhomedir.so /lib/security/pam_postgresok.so /lib/security/pam_rhosts_auth.so /lib/security/pam_userdb.so /usr/share/consolefonts/1* /usr/share/consolefonts/7* /usr/share/consolefonts/8* /usr/share/consolefonts/9* /usr/share/consolefonts/A* /usr/share/consolefonts/C* /usr/share/consolefonts/E* /usr/share/consolefonts/G* /usr/share/consolefonts/L* /usr/share/consolefonts/M* /usr/share/consolefonts/R* /usr/share/consolefonts/a* /usr/share/consolefonts/c* /usr/share/consolefonts/dr* /usr/share/consolefonts/g* /usr/share/consolefonts/i* /usr/share/consolefonts/k* /usr/share/consolefonts/l* /usr/share/consolefonts/r* /usr/share/consolefonts/s* /usr/share/consolefonts/t* /usr/share/consolefonts/v* /etc/splash/livecd-2006.1/16* /etc/splash/livecd-2006.1/12* /etc/splash/livecd-2006.1/6* /etc/splash/livecd-2006.1/8* /etc/splash/livecd-2006.1/images/silent-16* /etc/splash/livecd-2006.1/images/silent-12* /etc/splash/livecd-2006.1/images/silent-6* /etc/splash/livecd-2006.1/images/silent-8* /etc/splash/livecd-2006.1/images/verbose-16* /etc/splash/livecd-2006.1/images/verbose-12* /etc/splash/livecd-2006.1/images/verbose-6* /etc/splash/livecd-2006.1/images/verbose-8* /etc/make.conf.example /etc/make.globals /etc/resolv.conf
363
# livecd/rm: /lib/*.a /usr/lib/*.a /usr/lib/gcc-lib/*/*/libgcj* /etc/dispatch-conf.conf /etc/etc-update.conf /etc/*- /etc/issue* /etc/make.conf /etc/man.conf /etc/*.old /root/.viminfo /usr/sbin/bootsplash* /usr/sbin/fb* /usr/sbin/fsck.cramfs /usr/sbin/fsck.minix /usr/sbin/mkfs.minix /usr/sbin/mkfs.bfs /usr/sbin/mkfs.cramfs /lib/security/pam_access.so /lib/security/pam_chroot.so /lib/security/pam_debug.so /lib/security/pam_ftp.so /lib/security/pam_issue.so /lib/security/pam_mail.so /lib/security/pam_motd.so /lib/security/pam_mkhomedir.so /lib/security/pam_postgresok.so /lib/security/pam_rhosts_auth.so /lib/security/pam_userdb.so /usr/share/consolefonts/1* /usr/share/consolefonts/7* /usr/share/consolefonts/8* /usr/share/consolefonts/9* /usr/share/consolefonts/A* /usr/share/consolefonts/C* /usr/share/consolefonts/E* /usr/share/consolefonts/G* /usr/share/consolefonts/L* /usr/share/consolefonts/M* /usr/share/consolefonts/R* /usr/share/consolefonts/a* /usr/share/consolefonts/c* /usr/share/consolefonts/dr* /usr/share/consolefonts/g* /usr/share/consolefonts/i* /usr/share/consolefonts/k* /usr/share/consolefonts/l* /usr/share/consolefonts/r* /usr/share/consolefonts/s* /usr/share/consolefonts/t* /usr/share/consolefonts/v* /etc/splash/livecd-2006.1/16* /etc/splash/livecd-2006.1/12* /etc/splash/livecd-2006.1/6* /etc/splash/livecd-2006.1/8* /etc/splash/livecd-2006.1/images/silent-16* /etc/splash/livecd-2006.1/images/silent-12* /etc/splash/livecd-2006.1/images/silent-6* /etc/splash/livecd-2006.1/images/silent-8* /etc/splash/livecd-2006.1/images/verbose-16* /etc/splash/livecd-2006.1/images/verbose-12* /etc/splash/livecd-2006.1/images/verbose-6* /etc/splash/livecd-2006.1/images/verbose-8* /etc/make.conf.example /etc/make.globals /etc/resolv.conf
363
livecd/rm:
364
livecd/rm:
365
366
367
# If you do not want your livecd encrypted with LUKS leave this empty. 
368
# Possible values are 'keyfile' or 'manual'. Specifies whether you want 
369
# to boot your livecd with a 'keyfile' or by manually inserting the key 
370
# with 'manual'.
371
# You must configure the kernel config to work with luks, as usual
372
encryption/method:
373
374
# If above you chose 'keyfile' or 'manual', then below you need to specify 
375
# the file which contains the binary keyfile or the password.
376
encryption/key:
377
378
# Insert cryptsetup luksFormat options (such as --cipher and --verify-passphrase).
379
#encryption/options:
380
381
# Sets the luksFormat keysize, defaults to 256.
382
#encryption/keysize:
383
384
# If using 'keyfile', indicate the full relative location of the key from the root 
385
# of the device you're going to use when opening the cd.
386
encryption/keypath:

Return to bug 186909