Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-20 Thread deloptes
rhkra...@gmail.com wrote:

> Darn, please ignore the previous message -- didn't mean to send, was
> working on a draft, meant to save as a draft instead of send.
> 
> (Of course, if you want to reply, feel free.)

.



Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-15 Thread Stefan Monnier
> But in any case, I'm not sure about booting Grub on an SSD from the
> BIOS, because AIUI Grub uses sector addresses to find its core.img,
> and AIUI sectors get shuffled around by the SSD controller.

That shuffling is purely internal and hence completely invisible
(barring bugs and the need to sometimes make sure data is *really*
erased), so that's a non-issue.


Stefan



Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-14 Thread David Wright
On Thu 10 Jun 2021 at 23:43:12 (-0700), David Christensen wrote:
> On 6/10/21 9:31 PM, David Wright wrote:
> > I'm about to install buster or bullseye on a newly acquired laptop
> > with an SSD (a first for me). I'm intending to clean (zero or
> > randomise) the entire drive with dd before I start, and am
> > interested in any pitfalls with that.
> > 
> > I will also encrypt the new /home partition, but for the remaining
> > partitions I need to decide whether to add mount's discard option,
> > or use a weekly systemd trim, or leave it entirely up to the garbage
> > collection in the SSD device itself (which is an nvme THNSN5512GPUK
> > TOSHIBA, presumably an OEM model supplied for this HP Spectre).
> > 
> > The machine has 16GB of memory, so I wasn't intending to use swap.
> > (It won't have to hibernate, and if push came to shove, there's
> > always the possibility of setting up a swapfile or a ramdisk.)
> > 
> > Background:
> > 
> > The July 2017 system was pre-installed with Windows 10.
> > 
> > I have copied the entire disk to external spinning rust, and can
> > mount partitions from this image. It's difficult to foresee my ever
> > wanting to reload and run this Windows system.
> > 
> > The drive has unencrypted information on it, either in existing files,
> > or in deleted/overwritten/whatever ones (though I think that is
> > irrelevant to the method for erasing them).
> > 
> > I don't work for the CIA, so "basic" erasure methods are sufficient,
> > ie so-called logical and digital sanitisation, but not analogue
> > sanitisation/purging. I'm just encrypting stuff like personal bank
> > records etc, and not looking for anything like plausible deniability.
> 
> You want to command the SSD controller to do a "secure erase".  The
> manufacturer should provide a utility for this, but it will likely
> require Windows.  In years past I have found Linux CLI utilities to do
> secure erase.  STFW for details.

Yes, I guess the difficulty with using Windows would be that I don't
think it can erase itself while running the program.

Others' suggestions:

  Jeremy: the referenced article seems to apply to SSDs that are SATA,
  whereas this one is NVMe.

  Glenn: the same article warns that DBAN is not designed for SSDs.

  songbird, Andrew: the pre-existing data is not all ours, so it
  might include others' personal data (mainly education, but could
  be personnel material, given in confidence), so I feel the moral
  need to erase it with at least a best attempt.
  I need to investigate what's talked about in
  StorageUtilities311_Manual_ENG.pdf that Toshiba can allegedly
  supply as bootable media.

  Polyna-Maude: You *seem* to be suggesting that I encrypt on a
  file-by-file basis rather than the whole of /home. That can't
  work because you don't know a priori whether an incoming file
  is sensitive or not … and you'd always being having to make
  decisions.
  Either that, or you're overinterpreting what I wrote: I don't
  encrypt partitions other than /home and swap. Home, obviously,
  and swap because you have no control over what gets put there.
  Besides, if swap gets used (beyond certain static uses that
  I've read about, but never experienced), speed is already up
  the spout. I either kill browsers, or the OOM killer might
  do some culling.

> I would then make a decision between BIOS/MBR or UEFI/GPT.  I prefer
> the former so that I can boot system images in the older machines in
> my SOHO LAN.  Eventually we will all be using the latter.

I've already made that switch to GPT (with one exception for an
ancient, hardly used now, laptop. However, I don't burn my bridges,
and always leave a BIOS Boot partition (unformatted) in place:
con: 3MB wasted; pro: alignments of 4MB throughout the drive.

But in any case, I'm not sure about booting Grub on an SSD from the
BIOS, because AIUI Grub uses sector addresses to find its core.img,
and AIUI sectors get shuffled around by the SSD controller. OTOH,
booting with UEFI is carried out entirely through files found via
their filesystems, and the sector-shuffling doesn't affect that.

> I would then install Debian using the Debian Installer, choose manual
> partitioning, and partition the SSD as follows:
> 
> 1.  Create a 1 GB unencrypted partition with ext4 and mount it at /boot.
> 
> 2.  Create at least a 1 GB encrypted (dm-crypt) swap partition.  I
> experimented with no swap in the past and found that the systems were
> unstable when free memory was low.

I don't encrypt root, so I don't bother with (1).

I think I will create (2), but leave it unused for the time being.
I actually use the trick described here to LABEL my random-key
swap with a tiny filesystem on my other machines:
https://wiki.archlinux.org/index.php/Dm-crypt/Swap_encryption

> 3.  Create a small (I use 13 GB) encrypted (LUKS) ext4 partition and
> mount it at / (root).

I'm more generous, at 29GB.

> Once Debian is installed, I would take a raw binary image of the
> system drive for 

Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-12 Thread David Christensen

On 6/11/21 7:59 AM, Polyna-Maude Racicot-Summerside wrote:

Hi,

On 2021-06-11 12:31 a.m., David Wright wrote:

I'm about to install buster or bullseye on a newly acquired laptop
with an SSD (a first for me). I'm intending to clean (zero or
randomise) the entire drive with dd before I start, and am
interested in any pitfalls with that.

