-
Notifications
You must be signed in to change notification settings - Fork 31
Implement hierarchy keys #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
4ccd6b9
to
e58a89b
Compare
b05a05a
to
e048eec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking forward to this!
@behrmann Do consider the UX you want on this. Currently you can only get a hold of the public keys with |
I'm not sure I understand what the difference would mean. I gather there wouldn't be a semantic difference, when keys for a given hierarchy already exist, since I haven't built this yet, but I'll testdrive it tomorrow. |
2a9e18c
to
49b3c36
Compare
Well, |
Maybe I'm still misunderstanding, but wouldn't that be something for a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Playing with this I ran into some mild usability problems:
While the ssh-tpm-agent
understands PREFIX
and DESTDIR
and can be used to generate the unit files when packaging (I packaged it to get it on my test system), this doesn't work for ssh-tpm-hostkeys --install-sshd-config
, I'll open a separate issue for that, since I think that's an issue already.
Speaking of the unit files, though, with the introduced hierarchy setting, they should maybe become template units with DefaultInstance=owner
.
Related, I'm not sure whether it makes sense to have hostkeys from different hierarchies at the same time, but if so, it might make sense to encode the name of the hierarchy in the filename, since otherwise the condition in the keygen service would not be able to tell apart different hierarchies.
The most important thing: I can't say whether this so far survives a reboot with my testing, I've been holding it wrong for a bit and waiting for my machine to reinstall.
Fwiw, I regret implementing that entire thing. I thought it would be neat but it's clear to me it's just way too complicated.
I don't see a use-case for this yet so I reckon this is a "WONT FIX" until someone gives me a better idea. |
I actually can't quite tell what this setting does? |
Maybe a good point to drop it then? You're still below 1.0. I have to agree that the UX there is problematic.
Fine by me.
I'm currently running these unit files # ssh-tpm-agent@.service
[Unit]
ConditionEnvironment=!SSH_AGENT_PID
Description=ssh-tpm-agent service
Documentation=man:ssh-agent(1) man:ssh-add(1) man:ssh(1)
Wants=ssh-tpm-genkeys@%i.service
After=ssh-tpm-genkeys@%i.service
After=network.target
After=sshd.target
Requires=ssh-tpm-agent@%i.socket
[Service]
ExecStart=/usr/bin/ssh-tpm-agent --key-dir /etc/ssh --hierarchy %i
PassEnvironment=SSH_AGENT_PID
KillMode=process
Restart=always
[Install]
WantedBy=multi-user.target
DefaultInstance=endorsement [Unit]
Description=SSH TPM agent socket
Documentation=man:ssh-agent(1) man:ssh-add(1) man:ssh(1)
[Socket]
ListenStream=/var/tmp/ssh-tpm-agent.sock
SocketMode=0600
Service=ssh-tpm-agent@%i.service
[Install]
WantedBy=sockets.target
DefaultInstance=endorsement and [Unit]
Description=SSH TPM Key Generation
ConditionPathExists=|!/etc/ssh/ssh_tpm_host_ecdsa_key.tpm
ConditionPathExists=|!/etc/ssh/ssh_tpm_host_ecdsa_key.pub
ConditionPathExists=|!/etc/ssh/ssh_tpm_host_rsa_key.tpm
ConditionPathExists=|!/etc/ssh/ssh_tpm_host_rsa_key.pub
[Service]
ExecStart=/usr/bin/ssh-tpm-keygen -A --hierarchy %i
Type=oneshot
RemainAfterExit=yes The
I'm not entirely sure whether this is actually worthwhile. In light of the above "WONT FIX", it's probably better to just ship a dropin that changes the |
I can report back now, it's working fine. The endorsement hierarchy key survives fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be all endorments
@behrmann ah, the service files are clever. I'll need to think a little bit on how this could be packaged up in the project though. |
abf85ff
to
66e7054
Compare
0f53199
to
22ba9f1
Compare
Added service files here https://github.com/Foxboron/ssh-tpm-agent/tree/morten/hierarchy-keys/contrib/services/hierarchy_keys Not sure how I'll distribute it yet, but now it's somewhere :) |
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
22ba9f1
to
20b067a
Compare
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
20b067a
to
c8b4adc
Compare
Signed-off-by: Morten Linderud <morten@linderud.pw>
Signed-off-by: Morten Linderud <morten@linderud.pw>
46ffa0b
to
9cb1645
Compare
|
||
[Install] | ||
WantedBy=multi-user.target | ||
DefaultInstance=endorsement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I'm running it this way, the thing that's shipped (even only as contrib), should probably be
DefaultInstance=owner
Should be able to filter away some key typeslater