add ecryptfs_storage.sh and tests
This commit is contained in:
parent
9a4589f1bc
commit
6c5c3d9492
|
@ -0,0 +1,34 @@
|
|||
[ "$EUID" -eq 0 ] || { echo '[ERROR] The script must be executed under sudo!'; exit 1; };
|
||||
|
||||
echo '----- START ECRYPTFS STORAGE -----';
|
||||
|
||||
# Get action
|
||||
Action=${1};
|
||||
echo '[INFO] Action: '${Action}'';
|
||||
Directory=${2};
|
||||
echo '[INFO] Directory: '${Directory}'';
|
||||
|
||||
if [ "${Action}" == 'mount' ]; then {
|
||||
# Install packages
|
||||
apt install -y ecryptfs-utils
|
||||
|
||||
# Key file must contain: Passphrase, Signature, KeyBytes (default 32), Cipher (default 'aes')
|
||||
# Signature can be calculated with ecryptfs-add-passphrase
|
||||
KeyFile=${3};
|
||||
echo '[INFO] Key File: '${KeyFile}'';
|
||||
source <( GNUPGHOME=/home/amnesia/.gnupg gpg -d "${KeyFile}"; );
|
||||
|
||||
[ -z "${Passphrase}" ] && { echo '[ERROR] Key File cannot be decrypted. Exiting.'; exit 1; };
|
||||
|
||||
mount -t ecryptfs "${Directory}" "${Directory}" -o key=passphrase:passphrase_passwd=${Passphrase},ecryptfs_unlink_sigs,ecryptfs_fnek_sig=${Signature},ecryptfs_key_bytes=${KeyBytes},ecryptfs_cipher=${Cipher},ecryptfs_sig=${Signature};
|
||||
[ $? -eq 0 ] || { echo "[ERROR] Can't mount directory. Exiting."; exit 1; };
|
||||
echo '[INFO] Directory mounted';
|
||||
} fi;
|
||||
|
||||
if [ "${Action}" == 'umount' ]; then {
|
||||
umount ${Directory};
|
||||
[ $? -eq 0 ] || { echo "[ERROR] Can't unmount directory. Exiting."; exit 1; };
|
||||
echo '[INFO] Directory unmounted';
|
||||
} fi;
|
||||
|
||||
echo '----- END ECRYPTFS STORAGE -----';
|
|
@ -1,28 +0,0 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>
|
||||
TEST PAGE
|
||||
</title>
|
||||
<body>
|
||||
<h1>HTML Ipsum Presents</h1>
|
||||
<p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href="#">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p>
|
||||
<h2>Header Level 2</h2>
|
||||
<ol>
|
||||
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
|
||||
<li>Aliquam tincidunt mauris eu risus.</li>
|
||||
</ol>
|
||||
<blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p></blockquote>
|
||||
<h3>Header Level 3</h3>
|
||||
<ul>
|
||||
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
|
||||
<li>Aliquam tincidunt mauris eu risus.</li>
|
||||
</ul>
|
||||
<pre><code>
|
||||
#header h1 a {
|
||||
display: block;
|
||||
width: 300px;
|
||||
height: 80px;
|
||||
}
|
||||
</code></pre>
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
|
@ -0,0 +1,20 @@
|
|||
-----BEGIN PGP MESSAGE-----
|
||||
|
||||
hQIMA+2juZserviIAQ//b+oWlcnxNsZt9uof4ErKPLFqIe1Z7RFqlQJugoGcV7Mi
|
||||
glSj1zya3rIpVHGuYn+iEZLEyiGK9bqV7ivyyUZVOihQfIeno/oPSeJ+x18pU9Q8
|
||||
RneT6Eb3f4Wo59rd3gPOnpPIHHMnsXnZokRV2+1PGRA32HG1R5d9Un+yif9dMmwF
|
||||
MIY9G7peP5sp1Pmhf93BDQQBPHiufiepK3TXtk7XZbx3oix05/ZboLVfxPce7lYo
|
||||
pkcNwgCfDXrijRweqjiDzgts/1JFuN8fQUov6wu8sw+Fk1h+s7aIeg1Scu1abwM1
|
||||
pJxggcaFBunY8MvL5RMfgDZ6pGaaonzYAzZjbR+KYl88On5aqBBKV346QV54zCw5
|
||||
eKvyI+7G28XmtCjlkhPQ+H2bMicW70Hzq4xQC6D5bqNH5SwoJKy5vReoNf89EEXo
|
||||
eQHsJW6jKbHU7bIOJezSqRLCg6tSGF8eW7H75r6mc5NmIFv0nH89PWDsK337e7ny
|
||||
qc4dK2qFA46nq7jqbVxc46svmNOVdCr/KeU+Uz0pPzKhsvEqKqGuLR3BsrPMOjGE
|
||||
8hgxjKzPAnKozqQnsPVGIe1m95KQ5FrkpQa4hV+tC5CUK6b+hIzV7s7FXqWQdeCe
|
||||
BW27J3Zas499c61bn/NKexlEgHbx+bEdtsC+4FA6qX9aCgpccuQpZr62/p29WeLS
|
||||
wBEBgqZ2cyJ2q0JvAYlJrRhq3I3W5IOQBo8/785KNg8FIlaN7CTokp7nXi7aF042
|
||||
YR6en8Wux+TnHTdSs+xQ7pdNTTxyiQ/wBqdq6d7LBW5fH014feSNLzkY8Wxh4O4Z
|
||||
Q1eeigZiDWYX0vyMAyh2XM9SKw4x4EGcDRrtOIBRrY7D/t5V7CC9FrpDUmb+eboK
|
||||
YxA1a64Z/QoIl/fzGnbNA10QlEcqNqoz9BcFgXAP4ShiW6qHFWyFY27RzCo8l6q1
|
||||
qoxrYn0U0FQruBdxc9DK/bWk0g==
|
||||
=Atb5
|
||||
-----END PGP MESSAGE-----
|
|
@ -0,0 +1,6 @@
|
|||
CurrentDir=$( dirname "${BASH_SOURCE[0]}"; );
|
||||
EcryptfsScript=$( realpath ${CurrentDir}/../ecryptfs_storage.sh; );
|
||||
TestEncryptedDirectory=$( realpath ${CurrentDir}/input/test_ecryptfs; );
|
||||
TestEncryptedKey=$( realpath ${CurrentDir}/input/test_ecryptfs_Key.sh.asc; );
|
||||
|
||||
sudo bash "${EcryptfsScript}" mount "${TestEncryptedDirectory}" "${TestEncryptedKey}"
|
|
@ -0,0 +1,5 @@
|
|||
CurrentDir=$( dirname "${BASH_SOURCE[0]}"; );
|
||||
EcryptfsScript=$( realpath ${CurrentDir}/../ecryptfs_storage.sh; );
|
||||
TestEncryptedDirectory=$( realpath ${CurrentDir}/input/test_ecryptfs; );
|
||||
|
||||
sudo bash "${EcryptfsScript}" umount "${TestEncryptedDirectory}"
|
Loading…
Reference in New Issue