Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Secure Private Key Storage for UNIX?

Posted by Cliff on Thu Mar 01, 2007 06:51 PM
from the kernel-level-key-ring dept.
An anonymous reader asks: "Microsoft Windows, from 2000 forward (except ME) offers secure certificate and private storage at the OS level in what is called a protected store. Offline, it's encrypted by a combination of the user's password and a session key stored on the filesystem. When the OS is running, the private keys stored are available to the logged in user, optionally encrypted with another password. The keys are stored in protected memory, so no applications can access them without going through the Microsoft CAPI calls. This code also is FIPS 140-1 level 1 (the best one can get for software cryptography modules) compliant." Does any other OS provide this kind of feature at the OS-level? If so, who? If not, why?
This functionality (especially certified FIPS 140-1 or FIPS 140-2) would be nice to see in UNIX variants. MacOS's key-chain functionality is similar, but stores at the application level, and is not FIPS compliant. An implementation of the protected store functionality will allow applications like Firefox, Thunderbird and gpg to have one common place to obtain private keys and certificates rather than maintaining their own individual key-stores. An additional application for this would be the ability to use hardware PKCS #11 tokens.

I am wondering why this functionality does not exist at the OS level in most OSes except Windows. A number of applications on many platforms have this functionality, but its at the app level, with their own key-stores, and not a standard at the OS level."
This discussion has been archived. No new comments can be posted.
Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • Well duh.. (Score:4, Insightful)

    on Windows it is centralized and conforms to government requirements because, get this, Windows development is centralized, and Microsoft sell Windows to governments. Amazing huh? Now, of course, if you think this is important, and can code, you might feel like going and writing a daemon for handing out certificates. Hardening it against attack, etc. Then go write the support into all these various programs that use certificates. But unless you're willing to do that, we'll just have to wait until Red Hat, Novell, or whoever go for some government contracts that require this level of certification.

  • by Anonymous Coward on Thursday March 01 2007, @07:13PM (#18201318)
    On OS X, the keychain data (certificates, keys, etc) is not managed at the application level. There is a system daemon, securityd, that applications talk to if they need passwords or need data signed / decrypted or if they need credentials for a particular service.
    • Much like KDE's kwalletmanager (Score:5, Informative)

      by Straker Skunk (16970) on Thursday March 01 2007, @07:24PM (#18201458)
      Same idea in KDE, and I'm sure GNOME has a similar mechanism. Whether these are "OS-level" or "application-level" is a subtler question, but this has more to do with the situation that Linux desktop systems don't necessarily have a centrally-planned infrastructure in the manner of Windows or MacOS X, rather than that they haven't addressed this problem at all.
      [ Parent ]
  • Keychain is at the application level? (Score:4, Informative)

    by dgatwood (11270) on Thursday March 01 2007, @07:18PM (#18201384)

    I'm not sure what they're trying to claim here, but unless their definition of OS means "kernel", the Mac OS X (and classic Mac OS, AFAIK) keychain most certainly is an OS-level service. Keychain items can be shared among all applications, though most applications limit access to these items to a list of trusted applications for obvious security reasons.

    I don't know about the question of protected memory or FIPS certification, but the rest of this question just seemed like FUD to me.

  • chmod 600 (Score:2, Informative)

    by Anonymous Coward on Thursday March 01 2007, @07:19PM (#18201406)
    chmod 600 crypt.key

    Just make sure to store the key encrypted with a passphrase :)
    • 1 reply beneath your current threshold.
  • FIPS Levels (Score:3, Insightful)

    by Jherek Carnelian (831679) on Thursday March 01 2007, @07:19PM (#18201410)

    This code also is FIPS 140-1 level 1 (the best one can get for software cryptography modules) compliant."

    That's odd, OpenSSL was just certified to level 2 (FIPS 140-2). [linux.com]
    • Re:FIPS Levels by Anonymous Coward (Score:1) Thursday March 01 2007, @07:39PM
      • 1 reply beneath your current threshold.
    • No (Score:5, Informative)

      by John.P.Jones (601028) on Thursday March 01 2007, @07:41PM (#18201666)
      OpenSSL was just certified FIPS 140-2, that is NOT however level 2 it is version 2 of the standard. It was certified FIPS 140-2 level 1.
      [ Parent ]
      • 1 reply beneath your current threshold.
  • Eggs and baskets (Score:5, Insightful)

    An implementation of the protected store functionality will allow applications like Firefox, Thunderbird and gpg to have one common place to obtain private keys and certificates rather than maintaining their own individual key-stores.

    Maybe it's just me, but I think that putting all your eggs in one basket is not smart. All it would take would be on critical vulnerability to be discovered and all of a sudden a potential attacker can get to all of your keys. Not good if you ask me.

    • Re:Eggs and baskets (Score:5, Informative)

      Maybe it's just me, but I think that putting all your eggs in one basket is not smart. All it would take would be on critical vulnerability to be discovered and all of a sudden a potential attacker can get to all of your keys. Not good if you ask me.

      I disagree. Right now, we're putting all our eggs in a bunch of half-assed baskets woven from tissue paper and lunchmeat. I'd much rather trust one well-audited, well-engineered solution than the 100 home rolled ones we have to trust now.

      KDE does this now with KWallet (although without the spiffy kernel-level protections the author claims that Windows supports). If I'm writing a KDE application, I don't have to worry about getting password storage right - some other folks who know a whole lot more about the problem have already taken care of it for me.

      I think this is good in the same way that using libc's strncmp is better than writing your own. Sure, there might be some undiscovered flaw lurking that's just waiting to open our systems to the world, and an environment of heterogeneous strncmp implementations would keep a successful attack from owning everything that links to libc. And yet, I have a lot of faith that the libc version is much better than anything I'm likely to come up with on my own.

      Finally, if an error in strncmp were to be discovered, an upgrade of one library file would fix every dynamically linked program on my system. If each of those programs used their own, then each one would have to be audited to make sure they weren't broken in a similar way. In the same way, an upgrade to KWallet helps every program that uses it. Other programs have to hope that new vulnerabilities are specific to KWallet's own code and not a more general problem.

      The Unix way is to build a tool that does one thing supremely well, then trust it. I think this is a prime candidate for the same treatment.

      By the way, I'm only using KWallet as an example because I'm familiar with it; I'd be even more interested in Theo de Raadt getting a wild hair and writing OpenSecureStore some weekend.

      [ Parent ]
      • 1 reply beneath your current threshold.
    • Re:Eggs and baskets by IkeTo (Score:1) Thursday March 01 2007, @09:55PM
    • 1 reply beneath your current threshold.
  • Aladdin eToken (Score:2)

    by Vihai (668734) on Thursday March 01 2007, @07:24PM (#18201464)
    (http://www.orlandi.com/)

    They are quite good if you don't need frequent encryptions and signatures, well supported by openssh, opensc and openssl, less with gnupg, and firefox but I didn't experiment much.

    Just be sure to use the 32K version as the 64K version lacks support.

  • If not, why? (Score:2, Insightful)

    by HomelessInLaJolla (1026842) * <lajollahomeless@hotmail.com> on Thursday March 01 2007, @07:27PM (#18201484)
    (Last Journal: Saturday November 10, @01:52PM)
    Poor supplicant. You will never reach enlightenment if you still place your trust in secure keys and encryption algorithms. Have not the radar gun vs. radar detectors taught you anything? Has not copy protection taught you anything? Has not DVD, Blu-Ray, or iTunes taught you anything? Has not closed hardware taught you anything? These things are intricacies and crusades of people who are paid to assert that they have completed an impossible task. You ask for feats of engineering when reverse engineering is just as important.

    I will happily compile secure libraries, encryption algorithms, and maintain a basic level of privacy measures. I will never ever ever be deluded to think that "protected memory" is indeed protected, that "FIPS 140-1 level 1" is "the best one can get", or that "compliant" means anything other than sophisticated sounding advertising.

    This functionality (especially certified FIPS 140-1 or FIPS 140-2) would be nice to see in UNIX variants
    I'm sure that somewhere someone has made a program which you can pipe data to and from or which you can use as a wrapper around your network transactions (a la tcpwrapper).

    An additional application for this would be the ability to use hardware PKCS #11 tokens
    At one time railroad lines had two different track spacings and some roundhouses sported heavy machinery which could quickly change the wheelbases on locomotives and the train cars. Be careful of integration. There is profit motive in change (for the sake of change) and integration makes change very slow and painful.
  • Linux Kernel keyring; openCryptoki (Score:5, Informative)

    by omnirealm (244599) on Thursday March 01 2007, @07:49PM (#18201742)
    (http://slashdot.org/)
    Current versions of the Linux kernel have a key retention [lkml.org] feature. For PKCS#11, there is openCryptoki [sourceforge.net].
    • Re:Linux Kernel keyring; openCryptoki by Wonko the Sane (Score:2) Thursday March 01 2007, @08:13PM
      • Re:Linux Kernel keyring; openCryptoki (Score:5, Interesting)

        by tlhIngan (30335) <slashdot@@@worf...net> on Thursday March 01 2007, @11:24PM (#18203358)

        Any idea if that mechanism addresses the DRAM "memory" effect described in this paper: http://www.cs.auckland.ac.nz/~pgut001/pubs/secure_ [auckland.ac.nz] del.html?


        Having developed for embedded systems, I'm amazed at how well DRAM can retain data. I've had it such that RAM disks were preserved after power cycles (~1 second without power, and SDRAM controllers not initialized until many milliseconds after powerup). There was at one point a hack we had to implement in the bootloader to clear a bit of memory so a power cycle really would start clean.

        Heck, it's a great way when debugging - the OS could log all messages to the screen, but that greatly slows down operations. So we log into a circular RAM buffer. When the board crashes, we power cycle, then inspect the RAM buffer for the last few messages written.

        Out of curiousity, I once experimented to see how long the data was retained - I wrote a data pattern to RAM, looked at it back, then removed power for varying lengths of time. It can take anywhere from a few seconds to a minute before the data gets hopelessly corrupted. But before then, if you knew what you were looking for, you could find it.
        [ Parent ]
        • 1 reply beneath your current threshold.
  • by J'raxis (248192) on Thursday March 01 2007, @08:58PM (#18202428)
    (http://www.jraxis.com/)

    From "Vista encryption 'no threat' to computer forensics [theregister.co.uk]":

    We're seeing the same concerns with Vista as we saw with XP over the idea that built-in encryption features might frustrate law enforcement efforts. In practice XP has not proved to be a problem for computer forensics and we don't think Vista will be either," said Bill Thompson, director of professional development and training at Guidance Software.
  • Well... (Score:2)

    by nacturation (646836) on Thursday March 01 2007, @09:31PM (#18202664)
    (Last Journal: Thursday May 24, @01:08AM)
    It sounds like Linux needs a good dose of DRM to keep those keys secure.
     
  • by Kalzus (86795) on Thursday March 01 2007, @11:49PM (#18203506)
    ...in that form because it's rather domain-specific to Windows. But there are hardware devices out there and drivers that provide interfaces to said harware to provide similar bits.

    Most security doctrines operate with the conviction that physical access to the box, along with enough time and resources, negates all possible security measures.
  • Smart Card (Score:2)

    by Jeffrey Baker (6191) on Friday March 02 2007, @12:18AM (#18203720)
    A smart card is the best place to keep your private keys. The key is generated on the card, and never leaves. It is not even possible to get private keys off a smart card, except (perhaps) with an electron microscope.
    • Re:Smart Card by mr_death (Score:3) Friday March 02 2007, @01:24AM
      • Re:Smart Card by 12dec0de (Score:2) Friday March 02 2007, @10:35AM
        • Re:Smart Card by mr_death (Score:2) Friday March 02 2007, @11:40AM
    • Re:Smart Card by corychristison (Score:2) Friday March 02 2007, @12:31PM
  • not possible (Score:2)

    by mr_death (106532) on Friday March 02 2007, @01:10AM (#18203976)
    Any current operating system (yes, linux too) has too many built-in security holes (inadvertent or otherwise), which makes secure storage of anything, including private keys, a joke. At some point, the key must appear in the clear to be useful; for that time, the key is vulnerable to sniffing.

    Just as some of the keys for HD DVDs have been found, given a determined adversary, your private key will be found.

    We can talk about "less vulnerable" private key storage, but I don't think that's what you had in mind.
  • I think we did this first... (Score:3, Insightful)

    by SanityInAnarchy (655584) <ninja@slaphack.com> on Friday March 02 2007, @02:02AM (#18204192)
    (Last Journal: Tuesday October 30, @10:59AM)

    ... but what's magical about the "OS level"? According to Microsoft, Internet Explorer is part of the OS, so anything they say about "OS level" is really irrelevant.

    Offline, it's encrypted by a combination of the user's password and a session key stored on the filesystem.

    We've been mounting home directories on encrypted filesystems for decades, so that's one way to do this. OS X has this built in and very easy to enable.

    When the OS is running, the private keys stored are available to the logged in user, optionally encrypted with another password.

    Which is pretty much how we do this already; just read the file. If the user had a passphrase, use that to decrypt it.

    The keys are stored in protected memory, so no applications can access them without going through the Microsoft CAPI calls.

    Well, on Unix, no application can access any other application's memory, period. End of story.

    There are ways around this -- you could do tricks with kernel memory, or you could read it off the swapfile. However, I believe there is a way to request that a specific chunk of memory never be swapped out, and while it's in RAM, if your kernel's safe, your app is safe. And it's always possible to run without swap, or encrypt your swap.

    On Windows, I believe you can "attach" to a running process with a debugger. On Unix, if you want to debug, you have to start the app in a debugger, because once it's running, the app's memory is its own. Only way you can "attach" then is if the app specifically has a way to do that -- for instance, browser plugins are essentially an app deliberately loading code from somewhere else into itself and running it. But if an app doesn't go out of its way to let you in, you aren't getting in, and if your kernel is owned, so are you, even on Windows.

    MacOS's key-chain functionality is similar, but stores at the application level, and is not FIPS compliant.

    What does FIPS compliance mean?

    And once again, "application level" is a pointless distinction. Yes, there are mechanisms for storing keys at the kernel level, but in my mind, that's less secure because it's much more complex for no good reason.

    An implementation of the protected store functionality will allow applications like Firefox, Thunderbird and gpg to have one common place to obtain private keys and certificates rather than maintaining their own individual key-stores.

    So have them all use libgpg or something. But what is the advantage?

    In Thunderbird, I have a PGP key that I sign my mail with, and I have a password that I use to connect to the server. In Firefox, I have an entirely different set of passwords, and the public keys to some Certificate Authorities. Firefox needs none of the Thunderbird keys/passwords, and vice versa. On the commandline, I have an ssh key, which I use to shell in to other boxes -- which is a key that I don't use in Firefox or Thunderbird.

    What's the advantage of putting these all in the same app? And what's the advantage of that app being "OS level"?

    Ultimately, the only advantage I see is with something like OpenID. It'd be nice if I could use the same keys I use with ssh to gain access to my OpenID server. Unfortunately, I haven't managed to get my hands on a working server implementation of OpenID, so that's moot.

    • Re:I think we did this first... by Anonymous Coward (Score:3) Friday March 02 2007, @06:38AM
      • SanityInAnarchy has apparently not been doing a lot of development in a UNIX environment. While I don't blame him/her for potentially missing out on the ptrace syscall, as it's not mentioned in Stevens' Advanced Programming in the UNIX Environment, I do find it a bit sad that he/she makes such bold statements about the security of a computer system without checking at least the valid command line parameters to one of the tools he is referring to. Luckily an Anonymous Coward already told the world about two of these.

        For those not familiar with the ptrace syscall, here is some info about linux ptrace:

        • You have to have super-user privileges, CAP_SYS_PTRACE capabilities or be able to send signals to the process to "attach to". The first parts means you is or have the permission of the system administrator or compromised the system. The last part basically means that you can also poke around at will in "your own" (or all processes for the same user account you've hacked) processes.
        • It is possible to read and write all process memory and registers. Basically, this means that you can run, you can obfuscate, but you cannot hide your crypto keys. Not from yourself or a particularly Evil sysadm, that is.
        • Even if the traced process receives a signal from the tracing, it is already too late to do anything about it once it regains control over it's operation.

        Detecting that you're being traced is possible, but it equally possible to circumvent possible detection by tracing at the correct time, deliver spoofed signals, modifying memory in the traced process to avoid being detected. In short: if you cannot trust your system administrator and yourself (at least all processes running as you) you are out of luck as to local security. Network security is one step worse, in that you have to trust even more persons.

        Oh, and don't use trustno1 as password!

        [ Parent ]
    • Re:I think we did this first... by jallen02 (Score:2) Friday March 02 2007, @08:35AM
    • Re:I think we did this first... by rastos1 (Score:2) Friday March 02 2007, @10:46AM
    • Re:I think we did this first... MOD THIS DOWN by SanityInAnarchy (Score:2) Friday March 02 2007, @02:00PM
    • 2 replies beneath your current threshold.

  • For Lunix :
    http://swtch.com/plan9port/man/man1/secstored.html [swtch.com]
    http://swtch.com/plan9port/man/man4/factotum.html [swtch.com]

    in which you can store *any* data, factotum will get the individual keys out for you

  • Plan 9's Factotum (Score:2, Interesting)

    by Darren Bane (21195) on Friday March 02 2007, @07:21AM (#18205554)
    (http://www.skynet.ie/~poldy/ | Last Journal: Monday January 13 2003, @12:11PM)
    Plan 9 [bell-labs.com] has such a central key repository. It's called Factotum, and the best description is the USENIX paper [usenix.org]. It has been ported to other UNIX-likes by the plan9port [swtch.com] project.
  • by gzunk (242371) on Friday March 02 2007, @07:46AM (#18205696)
    (http://www.gzunk.com/)
    Maybe it's not in Unix because there are better alternatives for "real" systems?

    For example the IBM 4764 Cryptographic Coprocessor? They're expensive, but more secure than anything a basic machine / operating system could provide. But if you're developing a system that actually has a need for secure keys then surely a price worth paying?

    In my view, anything like this built into the operating system is a "poor mans" secure store. Something a home use might like, but certainly not something you'd want to use in a mission critical production system.
  • by the_B0fh (208483) on Friday March 02 2007, @11:12AM (#18207542)
    (http://www.bofh.to/)
    According to the breakms papers from Peter Gutmann, the cryptoapi has to store the private keys in the clear, in memory, and this is true from windows 3.1 to XP. No idea about vista.

    Wait - *you* the user needs to supply a password to access it, so it looks secure, but the actual key, in memory, is kept in the clear, unencrypted. Don't think just because the system asks for a password that your data is actually secured.
  • Re:uh, what? (Score:1, Troll)

    by Goaway (82658) on Thursday March 01 2007, @07:20PM (#18201416)
    (http://wakaba.c3.cx/)
    Oh no! Somebody asked something of Linux that it doesn't provide! Better silence him, quick!
    [ Parent ]
    • Re:uh, what? by Slashcrap (Score:1) Friday March 02 2007, @06:38AM
      • Re:uh, what? by Goaway (Score:2) Friday March 02 2007, @07:48AM
  • by Skreems (598317) on Thursday March 01 2007, @08:10PM (#18201966)
    The thing is, this should be possible in theory. The operating system is the final arbiter of all ring 0 operations, and enforcing protected memory should be one of the basic things it does.
    [ Parent ]
    • Re:Protected memory by Phillup (Score:2) Thursday March 01 2007, @09:21PM
    • Re:Protected memory (Score:4, Interesting)

      by Harik (4023) <Harik@chaos.ao.net> on Thursday March 01 2007, @09:36PM (#18202686)
      Er, Lots of stuff lives in ring0, and any vulnerability in ANY of it removes your "protected memory".

      You can play games with hypervisors (can protect memory even from 'ring 0') or treacherous computing chips, or things like USB keystores with biometric authentication. But on vanilla 80386 machines, the best you're going to get is the OS to memlock() a few pages so they can't get swapped out to disk.
      [ Parent ]
    • Re:Protected memory by SirTalon42 (Score:2) Friday March 02 2007, @12:09AM
  • Re:Protected memory (Score:3, Funny)

    by Goaway (82658) on Thursday March 01 2007, @08:33PM (#18202194)
    (http://wakaba.c3.cx/)
    Yes, when there is no actual Microsoft vulnerability available, the crafty Slashdotter can just imagine that one exists, and still get that refershing feeling of superiority!
    [ Parent ]
  • by poopdeville (841677) on Friday March 02 2007, @03:15AM (#18204486)
    i am in ur memoriez, hacking all ur encryption.

    [ Parent ]
  • Re:Loopback filesystems? (Score:3, Insightful)

    People who need such protection all encrypt whole file system and do not bother with only password/key storage. Linux/UNIX does that for all time I know (Crypto Loop patches is probably oldest patch set for Linux). Windows/Vista I heard can this now. MacOS X allows only to encrypt user home directory what is sufficient in most situations - since keys belonging to user are always saved in user's home directory.

    That protection was needed by Windows XP and earlier since it didn't supported FS encryption. And even then people were selling special solutions with transparent hard drive encryption: BIOS asks for password and gives it to the hard drive and Windows goes on booting as usual.

    [ Parent ]
  • 5 replies beneath your current threshold.