Swap criptografada no Slack ou no Slamd64

Criptografar sua swap pode ser uma boa pedida. Aqui segue um script baseado no tutorial disponível no wiki do dm-crypt, com algumas modificações. Os detalhes para a configuração do dm-crypt são descritos no texto sobre home criptografado. Este procedimento pode ser facilmente adaptado para funcionar em outras distribuições.

1 Retire a ativação da swap em tempo de boot

Comente a linha

swapon -a

do seu /etc/rc.d/rc.S. Adicione no seu /etc/rc.d/rc.local:

if [ -x /etc/rc.d/rc.cryptoswap ]; then
  /etc/rc.d/rc.cryptoswap
fi

2 /etc/rc.d/rc.cryptoswap

Crie este script com permissão 755:

#!/bin/bash
#
# /etc/rc.d/rc.cryptoswap - mount the swap partition encrypted
#

SWAPDEVICES=`cat /etc/fstab | grep "swap" | awk '{ print $1 }' | tr '\n' ' '`
NR=0
for DEVICE in ${SWAPDEVICES}; do
  echo "Creating encrypted swap on ${DEVICE}"

  swapoff "${DEVICE}" &> /dev/null
  swapoff /dev/mapper/swap${NR} &> /dev/null
  dmsetup remove swap${NR} &> /dev/null

  head -c 2880 /dev/urandom | uuencode -m - | head -n 65 | tail -n 64 | cryptsetup create "swap${NR}" "${DEVICE}"
  mkswap "/dev/mapper/swap${NR}"

  swapon "/dev/mapper/swap${NR}"

  NR=$((${NR}+1))
done

exit 0

About this document ...

This document was generated using the LaTeX2HTML translator Version 2002-2-1 (1.71)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html swap.tex -nonavigation -notop_navigation -show_section_numbers -split 0

The translation was initiated by on 2007-08-22


2007-08-22
AnexoTamanho
PDF icon swap.pdf33.06 KB
File swap.tex1.7 KB

Nível:

Idioma: