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

Check if raw string contains ipv4 address #171

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions libraries/helpers.rb
Original file line number Diff line number Diff line change
@@ -47,8 +47,9 @@ def ip_with_mask(new_resource, ip)

# ipv4-specific rule?
def ipv4_rule?(new_resource)
if (new_resource.source && IPAddr.new(new_resource.source).ipv4?) ||
(new_resource.destination && IPAddr.new(new_resource.destination).ipv4?)
if ((new_resource.source && IPAddr.new(new_resource.source).ipv4?) ||
(new_resource.destination && IPAddr.new(new_resource.destination).ipv4?)) || (new_resource.raw &&
new_resource.raw.scan(/10\.13\.[12]?[0-9]?[0-9]\.[12]?[0-9]?[0-9]/))
true
else
false
@@ -90,7 +91,7 @@ def build_rule_file(rules)
end

def repeatable_directives(s)
%w(:OUTPUT :INPUT :POSTROUTING :PREROUTING COMMIT).each do |special|
%w(:OUTPUT :INPUT :POSTROUTING :PREROUTING COMMIT :DOCKER :DOCKER-ISOLATION).each do |special|
return true if s.start_with?(special)
end

2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
license 'Apache-2.0'
description 'Provides a set of primitives for managing firewalls and associated rules.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '2.6.2'
version '2.6.3'

supports 'centos'
supports 'debian'