I will also encrypt the new /home partition, but for the remaining
partitions I need to decide whether to add mount's discard option,
or use a weekly systemd trim, or leave it entirely up to the garbage
collection in the SSD device itself (which is an nvme THNSN5512GPUK
TOSHIBA, presumably an OEM model supplied for this HP Spectre).

The machine has 16GB of memory, so I wasn't intending to use swap.
(It won't have to hibernate, and if push came to shove, there's
always the possibility of setting up a swapfile or a ramdisk.)

Background:

The July 2017 system was pre-installed with Windows 10.

I have copied the entire disk to external spinning rust, and can
mount partitions from this image. It's difficult to foresee my ever
wanting to reload and run this Windows system.

The drive has unencrypted information on it, either in existing files,
or in deleted/overwritten/whatever ones (though I think that is
irrelevant to the method for erasing them).

I don't work for the CIA, so "basic" erasure methods are sufficient,
ie so-called logical and digital sanitisation, but not analogue
sanitisation/purging. I'm just encrypting stuff like personal bank
records etc, and not looking for anything like plausible deniability.

Cheers,
David.


Why do you really want so much encryption level (swap with discard,
encrypted swap, encrypted all the partition, etc).
Other than your user data and possibly some config files, not much use
to encrypt everything. Do you have such a high risk of security breach
that it's worth the speed lost imposed by encryption ? Because yes
there's a cost and it's speed.



The key is to have a processor with AES-NI or equivalent.  With AES-NI, 
the loss is usually small enough to be tolerable -- less than 10%, 
depending upon CPU and drive(s).  Without AES-NI, I seem to recall the 
slow-down was very apparent -- half speed, quarter speed, etc..  RAID 
stacks with fast drives, encryption at the bottom, and more drives than 
CPU cores would be the worst case scenario.



A good alternative for a single-drive laptop is to use a self-encrypting 
drive (SED).  These have dedicated hardware encryption/ decryption.  I 
expect the slow-down is negligible (less than 1%).



David



Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-12 Thread David Christensen

On 6/11/21 6:01 AM, Reco wrote:

On Fri, Jun 11, 2021 at 05:55:02AM -0700, David Christensen wrote:

On 6/10/21 11:49 PM, Reco wrote:

On Thu, Jun 10, 2021 at 11:43:12PM -0700, David Christensen wrote:

I don't bother with the 'discard' option in /etc/fstab, but perhaps I
should.  The fstab(5) and mount(8) manual pages are unclear if
'discard' applies to swap or ext4.


swapon(8):

 -d, --discard[=policy]
  Enable  swap  discards ... The /etc/fstab mount options discard,
discard=once, or discard=pages may also be used to enable discard flags.


Therefore 'discard' can be applied to both ext4 and swap.


Thank you for the clarification regarding trim and swap.

Where do you see the information for ext4?


You just have to know where to look - ext4(5):

discard/nodiscard
Controls  whether  ext4  should issue discard/TRIM commands to the
underlying block device when blocks are freed.  This is useful for SSD
devices and sparse/thinly-provisioned LUNs, but it is off by default
until sufficient testing has been done.


