Sunday, January 7, 2018

welcome back to war! special insert and the "football" suitcase. information 1-2 PELICAN™ 1490CC1 - 1490 W/ SPECIAL INSERT


information 3

I want to decrypt some files to RAM so as not to have a record of them on the hard drive. I though about using tmpfs:
mount -t tmpfs -o size=64k tmpfs /ram

More permanently in /etc/fstab (untested):
# ram drive

tmpfs   /tmpfs  tmpfs   size=64k    0 0

Having read /usr/src/linux/Documentation/filesystems/tmpfs.txt I see that tmpfs can also be part of swap and thus on the hard drive.

Would it be better to use ramfs:
mount -t ramfs -o size=64k /dev/ram /ram

and in /etc/fstab (untested):
/dev/ram    /ram    ramfs  size=64k 0 0
It what purpose are you decrypting the files? If you are going to edit the files with vim, by default the file will be copied to /var/tmp, IIRC. If it is for processing by another program, you might be ok.
Doesn't Vim create a local copy in the current directory?
.filename.swp
Why not just set up an encrypted swap? http://www.gentoo.org/proj/en/hardened/disk-cryptography.xml
quote:
Originally posted by neilhwatson:
I want to decrypt some files to RAM so as not to have a record of them on the hard drive.


Are these files encrypted with gpg? And maybe you might consider using an encrypted filesystem (like encfs or the loopback fs approach) as the resting place for the files.

But to answer your question directly, it looks like you want to use ramdisks. On my ubuntu laptop, it looks like there are already a bunch configured:
$ dmesg |grep RAMDISK

RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize

RAMDISK: cramfs filesystem found at block 0

RAMDISK: Loading 4524KiB [1 disk] into ram disk... done.
tm,

File could be encrypted via Gpg. However, I prefer using OpenSSL. FYI, I would used it like this:
nwatson@valetta ~/tmp $ openssl enc -aes256 -in secret -out secret.en

enter aes-256-cbc encryption password:

Verifying - enter aes-256-cbc encryption password:

nwatson@valetta ~/tmp $ ls -l secret*

-rw-r--r--  1 nwatson users 44 Aug 25 08:12 secret

-rw-r--r--  1 nwatson users 64 Aug 25 10:31 secret.en

nwatson@valetta ~/tmp $ openssl enc -d -aes256 -in secret.en

enter aes-256-cbc decryption password:

This is a secret



site    user    password 

I have thought about using an encrypted file system but believe it takes a little more effort to use. One has to mount and unmount the system, usually as root.
Can I ask why you prefer symmetric encryption to a proper public/private key scheme?

As that stands, it's much more vulnerable to a dictionary attack than a proper keypair scheme, ala GnuPG. Less work to be done to decrypt the data.

Attacking a GPG keypair requires a hash computation, then a symmetric key decryption, then a comparsion of the hashes, then decryption of the actual data.

[edit]Thinking about it more (my head is fried today) GPG isn't really more work. It requires an extra SHA1 hash first, which while is some work, isn't really substantial.

However, OOB, it is safe from any sort of precomputation. The attacker can't do any work ahead of time until he gets your keyring.
[/edit]

And with all data storage schemes where a human will be interacting with the process directly, it's the password that's the weakest part.

Just curious if you have a specific reason.
The problem I see with keypair schemes is the dependency on the key files. What if I loose the file? In this instance it is not such an issue. I was drawing on the scheme I use for off site backups. I encrypt them via passphrase only because, should I need my backups, I may not be in possession of the key file.
quote:
Originally posted by neilhwatson:
The problem I see with keypair schemes is the dependency on the key files. What if I loose the file?
You go to great care to not lose the private key then. Multiple backups in multiple secure places, in multiple formats, would be a good idea.

I can understand that. The only thing worth nothing is that your scheme, as-is, is vulnerable to precomputed dictionary attacks.

So, make that rather difficult by doing two things:
  • Use a salt.
  • Use a really long password, or one with non-printable or other similiarly uncommon characters
This will make precomputed dictionary attacks impossible, as the attacker will be unable to precompute the key without your data, or impossible because he won't precompute the key.

It goes without saying that hte attacker still has to try all these keys, so if the data set is large, it would still take a very long time. However, it's still worthwhile to force them to search as large of a space as possible.
His Lordship offers a compelling arguement for key pair encryption. I don't use key pairs much except with SSH. Can you answer a few questions for me?

I generate a key pair using Gpg or ssl and encrypt the private key with a strong passphrase. Then I encrypt my files using the public key. Thus only my private key can decrypt them. I've never had much luck generating ssl key pairs. Ssl generates a single file that contains both keys
(ssl keys howto). How doe I use it?

My backups run nightly. Weekly, I manually copy my backup to a remote location. The local files are not encrypted. I encrypt them on the fly by passing them through SSL
openssl enc -aes256 -k $SSLPASS -in $file | ssh user@example.com "cat > /home/username/backup/$file.en"
That example uses just a passphrase. How would I do this using a public key?
quote:
Originally posted by neilhwatson:
I have thought about using an encrypted file system but believe it takes a little more effort to use. One has to mount and unmount the system, usually as root.


Well, re: openssl, I'd take a good look at its history of vulnerabilities.

encfs can run w/o root privileges from what I've read. I'm sure some other (lufs-based?) can as well.
quote:
Originally posted by neilhwatson:
His Lordship offers a compelling arguement for key pair encryption.
Well, or just using a salt and a really long/truly hard password

I jsut prefer using GPG because it does everything correctly for you, except the password. Meaning I don't have to remember to tell OpenSSL to use a salt or anything.

quote:
I generate a key pair using Gpg or ssl and encrypt the private key with a strong passphrase. Then I encrypt my files using the public key. Thus only my private key can decrypt them.
Close enough, yeah. The actual process for storing a private key is a little more complicated, but that's the idea.

quote:
How doe I use it?
For RSA, given the key:
openssl rsa -in file.key -pubout file.pub
will give you the public key in a file.

quote:
How would I do this using a public key?
openssl rsautl -encode -in data -inkey file.pub -pubkey
But you really probably just want to do GPG, as it'll make the headache easier. Really. It jsut makes things like the managment of keys and whatnot much less of a hassle.

However, see the OpenBSD openssl manpage for a good reference, if that's what you really want to use.

https://arstechnica.com/civis/viewtopic.php?t=363110



No comments:

Man in the Rain