Giter VIP home page Giter VIP logo

akd-client's Introduction

AKD Client

This is an AuthorizedKeysCommand-compatible client for controlling SSH access via AKD (authorized_keys distribution) or AKDS (authorized_keys distribution, signed) records stored in DNS.

Setup

  1. Download akd-client and install it wherever it can be accessed by root (/usr/local/bin/ works fine)
  2. Make sure its owned by root, and is go-wx
  3. Add the following line to /etc/ssh/sshd_config:
    AuthorizedKeysCommand /path/to/akd-client -c %h/.ssh/akd.toml
  4. Create the corresponding config file in each user's .ssh/ folder
  5. Restart sshd

If you're feeling brave, rename your authorized_keys file and try SSH in. If all goes well, you should be let through. If not, try running akd-client manually and check the output.

Configuration

akd-client

The client needs to be configured with the record it will be checking and (optionally if using AKDS) the public key to verify the AKDS record against. By default akd-client will try read this in from ./config.toml, but you can change this by specifying a path with the -c argument.

See config.toml for a template.

DNS

AKD/S operates using TXT records with either v=akd; or v=akds; headers. These help differentiate from other TXT-based protocols as well as determine whether the data is cryptographically signed.

Run the following snippet to generate an AKDS record based off your current authorized_keys file:

echo "v=akds; k=$(base64 -w 0 < ~/.ssh/authorized_keys); s=$(gpg --detach-sign < ~/.ssh/authorized_keys | base64 -w 0);"

The key format is as follows:

  • AKD: v=akd; k=<base64-encoded authorized_keys...>;
  • AKDS: v=akds; k=<base64-encoded authorized_keys...>; s=<base64-encoded PGP signature...>;

The order of the k= and s= sections in the AKDS record is arbitrary. Each keypair in the record must start with its identifier (e.g. k), followed by = and the value, ending with ;.

The authorized_keys data is only encoded in Base64, so it can easily be pulled out with a DNS request and decoded manually if needed.

Here is an example record value using AKDS:

v=akds; k=c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUY1dld0eE54S2FFUllZUjNaMzRhV1JSYlZPQm5Hd3ZTMUgrd0VsdXpNalogdG9tQGljZTUudGVtLnBhcnR5CnNzaC1lZDI1NTE5IEFBQUFDM056YUMxbFpESTFOVEU1QUFBQUlJVGJDdmpTOGFtN00rb3JBbmdLYTlKTGV0U29mS2ZuVmpOVm5lL1QvRWROIHRvbUB3aW4uaWNlNS50ZW0ucGFydHkKc3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUJHdkw1RVJEZ2ZKQmhydEZUOTkzNFpCcEZjRGI2andaOGQ0YnVPT2JVL2QgdG9tQHV0aWxpYm9vay50ZW0ucGFydHkKc3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUlLQlh6MkNwclVwWVJOOSt5VW9sc3NiMC9naU0zc2NRMkY0UVVZaXRyVnkgdG9tQG1hY2Jvb2sudGVtLnBhcnR5CnNzaC1lZDI1NTE5IEFBQUFDM056YUMxbFpESTFOVEU1QUFBQUlCdXZSc29GNHhpL2NQcEd5RE4yUkt6NzlNOE02NklvYytyS0RaVFc3dnJLIHRvbUBlZGdlMjAudGVtLnBhcnR5; s=iHUEABYKAB0WIQQ3uvv2LpbDyGv3Lm7MdkksvhHnFQUCYjxAQwAKCRDMdkksvhHnFUZiAQC2BM76AzoprX+KEcrJWyr6e5wODi3wbvLLUzBh7PnX8gEA0caQEWB890KlufnEaWy84WvVXNR1O8iIbWGFEFLMzQ8=;

The signature entry (s=) is created by making an AKD record as above, signing it using GPG, and base64 encoding it. This can be achieved by piping the record into the STDIN of gpg --detach-sign | base64.

akd-client's People

Contributors

notactuallyterry avatar thomotron avatar

Stargazers

 avatar

Watchers

 avatar

akd-client's Issues

Add caching ability

Description

Add some kind of cache to lessen the impact of DNS failures. Whether it be a genuine upstream issue, local resolver failure, domain expiration, tinkering with DNS, etc. there really should be a contingency.

Simply having the default authorized_keys isn't quite enough, since AKD is supposed to centralise and automate the distribution of the keys.

Possibly have an option to overwrite the existing and/or keep its own?

Implement query from URL

Description

Originally a part of the AKD spec before it became a DNS-based thing, there should be a way to query a URL for the keys rather than just having them in DNS.

This would be useful for things such as GitHub .keys URLs (e.g. github.com/thomotron.keys).

Verify keys format before passing to OpenSSH

Description

The key blob should be verified to ensure it matches the format that OpenSSH expects. At the moment you can just pipe through any arbitrary data you want into an AKD record and it will spit it straight into OpenSSH.

Allow including other DNS records

Similar to SPF's include mechanism, AKD/S should allow a user to include other DNS records with something like i:_akds.cocytus.services i:_akds.tem.party
If an AKD/S client requires GPG signature verification, they should not follow any include statements.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.