How exactly this ended in manpages section 5 (which is "File formats and
conventions eg /etc/passwd") is anyone's guess.

Reco



Thank you.


I needed to RTFM MOUNT(8) more carefully:

FILESYSTEM-SPECIFIC MOUNT OPTIONS
   You  should  consult  the respective man page for the filesystem 
first.
   If you want to know what options the  ext4  filesystem 
supports,  then

   check  the ext4(5) man page.


David




Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-11 Thread Michael Stone

On Thu, Jun 10, 2021 at 11:31:07PM -0500, David Wright wrote:

I'm about to install buster or bullseye on a newly acquired laptop
with an SSD (a first for me). I'm intending to clean (zero or
randomise) the entire drive with dd before I start, and am
interested in any pitfalls with that.


Do not try to write data to the drive, it'll just wear the drive out a 
bit and won't actually accomplish what you're trying to do.


Install the nvme-cli package and use something like (this will destroy 
the data on the drive, don't play with it):

nvme format -s1 /dev/nvme0n1
the -s1 triggers the drive's secure erase functionality.

If you're lucky that will work. If not (some manufacturers are more 
trouble than others) you can look for a workaround. 



Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-11 Thread Michael Stone

On Fri, Jun 11, 2021 at 06:19:37PM +0300, Reco wrote:

Encryption costs me whopping 13 MB/s out of 385.


Right now on my desktop I can read about 1.4GByte/s on an unencrypted 
partition and 1.3Gbyte/s on an encrypted partition. Whether that's 
significant is subjective.




Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-11 Thread Reco
Hi.

On Fri, Jun 11, 2021 at 10:59:21AM -0400, Polyna-Maude Racicot-Summerside wrote:
> Because yes there's a cost and it's speed.

I call this cost acceptable:

# pv /dev/sda3 > /dev/zero
^C50GiB 0:00:04 [ 385MiB/s] 


# cryptsetup status /dev/mapper/sda3_crypt
/dev/mapper/sda3_crypt is active and is in use.
  type:LUKS1
  cipher:  aes-xts-plain64
  keysize: 512 bits
  key location: dm-crypt
  device:  /dev/sda3

# pv /dev/mapper/sda3_crypt > /dev/zero
^C68GiB 0:00:05 [ 372MiB/s]

Encryption costs me whopping 13 MB/s out of 385.


And note that it's a 4 years old laptop (and it was pretty cheap when I
bought it) with SSD surpassing its age.

Reco



Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-11 Thread ghe2001
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256




‐‐‐ Original Message ‐‐‐

On Thursday, June 10th, 2021 at 10:31 PM, David Wright 
 wrote:

> I'm intending to clean (zero or
> randomise) the entire drive with dd before I start

Have you considered dban?  Takes a while, but works real good.

> The July 2017 system was pre-installed with Windows 10.

You for sure need to get rid of those Winders bits :-)

Dban followed by a Advanced CLI installation from a CD is what I always do.

--
Glenn English
-BEGIN PGP SIGNATURE-
Version: ProtonMail

wsBzBAEBCAAGBQJgw35MACEJEJ/XhjGCrIwyFiEELKJzD0JScCVjQA2Xn9eG
MYKsjDIHSwf/VOtmJXRyPocP/f2aR7qwaA5n8JBDGjvTs+y1MUXjBxQJlIUz
GYONtM2V66JYmHSbTi1E76xMsYrHPBRNH0xcHxrZ+nT7NmWhsPd/MEGCKZLd
3qB8URm/GSlwFh8BGvGZvNH5aTcM+yyClGMvsQ3nsZH9oORrXNXFbV3ZLEdZ
l3pCneGotYFmwTaNHJ8XB46LuJddYDh4ScTiQtFdjGxybsQCcCi48y6lSDuL
ZdsSOr9IVCSM2VW+Jx/dJTusB4lQz/T9dzbEYeodejzKyhKJXE03z2W/dD+m
XsIYC6w38Gyo+U38vwj5jHD/7bS7FyMBsngneD7pIZMwPl6RnRcs3Q==
=AOaa
-END PGP SIGNATURE-



Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-11 Thread rhkramer
Darn, please ignore the previous message -- didn't mean to send, was working 
on a draft, meant to save as a draft instead of send.

(Of course, if you want to reply, feel free.)

