Ask Your Question

How to setup manifest to manage SSH Server Config File Only if the server is Redhat or Ubuntu

asked 2013-07-18 14:14:59 -0500

jsnss gravatar image

I have two things I want to accomplish. I want to setup a manifest to manage the ssh server configuration file, only if the server is Redhat, and ensure that password based login is not possible, and only key based authentication is possible. This manifest/config should also disable root based ssh login.

I also want to be able to Restarts the ssh server every time the ssh server configuration file has changed.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-07-18 17:07:24 -0500

Ancillas gravatar image

Here's how I'd rough something up. I don't work in redhat, so I don't know if there are subtle SSH config differences between RedHat and Ubuntu, so please correct any RedHat ignorance I bring to the table. I'm ignorantly assuming that RedHat and Ubuntu use slightly different config files.

class ssh_config {
  case $operatingsystem {
    'Ubuntu':  { $service_name  = 'ssh'
                 $config_path   = '/etc/ssh/sshd_config'
                 $config_source = 'ssh_config.ubuntu'
    'RedHat':  { $service_name  = 'sshd'
                 $config_path   = '/etc/ssh/sshd_config'
                 $config_source = 'ssh_config.redhat'
    default:   { fail("${operatingsystem} is not a supported operating system") } 

  file {"${config_path}":
    ensure => present,
    owner  => 'root',
    group  => 'root',
    mode   => '0644',
    source => "puppet:///ssh_config ...
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-07-18 14:14:59 -0500

Seen: 979 times

Last updated: Jul 18 '13