/usr/share/doc/simple-tpm-pk11/README.md is in simple-tpm-pk11 0.04-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | Simple TPM PK11
===============
A simple library for using the TPM chip to secure SSH keys.
Copyright 2013 Google Inc. All Rights Reserved.
Apache 2.0 license.
This is NOT a Google product.
Contact: thomas@habets.se / habets@google.com
https://github.com/ThomasHabets/
Install dependencies
--------------------
Debian:
```
apt-get install tpm-tools libtspi-dev libopencryptoki-dev libssl-dev
```
Fedora:
```
tpm-tools
opencryptoki-devel
trousers-devel
openssl-devel
```
Build simple-tpm-pk11
---------------------
```
./configure && make && sudo make install
```
Init TPM chip
-------------
1. If you have not taken ownership, do so.
```
tpm_takeownership -z
Enter owner password: [enter something secret here]
Confirm password: [enter something secret here]
```
2. SRK password is usually the Well Known Secret (all nulls). You can
specify a password but it's easier it you don't. The SRK password is only
used to allow crypto operations. You still need blobs and key passwords to
use other peoples keys.
```
tpm_changeownerauth -s -r
```
If you get any error messages, see read TPM-TROUBLESHOOTING.
User setup
----------
### 1. Create key
```
mkdir ~/.simple-tpm-pk11/
stpm-keygen -o ~/.simple-tpm-pk11/my.key
```
Try out the key:
```
dd if=/dev/urandom of=to-sign bs=1 count=35
stpm-sign -k ~/.simple-tpm-pk11/my.key -f to-sign
```
### 2. Create config
```
echo "key my.key" > ~/.simple-tpm-pk11/config
```
Optionally add "log foo.log" in there too.
### 3. Extract the public key in SSH format
```
ssh-keygen -D libsimple-tpm-pk11.so
```
Install it where you want to log in, in the usual authorized_keys way.
Try logging in using your new fancy key:
```
ssh -I libsimple-tpm-pk11.so shell.example.com
```
### 4. Configure SSH to always use this module
Add this to `~/.ssh/config`:
```
Host *
PKCS11Provider libsimple-tpm-pk11.so
```
then try:
```
ssh shell.example.com
```
Tested with
-----------
### Machines
* Lenovo T410 / STM TPM 1.2.8.16
* Lenovo T500 / INTC STM 1.2.4.1
* Dell Precision T3500 / WEC TPM 1.2.2.81
* Lenovo T440s / STM TPM 1.2.13.12
* Lenovo X240 / STM TPM 1.2.13.12
* Lenono X200s / INTC TPM 1.2.4.1
### Software
* OpenSSH 6.0p1 on Debian 7.2
* OpenSSH 5.9
* OpenSSH 6.4p1 on CentOS 7.0
* OpenSSH 6.8p1 on Arch Linux
TODO
----
* Clean up code.
* config option: log to stdout and/or stderr in addition to logfile.
* Install in the correct place.
* Add PKCS11 support to ssh *server*.
* Global config in /etc.
* Optionally stir with /dev/random when generating keys.
* Script to automate setting up, including verifying TPM state and fixing it.
* Auto-generate keys on demand? Or should this only be part of script to set up?
* Make it work with gpg, and document.
* Make it work with SSH certs, and document.
* Make it work with openssl, and document.
* Make it work with Firefox, and document.
* Make it work with Chrome, and document.
* Make it work with encrypted home directories, and document.
Reference links
---------------
* http://secgroup.ext.dsi.unive.it/projects/security-apis/tookan/
* http://secgroup.ext.dsi.unive.it/projects/security-apis/cryptokix/
* http://trousers.sourceforge.net/pkcs11.html
* http://www.trustedcomputinggroup.org/resources/tcg_software_stack_tss_specification
* http://www.infineon.com/dgdl/TPM+Key+Backup+and+Recovery.pdf
* http://www.engadget.com/2010/02/12/christopher-tarnovsky-hacks-infineons-unhackable-chip-we-pre/
* http://trousers.sourceforge.net/dev_faq.html
* http://resources.infosecinstitute.com/linux-tpm-encryption-initializing-and-using-the-tpm/
* http://p11-glue.freedesktop.org/p11-kit.html
* http://trousers.sourceforge.net/dev_faq.html
Make new release
----------------
* Update configure.ac with new version, commit.
* git tag -a -s 0.0x
* git push --tags
Some random notes, not instructions
-----------------------------------
```
openssl genrsa -out rsa-key 2048
openssl rsa -in rsa-key -modulus
exponent is always 65537.
ssh-keygen -f rsa-key -y > rsa-key.pub
```
|