Code: Select all
Dec 30 18:50:06 nemesis EXT3-fs warning: maximal mount count reached, running e2
fsck is recommended
Dec 30 18:50:06 nemesis kjournald starting. Commit interval 5 seconds
Dec 30 18:50:06 nemesis EXT3 FS on dm-0, internal journal
Dec 30 18:50:06 nemesis EXT3-fs: mounted filesystem with ordered data mode.
Code: Select all
# fsck /dev/hda6
fsck 1.38 (30-Jun-2005)
e2fsck 1.38 (30-Jun-2005)
Couldn't find ext2 superblock, trying backup blocks...
fsck.ext2: Bad magic number in super-block while trying to open /dev/hda6
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
Code: Select all
# fsck.ext3 /dev/hda6
e2fsck 1.38 (30-Jun-2005)
Couldn't find ext2 superblock, trying backup blocks...
fsck.ext3: Bad magic number in super-block while trying to open /dev/hda6
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
Code: Select all
DEVICE_NAME="/dev/hda6" # Name of the partition-device, e.g. hda3
CRYPTO_FS="ext3" # Filesystem of the crypto-device
Das geht mit "cryptsetup resize". Wennich mich richtig an meine letzte Erweiterung erinnere braucht man das Filesystem nichtmal auszuhängen. Das ist besonders praktisch, wenn man ein Filesystem wie xfs benutzt. Das kann man dann auch online erweiternAnarcho wrote:Es gibt nen parameter für cryptsetup mit dem man die grösse ändern kann.
Das Programm heißt "resize2fs", ext2resize und ext2online sind schon ziemlich alt und haben mit manchen Strukturen Probleme. Bei mir sind sie über die Raid-Optimierungen gestolpert.Anarcho wrote:Und es gibt glaube ich nen ext3resize oder so ähnlich.
Mit dieser Kombination könnte man es mal probieren (natürlich vorher die echte partition vergrössern).

