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 ability to assign additional keys to a user, add list-users and add-key commands. #10

Merged
merged 5 commits into from
Apr 14, 2016

Conversation

pirogoeth
Copy link
Collaborator

So I added the ability to add extra keys for a single user ID and the ability to list user IDs.

The list command looks like this:

→ sean@gamma | ~/.go/src/github.com/dcu/onetouch-ssh | SSH | branch: master | load: 0.10
λ onetouch-ssh list-users
        Authy ID        Key Comment                      Public Key
         3918644                                         b5:bd:c7:e1:f0:0f:2c:48:30:79:8c:1d:4c:af:f4:d4
         3918644        pirogoeth@eon.internal.maio.me   a7:8f:12:19:03:7c:8d:ab:24:1a:fe:43:23:f0:43:c0

And I've confirmed that add-key works. I know you removed ssh/user.go earlier today, but I've implemented a LoadUser command on top of the User struct that I was planning on incorporating into the list-users somehow. Maybe we can bring User struct and LoadUser into ssh/users_manager.go or just trim down ssh/user.go?

@pirogoeth
Copy link
Collaborator Author

Okay so this has very rapidly progressed from "add two things" to "ADD ALL THE THINGS".

I've trimmed some of the old database code from ssh/user.go, merged most (if not all) of the upstream changes, made some messages more concise, and added two more configuration options:

shell: <string>
shell_args: ["list", "of", "arguments"]

Use case: After login, the user gets dropped in to a bare bash shell because of the interactivity "hack", which completely skips any of the user's rcfiles, etc. So here's where it becomes useful:

shell: /bin/bash
shell_args: ["--login"]

... To basically re-enable launching the user's shell as a profile/login shell :)

Next, we probably need to definitely update the readme, enhance the error capturing/passing in utils.RunCommand, and maybe have a nice little progress spinner show up while waiting for the user's input from Authy (totally optional but would be pretty cool).

Note: I suppose this PR takes care of #11, #9, and #4...

publicKey := strings.Join(args[1:], " ")
err := usersManager.AddKey(args[0], publicKey)
if err != nil {
fmt.Printf("Error adding key to user: %s", err)
Copy link
Owner

Choose a reason for hiding this comment

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

we're missing a \n here

@dcu
Copy link
Owner

dcu commented Apr 14, 2016

wow amazing work! thanks

@dcu dcu merged commit 493234b into dcu:master Apr 14, 2016
@pirogoeth
Copy link
Collaborator Author

No problem! I'm enjoying toying around with this code and I really like the end-product, so it's kind-of a win-win 😆

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.

None yet

2 participants