-
Notifications
You must be signed in to change notification settings - Fork 34
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
Allow changing ownership of authorized_keys file #64
Comments
I'm not sure if your configuration would work with standard sshd, typically ssh enforces quite strict policy about I've added The closest configuration I was able to run, is following: accounts::users:
user1:
authorized_keys_file: '/etc/ssh/user1/user1_authorized_keys'
comment: "user1"
ssh_keys:
'local_key':
type: "ssh-rsa"
key: "AAAB"
user2:
authorized_keys_file: '/etc/ssh/user2/user2_authorized_keys'
comment: "user2"
ssh_keys:
'user2':
type: "ssh-rsa"
key: "AAAAB=" Otherwise puppet refuses to write authorized keys into same directory. |
Yes, it does, I already did it this way. See also
So in the
and then you can do it like I mentioned in the OP: I'll try it with the new option! |
With the latest master-version and following config theres no duplicate problem anymore. accounts::users:
user2:
authorized_keys_file: '/etc/ssh/authorized_keys_user2'
comment: "foo"
ssh_keys:
'local_key_user2':
type: "ssh-rsa"
key: "AAAAAAAAAA"
user1:
authorized_keys_file: '/etc/ssh/authorized_keys_user1'
comment: "foo"
ssh_keys:
'local_key_user1':
type: "ssh-rsa"
key: "AAAAAAAAAA"
user3:
authorized_keys_file: '/etc/ssh/authorized_keys_user3'
comment: "foo"
ssh_keys:
'local_key_user3':
type: "ssh-rsa"
key: "AAAAAAAAAA"
user4:
authorized_keys_file: '/etc/ssh/authorized_keys_user4'
comment: "foo"
ssh_keys:
'local_key_user4':
type: "ssh-rsa"
key: "AAAAAAAAAA"
But then this happens:
This does not happen if I change the user to |
Yeah, I run into the same issue yesterday. It seems to be feature of You might be able to bypass this if you would manage parent directory before creating accounts (I haven't found code that would be So, we could introduce something like |
Sort of 'hacky' approach as Puppet's ssh_authorized_key resource doesn't support changing ownership (file write would fail).
@rndmh3ro try current version from master branch. It's a bit hacky approach as I had to bypass classes:
- '::accounts'
accounts::user_defaults:
ssh_dir_owner: 'root'
ssh_dir_group: 'root'
manage_ssh_dir: false
accounts::users:
user1:
authorized_keys_file: '/etc/ssh/user1_authorized_keys'
comment: "user1"
ssh_keys:
'local_key':
type: "ssh-rsa"
key: "AAAB"
user2:
authorized_keys_file: '/etc/ssh/user2_authorized_keys'
comment: "user2"
ssh_keys:
'user2':
type: "ssh-rsa"
key: "AAAAB=" |
That works perfectly! Thanks for taking the time to help me here! |
Good. You're welcome. I'll update the documentation and then it should be ready for new release. |
With the latest changes I cannot set different (or the same) authorized_key_file for different users, because of https://github.com/deric/puppet-accounts/blob/master/manifests/authorized_keys.pp#L23-L30
This assumes that the directory containing the file should belong to the user for that file. However some german companies require the authorized_keys file to not be writable be the user itself, only by root (because of security reasons and traceability).
Here's the hiera config:
Thats the error:
I don't know the best way this could be solved or if its even in the scope of this module.
Maybe make user and group of the $ssh_dir configurable? Set it to
root
by default?Maybe the easiest option: make managing the $ssh_dir through puppet optional, e.g. with
manange_ssh_dir = false
.The text was updated successfully, but these errors were encountered: