GNU/Linux >> Belajar Linux >  >> Ubuntu

Enkripsi data Anda dengan EncFS di Ubuntu 15.10

EncFS menyediakan sistem file terenkripsi di ruang pengguna. Ini berjalan tanpa izin khusus dan menggunakan library FUSE dan modul kernel Linux untuk menyediakan antarmuka sistem file. Ini adalah sistem file pass-through, bukan  perangkat blok terenkripsi, yang berarti dibuat di atas  sistem file yang ada. Tutorial ini menunjukkan bagaimana Anda dapat menggunakan EncFS di Ubuntu 15.10 (Wiley Werewolf) untuk mengenkripsi data Anda.

1 Catatan Awal

Saya menggunakan nama pengguna falko di Sistem Ubuntu 15.10 saya dalam tutorial ini. Audit keamanan telah mengungkapkan beberapa masalah dalam penerapan encf saat ini, harap lihat peringatan keamanan di bawah untuk memutuskan apakah cara Anda ingin menggunakan encf terpengaruh oleh masalah ini. Alternatif untuk encfs adalah ecryptfs (https://launchpad.net/ecryptfs) yang akan saya bahas di tutorial lain.

Encfs informasi keamanan

"Menurut audit keamanan oleh Taylor Hornby (Defuse Security), implementasi Encfs saat ini rentan atau berpotensi rentan terhadap beberapa jenis serangan. Misalnya, penyerang dengan akses baca/tulis ke data terenkripsi mungkin menurunkan dekripsi kompleksitas untuk data yang dienkripsi selanjutnya tanpa diketahui oleh pengguna yang sah, atau mungkin menggunakan analisis waktu untuk menyimpulkan informasi. Sampai masalah ini diselesaikan, encfs tidak boleh dianggap sebagai rumah yang aman untuk data sensitif dalam skenario di mana serangan seperti itu mungkin terjadi."

2 Menginstal EncFS

EncFS dapat diinstal sebagai berikut (kami membutuhkan hak akses root, oleh karena itu kami menggunakan sudo):

sudo apt-get install encfs

Anda sekarang harus melihat halaman manual EncFS untuk membiasakan diri dengan pilihannya:

man encfs

3 Menggunakan EncFS

Sekarang saya akan membuat direktori yang dienkripsi dan didekripsi di direktori home saya:

mkdir -p ~/encrypted
mkdir -p ~/decrypted

Direktori yang didekripsi bertindak sebagai titik pemasangan untuk direktori terenkripsi. Untuk memasang ~/encrypted ke ~/decrypted, jalankan saja:

encfs ~/encrypted ~/decrypted

Jika Anda menjalankan perintah ini untuk pertama kalinya, pengaturan EncFS dimulai, dan Anda harus menentukan kata sandi untuk volume terenkripsi:

[email protected]:~$ encfs ~/encrypted ~/decrypted
Creating new encrypted volume.
Please choose from one of the following options:
enter "x" for expert configuration mode,
enter "p" for pre-configured paranoia mode,
anything else, or an empty line will select standard mode.
?> <-- p
Paranoia configuration selected.
Configuration finished. The filesystem to be created has
the following properties:
Filesystem cipher: "ssl/aes", version 3:0:2
Filename encoding: "nameio/block", version 4:0:2
Key Size: 256 bits
Block Size: 1024 bytes, including 8 byte MAC header
Each file contains 8 byte header with unique IV data.
Filenames encoded using IV chaining mode.
File data IV is chained to filename IV.
File holes passed through to ciphertext.
-------------------------- WARNING --------------------------
The external initialization-vector chaining option has been
enabled. This option disables the use of hard links on the
filesystem. Without hard links, some programs may not work.
The programs 'mutt' and 'procmail' are known to fail. For
more information, please see the encfs mailing list.
If you would like to choose another configuration setting,
please press CTRL-C now to abort and start over.
Now you will need to enter a password for your filesystem.
You will need to remember this password, as there is absolutely
no recovery mechanism. However, the password can be changed
later using encfsctl.
New Encfs Password: <-- Enter a secure password here
Verify Encfs Password: <-- Enter the secure password a second time

Pastikan Anda mengingat kata sandinya karena tidak ada cara untuk memulihkan data terenkripsi jika Anda lupa kata sandinya!

Anda sekarang harus menemukan volume EncFS di output

mount
[email protected]:~$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=1006420k,nr_inodes=251605,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=204480k,mode=755)
/dev/mapper/server1--vg-root on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset,clone_children)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=21,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sda1 on /boot type ext2 (rw,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=204480k,mode=700,uid=1000,gid=1000)
encfs on /home/falko/decrypted type fuse.encfs (rw,nosuid,nodev,relatime,user_id=1001,group_id=1001)

