SHARE
TWEET

Untitled

a guest Jan 19th, 2020 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. NUM_ARGS=$#
  3.  
  4. echo
  5. echo "###############################################"
  6. echo "#     dm-crypt LUKS Container MAKER - 0.1     #"
  7. echo "###############################################"
  8. echo
  9.  
  10. if [ $NUM_ARGS -ne 2 ] ; then
  11.     echo Wrong number of arguments.
  12.     echo Usage: [size in MB] [file to create]
  13.  
  14. else
  15.     SIZE=$1
  16.     FILE=$2
  17.  
  18.     # create file
  19.     echo "Creating $FILE with a size of ${SIZE}MB"
  20.     fallocate -v -l ${SIZE}MB $FILE
  21.  
  22.     # randomize file contents
  23.     echo
  24.     echo "Randomizing content"
  25.     dd if=/dev/urandom of=$FILE bs=1MB count=$SIZE
  26.  
  27.     # creating a dm-crypt LUKS Container in the file
  28.     echo
  29.     echo "Creating dm-crypt LUKS Container (AES-XTS-PLAIN64, 256, SHA512)"
  30.     cryptsetup -v -q --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 --use-urandom --verify-passphrase luksFormat $2
  31.  
  32.     # modify owner
  33.     echo
  34.     echo "Modifying permissions"
  35.     chown unknown:unknown $FILE
  36.     chmod 660 $FILE
  37. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top