For security I have decided to use an IronKey usb stick to keep my private key when using ssh. However, I am not able to use ssh because my ironkey mounts with permissions that are too loose for ssh.
My IronKey automounts:
:~> mount |tail -1
/dev/sr0 on /media/IronKey type iso9660 (ro,nosuid,nodev,uid=1000)
I unlock my secure drive:
:~> sudo ironkey
password:
Enter your IronKey password: *************
Unlock successful.
IronKey device names are cd: /dev/sr0 hdd: /dev/sdb
:~>
Now my secure drive is opened, but I have permissions set to 755 on all of my folders and files. These are too loose for ssh:
:~> ssh -i ‘/media/IronKey USB/key/id_dsa’ myremotecomputer.company.com
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0755 for ‘/media/IronKey USB/key/id_dsa’ are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /media/IronKey USB/key/id_dsa
Permission denied (publickey).
:~>
:~> mount |tail -2
/dev/sr0 on /media/IronKey type iso9660 (ro,nosuid,nodev,uid=1000)
/dev/sdb on /media/IronKey USB type vfat (rw,nosuid,nodev,shortname=lower,flush,utf8,uid=1000)
:~> ll ‘/media/IronKey USB/’
total 16
drwxr-xr-x 2 bill root 4096 2009-05-29 22:14 key
:~> ll ‘/media/IronKey USB/key’
total 8
-rwxr-xr-x 1 bill root 736 2009-05-29 22:14 id_dsa
:~>
The usb line in /etc/fstab gives me no clue on how or where my Ironkey gets it’s options for mounting. I see nothing in there about umask:
usbfs /proc/bus/usb usbfs noauto 0 0
Note that chmod doesn’t work for making the permissions more restrictive:
:~> chmod 700 ‘/media/IronKey USB/key’
:~> ll ‘/media/IronKey USB/key’
total 8
-rwxr-xr-x 1 bill root 736 2009-05-29 22:14 id_dsa
:~> ll ‘/media/IronKey USB/’
total 16
drwxr-xr-x 2 bill root 4096 2009-05-29 22:14 key
:~>
I can’t even do a manual mount with a more restrictive umask and get it to work:
:~ # mount -t vfat -o rw,nosuid,nodev,shortname=lower,uid=1000,utf8,umask=077 /dev/sdb /mnt/a
:~ # ll /mnt/a
total 20
drwxr-xr-x 4 bill root 4096 May 23 21:42 .Trash-1000
drwxr-xr-x 2 bill root 4096 May 29 22:14 key
:~ #
:~> cat /etc/issue
Welcome to openSUSE 11.1 - Kernel \r (\l).
:~> uname -a
Linux hostname 2.6.27.21-0.1-pae #1 SMP 2009-03-31 14:50:44 +0200 i686 i686 i386 GNU/Linux
:~>
My questions:
How can I mount my IronKey with the more restrictive permissions needed to keep my private keys on my IronKey?
Where are the options set for auto-mounting a vfat usb stick?