Tomb - el sepulturero criptográfico Jaromil @ Dyne.org Hackmeeting 2019 NextEmerson CSA Firenze https://dyne.org/software/tomb https://github.com/dyne/tomb https://files.dyne.org/tomb http://freshcode.club/projects/tomb Una Tomba consiste di: - File .tomb che e' il file grande con i dati - File .key che e' la chiave per accedere ai dati - Password da memorizzare per attivare la chiave l'estensione non e' obbligatoria, puo' essere una qualsiasi Scava una tomba di 100 MiB: : tomb dig -s 100 loculo.tomb Forgia una chiave (e scegline la password) : tomb forge -k loculo.key Sigilla la tomba con la chiave : tomb lock -k loculo.key loculo.tomb A questo punto il file `loculo.tomb` puo' essere aperto solo in presenza della chiave `loculo.key` e conoscendone la password. Apri loculo.tomb su /media/loculo usando loculo.key : tomb open -k loculo.key loculo.tomb Per chiuderla tomb close loculo oppure solo tomb close C'e' altro: tomb resize tomb index tomb search tomb list tomb ps tomb slam ... !Quiz! l'algoritmo crittografico che protegge la chiave con una password e' simmetrico o asimmetrico? Fully compliant with the FIPS 197 advanced encryption standard published by NIST and with the following industry standards: Information technology -- Security techniques -- Encryption algorithms ISO/IEC 18033-1:2015 -- Part 1: General ISO/IEC 18033-3:2010 -- Part 3: Block ciphers Tomb implementation is known to address at least partially issues raised in: Information technology -- Security techniques -- Key management ISO/IEC 11770-1:2010 -- Part 1: Framework ISO/IEC 11770-2:2008 -- Part 2: Mechanisms using symmetric techniques ISO/IEC 27005:2011 Information technology -- Security techniques -- Information security risk management ISO/IEC 24759:2014 Information technology -- Security techniques -- Test requirements for cryptographic modules Usi un po' piu' avanzati di Tomb Per la sicurezza dei dati e' molto importante tenere la chiave separata dalla tomba su differenti supporti fisici: memorie di massa, chiavette usbe o server online. Con Tomb e' anche possibile nascondere la chiave dentro una JPEG : tomb bury -k loculo.key sorrento.jpeg tomb open -k sorrento.jpeg loculo.tomb Per tenere la chiave su un server e usarla senza mai salvarla in locale : scp loculo.key io@casa.dyndns.net wipe loculo.key ssh io@casa.dyndns.net 'cat ./loculo.key' | tomb open loculo.tomb -k -` Nuova feature di Tomb: l'Oracolo della Sfinge! Tomb usando l'oracolo di sphinx Libsphinx e' un'implementazione libera del "Password-authenticated key agreement" anche detto "PAKE" https://github.com/stef/libsphinx https://github.com/stef/pwdsphinx Fatti coraggio, clona Tomb ed entra nell'anfratto git clone https://github.com/dyne/tomb Se sei un hipster e usi docker basta fare : cp -v extras/test/Dockerfile . docker build -t dyne/tomb . docker run -it --privileged dyne/tomb /bin/bash Istalla le dipendenze di sistema : apt-get update -y -q && apt-get install -y -q \ zsh cryptsetup gawk libgcrypt20-dev steghide qrencode \ python python2.7 python3-pip python3-dev libsodium-dev \ libssl-dev make gcc g++ sudo gettext file bsdmainutils : per sphinx servono `python python2.7 python3-pip python3-dev libsodium-dev` eppoi il pacchetto wheel in pip3 : pip3 install setuptools wheel Compila ed istalla sphinx : set -ex git clone https://github.com/stef/libsphinx cd libsphinx git submodule update --init --recursive --remote cd src sed -i 's|/usr/local|/usr|' makefile make sudo make install ldconfig pip3 install pwdsphinx sudo mkdir -p /etc/sphinx Istalla la configurazione di sphinx da dentro tomb : cp test/sphinx.cfg /etc/sphinx/config [client] verbose = False address = 127.0.0.1 port = 2355 datadir = /tmp/.sphinx/ [server] verbose = False address = 127.0.0.1 port = 2355 datadir = /tmp/.sphinx/ keydir = /tmp/.sphinx/ [websphinx] pinentry=/usr/bin/pinentry log= Fai partire l'oracolo di sphinx (un demone in python) : oracle & usa il client sphinx per creare, ritrovare e cambiare le password : echo 'password principale' | sphinx create utente https://example.com ulsd 0 ulsd sono delle flags: - `u` lettere maiuscole - `l` lettere minuscole - `s` simboli - `d` numeri Get : echo 'password principale' | sphinx get username https://example.com Change + Commit : echo 'password principale' | sphinx change username https://example.com echo 'password principale' | sphinx commit username https://example.com Delete : sphinx delete username https://example.com Proviamo a fare una tomba con sphinx : docker run -it --privileged dyne/tomb /bin/bash Scava una tomba di 10MiB : tomb dig -s 10 test-sphinx.tomb Crea una chiave usando l'oracolo di sphinx : tomb forge --sphx-user jaromil --sphx-host https://dyne.org Blocca la tomba con la chiave nell'oracolo di sphinx : tomb lock --sphx-user jaromil --sphx-host https://dyne.org \ -k test-sphinx.key test-sphinx.tomb Apri la tomba con la chiave nell'oracolo di sphinx : tomb open --sphx-user jaromil \ --sphx-host https://dyne.org \ -k test-sphinx.key test-sphinx.tomb Domande? Risposte? !Quiz! :^) ,--. ( o O) \||| ,--. ( x o) \||| ,--. ( x x) \|:|