saz / puppet-ssh

Puppet module to manage ssh server and client
http://forge.puppetlabs.com/saz/ssh
Other
123 stars 236 forks source link

Subsystem setting broken with use_augeas => true #376

Closed egrist closed 5 months ago

egrist commented 8 months ago

Using module version 11.2.0.

First problem we notices was that when using use_augeas => true, $default_options is ignored. A work around was to replace $options on line L78 in manifests/server.pp with deep_merge($default_options, $options). This enables defaults_options and the possibility to override them via the manifest or hieradata.

However, we got an error from Puppet::Type::Sshd_config::ProviderAugeas stating Ssh::Server::Config/Sshd_config[Subsystem]: Could not evaluate: Failed to save Augeas tree to file. See debug logs for details Looking at the debug output I noticed /Subsystem/ missing from the pattern. Investigated further and found that in the 'puppet-augeasproviders_ssh', '6.0.0' this seems to be in another provider, sshd_config_subsystem as commented here, (not sure how to use the correct terminology, but hope it makes sense).

I'm not capable enough to conjure a solution, but maybe this info can help someone that hits the same issue. I'll just use the default use_augeas => false as a viable solution.

saz commented 6 months ago

Thanks for the detailed report. To get this working, subsystem must be handled differently in https://github.com/saz/puppet-ssh/blob/f8a311052793e07b6c41de6b53bc8fec89214520/manifests/server/config.pp#L21:

sshd_config_subsystem { "sftp":
  ensure  => present,
  command => "/usr/lib/openssh/sftp-server",
}

It might be enough to check if the key matches subsystem, split the value on ` and depending on the number of split results, pass it tosshd_config_subsystem`

I'll try to come up with a PR

saz commented 5 months ago

@egrist This should be fixed with https://github.com/saz/puppet-ssh/pull/386

Can you give it a try?

egrist commented 5 months ago

@saz Sorry but we've teared down that puppet environment about a month ago so I can't test it :(

saz commented 5 months ago

Thanks for the feedback. My change seems to be working, so I'll just merge it.