ssh_authorized_key pattern-list

44 views
Skip to first unread message

Saad Butto

unread,
Aug 31, 2022, 5:31:03 PM8/31/22
to Puppet Users
Hi guys,

I am trying to add a restriction to an SSH public key in the authorized_keys file. The restriction is to only allow ssh access from certain IP addresses using that particular SSH key.

SSH has something called pattern-list where you can add from=<pattern-list> ahead of the public key in the authorized_keys.

something like this:

from="10.0.0.?,*.example.com" ssh-rsa AB3Nz...EN8w== us...@example.com

I couldn't find the ssh_authorized_key attribute that can help achieve that.

Can someone please help me find a way to do it using puppet ssh_authorized_key  resource?

Thanks

Ian Mortimer

unread,
Sep 4, 2022, 6:07:48 PM9/4/22
to puppet...@googlegroups.com
On Wed, 2022-08-31 at 14:03 -0700, Saad Butto wrote:


> I couldn't find the ssh_authorized_key attribute that can help
> achieve that.
>
> Can someone please help me find a way to do it using puppet
> ssh_authorized_key resource?

https://puppet.com/docs/puppet/5.5/types/ssh_authorized_key.html#ssh_authorized_key-attribute-options


--
Ian

Saad Butto

unread,
Sep 10, 2022, 11:26:32 AM9/10/22
to Puppet Users
Hi Ian,

I found that too but it defers you to SSH options. It doesn't say how to use from=<pattern-list> with puppet ssh_authorized_key resource.

Thanks

Ian Mortimer

unread,
Sep 11, 2022, 6:58:04 PM9/11/22
to puppet...@googlegroups.com
On Sat, 2022-09-10 at 08:26 -0700, Saad Butto wrote:

> I found that too but it defers you to SSH options. It doesn't say how
> to use from=<pattern-list> with puppet ssh_authorized_key resource.

Options is an array. Most commonly used options are from and command.
Something like this in hiera is what we use:

options: ['from="allowed.host"', 'command="allowed_command"']


--
Ian

Saad Butto

unread,
Sep 14, 2022, 9:46:27 AM9/14/22
to Puppet Users
hmmm, I will give it a try.

Thanks
Reply all
Reply to author
Forward
0 new messages