Skip to content

fix for two parameters in match-set #29423 - #29426

Closed
l13t wants to merge 2 commits into
saltstack:developfrom
l13t:develop
Closed

l13t wants to merge 2 commits into
saltstack:developfrom
l13t:develop

Conversation

@l13t

@l13t l13t commented Dec 4, 2015

Copy link
Copy Markdown
Contributor

No description provided.

@jfindlay

jfindlay commented Dec 5, 2015

Copy link
Copy Markdown
Contributor

Fixes #29423.

@thusoy, ping.

@jfindlay jfindlay added pending-discussion The issue or pull request needs more discussion before it can be closed or merged Execution-Module Platform Relates to OS, containers, platform-based utilities like FS, system based apps labels Dec 5, 2015
@thusoy

thusoy commented Dec 7, 2015

Copy link
Copy Markdown
Contributor

As far as I understand it, it should be possible to either specify match sets like this:

match-set: src dest,dest2

or like this:

match-set:
  - src dest
  - other_src flag1,flag2

Thus like I mentioned in #29423, you can't split the string on commas, as it would break the string case with multiple flags.

Also like mentioned, rule is a list, so you have to use rule.append().

You also need to take care to extract negations properly, so that it's possible to specify the following rule:

match-set:
  - ! src dest

The current suggestion would build the rule as -m set --match-set ! src dest, while the correct rule would be -m set ! --match-set src dest.

There is a function to help with the negations, maybe_add_negation, but it's made specifically for string keys, thus might need some tweaking to support list arguments like this.

@cachedout

Copy link
Copy Markdown
Contributor

@l13t Did you see the above comment from @thusoy ? We'd love to have your feedback so we can get this PR modified if necessary and then merged. Thanks!

@l13t

l13t commented Dec 9, 2015

Copy link
Copy Markdown
Contributor Author

@cachedout
Hello
I saw this answer. And we proceeded discussion in Issue #29423 .
Sorry. I got few tasks at work and did upload changes to github. I'll try to do this today.

@cachedout

Copy link
Copy Markdown
Contributor

Thanks @l13t . Please let me know when this is ready to go.

@thusoy

thusoy commented Dec 9, 2015

Copy link
Copy Markdown
Contributor

@l13t Good work on the negations! Just remember to use rule.append() as well.

@l13t

l13t commented Dec 9, 2015

Copy link
Copy Markdown
Contributor Author

Oh... Only now I understand about what you were talking ((((:
If it's so necessary I change it tomorrow.
But after weeks of investigation of module/state and working on my own firewall formula I finally understand that it should be totally rewritten ))):

@cachedout

Copy link
Copy Markdown
Contributor

Hi @l13t . Are there still changes to be made with this one? Please let me know when it is ready to go. Thanks!

@l13t

l13t commented Dec 11, 2015

Copy link
Copy Markdown
Contributor Author

You can merge this changes. I'll try later to rewrite this module in state like in was suggested with python-iptables.

@thusoy

thusoy commented Dec 11, 2015

Copy link
Copy Markdown
Contributor

Negative, this can not be merged until the change uses rule.append or it won't work. Write a simple test case to build_url (there are several already) and you'll see.

@thusoy

thusoy commented Dec 12, 2015

Copy link
Copy Markdown
Contributor

Based on @l13t's work I added some tests, the suggested fix doesn't remove the negated string from the original match-set, and as I've pointed out, fails to append the rule since it doesn't use rule.append. I fixed these issues and added tests in this commit, which I can open a new PR for if desired and then we close this, or the changes can be ported by @l13t into this PR and rebased.

@l13t

l13t commented Dec 14, 2015

Copy link
Copy Markdown
Contributor Author

@thusoy
please open PR from your side.
i didn't know about some test changes ))):

@cachedout

Copy link
Copy Markdown
Contributor

OK, based on what I'm reading here it sounds like the decision is to close this PR and wait for a new one from @thusoy . I'll close this one for the time being. Thanks to you both for the good discussion here.

@thusoy

thusoy commented Dec 15, 2015

Copy link
Copy Markdown
Contributor

@cachedout Cool, new PR is here

thusoy added a commit to thusoy/salt that referenced this pull request Dec 16, 2015
Based on work by @l13t in saltstack#29426.

Added tests and fixed incorrect appending of the built rule.

Closes saltstack#29423.
rallytime pushed a commit to rallytime/salt that referenced this pull request Feb 12, 2016
Based on work by @l13t in saltstack#29426.

Added tests and fixed incorrect appending of the built rule.

Closes saltstack#29423.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Execution-Module pending-discussion The issue or pull request needs more discussion before it can be closed or merged Platform Relates to OS, containers, platform-based utilities like FS, system based apps

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants