Skip to content

refactor hostkeys and knownhosts classes by moving and exposing their parameters in the relevant parents #412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

stuartrobert
Copy link

@stuartrobert stuartrobert commented Jun 20, 2025

  • moved parameters from hostkeys to server
  • removed use of knownhosts from server class
  • moved parameters from knownhosts to client
  • removed knownhosts class
  • updated data to reflect

This Pull Request (PR) fixes the following issues

Fixes #411

@stuartrobert stuartrobert marked this pull request as ready for review June 20, 2025 05:51
Comment on lines +121 to +128
Boolean $export_ipaddresses = true,
Optional[String[1]] $storeconfigs_group = undef,
Array $extra_aliases = [],
Array $exclude_interfaces = [],
Array $exclude_interfaces_re = [],
Array $exclude_ipaddresses = [],
Boolean $use_trusted_facts = false,
Optional[Array[String[1]]] $tags = undef,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a backwards-incompatible change and I don't really like it. Maybe we can just keep the parameters on ssh::hostkeys and use parameters on ssh::server as default? This way, any value set via e.g. hiera will be working as expected.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Steffen,
I didn't think about the breaking change side of it as the hostkeys code almost seemed like it was really heading towards being a private class. I'll put it back more like it was as breaking what is working for people isn't great.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Set it up as you described to keep backward compatibility.


Class['ssh::server::install']
-> Class['ssh::server::config']
~> Class['ssh::server::service']
-> Class['ssh::hostkeys']
-> Class['ssh::knownhosts']
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a chance, that someone's making use of this by not managing the client, but still making use of the collected known hosts. Except for getting rid of the class, is there any disadvantage which gets solved?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Steffen,
Thanks for the feedback. Its really about "knownhosts" being about the client side of ssh, its never a server bit of functionality. Unless you go to some trouble, with this in the class, you can't avoid having knownhosts being updated. If you have fleets of systems where you don't want the hosts, IPs and keys being shared between them, this is going to put them there by default. The (very welcome) addition of the filtering of keys is a partial answer to this problem, but in many cases it can be avoided completely by not insisting on writing knownhosts files on every server (who normally won't use them) which also produces a lot of noise in large fleets.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartrobert that's a good point. I currently use this module to distribute knownhosts to my entire fleet, but I would welcome the ability to limit knownhosts to clients only, in order to reduce the number of changes puppet is making.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at this again trying to think how to add this functionality with a view to making the server side collection disabled by default, but didn't come up with anything without breaking the principle that this should be primarily a client side item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reference parameter to ssh::hostkeys and ssh::knownhosts to "parent" classes
3 participants