dan

df -h
[email protected]:~$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 983M 0 983M 0% /dev
tmpfs 200M 4.9M 195M 3% /run
/dev/dm-0 28G 1.7G 25G 7% /
tmpfs 999M 0 999M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 999M 0 999M 0% /sys/fs/cgroup
/dev/sda1 236M 51M 173M 23% /boot
tmpfs 200M 0 200M 0% /run/user/1000
encfs 28G 1.7G 25G 7% /home/falko/decrypted

Untuk menyimpan data Anda dalam bentuk terenkripsi, masukkan data Anda ke dalam direktori yang didekripsi, seperti yang Anda lakukan dengan direktori normal:

cd ~/decrypted
echo "hello foo" > foo
echo "hello bar" > bar
ln -s foo foo2

Jika Anda memeriksa isi direktori, Anda akan melihat bahwa Anda dapat melihatnya dalam bentuk tidak terenkripsi...

ls -l
[email protected]top:~/decrypted$ ls -l
total 8
-rw-rw-r-- 1 falko falko 10 Nov 10 14:57 bar
-rw-rw-r-- 1 falko falko 10 Nov 10 14:57 foo
lrwxrwxrwx 1 falko falko 3 Nov 10 14:57 foo2 -> foo

... sementara di direktori terenkripsi, itu dienkripsi:

cd ~/encrypted
ls -l
[email protected]:~/encrypted$ ls -l
total 8
lrwxrwxrwx 1 falko falko 24 Nov 10 14:57 gIKlbEtIpTfiGOCy,wKFpMFd -> nZgFI3s62v5LtaHOu-V4lUSy
-rw-rw-r-- 1 falko falko 26 Nov 10 14:57 mEqwt,ssEJhGYpN8HfJMoVxk
-rw-rw-r-- 1 falko falko 26 Nov 10 14:57 nZgFI3s62v5LtaHOu-V4lUSy

Untuk melepas volume terenkripsi, jalankan:

cd
fusermount -u ~/decrypted

Periksa output dari...

mount

... dan...

df -h

... dan Anda akan melihat bahwa volume EncFS tidak terdaftar lagi.

Untuk memasangnya kembali, jalankan

encfs ~/encrypted ~/decrypted

Anda akan dimintai kata sandi yang Anda tentukan sebelumnya:

[email protected]:~$ encfs ~/encrypted ~/decrypted
EncFS Password:<-- yoursecretpassword

Jika Anda menentukan kata sandi yang benar, ini akan memasang direktori ~/encrypted ke ~/decrypted dari mana Anda dapat mengakses data terenkripsi Anda dalam bentuk tidak terenkripsi. Jika Anda lupa kata sandinya, data terenkripsi Anda akan hilang!

Jika Anda ingin mengubah kata sandi, Anda dapat melakukannya dengan

encfsctl passwd ~/encrypted

perintah.

[email protected]:~$ encfsctl passwd ~/encrypted
Masukkan sandi Encfs saat ini
Sandi EncFS:<-- sandirahasiaanda
Masukkan sandi Encfs baru
Sandi Encfs Baru:<-- newsecretpassword
Verifikasi Sandi Encfs:<-- newsecretpassword
Tombol Volume berhasil diperbarui.

  • EncFS:http://www.arg0.net/encfs
  • Ubuntu:http://www.ubuntu.com/

Ubuntu
  1. Cara Mengamankan Nginx dengan Lets Encrypt Di Ubuntu 20.04 / 18.04

  2. Melindungi Obrolan Anda Dengan qTox di Ubuntu Linux

  3. Encfs – Cara Mengenkripsi dan Melindungi Data dengan Kata Sandi di Ubuntu/Debian/Linux Mint

  1. Amankan Nginx dengan Lets Encrypt di Ubuntu 18.04

  2. Amankan Nginx dengan Lets Encrypt di Ubuntu 16.04

  3. Amankan Apache dengan Lets Encrypt di Ubuntu 18.04

  1. Amankan Nginx dengan Lets Encrypt di Ubuntu 20.04

  2. Amankan Apache dengan Lets Encrypt di Ubuntu 20.04

  3. Cara Mengenkripsi File dengan Tomb di Ubuntu 16.04 LTS