-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add ferm::rule parameters outerface
, to_source
and to_destination
.
#111
Add ferm::rule parameters outerface
, to_source
and to_destination
.
#111
Conversation
@robinelfrink thanks for the PR! can you please add unit and maybe an acceptance test for this? |
I'll do my best :) |
c671162
to
676d5cf
Compare
@bastelfreak Tests added. |
manifests/rule.pp
Outdated
@@ -162,7 +162,7 @@ | |||
$filename = "${ferm::configdirectory}/chains/${table}-${chain}.conf" | |||
} | |||
|
|||
$rule = squeeze("${comment_real} ${proto_real} ${proto_options_real} ${dport_real} ${sport_real} ${daddr_real} ${saddr_real}${outerface_real} ${action_real}${to_source_real};", ' ') | |||
$rule = join([strip(squeeze("${comment_real} ${proto_real} ${proto_options_real} ${dport_real} ${sport_real} ${daddr_real} ${saddr_real} ${outerface_real} ${action_real} ${to_source_real}", ' ')), ';']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we now suddenly need join()
and strip()
?
From what I can tell you're only adding strings and everyting is inside a single string interpolation anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because to ...
needs to be after SNAT
, and <space>${to_source_real}
results in a single space between ${action_real}
and ;
in all rules that have an empty ${to_source_real}
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That extra space makes all (other) acceptance tests fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could make it more clear using a regsubst()
maybe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide compiled/expanded results for each?
I.e. output for the version that doesn't work and output for the one that does work. I'm having a little trouble seeing why any of that regsubst()
or similar is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's an example of why tests fail when a rule ends with <space><semi colon>
:
84) ferm::rule on centos-7-x86_64 definining rules in custom chains is expected to contain Concat::Fragment[SSH-allow-ssh-localhost] with content supplied string
Failure/Error: it { is_expected.to contain_concat__fragment('SSH-allow-ssh-localhost').with_content("mod comment comment 'allow-ssh-localhost' proto tcp dport 22 saddr @ipfilter((127.0.0.1)) ACCEPT;\n") }
expected that the catalogue would contain Concat::Fragment[SSH-allow-ssh-localhost] with content set to supplied string
Diff:
@@ -1,2 +1,2 @@
-mod comment comment 'allow-ssh-localhost' proto tcp dport 22 saddr @ipfilter((127.0.0.1)) ACCEPT;
+mod comment comment 'allow-ssh-localhost' proto tcp dport 22 saddr @ipfilter((127.0.0.1)) ACCEPT ;
Oh, by the way, should I do some squashing first? |
That would be great, yes. |
8ff18f0
to
d374fc6
Compare
d374fc6
to
4f2cc4d
Compare
23933ad
to
ecc8d22
Compare
outerface
and to_source
.outerface
, to_source
and to_destination
.
I've also added Travis keeps complaining about |
Dear @robinelfrink, 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? |
2 similar comments
Dear @robinelfrink, 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? |
Dear @robinelfrink, 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? |
Dear @robinelfrink, thanks for the PR! This is Vox Pupuli Tasks, your friendly Vox Pupuli GitHub Bot. I noticed that your pull request contains merge conflict. Can you please rebase? You can find my sourcecode at voxpupuli/vox-pupuli-tasks |
Pull Request (PR) description
Add options:
outerface
(iptables--out-interface
)to_source
(iptables--to-source
)to_destination
(iptables--to-destination
)This Pull Request (PR) fixes the following issues
Fixes #74