[e-privacy] Cifroserver 2 - la vendetta
Marco A. Calamari
marcoc1 at dada.it
Mon Aug 22 10:42:54 CEST 2005
On Fri, 2005-08-19 at 23:20 +0200, Leandro Noferini wrote:
> Ciao a tutti,
>
> innanzitutto chiedo perdono per il titolo piuttosto ignobile ma ora non
> mi viene niente di più arguto.
>
> Allora io sarei per riprendere il discorso interrotto un paio di mesi fa
> sulle possibilità tecniche di cifrare i dati su computer non desktop e
> comincio con un breve riassunto di quello che è stato fatto nella prima
> versione.
>
> La necessità è la seguente: dato un computer non presenziato che svolge
> funzioni di server come è possibile usare partizioni cifrate in modo da
> evitare il più possibile accessi e modifiche dei dati contenuti anche
> contro coloro che riescono ad avere accesso fisico al computer in
> questione?
>
> La prima soluzione data è stata quella di avviare il sistema in una
> modalità "temporanea" nella quale non venivano avviati tutti i servizi
> ma solo quelli necessari perché il computer fosse raggiungibile e
> utilizzabile via rete. Purtroppo questa soluzione ha presentato troppi
> problemi perché fosse poi realizzabile e quindi è stata scartata.
Ciao Leandro,
scusa se esordisco con un appunto, ma sarebbe meglio che anche i
problemi venissero fatti circolare. Se questa e', come penso,
una call per attivita' tecnica, sarebbe meglio che anche
le attivita' fatte venissero relazionate pur se negative, ad evitare
duplicazioni di sforzi.
Oppure il virus di autistici (fare tutto senza comunicare niente,
ma dicendo che niente e' segreto) si e' diffuso anche da noi ?
> Di conseguenza è necessario usare un altro approccio. Durante la
> precedente discussione era stato suggerito di usare un initrd fatto ad
> hoc: in sostanza la cosa consisterebbe nel realizzare un initrd (che è
> un disco ram che può essere usato da un sistema linux per avviarsi, come
> viene fatto comunemente nei dischi di installazione) che abbia il
> supporto di rete e che faccia avviare anche un programma come ssh così
> che l'amministratore possa montare le varie partizioni cifrate e poi far
> terminare il processo di boot.
>
> Il problema mio è che di queste cose non ne so praticamente niente e
> quindi chiedo se ci fosse qualcuno con maggiore esperienza in queste
> cose così da cominciare a rompere il ghiaccio.
Fatto salvo che quello che dico potrebbe essere viziato dal
non sapere cosa e' stato fatto, vi allego due file di help
che si trovano nella documentazione di cryptsetup.
Sono come realizzare una root criptata che chieda la
password in console, ed uno script che fa la stessa
cosa leggendo le chiavi da una chiavetta usb.
Ora provo a sottolineare cosa penso che sarebbe meglio fare.
- le precauzioni prese sul serverone sono utili, ma poco
informatiche; in particolare non criptare nulla fa un po'
onco ...... siamo esposti ad un possibile altro attacco fisico.
- essendo il serverone fisicamente vicino, in attesa che si
riesca ad attuare una procedura di reboot remoto con dischi
criptati, suggerirei di implementare subito una soluzione
intermedia, in cui il serverone possa ripartire solo in
presenza fisica di uno dei root che vi inserisce temporaneamente
una chiave usb contenente la chiave di criptazione.
Il serverone bootstrappa una volta all'anno, in media,
quindi con 3 (anche 4, mi candido al ruolo) root fiorentini
in possesso della chiave direi che proprio non ci siano problemi.
I vantaggio e' che potremmo avere subito un server non ottimizzato
come disponibilita' (magari ci vorrebbe qualche ora in piu' per
farlo risalire) ma blindato come sicurezza.
Cosa ne pensate ?
JM2C. Marco
>
> Ovviamente resto aperto anche verso altre soluzioni.
============ cryptoroot howto
To setup cryptoroot you will need several things:
- an existing /boot partition
- a boot loader pointing at /boot (i recommend grub)
- a standard debian kernel
- an encrypted partition for the root filesystem
- a /etc/crypttab describing the root filesystem
- a /etc/fstab referring to the encrypted device mapper name
Step by step:
# Enter run-level 1
init 1
# Install a standard debian kernel (>= 2.6.4) and the initrd-tools
packages
# Replace 386 with whatever architecture you have (such as k8)
apt-get install initrd-tools kernel-image-2.6.8-1-386
# Edit /etc/crypttab and add the following line
# Replace /dev/hda4 with your backing device (lvm is ok, as is raid)
root /dev/hda4
# Start the encrypted root filesystem
/etc/init.d/cryptdisks start
# Enter a password for the filesystem when prompted
my_boot_password
# Now, setup a filesystem (/dev/mapper/root is always the encrypted
disk)
mkfs.ext3 /dev/mapper/root
# Mount the device for initialization
mount /dev/mapper/root /mnt
# Copy your root filesystem into place
cp -axv / /mnt
# Edit the new root's /mnt/etc/fstab to add the line
/dev/mapper/root / ext3 defaults 0 1
# Remove whatever the old root filesystem line was
# Enter the new root filesystem
chroot /mnt /bin/bash
# Mount your core filesystems (/usr, /var, etc)
mount sysfs /sys -t sysfs
mount proc /proc -t proc
mount /dev/??? /boot
# Setup the initrd (change 386 to the correct value)
mkinitrd -o /boot/initrd.img-2.6.7-1-386
# Configure your boot loader to use /dev/mapper/root for the root
filesystem
# If you are using grub, you can test boot without changing your old
setup
# Re-run your boot-loader setup program if needed (lilo)
# Reboot!
# If all works out, you will be prompted for a password at boot-up
# You can now add entries in /etc/crypttab for other partitions.
# Note that since /etc/keys is encrypted, it is ok to keep keys for the
other
# partitions in this directory. This is _NOT_ ok for unencrypted root.
================= cryptousb script
#!/bin/dash -e
# Boot from an encrypted usb stick
# Host. Do not use `hostname`, you might want to run this in a chroot
usbenc_host="`cat /etc/hostname`"
# Encrypted device and key location
usbenc_devices="/devfs/scsi/host0/bus0/target0/lun0/part2 /devfs/ub/a/part2"
usbenc_keypath="/hostkeys/${usbenc_host}"
# Where to write the rootkey
usbenc_rootkey="/dev2/usbenc_rootkey"
# Device mapper name to use
usbenc_dmname="secstick"
#usbenc_modules="uhci-hcd usb-storage ub sd-mod"
usbenc_modules="uhci-hcd usb-storage sd-mod"
usbenc_scriptname="`basename ${0}`"
# The rest should be generic
# Install modules in initrd
for m in ${usbenc_modules}; do
for k in `modprobe --set-version $VERSION --show-depends ${m} | cut
-b8-`; do
install -d ${INITRDDIR}/${k%/*}
install ${k} ${INITRDDIR}/${k}
done
done
# Generate initrd script
cat <<EOF >${INITRDDIR}/keyscripts/${usbenc_scriptname}
#!/bin/dash -e
# Install modules into the kernel
for m in ${usbenc_modules}; do
modprobe \${m}
done
# sleep 4 would be nice here
if [ ! -f ${usbenc_rootkey} ]; then
for usbenc_dev in ${usbenc_devices}; do
echo
echo
echo -n "Setting up \${dmname} (trying \${usbenc_dev})...[R]"
read dummy
if /sbin/cryptsetup create ${usbenc_dmname} \${usbenc_dev} && mount
-n /dev/mapper/${usbenc_dmname} /mnt -o ro; then
cat /mnt/${usbenc_keypath} >${usbenc_rootkey}
umount -n /mnt || true
/sbin/cryptsetup remove ${usbenc_dmname} || true
break
fi
done
fi
if [ -f ${usbenc_rootkey} ]; then
/sbin/cryptsetup -d ${usbenc_rootkey} -c \${cipher_mode} create \
${dmname} \${device}
echo
echo "=> \${dmname} is set up."
echo
fi
exit 0
EOF
chmod +x ${INITRDDIR}/keyscripts/${usbenc_scriptname}
--
+--------------- http://www.winstonsmith.info ---------------+
| il Progetto Winston Smith: scolleghiamo il Grande Fratello |
| the Winston Smith Project: unplug the Big Brother |
| Marco A. Calamari marcoc at dada.it http:// www.marcoc.it |
| DSS/DH: 8F3E 5BAE 906F B416 9242 1C10 8661 24A9 BFCE 822B |
+ PGP RSA: ED84 3839 6C4D 3FFE 389F 209E 3128 5698 ----------+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
URL: <http://lists.winstonsmith.org/pipermail/e-privacy/attachments/20050822/14341f92/attachment.pgp>
More information about the E-privacy
mailing list