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

What am I missing? #25

Closed
Craig1f opened this issue Aug 19, 2017 · 2 comments
Closed

What am I missing? #25

Craig1f opened this issue Aug 19, 2017 · 2 comments

Comments

@Craig1f
Copy link

Craig1f commented Aug 19, 2017

I've got everything working, but I'm down to two problems:

If I tail /var/log/secure, I get this: /usr/local/bin/keymaker-create-account-for-iam-user failed: exit code 2

If I modify that file and set $PAM_USER to $1, and then call the file from the command line, it works fine. When it's being called via PAM Module, it fails. No idea what is wired incorrectly for PAM_USER.

  1. If I've already set the user using the hack above, and I tail /var/log/secure again, I get: error: AuthorizedKeysCommand /usr/sbin/keymaker-get-public-keys returned status 22

If I paste my public key into the file and echo it, my user authenticates just fine. If I call this file directly from the command line, it gives me back the authorized_keys I expect. If I remove 'get_authorized_keys "$@"' I get the expected keymaker help menu. If I just do "keymaker get_authorized_keys" without the "$@", I get nothing. It seems to be behaving really weird when I try to call keymaker with any arguments. It doesn't return the authorized_keys, so the user doesn't get authenticated.

This is all on CentOS 7.3

@kislyuk
Copy link
Owner

kislyuk commented Aug 28, 2017

Hello, sorry for the late response to this issue.

The scripts /usr/local/bin/keymaker-create-account-for-iam-user and /usr/sbin/keymaker-get-public-keys are not meant to be called directly.

The first script is called by the PAM authentication stack when trying to log in the user. The currently released version of keymaker incorrectly raises errors in keymaker-create-account-for-iam-user even when the process succeeds. It's safe to disregard these errors. You can check whether the process succeeded or not by trying to log in with a user with a name corresponding to an IAM user name, but no local user account. If the account is created after trying to log in, then the script is working fine.

Your second issue means that /usr/sbin/keymaker-get-public-keys failed to retrieve the keys for the user. This script is called by sshd when trying to log in the user. The failure to retrieve keys can happen because you did not upload the user's public key with keymaker upload, the IAM role for your instance doesn't have read access to the IAM user object, or the instance has no network access to the IAM API. (I do need to figure out a better way for these processes to log their errors).

@kislyuk
Copy link
Owner

kislyuk commented Feb 8, 2018

Closing due to lack of response. Please reopen if you are still having difficulties.

@kislyuk kislyuk closed this as completed Feb 8, 2018
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

No branches or pull requests

2 participants