On Friday, June 11, 2021 11:01:40 AM rhkra...@gmail.com wrote:
> On Friday, June 11, 2021 02:49:03 AM Reco wrote:
> > On Thu, Jun 10, 2021 at 11:43:12PM -0700, David Christensen wrote:
> > > I don't bother with the 'discard' option in /etc/fstab, but perhaps I
> > > should.  The fstab(5) and mount(8) manual pages are unclear if
> > > 'discard' applies to swap or ext4.
> > 
> > swapon(8):
> >-d, --discard[=policy]
> >
> >   Enable  swap  discards ... The /etc/fstab mount options discard,
> > 
> > discard=once, or discard=pages may also be used to enable discard flags.
> 
> So, I'm not clear on what happens if you don't use the discard option.  I
> assume that the data in swap is swapped back (written back) to the proper
> location in RAM before reusing the swap space, which would be unnecessary
> if the
> 
> 
>-d, --discard
>   Discard freed swap pages before they are reused, if the swap
> device supports the discard or trim operation.  This may improve
> performance on some  Solid  State  Devices, but  often  it  does  not.  
> The  /etc/fstab mount option discard may be also used to enable discard
> flag.



Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-11 Thread Reco
On Fri, Jun 11, 2021 at 11:01:40AM -0400, rhkra...@gmail.com wrote:
> On Friday, June 11, 2021 02:49:03 AM Reco wrote:
> > On Thu, Jun 10, 2021 at 11:43:12PM -0700, David Christensen wrote:
> > > I don't bother with the 'discard' option in /etc/fstab, but perhaps I
> > > should.  The fstab(5) and mount(8) manual pages are unclear if
> > > 'discard' applies to swap or ext4.
> > 
> > swapon(8):
> > 
> >-d, --discard[=policy]
> >   Enable  swap  discards ... The /etc/fstab mount options discard,
> > discard=once, or discard=pages may also be used to enable discard flags.
> 
> So, I'm not clear on what happens if you don't use the discard option.

Your swap will work the same as far as the kernel is concerned.

Your drive won't receive TRIM commands for the partition/logical
volume/whatever your swap resides in (on swapping out pages).
Theoretically it could lead to longer swap times, practically swapping
is painful enough to avoid it regardless of the time it takes.

Reco



Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-11 Thread rhkramer
On Friday, June 11, 2021 02:49:03 AM Reco wrote:
> On Thu, Jun 10, 2021 at 11:43:12PM -0700, David Christensen wrote:
> > I don't bother with the 'discard' option in /etc/fstab, but perhaps I
> > should.  The fstab(5) and mount(8) manual pages are unclear if
> > 'discard' applies to swap or ext4.
> 
> swapon(8):
> 
>-d, --discard[=policy]
> Enable  swap  discards ... The /etc/fstab mount options discard,
> discard=once, or discard=pages may also be used to enable discard flags.

So, I'm not clear on what happens if you don't use the discard option.  I 
assume that the data in swap is swapped back (written back) to the proper 
location in RAM before reusing the swap space, which would be unnecessary if 
the 


   -d, --discard
  Discard freed swap pages before they are reused, if the swap 
device supports the discard or trim operation.  This may improve performance 
on some  Solid  State  Devices, but  often  it  does  not.   The  /etc/fstab 
mount option discard may be also used to enable discard flag.



Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-11 Thread Polyna-Maude Racicot-Summerside
Hi,

On 2021-06-11 12:31 a.m., David Wright wrote:
> I'm about to install buster or bullseye on a newly acquired laptop
> with an SSD (a first for me). I'm intending to clean (zero or
> randomise) the entire drive with dd before I start, and am
> interested in any pitfalls with that.
> 
> I will also encrypt the new /home partition, but for the remaining
> partitions I need to decide whether to add mount's discard option,
> or use a weekly systemd trim, or leave it entirely up to the garbage
> collection in the SSD device itself (which is an nvme THNSN5512GPUK
> TOSHIBA, presumably an OEM model supplied for this HP Spectre).
> 
> The machine has 16GB of memory, so I wasn't intending to use swap.
> (It won't have to hibernate, and if push came to shove, there's
> always the possibility of setting up a swapfile or a ramdisk.)
> 
> Background:
> 
> The July 2017 system was pre-installed with Windows 10.
> 
> I have copied the entire disk to external spinning rust, and can
> mount partitions from this image. It's difficult to foresee my ever
> wanting to reload and run this Windows system.
> 
> The drive has unencrypted information on it, either in existing files,
> or in deleted/overwritten/whatever ones (though I think that is
> irrelevant to the method for erasing them).
> 
> I don't work for the CIA, so "basic" erasure methods are sufficient,
> ie so-called logical and digital sanitisation, but not analogue
> sanitisation/purging. I'm just encrypting stuff like personal bank
> records etc, and not looking for anything like plausible deniability.
> 
> Cheers,
> David.
> 
Why do you really want so much encryption level (swap with discard,
encrypted swap, encrypted all the partition, etc).
Other than your user data and possibly some config files, not much use
to encrypt everything. Do you have such a high risk of security breach
that it's worth the speed lost imposed by encryption ? Because yes
there's a cost and it's speed.

