sub _gather_ssh_keys {
my ($self, $user, $home) = @_;
- my $ssh_dir = "$home/.ssh/";
- return {}
- unless -d $ssh_dir;
+ my $ssh_dir = "$home/.ssh";
+ return {
+ files => {},
+ authorized => { file_name => "$ssh_dir/authorized_keys", body => '' }
+ } unless -d $ssh_dir;
my %key;
for my $item (files_from_dir $ssh_dir) {
next unless $item =~ m{\.pub$};
$key{ $item } = transform_exceptions {
return {
+ file_name => "$ssh_dir/$item",
body => scalar output_from_file "$ssh_dir/$item",
};
};
}
- return { files => \%key };
+ my $auth_keys = transform_exceptions {
+ return {
+ file_name => "$ssh_dir/authorized_keys",
+ body => scalar output_from_file "$ssh_dir/authorized_keys",
+ };
+ };
+ return { files => \%key, authorized => $auth_keys };
}
sub _gather_user_groups {