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

Make parsing on jail.conf more robust #534

Merged
merged 1 commit into from
Dec 14, 2022

Conversation

cqexbesd
Copy link
Contributor

@cqexbesd cqexbesd commented Jul 24, 2022

jail.conf has a few tricky things about it's format (such as supporting
variable expansion) so it is easiest to get jail to do the parsing for us.

The changes to get required changes to set as well as we are no longer calling grep so that became a single awk script as well.

I hope there are some good tests for this code! One thing that has changed is the stripping of quotes on output, if they were present. I think this is better than sometimes having (and makes things easier for me for an upcoming change). I didn't see anywhere that broke existing code but I'm just a beginner.

@cedwards cedwards requested a review from JRGTH July 24, 2022 03:12
@cqexbesd cqexbesd marked this pull request as draft July 24, 2022 09:53
@cqexbesd
Copy link
Contributor Author

I have spotted a bug so this isn't ready to be merged yet. Will push an update soon.

@cqexbesd cqexbesd force-pushed the config_rebased branch 2 times, most recently from f1bffa9 to 538cf34 Compare July 24, 2022 10:02
@cqexbesd cqexbesd marked this pull request as ready for review July 24, 2022 10:02
@cqexbesd
Copy link
Contributor Author

OK I think its good to go now. I missed adding a new line to the config if the property wasn't already set.

@cqexbesd
Copy link
Contributor Author

One other change in behaviour is that "not set" is now just printed and doesn't go via warn. Is this a problem? Let me know if you want that fixed.

jail.conf has a few tricky things about it's format (such as supporting
variable expansion) so it is easiest to get jail to do the parsing for us.

The changes to get required changes to set as well as we no longer are calling
grep so that became a single awk script as well.
@cqexbesd
Copy link
Contributor Author

One other change in behaviour is that "not set" is now just printed and doesn't go via warn. Is this a problem? Let me know if you want that fixed.

OK I realise I was just being lazy so I had fixed that now as well. Hopefully that's the last of it!

@JRGTH
Copy link
Collaborator

JRGTH commented Jul 24, 2022

Just basic tested with/without quotes and with/without spaces, and with pipe | character, and working here as expected.

P.S. Letting jail the parsing with variable expansion seems nice to have.

Sample output HERE

Copy link
Collaborator

@JRGTH JRGTH left a comment

Choose a reason for hiding this comment

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

Tested the basics and the jail parsing and var expansion seems to be working here as expected.
Between more testing is welcome.

@cedwards cedwards merged commit 0629233 into BastilleBSD:master Dec 14, 2022
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.

None yet

3 participants