-- 
Polyna-Maude R.-Summerside
-Be smart, Be wise, Support opensource development



OpenPGP_signature
Description: OpenPGP digital signature


Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-11 Thread Reco
On Fri, Jun 11, 2021 at 05:55:02AM -0700, David Christensen wrote:
> On 6/10/21 11:49 PM, Reco wrote:
> > On Thu, Jun 10, 2021 at 11:43:12PM -0700, David Christensen wrote:
> > > I don't bother with the 'discard' option in /etc/fstab, but perhaps I
> > > should.  The fstab(5) and mount(8) manual pages are unclear if
> > > 'discard' applies to swap or ext4.
> > 
> > swapon(8):
> > 
> > -d, --discard[=policy]
> >   Enable  swap  discards ... The /etc/fstab mount options discard,
> > discard=once, or discard=pages may also be used to enable discard flags.
> > 
> > 
> > Therefore 'discard' can be applied to both ext4 and swap.
> 
> Thank you for the clarification regarding trim and swap.
> 
> Where do you see the information for ext4?

You just have to know where to look - ext4(5):

discard/nodiscard
Controls  whether  ext4  should issue discard/TRIM commands to the
underlying block device when blocks are freed.  This is useful for SSD
devices and sparse/thinly-provisioned LUNs, but it is off by default
until sufficient testing has been done.


How exactly this ended in manpages section 5 (which is "File formats and
conventions eg /etc/passwd") is anyone's guess.

Reco



Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-11 Thread David Christensen

On 6/10/21 11:49 PM, Reco wrote:

Hi.

On Thu, Jun 10, 2021 at 11:43:12PM -0700, David Christensen wrote:

I don't bother with the 'discard' option in /etc/fstab, but perhaps I
should.  The fstab(5) and mount(8) manual pages are unclear if
'discard' applies to swap or ext4.


swapon(8):

-d, --discard[=policy]
  Enable  swap  discards ... The /etc/fstab mount options discard,
discard=once, or discard=pages may also be used to enable discard flags.


Therefore 'discard' can be applied to both ext4 and swap.


Thank you for the clarification regarding trim and swap.


Where do you see the information for ext4?


David



Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-11 Thread Andrew M.A. Cater
On Thu, Jun 10, 2021 at 11:31:07PM -0500, David Wright wrote:
> I'm about to install buster or bullseye on a newly acquired laptop
> with an SSD (a first for me). I'm intending to clean (zero or
> randomise) the entire drive with dd before I start, and am
> interested in any pitfalls with that.
> 
Don't bother - as others have said, it won't help particularly
_especially_ since this is an NVME. Enjoy the speed :)

> I will also encrypt the new /home partition, but for the remaining
> partitions I need to decide whether to add mount's discard option,
> or use a weekly systemd trim, or leave it entirely up to the garbage
> collection in the SSD device itself (which is an nvme THNSN5512GPUK
> TOSHIBA, presumably an OEM model supplied for this HP Spectre).
> 
Just install Debian with an expert install: use the guided partitioning 
for encrypted LVM and set /home as a separate partition.

> The machine has 16GB of memory, so I wasn't intending to use swap.
> (It won't have to hibernate, and if push came to shove, there's
> always the possibility of setting up a swapfile or a ramdisk.)
> 
If you install bullseye, the swap file is only 1G anyway (changed default
for Bullseye).

> Background:
> 
> The July 2017 system was pre-installed with Windows 10.
> 
> I have copied the entire disk to external spinning rust, and can
> mount partitions from this image. It's difficult to foresee my ever
> wanting to reload and run this Windows system.
> 
> The drive has unencrypted information on it, either in existing files,
> or in deleted/overwritten/whatever ones (though I think that is
> irrelevant to the method for erasing them).
> 

