Skip to content
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

Add public key pinning in authorized-keys command #132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

reynir
Copy link

@reynir reynir commented Dec 18, 2020

This adds pubkey pinning so we don't need to trust the whole slew of CAs that come by default.

You probably want to:

  1. Verify the pubkey is stable and doesn't change on renewal,
  2. Structure this differently so the pubkey hash is a variable living somewhere else.

@@ -1,6 +1,6 @@
#!/bin/sh

user="$(id -u "$1")"
curl -s "{{ userdb_apidomain }}/v1/ssh_public_key?uid=eq.$user&select=type,key" \
curl --pinnedpubkey "QUfPGxRcqlRoehidvMEsF/R1Ee1MXkb3Sxw+MNTARdY=" -s "{{ userdb_apidomain }}/v1/ssh_public_key?uid=eq.$user&select=type,key" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this pinned to? our private key or letsencrypt?
the former seems dangerous: we don't really have backups and consider it ephemeral
the latter seems dangerous: if shit happens we might want to use something else

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the public key from the certificate which corresponds to your private key. It was retrieved with this command: openssl s_client -servername userdb.hashbang.sh -connect userdb.hashbang.sh:443 | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't have backups and consider it ephemeral

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe that should be reconsidered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants