Coder Social home page Coder Social logo

puppet-ssh's Introduction

Puppet SSH

Puppet Forge modules by saz Puppet Forge Puppet Forge downloads Puppet Forge score Build Status

Manage SSH client and server via Puppet. Source: https://github.com/saz/puppet-ssh

Requirements

  • Exported resources for host keys management
  • puppetlabs/stdlib
  • puppetlabs/concat

Usage

Since version 2.0.0 only non-default values are written to both, client and server, configuration files.

Multiple occurrences of one config key (e.g. sshd should be listening on port 22 and 2222) should be passed as an array.

options => {
  'Port' => [22, 2222],
}

This is working for both, client and server.

Both client, server and per user client configuration

Host keys will be collected and distributed unless storeconfigs_enabled is false.

include ssh

or

class { 'ssh':
  storeconfigs_enabled => false,
  server_options => {
    'Match User www-data' => {
      'ChrootDirectory' => '%h',
      'ForceCommand' => 'internal-sftp',
      'PasswordAuthentication' => 'yes',
      'AllowTcpForwarding' => 'no',
      'X11Forwarding' => 'no',
    },
    'Port' => [22, 2222, 2288],
  },
  client_options => {
    'Host *.amazonaws.com' => {
      'User' => 'ec2-user',
    },
  },
  users_client_options => {
    'bob' => {
      options => {
        'Host *.alice.fr' => {
          'User' => 'alice',
        },
      },
    },
  },
}

Hiera example

ssh::storeconfigs_enabled: true

ssh::server_options:
    Protocol: '2'
    ListenAddress:
        - '127.0.0.0'
        - '%{::hostname}'
    PasswordAuthentication: 'yes'
    SyslogFacility: 'AUTHPRIV'
    UsePAM: 'yes'
    X11Forwarding: 'yes'

ssh::server::match_block:
  filetransfer:
    type: group
    options:
      ChrootDirectory: /home/sftp
      ForceCommand: internal-sftp

ssh::client_options:
    'Host *':
        SendEnv: 'LANG LC_*'
        ForwardX11Trusted: 'yes'
        ServerAliveInterval: '10'

ssh::users_client_options:
    'bob':
        'options':
            'Host *.alice.fr':
                'User': 'alice'
                'PasswordAuthentication': 'no'

Client only

Collected host keys from servers will be written to known_hosts unless storeconfigs_enabled is false

include ssh::client

or

class { 'ssh::client':
  storeconfigs_enabled => false,
  options => {
    'Host short' => {
      'User' => 'my-user',
      'HostName' => 'extreme.long.and.complicated.hostname.domain.tld',
    },
    'Host *' => {
      'User' => 'andromeda',
      'UserKnownHostsFile' => '/dev/null',
    },
  },
}

Per user client configuration

User's home is expected to be /home/bob

SSH configuration file will be /home/bob/.ssh/config.

::ssh::client::config::user { 'bob':
  ensure => present,
  options => {
    'HashKnownHosts' => 'yes'
  }
}

User's home is passed to define type

SSH configuration file will be /var/lib/bob/.ssh/config and puppet will manage directory /var/lib/bob/.ssh.

::ssh::client::config::user { 'bob':
  ensure => present,
  user_home_dir => '/var/lib/bob',
  options => {
    'HashKnownHosts' => 'yes'
  }
}

User's ssh directory should not be managed by the define type

SSH configuration file will be /var/lib/bob/.ssh/config.

::ssh::client::config::user { 'bob':
  ensure => present,
  user_home_dir => '/var/lib/bob',
  manage_user_ssh_dir => false,
  options => {
    'HashKnownHosts' => 'yes'
  }
}

User's ssh config is specified with an absolute path

::ssh::client::config::user { 'bob':
  ensure => present,
  target => '/var/lib/bob/.ssh/ssh_config',
  options => {
    'HashKnownHosts' => 'yes'
  }
}

Server only

Host keys will be collected for client distribution unless storeconfigs_enabled is false

include ssh::server

or

class { 'ssh::server':
  storeconfigs_enabled => false,
  options => {
    'Match User www-data' => {
      'ChrootDirectory' => '%h',
      'ForceCommand' => 'internal-sftp',
      'PasswordAuthentication' => 'yes',
      'AllowTcpForwarding' => 'no',
      'X11Forwarding' => 'no',
    },
    'PasswordAuthentication' => 'no',
    'PermitRootLogin'        => 'no',
    'Port'                   => [22, 2222],
  },
}

Validate config before replacing it

validate_sshd_file allows you to run /usr/sbin/sshd -tf against the sshd config file before it gets replaced, and will raise an error if the config is incorrect.

class { 'ssh::server':
  validate_sshd_file => true,
}

Default options

Client

'Host *'                 => {
  'SendEnv'              => 'LANG LC_*',
  'HashKnownHosts'       => 'yes',
  'GSSAPIAuthentication' => 'yes',
}

Server

'ChallengeResponseAuthentication' => 'no',
'X11Forwarding'                   => 'yes',
'PrintMotd'                       => 'no',
'AcceptEnv'                       => 'LANG LC_*',
'Subsystem'                       => 'sftp /usr/lib/openssh/sftp-server',
'UsePAM'                          => 'yes',

Overwriting default options

Default options will be merged with options passed in. If an option is set both as default and via options parameter, the latter will win.

The following example will disable X11Forwarding, which is enabled by default:

class { 'ssh::server':
  options           => {
    'X11Forwarding' => 'no',
  },
}

Which will lead to the following sshd_config file:

# File is managed by Puppet

ChallengeResponseAuthentication no
X11Forwarding no
PrintMotd no
AcceptEnv LANG LC\_\*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes
PasswordAuthentication no

Values can also be arrays, which will result in the option being specified multiple times

class { 'ssh::server':
  options           => {
    'HostKey' => ['/etc/ssh/ssh_host_ed25519_key', '/etc/ssh/ssh_host_rsa_key'],
  },
}

Which will lead to the following sshd_config file:

# File is managed by Puppet

ChallengeResponseAuthentication no
HostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_rsa_key
PrintMotd no
AcceptEnv LANG LC_\*
Subsystem sftp /usr/lib/openssh/sftp-server
UsePAM yes
PasswordAuthentication no

Defining host keys for server

You can define host keys your server will use

ssh::server::host_key {'ssh_host_rsa_key':
  private_key_content => '<the private key>',
  public_key_content  => '<the public key>',
}

Alternately, you could create the host key providing the files, instead of the content:

ssh::server::host_key {'ssh_host_rsa_key':
  private_key_source => 'puppet:///mymodule/ssh_host_rsa_key',
  public_key_source  => 'puppet:///mymodule/ssh_host_rsa_key.pub',
}

Both of these definitions will create /etc/ssh/ssh_host_rsa_key and /etc/ssh/ssh_host_rsa_key.pub and restart sshd daemon.

Adding custom match blocks

class YOURCUSTOMCLASS {

  include ssh

  ssh::server::match_block { 'sftp_only':
    type    => 'User',
    options => {
      'ChrootDirectory'        => "/sftp/%u",
      'ForceCommand'           => 'internal-sftp',
      'PasswordAuthentication' => 'no',
      'AllowTcpForwarding'     => 'no',
      'X11Forwarding'          => 'no',
    }
  }
}

Tag hostkey

Assign tags to exported sshkey resources (when ssh::storeconfigs_enabled is set to true).

ssh::hostkeys::tags:
  - hostkey_group1
  - hostkey_group2

Host keys then can be imported using:

Sshkey <<| tag == "hostkey_group1" |>>

Excluding network interfaces or ipaddresses

Use hiera to exclude interfaces or ipaddresses from hostkey inclusion

ssh::hostkeys::exclude_interfaces:
  - eth0
  - eth3
ssh::hostkeys::exclude_ipaddresses:
  - 192.168.0.1
  - 10.42.24.242

Facts

This module provides facts detailing the available SSH client and server versions.

  • ssh_*_version_full Provides the full version number including the portable version number.
  • ssh_*_version_major Provides the first two numbers in the version number.
  • ssh_*_version_release Provides the first three number components of the version, no portable version is present.

Example facter output for OpenSSH 6.6.1p1:

ssh_client_version_full => 6.6.1p1
ssh_client_version_major => 6.6
ssh_client_version_release => 6.6.1
ssh_server_version_full => 6.6.1p1
ssh_server_version_major => 6.6
ssh_server_version_release => 6.6.1

puppet-ssh's People

Contributors

alexjfisher avatar amateo avatar bastelfreak avatar buzzdeee avatar costela avatar cristifalcas avatar cs278 avatar cyberoni avatar derekhiggins avatar earsdown avatar edestecd avatar emning avatar gertvdijk avatar halfninja avatar jhoblitt avatar kenyon avatar kepstin avatar markasammut avatar marknl avatar martijndegouw avatar mcgege avatar petems avatar pmuller avatar rcuza avatar saz avatar slauger avatar spielkind avatar tedivm avatar voidus avatar wonko21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-ssh's Issues

"ssh_client_version_full" fact uses 'sshd -V 2>&1'

The "ssh_client_version_full" and "ssh_server_version_full" facts are both determined using 'sshd -V 2>&1'. I would think that the client version should be determined using 'ssh -V 2>&1'. Not sure if there's a reason for using 'sshd -V 2>&1' for both facts, but I wanted to report this anyway.

replace => false in server/config.pp

replace => false in server/config.pp obviously causes the agent not to copy the file over after editing.

I know this is probably the safe way to go BUT is unexpected behavior and it should be documented. Also maybe the class should be extended to restart the server if "replace => false" it's not used.

In theory it would be good enough if the config file was sent on the first run but since it will almost always be in place from the start the file would never get sent over?!

Removal of a node does not result in removal of ssh_known_hosts entry

With storeconfigs enabled and keys in puppetdb, ssh::knownhosts collects them and writes to /etc/ssh/ssh_known_hosts. But if a node is then deactivated, its entry is not removed from ssh_known_hosts. If that file is truncated, it can be remade without the removed node, but it seems like it should be possible to have node deactivation result in the removal of the key from ssh_known_hosts.

sshd_config AllowUsers

Augeas uses a sequence to manage this resource. Adding multiple users with puppet-ssh can be achieved:

ssh::server::configline { 'AllowUsers/1': value => 'user1' }
ssh::server::configline { 'AllowUsers/2': value => 'user2@host' }

However, your rules check each if these for equality individually.
since 'AllowUsers user1' does not equal 'AllowUsers 'user1 user2@host', the new value becomes 'AllowUsers user1 user2@host user1' Every puppet run will add new entries to the AllowUsers line.

Am I misusing puppet-ssh with AllowUsers or is this a bug?

Config fails to handle listenaddress versus ListenAddress

Because Augeas is case sensitive it fails to modify existing config entries such as:

listenaddress 0.0.0.0

When you wanted to use Puppet to replace it with ListenAddress 10.1.1.1.

This is a limitation of Augeas and may require using templates or some other mechanism.

Using match_block causes Error 400 on SERVER: Invalid tag

I'm trying to use match_block as shown in the example. But get an internal server error:
Error 400 on SERVER: Invalid tag '::ssh::server::match_block'

  ::ssh::server::match_block { 'sftpusers':
    type                       => 'Group',
    options                    => {
      'ChrootDirectory'        => "/var/sftp/",
      'ForceCommand'           => 'internal-sftp',
      'AllowTcpForwarding'     => 'no',
      'X11Forwarding'          => 'no',
    }
  }

Am I using it incorrectly? The debug output for puppet agent -t --debug doesn't show any additional info.

enhancement: add hiera example

