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

set authorized_keys directory so its actually used #63

Merged
merged 8 commits into from
Jan 5, 2017
Merged

set authorized_keys directory so its actually used #63

merged 8 commits into from
Jan 5, 2017

Conversation

rndmh3ro
Copy link
Contributor

@rndmh3ro rndmh3ro commented Jan 4, 2017

Before this commit, you could specify a authorized_keys directory, but it would only be created, not actually used, unless you specified twice:

accounts::users:
  user:
    authorized_keys_file: '/etc/ssh/authorized_keys_user'
    comment: "foo Bar"
    ssh_keys:
      'user':
        target: "/etc/ssh/authorized_keys_user"
        type: "ssh-rsa"
        key: "asdjsjgiov"

I don't know why the test "supply custom path to authorized_keys file outside of home dir" doesn't catch this, but I guess, because the target-option for ssh_authorized_keys is missing and the test looks for the key in the home-directory, where its created.
I can't test it myself, either.

Anyway, now it works like this:

accounts::users:
  user:
    authorized_keys_file: '/etc/ssh/authorized_keys_user'
    comment: "foo Bar"
    ssh_keys:
      'user':
        type: "ssh-rsa"
        key: "asdjsjgiov"

Additionally a needed dependency was set so the authorized_keys-file gets created before trying to insert keys into it.

Before this commit, you could specify a authorized_keys directory,
but it would only be created, not actually used, unless you specified twice:

```
accounts::users:
  user:
    authorized_keys_file: '/etc/ssh/authorized_keys_user'
    comment: "foo Bar"
    ssh_keys:
      'user':
        target: "/etc/ssh/authorized_keys_user"
        type: "ssh-rsa"
        key: "asdjsjgiov"
```

I don't know why the test "supply custom path to authorized_keys file outside of home dir"
doesn't catch this, but I guess, because the target-option for ssh_authorized_keys
is missing and the test looks for the key in the home-directory, where its created.
I can't test it myself, either.

Anyway, now it works like this:

```
accounts::users:
  user:
    authorized_keys_file: '/etc/ssh/authorized_keys_user'
    comment: "foo Bar"
    ssh_keys:
      'user':
        type: "ssh-rsa"
        key: "asdjsjgiov"
```

Additionally a needed dependency was set so the authorized_keys-file
gets created before trying to insert keys into it.
@deric
Copy link
Owner

deric commented Jan 4, 2017

Have a look at the Travis build logs. It seems to introduce a cycle on some Puppet versions:

       dependency cycles found: (File[/home/myuser/.ssh/authorized_keys] => Ssh_authorized_key[myawesomefirstkey] => File[/home/myuser/.ssh/authorized_keys])
     # ./spec/classes/init_spec.rb:13:in `block (2 levels) in <top (required)>'

Moreover for Puppet 4 compatibility the word type should be quoted.

 Use of reserved word: type, must be quoted if intended to be a String 

@rndmh3ro
Copy link
Contributor Author

rndmh3ro commented Jan 4, 2017

Strange, this did not happen for me locally.
I'll check it tomorrow, and I'll also add back the quotes around type!

@deric deric merged commit 9f28cd7 into deric:master Jan 5, 2017
@deric
Copy link
Owner

deric commented Jan 5, 2017

Thanks!

@rndmh3ro rndmh3ro deleted the ssh_auth_keys_target branch January 5, 2017 07:59
@rndmh3ro
Copy link
Contributor Author

rndmh3ro commented Jan 5, 2017

You're welcome!

PS: Could you release a new version on the forge?

deric added a commit that referenced this pull request Jan 5, 2017
@deric
Copy link
Owner

deric commented Jan 5, 2017

Sure. v1.5.1 has been released.

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