Skip to content
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

sshd_config_match doesn't handle meta characters properly #66

Closed
wants to merge 0 commits into from

Conversation

raybellis
Copy link

The comment field in an sshd_config_match block is auto-generated and may end up containing regex meta-characters in the resource name field, which fail to match correctly and cause repeated "corrective" updates.

This patch ensures that the resource name is escaped before it's passed into the RE that matches for ^#{resource[:name]}:\s*/i.

@coveralls
Copy link

Coverage Status

Coverage decreased (-65.7%) to 31.209% when pulling 0617d49 on raybellis:master into a0f3728 on hercules-team:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-65.7%) to 31.209% when pulling 0617d49 on raybellis:master into a0f3728 on hercules-team:master.

@raybellis
Copy link
Author

I think these new CI errors are issues with Travis rather than with the code.

@raphink
Copy link
Member

raphink commented Apr 26, 2021

Thanks for this. Could you add a unit test for this please?

@raphink raphink added the enhancement New feature or request label Apr 26, 2021
@raybellis
Copy link
Author

Sorry - not sure how. We were able to figure out the Ruby code sufficiently to identify and resolve the issue, but we've no familiarity with the test framework you use.

What I can tell you is that lines such as Match 192.168.*.5 would typically match, because the .* does actually match (albeit technically it would also overmatch many other strings). However Match fe80:* would fail.

@raybellis
Copy link
Author

p.s. I consider this a bug, not an enhancement. With * wildcard matches being common in ssh match rules, it's pretty important that they work properly. Having a manifest return status code 2 because it tries to fix up the file every time the puppet agent runs is a giant PITA.

@vox-pupuli-tasks
Copy link

Dear @raybellis, thanks for the PR!

This is Vox Pupuli Tasks, your friendly Vox Pupuli Github Bot. I noticed that your pull request has CI failures. Can you please have a look at the failing CI jobs?
If you need any help, you can reach out to us on our IRC channel voxpupuli on Freenode or our Slack channel voxpupuli at slack.puppet.com.
You can find my sourcecode at voxpupuli/vox-pupuli-tasks

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

Successfully merging this pull request may close these issues.

None yet

4 participants