Can you add an example of recording the data using a yaml-backed hiera setup? I'm having a hard time getting my head around how I'd do that.

Problem with server_options argument when not using hiera

Hi.
We are having problems with the 2.6.0 release:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, Could not find data item ssh::server_options in any Hiera data file and no default supplied at /etc/puppetlabs/puppet/thirdparty_modules/ssh/manifests/init.pp:9:27

We are not supplying server_options through hiera, we are using the server_options argument

Best Regards Olof Hellqvist

Multiple ports results in a single concatenated port numbers

 class { 'ssh::server':
    storeconfigs_enabled => false,
    options => {
      'PasswordAuthentication' => 'no',
      'Port'                   => [22,65432],
    },
  }

Results in:

notice: /Stage[main]/Ssh::Server::Config/File[/etc/ssh/sshd_config]/content: 
--- /etc/ssh/sshd_config    2014-04-17 11:32:16.768188177 +0100
+++ /tmp/puppet-file20140417-9314-kgmf64-0  2014-04-17 11:35:01.376416998 +0100
@@ -1,5 +1,5 @@
 # File is managed by Puppet
-Port 22
+Port 2265432

Module broken on 3.7.4

When trying to include this module without any hiera options, I get the following error:

Error: Evaluation Error: Error while evaluating a Function Call, create_resources(): second argument must be a hash at /etc/puppet/modules/ssh/manifests/init.pp:46:3

The reason is that in init.pp, $fin_users_client_options is a string, not a hash. This kind of problem was mentioned in this commit: cb626fd

Strange error when running on PE 3.8

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, uncaught throw :undefined_variable in thread 0x213a2 at /etc/puppetlabs/puppet/modules/ssh/manifests/hostkeys.pp:2:18 on node

Any thoughts on this?

puppetlabs-concat v1.2.1 with file_concat breaks sshd_config ~> Service

When using this module with the latest version of puppetlabs-concat the File/Service relationship fails.

File[$ssh::params::sshd_config] ~> Service[$ssh::params::service_name]

as the File resource doesn't exist. The new concat module doesn't create a File resource by the looks of things anymore. With some very loose testing I've found that

  1. Removing the File ~> Service relationship chains seems fine, as the Class ~> Class relationships between the 'ssh::server::config' and 'ssh::server::service' are defined.
  2. Changing the File ~> Service relationship to Concat ~> Service works fine as the relationship is now with the public module name rather than the internal File resource.

I'm not completely sure which method would be the best.

Map boolean config values to the real pairs

The module does not map booleans from YAML/JSON to the value what the ssh/sshd accepts. For example, PrintMotd is a boolean config option, can be true or false, however, if you provide true (e.g. foreman converts all unquoted yes / no to boolean values true / false), the module generates wrong config code (true instead of yes) what sshd does not understand and fails to start.

The workaround is easy: in foreman you should always quote 'yes' / 'no' values to ensure it will be written correctly, however the module should know this mapping, especially because the OpenSSH currently not uses any config option where true or false makes sense.

Allow Options like HostKey to be specified multiple times

The HostKey option for sshd_config can be specified multiple times. Currently, it is not possible to add multiple HostKey statements to the config, because additional Options are stored in a Hash.

One possible Solution would be to allow HostKey to be an array which expands to multiple HostKey-Statements. How do you feel about this approach?

Use puppet-ssh without storeconfigs or puppetdb?

I'm using this (successfully) in a vagrant environment without puppetdb, but of course I get

Warning: You cannot collect without storeconfigs being set on line 9 in file /tmp/vagrant-puppet-1/modules-0/ssh/manifests/hostkeys.pp

I understand the purpose of managing the hostkeys, but don't particularly want to use puppetdb or storeconfigs. I don't see an option to turn off this behavior. Am I missing something?

Puppet 4 Errors

Receiving custom fact errors on puppet 4