Code: Select all
# warte kurz...
sleep 4
#"$UMOUNT" "$1";
"$UMOUNT" -l "$1";
if [ $? -ne 0 ]; then
echo "${0##*/}: error unmounting $1" >&2
# ...Code: Select all
echo $PASS | md5sum | cut -d ' ' -f 1 | md5sum | cut -d ' ' -f 1 | md5sum | cut -d ' ' -f 1Code: Select all
# ********************************************************************* #
# Script for automatically mounting and unmounting a crypted partition #
# by using a keyfile stored on a removable media. This keyfile can be #
# encrypted by gpg. #
# #
# Author: Matthias Schroeer (Anarcho) #
# Date: 01.11.2004 #
# Version: 0.6 #
# License: GPL #
# #
# ToDo: #
# - add support for multiple crypted partitions #
# ********************************************************************* #
#
# 17.02.2006 - modified by slick, who don't like keyfiles, use password only
#
# Config
PW_TRIPLE_MD5="cc9a69285ff5fffd26e33bde2130c56f" # triple md5sum of password
MAX_PW_TRIES=3 # Maximum password tries
PW_TIME_OUT="20" # password timeout in seconds, set to "" to disable
MAPPER_NAME="crypto" # Mapper-device name
DEVICE_NAME="/dev/md6" # Name of the partition-device, e.g. hda3
CRYPTSETUP_OPTIONS="" # Options for cryptsetup like -s 128
CRYPTO_MOUNT="/mnt/crypto" # Moutpoint for the crypto-device
MOUNT_OPTIONS="-t ext3 -o noatime" # Mountoptions for the crypted deviceCode: Select all
#!/bin/bash
# ********************************************************************* #
# crypto-mount #
# #
# Script for automatically mounting a crypted partition by using a #
# keyfile stored on a removable media. This can be encrypted by gpg. #
# #
# Author: Matthias Schroeer (Anarcho) #
# Date: 05.12.2004 #
# Version: 0.6.2 #
# License: GPL #
# #
# ToDo: #
# - add support for multiple crypted partitions #
# ********************************************************************* #
#
# 17.02.2006 - modified by slick, who don't like keyfiles, use password only
#
unset PASS
# Color definition
cblack='\E[30m'
cred='\E[31m'
cgreen='\E[32m'
cyellow='\E[33m'
cblue='\E[34m'
cmagenta='\E[35m'
ccyan='\E[36m'
cwhite='\E[37m'
cecho ()
# Argument $1 = message
# Argument $2 = color
{
use_color=${2:-$cblack} # Defaults to black, if not specified.
echo -en '\033[1m'"$use_color"
echo -n "$1"
tput sgr0 # Reset to normal.
return
}
# Checking if you are root
if [ `whoami` != "root" ]; then
cecho " ERROR: " $cred
echo "You have to be Super-User to mount $MAPPER_NAME"
exit 1
fi
# Check for config-file
if [ -f /etc/crypto-mount.conf ]; then
source /etc/crypto-mount.conf
else
cecho " ERROR: " $cred
echo "No config file was found (/etc/crypto_mount.conf)"
exit 10
fi
# Checking if the mapper-device already exists
if [ -b /dev/mapper/${MAPPER_NAME} ]; then
cecho " WARNING: " $cyellow
echo "Mapper already created, only trying to mount"
# Checking if already mounted
MOUNT_TEST=`mount | grep /dev/mapper/${MAPPER_NAME}`
if [ "$MOUNT_TEST" == "" ]; then
# Checking mount-options
if [ "$MOUNT_OPTIONS" != "" ]; then MOUNT_OPTIONS="-o $MOUNT_OPTIONS"; fi
# Checking if mountpoiunt for the crypto-device exists
if [ ! -d ${CRYPTO_MOUNT} ]; then
if [ -e ${CRYPTO_MOUNT} ]; then
cecho " ERROR: " $cred
echo "There is a file where a directory should be (${CRYPTO_MOUNT})"
exit 7
else
cecho " WARNING: " $cyellow
echo "The mountpoint does not exist, I will try to create it (${CRYPTO_MOUNT})"
if ! mkdir ${CRYPTO_MOUNT}; then
cecho " ERROR: " $cred
echo "Creating mountpoint (${CRYPTO_MOUNT})"
exit 9
fi
fi
fi
# fsck
fsck /dev/mapper/${MAPPER_NAME}
# Mounting the cryptodevice
if /bin/mount ${MOUNT_OPTIONS} /dev/mapper/${MAPPER_NAME} ${CRYPTO_MOUNT}; then
echo "Crypto-Device mounted succesfully (${CRYPTO_MOUNT})"
exit 0
else
cecho " ERROR: " $cred
echo "Mounting crypto-device"
exit 5
fi
else
cecho " WARNING: " $cyellow
echo "Crypto-device already mounted! (${CRYPTO_MOUNT})"
exit 0
fi
fi
# Checking if the partition to crypt exists
if [ ! -b "${DEVICE_NAME}" ]; then
cecho " ERROR: " $cred
echo "Device does not exist (${DEVICE_NAME})"
exit 6
fi
# Creating the crypto-device
PW_OK="no"
if [ "$PW_TIME_OUT" != "" ]; then
PW_TIME_OUT="-t $PW_TIME_OUT"
fi
COUNTER=0
while [ "$PW_OK" != "yes" ]; do
echo "Sorry, the password is wrong!"
if [ $COUNTER -ge $MAX_PW_TRIES ]; then
cecho " ERROR: " $cred
echo "Maximum password tries are reached!"
exit 12
fi
echo -n "Please enter passphrase (hit ENTER to exit): "; read -ers $PW_TIME_OUT PASS
# Check if only ENTER
if [ "$PASS" == "" ]; then
echo ""
exit 13
fi
# Check if passwort is right
if [ "`echo $PASS | md5sum | cut -d ' ' -f 1 | md5sum | cut -d ' ' -f 1 | md5sum | cut -d ' ' -f 1`" == "$PW_TRIPLE_MD5" ] ; then
PW_OK="yes" ;
fi
COUNTER=$[$COUNTER+1]
done
echo "$PASS" | /bin/cryptsetup ${CRYPTSETUP_OPTIONS} -h plain create ${MAPPER_NAME} ${DEVICE_NAME} && CRYPT_SUCC="yes"
unset PASS; echo ""
#echo $RUN_CRYPT; exit 1
if [ "$CRYPT_SUCC" == "yes" ]; then
# Checking if mountpoiunt for the crypto-device exists
if [ ! -d ${CRYPTO_MOUNT} ]; then
if [ -e ${CRYPTO_MOUNT} ]; then
cecho " ERROR: " $cred
echo "There is a file where a directory should be (${CRYPTO_MOUNT})"
/bin/cryptsetup remove ${MAPPER_NAME}
exit 7
else
cecho " WARNING: " $cyellow
echo "The mountpoint does not exist, I will try to create it (${CRYPTO_MOUNT})"
if ! mkdir ${CRYPTO_MOUNT}; then
cecho " ERROR: " $cred
echo "Creating mountpoint (${CRYPTO_MOUNT})"
exit 9
fi
fi
fi
# fsck
fsck /dev/mapper/${MAPPER_NAME}
# Mounting the cryptodevice
if /bin/mount ${MOUNT_OPTIONS} /dev/mapper/${MAPPER_NAME} ${CRYPTO_MOUNT}; then
cecho " SUCCESS: " $cgreen
echo "Crypto-Device mounted succesfully (${CRYPTO_MOUNT})"
exit 0
else
cecho " ERROR: " $cred
echo "Mounting crypto-device"
cryptsetup remove ${MAPPER_NAME}
exit 5
fi
else
cecho " ERROR: " $cred
echo "Creating the mapper-device (${MAPPER_NAME})"
exit 4
fi
exit 0Code: Select all
/dev/hdax none swap sw,loop=/dev/loop7,encryption=AES128 0 0 Code: Select all
umount /dev/evms/bigspace
gpg -d /system.key.gpg|cryptsetup -h plain create bigspace_crypt /dev/evms/bigspace
#passwort für alten key eingeben
gpg -d /system-neu.key.gpg|cryptsetup -h plain create bigspace_crypt2 /dev/evms/bigspace
#passwort für neuen key eingeben
dd if=/dev/mapper/bigspace_crypt|buffer -s64k -S10m|dd of=/dev/mapper/bigspace_crypt2
misterjack wrote:Eine bessere Alternative ist die zusätzliche Verwendung von LUKS, wie das funktioniert, ...
Ich denke hier sollte man genau überlegen was man möchte. Sicher bietet LUKS Vorteile, aber dafür scheint es mir auf den ersten Blick unsicherer in bezug auf Anfälligkeiten der Hardware (defekte Sektoren). Bei normalem Cryptsetup kann ich genannte "Skripte oder Dateien" einfach sichern. Bei LUKS, wenn ich das richtig verstehe, muß ich schon gezielt einzelne Sektoren der Festplatte sichern (sofern überhaupt bekannt welche) um wieder an den Masterkey zu kommen falls auch nur ein Sektor ausfällt.http://de.gentoo-wiki.com/DM-Crypt wrote:Cryptsetup hat einen Schönheitsfehler, es trennt die Informationen des Keys von den zu verschlüsselten Informationen. Die Cryptsetup Parameter stehen in Skripten oder Dateien und wer diese verliert, erhält keinen Zugriff auf seine Daten.
[...]
LUKS trickst Datenretter aus, indem ein AF-Splitter diese Daten um das Viertausendfache aufbläht. Die aufgeblasene Information ist nicht redudant, es ist immer der komplette Datensatz nötig, um den Master-Key zu bestimmen. Fehlt ein Sektor, ist ein Zugriff unmöglich.

dafür gibts doch das:slick wrote:Die aufgeblasene Information ist nicht redudant, es ist immer der komplette Datensatz nötig, um den Master-Ke aber dafür scheint es mir auf den ersten Blick unsicherer in bezug auf Anfälligkeiten der Hardware (defekte Sektoren)

Ich hab sowohl eine luks-Verschlüsselung, als auch eine herkömmliche [topic=274651] nach Anleitung mit pam_mount[/topic] (zum automatischen Öffnen und mounten bei Login) erfolgreich erstellt. Leider hab ich die Verbindung, nämlich eine Passwortübergabe mit pam_mount an luks nicht hinbekommen.misterjack wrote:http://de.gentoo-wiki.com/DM-Crypt
Fragen zur Howto:

sorry, kann ich nix dazu sagenpaoleela wrote: Ich hab sowohl eine luks-Verschlüsselung, als auch eine herkömmliche [topic=274651] nach Anleitung mit pam_mount[/topic] (zum automatischen Öffnen und mounten bei Login) erfolgreich erstellt. Leider hab ich die Verbindung, nämlich eine Passwortübergabe mit pam_mount an luks nicht hinbekommen.
Dein Masterkey ist noch lange nicht so gut gesichert wie bei LUKSpaoleela wrote: Mit gleichem cipher (aes-cbc-essiv:sha256 in meinem Fall, was die 600Mhz-G3 ziemlich streßt) sollte luks doch die gleiche Sicherheit bieten, wie herkömmliches cryptsetup, nur weniger komfortabel was fallback-Passwort und Passwortänderung betrifft.
habe ich übersehen
Ja stimmt eigentlich, werde es gleich ändern. urandom ist auch nur nötig, wenn man vorhandene daten löschen will. das macht aber shred schon ziemlich gutpaoleela wrote: Ist die erste Formatierung vor luksFormat nicht unnötig? Besser wäre eine urandom Überschreibung (wie oft erwähnt, ohne auf Sicherheit von (u)random einzugehen).
Teste es doch einfach malpaoleela wrote:Warum /dev/hda1 und nicht direkt /dev/hda?
gerade mal ausprobiert mit usbstick:paoleela wrote: Ist es möglich ein /dev/mapper/_dev_hda erneut zu partitionieren, d.h. ein großes mapper-device auf /dev/hda erstellen, und darauf dann /dev/mapper/_dev_hda1,2,3?
Code: Select all
Platte /dev/mapper/usbstick: 65 MByte, 65531904 Byte
255 Köpfe, 63 Sektoren/Spuren, 7 Zylinder
Einheiten = Zylinder von 16065 × 512 = 8225280 Bytes
Gerät boot. Anfang Ende Blöcke Id System
/dev/mapper/usbstick1 1 7 56196 83 Linux
misterjack ~ # ls /dev/mapper/
control media usbstickich habe mit blowfish-cbc-essiv:sha256 und 256 bit key ca 19 MiB/s (auf 1.6 GHZ war mein Athlon XP-M während des Transfer-Tests getaktet). mit ext3 formatiertpaoleela wrote: aes-cbc-essiv:sha256 mit 256 bit key bringt auf meinem Laptop gerade mal noch 1MB/s Performance, bei maximaler CPU-Last von kjournald, der eigentlich ja nicht für die Verschlüsselung zuständig ist. Ist ext3 auf einer Crypt-Partition nicht zu emfehlen? Von journaled-Dateisystemen wurde stellenweise abgeraten. Gibts einen leichteren cipher ohne mit der Sicherheit und Schlüsselgröße runterzugehen? aes soll doch weniger lastig als blowfish sein?
Hi,misterjack wrote:Dieses Howto entspricht nicht mehr dem Stand der Sicherheitstechnischen Dinge
Eine bessere Alternative ist die zusätzliche Verwendung von LUKS, wie das funktioniert, wird hier beschrieben:
http://de.gentoo-wiki.com/DM-Crypt
Code: Select all
gpg --quiet -d movies.key.gpg | cryptsetup -h plain create dump /dev/sda1
[b]Command failed: Block device required[/b]
gpg: DBG: connection to agent established
gpg: WARNING: message was not integrity protectedCode: Select all
fdisk /dev/sda
Disk /dev/sda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
Command (m for help): q
Code: Select all
# head -c 1000 < /dev/urandom | uuencode -m - | grep -v begin | head -c 32 >TEST.key
bash: uuencode: command not found
Code: Select all
# emerge sys-fs/cryptsetup --pretend
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild N ] sys-fs/cryptsetup-1.0.5-r1 USE="nls -build -dynamic (-selinux)"
[blocks B ] sys-fs/cryptsetup-luks (is blocking sys-fs/cryptsetup-1.0.5-r1)
[blocks B ] sys-fs/cryptsetup (is blocking sys-fs/cryptsetup-luks-1.0.4-r3)
localhost usixq # emerge -C cryptsetup-luks && emerge sys-fs/cryptsetup