If you really do want to erase older spinning rust, DBAN is probably good
enough - but in many cases just doing a couple of installs of Debian over
the top may be enough :)

> I don't work for the CIA**, so "basic" erasure methods are sufficient,
> ie so-called logical and digital sanitisation, but not analogue
> sanitisation/purging. I'm just encrypting stuff like personal bank
> records etc, and not looking for anything like plausible deniability.
> 
> Cheers,
> David.
> 
Just my €0.02 - all best, as ever,

Andy C.

** You mentioned the CIA:

As I was going up the stair
I met a man who wasn't there
He wasn't there again today
I *think* he's from the CIA



Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-11 Thread Reco
Hi.

On Thu, Jun 10, 2021 at 11:43:12PM -0700, David Christensen wrote:
> I don't bother with the 'discard' option in /etc/fstab, but perhaps I
> should.  The fstab(5) and mount(8) manual pages are unclear if
> 'discard' applies to swap or ext4.

swapon(8):

   -d, --discard[=policy]
  Enable  swap  discards ... The /etc/fstab mount options discard,
discard=once, or discard=pages may also be used to enable discard flags.


Therefore 'discard' can be applied to both ext4 and swap.

Reco



Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-11 Thread David Christensen

On 6/10/21 9:31 PM, David Wright wrote:

I'm about to install buster or bullseye on a newly acquired laptop
with an SSD (a first for me). I'm intending to clean (zero or
randomise) the entire drive with dd before I start, and am
interested in any pitfalls with that.

I will also encrypt the new /home partition, but for the remaining
partitions I need to decide whether to add mount's discard option,
or use a weekly systemd trim, or leave it entirely up to the garbage
collection in the SSD device itself (which is an nvme THNSN5512GPUK
TOSHIBA, presumably an OEM model supplied for this HP Spectre).

The machine has 16GB of memory, so I wasn't intending to use swap.
(It won't have to hibernate, and if push came to shove, there's
always the possibility of setting up a swapfile or a ramdisk.)

Background:

The July 2017 system was pre-installed with Windows 10.

I have copied the entire disk to external spinning rust, and can
mount partitions from this image. It's difficult to foresee my ever
wanting to reload and run this Windows system.

The drive has unencrypted information on it, either in existing files,
or in deleted/overwritten/whatever ones (though I think that is
irrelevant to the method for erasing them).

I don't work for the CIA, so "basic" erasure methods are sufficient,
ie so-called logical and digital sanitisation, but not analogue
sanitisation/purging. I'm just encrypting stuff like personal bank
records etc, and not looking for anything like plausible deniability.

Cheers,
David.



You want to command the SSD controller to do a "secure erase".  The 
manufacturer should provide a utility for this, but it will likely 
require Windows.  In years past I have found Linux CLI utilities to do 
secure erase.  STFW for details.



I would then make a decision between BIOS/MBR or UEFI/GPT.  I prefer the 
former so that I can boot system images in the older machines in my SOHO 
LAN.  Eventually we will all be using the latter.



I would then install Debian using the Debian Installer, choose manual 
partitioning, and partition the SSD as follows:


1.  Create a 1 GB unencrypted partition with ext4 and mount it at /boot.

2.  Create at least a 1 GB encrypted (dm-crypt) swap partition.  I 
experimented with no swap in the past and found that the systems were 
unstable when free memory was low.


3.  Create a small (I use 13 GB) encrypted (LUKS) ext4 partition and 
mount it at / (root).



Once Debian is installed, I would take a raw binary image of the system 
drive for backup, reboot into single-user mode, login as root, create a 
fourth partition, create a LUKS key, chmod the key to 0400, put a LUKS 
container into the 4th partition using the key, add an entry to 
/etc/crypttab for the fourth partition using the key, open the LUKS 
container, put an ext4 filesystem inside the LUKS container, move aside 
the old /home subdirectory, add an /etc/fstab entry to mount the new 
ext4 filesystem at /home, mount the new /home, copy the old /home 
contents into the new /home, reboot into multiuser mode, and verify 
everything.  I would then take another raw binary image for backup.  It 
would be best to do this before you log in to any unpriviledged 
accounts, so that /home contains few or no directories or files.