Error: Facter: error while resolving custom fact "ssh_client_version_full": undefined method `lines' for nil:NilClass
Error: Facter: error while resolving custom fact "ssh_client_version_major": undefined method `gsub' for nil:NilClass
Error: Facter: error while resolving custom fact "ssh_client_version_release": undefined method `gsub' for nil:NilClass
Error: Facter: error while resolving custom fact "ssh_server_version_full": undefined method `lines' for nil:NilClass
Error: Facter: error while resolving custom fact "ssh_server_version_major": undefined method `gsub' for nil:NilClass
Error: Facter: error while resolving custom fact "ssh_server_version_release": undefined method `gsub' for nil:NilClass

Allow for Sshkey's to be only "realized" from the current environment

I have a "multi-tennant" puppet server where each customer has their own puppet environment. I know that I can always set storeconfigs_enabled => false, but I would like the hosts to "send" their host keys, but only retrieve host keys from the same puppet environment. Does this make any sense? I honestly think it would be a fairly easy change, but if there is no desire for it, maybe I will just disable the storeconfigs option.

Failed to parse template ssh/sshd_config.erb (undefined method)

v2.3.1 seems to have a (fatal) problem with sshd_config.erb (or what's being input to it). A casual glance didn't explain it to me.

Error: Failed to parse template ssh/sshd_config.erb:
  Filepath: /tmp/vagrant-puppet-1/modules-0/ssh/templates/sshd_config.erb
  Line: 3
  Detail: undefined method `<=>' for false:FalseClass
 at /tmp/vagrant-puppet-1/modules-0/ssh/manifests/server/config.pp:7 on node xxx

Travis build is failing

The travis build is failing, and it looks like it has been failing for a while. Does that mean this module is dead?

File[$ssh::params::sshd_config] file resource missing?

When you define "File[$ssh::params::sshd_config] ~> Service[$ssh::params::service_name]" .. i am getting error

Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find resource 'File[/etc/ssh/sshd_config]' for relationship on 'Service[sshd]'

this happened after i added concat module i guess .. i think we need "Concat[$ssh::params::sshd_config]"

sshd_config order wrong

when specifying Port and ListenAddress for sshd_config, options are sorted and ListenAddress will be in the file before Ports.

This is wrong, sshd needs Ports in config first:
"Starting sshd: /etc/ssh/sshd_config line 7: ports must be specified before ListenAddress."

invalid parameter: allow_virtual

Hi there,

I got following errors when applying the module on a Debian Wheezy machine:

Error 400 on SERVER: Invalid parameter allow_virtual at 
/etc/puppet/modules/ssh/manifests/server/install.pp:8
Error 400 on SERVER: Invalid parameter allow_virtual at 
/etc/puppet/modules/ssh/manifests/client/install.pp:7

When I comment both parameters in install.pp it seems to work fine. I can't find these parameters anywhere else in the module. What am I doing wrong here?

Could not find command '/var/lib/puppet/concat/bin/concatfragments.rb'

I'm getting the error Could not find command '/var/lib/puppet/concat/bin/concatfragments.rb' , when using puppet module saz-ssh v2.8.1 and running a noop.

All my modules are:

puppet module list

/etc/puppet/modules
├── puppetlabs-concat (v1.2.3)
├── puppetlabs-ntp (v4.0.0)
├── puppetlabs-stdlib (v4.6.0)
└── saz-ssh (v2.8.1)

Some facts from my fresh installation:

facter os puppetversion

os => {"name"=>"Ubuntu", "release"=>{"major"=>"12.04", "full"=>"12.04"}, "lsb"=>{"distrelease"=>"12.04", "distcodename"=>"precise", "majdistrelease"=>"12.04", "distdescription"=>"Ubuntu 12.04", "distid"=>"Ubuntu"}, "family"=>"Debian"}
puppetversion => 3.8.1

My site.pp:

include ::ssh::server

Error:

puppet agent --test --noop

Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for ema
Info: Applying configuration version '1436379851'
Notice: /Stage[main]/Concat::Setup/File[/var/lib/puppet/concat]/ensure: current_value absent, should be directory (noop)
Notice: /Stage[main]/Concat::Setup/File[/var/lib/puppet/concat/bin]/ensure: current_value absent, should be directory (noop)
Notice: /Stage[main]/Concat::Setup/File[/var/lib/puppet/concat/bin/concatfragments.rb]/ensure: current_value absent, should be file (noop)
Notice: Class[Concat::Setup]: Would have triggered 'refresh' from 3 events
Notice: /Stage[main]/Ssh::Server::Config/Concat[/etc/ssh/sshd_config]/File[/var/lib/puppet/concat/etc_ssh_sshd_config]/ensure: current_value absent, should be directory (noop)
Info: /Stage[main]/Ssh::Server::Config/Concat[/etc/ssh/sshd_config]/File[/var/lib/puppet/concat/etc_ssh_sshd_config]: Scheduling refresh of Exec[concat/etc/ssh/sshd_config]
Notice: /Stage[main]/Ssh::Server::Config/Concat[/etc/ssh/sshd_config]/File[/var/lib/puppet/concat/etc_ssh_sshd_config/fragments.concat.out]/ensure: current_value absent, should be present (noop)
Notice: /Stage[main]/Ssh::Server::Config/Concat[/etc/ssh/sshd_config]/File[/var/lib/puppet/concat/etc_ssh_sshd_config/fragments]/ensure: current_value absent, should be directory (noop)
Info: /Stage[main]/Ssh::Server::Config/Concat[/etc/ssh/sshd_config]/File[/var/lib/puppet/concat/etc_ssh_sshd_config/fragments]: Scheduling refresh of Exec[concat/etc/ssh/sshd_config]
Notice: /Stage[main]/Ssh::Server::Config/Concat::Fragment[global config]/File[/var/lib/puppet/concat/etc_ssh_sshd_config/fragments/00_global config]/ensure: current_value absent, should be file (noop)
Info: /Stage[main]/Ssh::Server::Config/Concat::Fragment[global config]/File[/var/lib/puppet/concat/etc_ssh_sshd_config/fragments/00_global config]: Scheduling refresh of Exec[concat/etc/ssh/sshd_config]
Notice: /Stage[main]/Ssh::Server::Config/Concat[/etc/ssh/sshd_config]/File[/var/lib/puppet/concat/etc_ssh_sshd_config/fragments.concat]/ensure: current_value absent, should be present (noop)
Error: /Stage[main]/Ssh::Server::Config/Concat[/etc/ssh/sshd_config]/Exec[concat
/etc/ssh/sshd_config]: Could not evaluate: Could not find command '/var/lib/puppet/concat/bin/concatfragments.rb'
Notice: /Stage[main]/Ssh::Server::Config/Concat[/etc/ssh/sshd_config]/Exec[concat
/etc/ssh/sshd_config]: Would have triggered 'refresh' from 3 events
Notice: /Stage[main]/Ssh::Server::Config/Concat[/etc/ssh/sshd_config]/File[/etc/ssh/sshd_config]: Dependency Exec[concat
/etc/ssh/sshd_config] has failures: true
Warning: /Stage[main]/Ssh::Server::Config/Concat[/etc/ssh/sshd_config]/File[/etc/ssh/sshd_config]: Skipping because of failed dependencies
Notice: Concat[/etc/ssh/sshd_config]: Would have triggered 'refresh' from 5 events
Info: Concat[/etc/ssh/sshd_config]: Scheduling refresh of Service[ssh]
Notice: Concat::Fragment[global config]: Would have triggered 'refresh' from 1 events
Notice: Class[Ssh::Server::Config]: Would have triggered 'refresh' from 2 events
Info: Class[Ssh::Server::Config]: Scheduling refresh of Class[Ssh::Server::Service]
Notice: Class[Ssh::Server::Service]: Would have triggered 'refresh' from 1 events
Info: Class[Ssh::Server::Service]: Scheduling refresh of Service[ssh]
Notice: /Stage[main]/Ssh::Server::Service/Service[ssh]: Dependency Exec[concat
/etc/ssh/sshd_config] has failures: true
Warning: /Stage[main]/Ssh::Server::Service/Service[ssh]: Skipping because of failed dependencies
Notice: /Stage[main]/Ssh::Server::Service/Service[ssh]: Would have triggered 'refresh' from 2 events
Notice: Class[Ssh::Server::Service]: Would have triggered 'refresh' from 1 events
Notice: /Stage[main]/Ssh::Server/Anchor[ssh::server::end]: Dependency Exec[concat
/etc/ssh/sshd_config] has failures: true
Warning: /Stage[main]/Ssh::Server/Anchor[ssh::server::end]: Skipping because of failed dependencies
Notice: Stage[main]: Would have triggered 'refresh' from 3 events
Notice: Finished catalog run in 0.34 seconds

metadata.json does not compile

Could not use this module as metadata.json did not compile... issues are the dependency clause had a look but I could not see the issue. Worth adding in the metadata lint too.

What is <<| |>> ?

This is more of a question, rather than an issue, but what is the <<| |>> and how does it work? I found it in knownhosts.pp whilst debugging an issue I'm having with SSH keys in a new environment I created. I can't seem to find the mystical space ship thing (<<| |>>) documented anywhere. I'm stumped.

Support for merging options hash using multi-level hierarchy in hiera

I generally appreciate the idea behind it, but
I think the merge 3b2b2fb broke my ssh setup.

In my hierarchy, I have ssh::server_options defined, but no ssh::server::options.

in init.pp, these options are taken and passed to the server.pp. However, there, the selector, doesn't work. (It also doesn't work in init.pp, but there it's not recognized ;)

I wrote little test manifest:

class test {
$blah = hiera_hash('something', undef)

$blubb = $blah ? {
undef => "yalla",
default => "foo bar",
}

notify {"$blubb":}

}

Which spits out:
Notice: Compiled catalog for galen.l00-bugdead-prods.de in environment production in 1.98 seconds
Info: Applying configuration version '1431328078'
Notice: foo bar
Notice: /Stage[main]/Test/Notify[foo bar]/message: defined 'message' as 'foo bar'
Notice: Finished catalog run in 0.90 seconds

so the selectors used in the ssh module always fall back to the default.
Don't know what's wrong, if it is not possible to define 'undef' as default value?

This happens for me on OpenBSD with puppet-3.7.4p2, and ruby21-hiera-1.3.4

my current workaround is to use ssh::client::options and ssh::server::options in my Hiera hierarchy.

Don't know really how to work around it, i.e. A fallback value should be specified, as hiera_hash would bail out if it cannot find anything. Changing the default value to an empty hash {}, I haven't tried it, but I think the selectors would not like this. Don't know if it would be possible to have a string as default value, i.e. "Nothing Found", that then should work with the selector at least.

Sebastian

Dependency Cycle

When adding your module to my own configuration I appear to get the following error:

Error: Could not apply complete catalog: Found 1 dependency cycle:
(Anchor[ssh::server::end] => Class[Ssh::Server] => Service[sshd] => Class[Ssh::Server::Service] => Anchor[ssh::server::end])
Try the '--graph' option and opening the resulting '.dot' file in OmniGraffle or GraphViz

I have not been able to track down the cause of the problem.
Running Puppet 3.6.2

Using it in this way:

class { 'ssh::server':
  storeconfigs_enabled => false,
  options => {
    'PasswordAuthentication' => 'no',
    'PermitRootLogin'        => 'yes',
    'Port'                   => 1233,
  },
  notify => Service['sshd']
}

If you need more information just let me know

I think puppetlabs-concat might be a requirement also

Being new to Puppet.. I could not get the ssh module to deploy to a node without installing puppetlabs-concat on the master.
Both hosts are Ubuntu 14.04.2
Puppet versions are; node 3.7.4, master 3.7.5

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type concat at /etc/puppet/modules/ssh/manifests/server/config.pp:9 on node pn-test.playground.uno
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

Be able to edit ssh_config line entries as well

I'd love to be able to mange per-line entries in ssh_config. I started toying with copying over your defined type with augeas for clients and ran into a few issues. I won't have time to get back to it, but I thought I'd open an issue in case you get time.

Dependency error during rake spec

I'm getting this error when I run rake spec from my roles/profiles. Is there a missing fact that I need to include? It looked like $::osfamily drove everything in the params.pp.

    Failure/Error: it { should contain_class('roles') }
     Puppet::Error:
       Could not find resource 'File[/etc/ssh/sshd_config]' for relationship on 'Service[sshd]'

Here is my simple spec. I tried including lsbdistdescription, lsbdistid, interfaces, and ipaddress_eth0 because you had them in your spec.

require 'spec_helper'

describe 'roles' do
  context 'supported operating systems' do
    ['RedHat'].each do |osfamily|
      describe "roles class without any parameters on #{osfamily}" do
        let(:hiera_config) { 'spec/fixtures/hiera/hiera.yaml' }
        let(:params) {{ }}
        let(:facts) {{
          :osfamily => osfamily,
          :operatingsystem => osfamily,
          :operatingsystemmajrelease => '6',
          :operatingsystemrelease     => '6.3',
          :lsbdistdescription => 'Red Hat Enterprise Linux Server release 6.6 (Santiago)',
          :lsbdistid => 'RedHatEnterpriseServer',
          :interfaces => 'eth0',
          :ipaddress_eth0 => '192.168.1.1',
          :concat_basedir => '/tmp'
        }}

        it { should compile.with_all_deps }
        it { should contain_class('roles') }
      end
    end
  end
end

Host ordering for ssh_config matters and the sort kinda breaks that

At https://github.com/saz/puppet-ssh/blob/master/templates/ssh_config.erb#L15 the .sort breaks one of the 'features' of ssh_config. The options are applied on a first come, first served basis. The scenario I'm thinking of works like this:

Host .
ForwardAgent no
Host *
ForwardAgent yes

I'm trying to add these to my ssh_config and in that specific order. But, the sort makes it so I can't keep them in that order. I got around it by changing my config to be "# 0\nHost ." and "# 1\nHost *", but that's kinda cheesy. Is the .sort necessary or just to keep things pretty?

Invalid value "ed25519"

err: Failed to apply catalog: Parameter type failed on Sshkey[graphite.powernet_ed25519]: Invalid value "ed25519". Valid values are ssh-dss, ssh-rsa, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521.

this error after i update module with r10k

How to disable subsystem?

By default your server class configures a SSH Subsystem (/usr/lib/openssh/sftp-server). How can we not configure a subsystem when the only thing we can do is override the Subsystem value? i.e. an empty 'Subsystem' declaration will result in sshd failing to start.

Can not add multiple parameters like 'Port' or 'ListenAddress'

I modified configline.pp in next maer:
...
case $ensure {
present: {
augeas { "sshd_config_${name}":
changes => "set ${name} ${value}",
onlyif => "get ${name} != ${value}",
}
}
add: {
augeas { "sshd_config_${name}":
changes => [
"ins ${name} after ${name}[last()]",
"set ${name}[last()] ${value}"
],
onlyif => "get ${name}[. = '${value}'] != ${value}",
}
}
absent: {
augeas { "sshd_config_${name}":
changes => "rm ${name}",
onlyif => "get ${name}",
}
}
}
...
Now you can add multiple option:
ssh::server::configline {
'Port' :
ensure => 'add',
value => '5190'
}

Provide openssh version as a fact

I'd like to enable some specific cipher options but they require OpenSSH >= 6.2, which isn't always available. So I'd like to be able to selectively enable these ciphers if the OpenSSH version supports them and OpenSSH server fails hard if you supply unrecognised cipher options.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.