simple-tpm-pk11

TPMを使ってSSHの鍵を保護する。

  • Links

https://github.com/ThomasHabets/simple-tpm-pk11
https://blog.habets.se/2013/11/TPM-chip-protecting-SSH-keys---properly

  • Build
$ sudo apt-get install tpm-tools libtspi-dev libopencryptoki-dev libssl-dev autoreconf libtool

$ git clone https://github.com/ThomasHabets/simple-tpm-pk11.git
$ cd simple-tpm-pk11
$ sh ./bootstrap.sh
$ ./configure
$ make
$ sudo make install
  • Setup
$ tpm_version
$ tpm_takeownership -z

set your password

$ tpm_changeownerauth -s -r
$ mkdir ~/.simple-tpm-pk11
$ stpm-keygen -o ~/.simple-tpm-pk11/my.key
Modulus size: 256
Exponent size: 3
Size: 2048
Blob size: 559

$ echo key my.key > ~/.simple-tpm-pk11/config
$ echo -e "\nHost *\n    PKCS11Provider /usr/local/lib/libsimple-tpm-pk11.so" >> ~/.ssh/config


- shell.example.com を例に

$ ssh-keygen -D /usr/local/lib/libsimple-tpm-pk11.so | ssh shell.example.com tee -a .ssh/authorized_keys
$ ssh shell.example.com    # Unless you have an ssh-agent with other keys, this will use the hardware-protected key.


これで shell.example.com に接続するための、SSH鍵がTPMに保存され保護されます。

  • TPM以外の方法
    • GNUK Tokenを使う

GnukトークンでSSH
http://www.janog.gr.jp/meeting/janog35/index.php/download_file/view/94/202/

vmhgfs

GuestOSのUpdateでLinux Kernelが新しくなり、VMWare player でHostの共有ができないのはvmhgfs の コンパイルエラーが原因。

sudo vmware-config-tools.pl

の実行結果をよく見ると

error: ‘struct dentry’ has no member named ‘d_alias’

とか怒られている(のにスクリプトは止まらずスルーするので見落とすわけだ)


https://communities.vmware.com/message/2475736
https://bugs.launchpad.net/ubuntu/+source/open-vm-tools/+bug/1416003

vmhgfs-only/inode.c:1945 の怒られてるところ

dentry = list_entry(pos, struct dentry, d_alias);

をこうしろと

dentry = list_entry(pos, struct dentry, d_u.d_alias);

とりあえず、これで治るようです。

https://github.com/rasa/vmware-tools-patches

KernelのVersionとToolのVersionの不整合が原因で、Version地獄に陥っている? ということはそう簡単には解決しない。


Ubuntu 14.04、Kernel 3.13.0-54 では、 Toolの9.6.1 にはOKだけど、9.6.2はCompileエラーが色々出てNG。


Ubuntu 14.04、Kernel 3.16.0-41 では、 Toolの9.6.1 にはOK

Intel SGX

https://software.intel.com/en-us/blogs/2013/09/26/protecting-application-secrets-with-intel-sgx

Thoughts on Intel's upcoming Software Guard Extensions (Part 1)
http://theinvisiblethings.blogspot.jp/2013/08/thoughts-on-intels-upcoming-software.html

Thoughts on Intel's upcoming Software Guard Extensions (Part 2)
http://theinvisiblethings.blogspot.jp/2013/09/thoughts-on-intels-upcoming-software.html