mirror of
https://github.com/kevinveenbirkenbach/linux-image-manager.git
synced 2025-09-10 04:08:23 +02:00
Implemented raid1 luks encrypted draft
This commit is contained in:
2
scripts/encryption/storage/single_drive/base.sh
Normal file
2
scripts/encryption/storage/single_drive/base.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
source "$(dirname "$(readlink -f "${0}")")/../base.sh" || (echo "Loading base.sh failed." && exit 1)
|
15
scripts/encryption/storage/single_drive/mount.sh
Normal file
15
scripts/encryption/storage/single_drive/mount.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
source "$(dirname "$(readlink -f "${0}")")/base.sh" || (echo "Loading base.sh failed." && exit 1)
|
||||
echo "Mounts encrypted storages"
|
||||
|
||||
set_device_mount_partition_and_mapper_paths
|
||||
|
||||
info "Unlock partition..." &&
|
||||
sudo cryptsetup luksOpen $partition_path $mapper_name ||
|
||||
error
|
||||
|
||||
info "Mount partition..." &&
|
||||
sudo mount $mapper_path $mount_path ||
|
||||
error
|
||||
|
||||
success "Mounting successfull :)"
|
11
scripts/encryption/storage/single_drive/mount_on_boot.sh
Normal file
11
scripts/encryption/storage/single_drive/mount_on_boot.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
source "$(dirname "$(readlink -f "${0}")")/base.sh" || (echo "Loading base.sh failed." && exit 1)
|
||||
echo "Automount encrypted storages"
|
||||
echo
|
||||
set_device_mount_partition_and_mapper_paths
|
||||
|
||||
create_luks_key_and_update_cryptab $mapper_name $partition_path
|
||||
|
||||
update_fstab $mapper_path $mount_path
|
||||
|
||||
success "Installation finished. Please restart :)"
|
47
scripts/encryption/storage/single_drive/setup.sh
Normal file
47
scripts/encryption/storage/single_drive/setup.sh
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
source "$(dirname "$(readlink -f "${0}")")/base.sh" || (echo "Loading base.sh failed." && exit 1)
|
||||
echo "Setups disk encryption"
|
||||
|
||||
set_device_mount_partition_and_mapper_paths
|
||||
|
||||
overwritte_device_with_zeros
|
||||
|
||||
info "Creating new GPT partition table..."
|
||||
( echo "g" # create a new empty GPT partition table
|
||||
echo "w" # Write partition table
|
||||
)| sudo fdisk --wipe always "$device_path" ||
|
||||
error
|
||||
|
||||
info "Creating partition table..."
|
||||
( echo "n" # Create new partition
|
||||
echo "" # Accept default
|
||||
echo "" # Accept default
|
||||
echo "" # Accept default
|
||||
echo "p" # Create GPT partition table
|
||||
echo "w" # Write partition table
|
||||
)| sudo fdisk --wipe always "$device_path" ||
|
||||
error
|
||||
|
||||
info "Encrypt $device_path..." &&
|
||||
sudo cryptsetup -v -y luksFormat $partition_path ||
|
||||
error
|
||||
|
||||
info "Unlock partition..." &&
|
||||
sudo cryptsetup luksOpen $partition_path $mapper_name ||
|
||||
error
|
||||
|
||||
info "Create btrfs file system..." &&
|
||||
sudo mkfs.btrfs $mapper_path || error
|
||||
|
||||
info "Creating mount folder unter \"$mount_path\"..." &&
|
||||
sudo mkdir -p $mount_path || error
|
||||
|
||||
info "Mount partition..." &&
|
||||
sudo mount $mapper_path $mount_path ||
|
||||
error
|
||||
|
||||
info "Own partition by user..." &&
|
||||
sudo chown -R $USER:$USER $mount_path ||
|
||||
error
|
||||
|
||||
success "Encryption successfull :)"
|
12
scripts/encryption/storage/single_drive/umount.sh
Normal file
12
scripts/encryption/storage/single_drive/umount.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
source "$(dirname "$(readlink -f "${0}")")/base.sh" || (echo "Loading base.sh failed." && exit 1)
|
||||
echo "Unmount encrypted storages"
|
||||
|
||||
set_device_mount_partition_and_mapper_paths
|
||||
|
||||
info "Unmount $mapper_path..."
|
||||
sudo umount $mapper_path &&
|
||||
sudo cryptsetup luksClose $mapper_path ||
|
||||
error
|
||||
|
||||
success "Successfull :)"
|
Reference in New Issue
Block a user