Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 6 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@
include ipset::base

if $ensure == 'absent' {
exec { "/usr/sbin/ipset destroy ${title}":
onlyif => "/usr/sbin/ipset list ${title} &>/dev/null",
exec { "ipset destroy ${title}":
onlyif => "ipset list ${title} &>/dev/null",
path => [ '/sbin', '/usr/sbin', '/bin', '/usr/bin' ],
require => Package['ipset'],
}
} else {
Expand All @@ -47,14 +48,16 @@
$command = "/usr/local/sbin/ipset_from_file -n ${title} -f ${from_file} -t \"${ipset_type}\" -c \"${ipset_create_options}\" -a \"${ipset_add_options}\""
exec { "ipset-create-${name}":
command => $command,
unless => "/usr/sbin/ipset list ${title}",
unless => "ipset list ${title} >/dev/null",
logoutput => false,
require => Package['ipset'],
path => [ '/sbin', '/usr/sbin', '/bin', '/usr/bin' ],
}
exec { "ipset-refresh-${name}":
command => $command,
subscribe => File[$from_file],
refreshonly => true,
logoutput => false,
require => Package['ipset'],
path => [ '/sbin', '/usr/sbin', '/bin', '/usr/bin' ],
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/iptables.pp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
$target_name = regsubst($target,'^([^ ]+).*$','\1')
# Strict vs. looser matching
if $strictmatch {
$iptables_match = "iptables-save | egrep \"^-A ${chain} .+ -m set --match-set ${ipset} ${flags} .*${options}.*-j ${target_name}\""
$iptables_match = "iptables-save | egrep \"^-A ${chain} -m set --match-set ${ipset} ${flags} .*${options}.*-j ${target_name}\""
} else {
$iptables_match = "iptables-save | egrep \"^-A ${chain} .+ -m set --match-set ${ipset} ${flags} .*-j ${target_name}\""
$iptables_match = "iptables-save | egrep \"^-A ${chain} -m set --match-set ${ipset} ${flags} .*-j ${target_name}\""
}

# Insert the rule if it's not already there
Expand Down
10 changes: 10 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "thias-ipset",
"version": "0.1.0",
"author": "Matthias Saou",
"summary": "ipset module",
"license": "Apache-2.0",
"source": "git://github.com/thias/puppet-ipset",
"description": "Manage IP sets in the Linux kernel",
"project_page": "https://github.com/thias/puppet-ipset"
}