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

discussion: v2 api? #66

Closed
paultag opened this issue Feb 9, 2020 · 10 comments
Closed

discussion: v2 api? #66

paultag opened this issue Feb 9, 2020 · 10 comments
Labels
question Further information is requested

Comments

@paultag
Copy link
Member

paultag commented Feb 9, 2020

Currently, we PUT an ssh key, in the authorized key format. This is very easy to implement and it makes me feel very satisfied in the API call. Send a public key, get a certificate.

I think it may be time to tweak the API though, perhaps sending JSON to the endpoint instead.

In particular, I'd like to change the API to look like:

{
    "public_key": {
        "type": "ssh-*",
        "bytes": "base64byteshere==",
    },
    "certificate_key_id": "user@host",
    "certificate_type": "user|host",
}

or perhaps

{
    "public_key_bytes": "base64byteshere==",
    "certificate_key_id": "user@host",
    "certificate_type": "user|host",
}

to allow Hallow to issue Host Certificates too.

Alternatively, we can set this in http X-Hallow-* headers. I like that slightly less.

As a stop-gap, we can support both inputs by checking the first byte, since { is not a valid ssh key type, and then drop the old format after we're sure all client binaries out there have been forward-ported.

@paultag paultag added the question Further information is requested label Feb 9, 2020
@alex
Copy link
Member

alex commented Feb 9, 2020 via email

@paultag
Copy link
Member Author

paultag commented Feb 9, 2020

@alex The use-case is so you don't have to rely on TOFU, or if you have an autoscaling cluster where the key changes frequently, the key validation happens by distributing a set of public keys to validate against.

As for what to use for principal, I think I'd likely try to add in a Hallow::Principals tag on a Role, and have hallow call iam:GetRole to fetch tags, and set the principal to the space delimited value of that tag, if set. This could also be used for User certificates, but I don't think I would encourage that, since every user on most aws machines is either ubuntu or ec2-user

@alex
Copy link
Member

alex commented Feb 9, 2020

Interesting, does that work for all (important) cases? It seems like that requires a role-per-EC2 instance. What happens if you've got an ASG?

@paultag
Copy link
Member Author

paultag commented Feb 9, 2020

@alex less per-instance, and more per-fqdn. I have a service that speaks ssh, and I'm going to deploy that fronted with an NLB (likely via fargate), and each instance part of the group will be given a specific role, all of which are handling requests for a specific fqdn.

That means I either have to share the private key material across the entire cluster (meh), ignore keys (double meh) or use signed host keys.

(If you're interested, it's a freetime project and is designed with Hallow in mind)

@alex
Copy link
Member

alex commented Feb 9, 2020

So, if I follow: your use case is for a service that operates using the SSH protocol, not actually conventional SSHing into a server?

@paultag
Copy link
Member Author

paultag commented Feb 9, 2020

@alex correct, yes!

@alex
Copy link
Member

alex commented Feb 9, 2020

Interesting. I'm not sure how I feel, something about it feels scope creepy, but I can't identify why, which suggests it's not a good concern :-)

Anyways, I think allowing posting the data as JSON seems like a reasonable thing, since it gives us an avenue for extensibility. I'm cautiously in favor of just doing content-type detection on the body, instead of a whole new endpoint.

@paultag
Copy link
Member Author

paultag commented Feb 9, 2020

OK, why don't we sleep on this and come to a consensus by like wednesday? I'm also not super wed to this, and I can work around it for my hack.

@alex
Copy link
Member

alex commented Feb 9, 2020 via email

@paultag
Copy link
Member Author

paultag commented Feb 15, 2020

Punting until later, once we better understand scope and priorities.

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

No branches or pull requests

2 participants