LUKS USB pen/disk – CreateLuksDev.sh

Ciao,
ecco uno script, tratto leggendo la guida che trovate qui.
CreateLuksDev.sh crea un device cifrato con LUKS sul device specificato, dopo aver riempito lo stesso con dati random.
Per utilizzare il device anche su Windows, utilizzate FreeOTFE.

ATTENZIONE: tutti i dati della chiavetta vengono persi.

Scarica lo script

#!/bin/bash
###############################################################################
# AUTHOR BM 20090505
# Copyright (C) 2009 Beppe Medeghini
# Licensed under the terms of the GNU General Public License version 2 (only).
# Source GUIDE:
# http://www.g-loaded.eu/2005/11/10/encrypt-devices-using-dm-crypt-and-luks/
# History: V1.0 2009/05/05
###############################################################################
if [ $# != 2 ]
then
echo Usage: CreateLuksDev.sh device dev_name
echo
echo device is in the form /dev/sdc1
echo dev_name is a string
exit 1
fi
echo DEVICE = $1
echo DEVICE_NAME = $2
echo FSTYPE = FAT32
#
echo Filling with random data... please wait. This step is slow
echo Approx 5 min per 1 Gb on hard disk
echo If you want to know the actual statei => kill -USR1 `pidof dd`
echo dd if=/dev/urandom of=$1
dd if=/dev/urandom of=$1
#
echo Creating luks device
cryptsetup --verbose --verify-passphrase luksFormat $1
#
echo Opening luks device
cryptsetup luksOpen $1 encrdev
#
echo Creating FAT32 filesystem
mkfs.vfat -v -F 32 -n "$2" /dev/mapper/encrdev
#
echo Mounting
mkdir /mnt/pen/
mount -t vfat -o rw /dev/mapper/encrdev /mnt/pen/
#
echo Device mounted on /mnt/pen/
#
echo "********************************************************"
echo "* TO MOUNT"
echo "* cryptsetup luksOpen $1 encrdev"
echo "* mount /dev/mapper/encrdev /mnt/pen"
echo "********************************************************"
#
echo "********************************************************"
echo "* TO UNMOUNT"
echo "* umount /mnt/pen/"
echo "* cryptsetup luksClose encrdev"
echo "********************************************************"

Annunci
Questa voce è stata pubblicata in Script, sicurezza. Contrassegna il permalink.

Rispondi

Effettua il login con uno di questi metodi per inviare il tuo commento:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...