I don't bother with the 'discard' option in /etc/fstab, but perhaps I 
should.  The fstab(5) and mount(8) manual pages are unclear if 'discard' 
applies to swap or ext4.  Beware that adding 'discard' to /etc/fstab 
boot, swap, and/or root entries could break boot.  If you want trim, one 
option might be to run fstrim(8) periodically.



David



Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-10 Thread songbird
David Wright wrote:

...
> I don't work for the CIA, so "basic" erasure methods are sufficient,
> ie so-called logical and digital sanitisation, but not analogue
> sanitisation/purging. I'm just encrypting stuff like personal bank
> records etc, and not looking for anything like plausible deniability.

  i don't think this really matters, but the overriding issue
is that the technology of SSD means that sometimes things are
moved around (wear leveling) hidden from the user and will not 
be seen again in normal use, but they are still there.

  you will have to see if the SSD manufacturer releases a 
deep erase utility or something like that for it to be a sure
thing (and even then i'd have my doubts).

  personally, i wouldn't bother going beyond the simple format 
and setting up of file systems.  like you i have nothing on
this machine i consider sensitive so i don't need to worry
about what is left where.


  songbird



Re: Wiping an unencrypted SSD in preparation for encryption

2021-06-10 Thread Jeremy Ardley


On 11/6/21 12:31 pm, David Wright wrote:

I'm about to install buster or bullseye on a newly acquired laptop
with an SSD (a first for me). I'm intending to clean (zero or
randomise) the entire drive with dd before I start, and am
interested in any pitfalls with that.

I will also encrypt the new /home partition, but for the remaining
partitions I need to decide whether to add mount's discard option,
or use a weekly systemd trim, or leave it entirely up to the garbage
collection in the SSD device itself (which is an nvme THNSN5512GPUK
TOSHIBA, presumably an OEM model supplied for this HP Spectre).

The machine has 16GB of memory, so I wasn't intending to use swap.
(It won't have to hibernate, and if push came to shove, there's
always the possibility of setting up a swapfile or a ramdisk.)

Background:

The July 2017 system was pre-installed with Windows 10.

I have copied the entire disk to external spinning rust, and can
mount partitions from this image. It's difficult to foresee my ever
wanting to reload and run this Windows system.

The drive has unencrypted information on it, either in existing files,
or in deleted/overwritten/whatever ones (though I think that is
irrelevant to the method for erasing them).

I don't work for the CIA, so "basic" erasure methods are sufficient,
ie so-called logical and digital sanitisation, but not analogue
sanitisation/purging. I'm just encrypting stuff like personal bank
records etc, and not looking for anything like plausible deniability.

Cheers,
David.


The problem with SSD is that it's actually very difficult if not 
impossible.to completely erase them with DD. The drives have a large 
number of sectors in reserve and use them to wear level. This means some 
sectors may be swapped out when you do the DD and so aren't cleared.


There are some drives that have a self erase function that may work for 
your drive


See https://grok.lsu.edu/article.aspx?articleid=16716

--
Jeremy




OpenPGP_signature
Description: OpenPGP digital signature


Wiping an unencrypted SSD in preparation for encryption

2021-06-10 Thread David Wright
I'm about to install buster or bullseye on a newly acquired laptop
with an SSD (a first for me). I'm intending to clean (zero or
randomise) the entire drive with dd before I start, and am
interested in any pitfalls with that.

I will also encrypt the new /home partition, but for the remaining
partitions I need to decide whether to add mount's discard option,
or use a weekly systemd trim, or leave it entirely up to the garbage
collection in the SSD device itself (which is an nvme THNSN5512GPUK
TOSHIBA, presumably an OEM model supplied for this HP Spectre).

The machine has 16GB of memory, so I wasn't intending to use swap.
(It won't have to hibernate, and if push came to shove, there's
always the possibility of setting up a swapfile or a ramdisk.)

Background:

The July 2017 system was pre-installed with Windows 10.

I have copied the entire disk to external spinning rust, and can
mount partitions from this image. It's difficult to foresee my ever
wanting to reload and run this Windows system.

The drive has unencrypted information on it, either in existing files,
or in deleted/overwritten/whatever ones (though I think that is
irrelevant to the method for erasing them).

I don't work for the CIA, so "basic" erasure methods are sufficient,
ie so-called logical and digital sanitisation, but not analogue
sanitisation/purging. I'm just encrypting stuff like personal bank
records etc, and not looking for anything like plausible deniability.

Cheers,
David.