Refactored abusehelper init, added support for $abusesa_botnets
This commit is contained in:
parent
7ba77ed2ea
commit
12791c5891
2 changed files with 60 additions and 35 deletions
|
@ -2,6 +2,9 @@
|
||||||
#
|
#
|
||||||
# === Global variables
|
# === Global variables
|
||||||
#
|
#
|
||||||
|
# $abusehelper_datadir
|
||||||
|
# Abusehelper home directory. Defaults to /var/lib/ah2.
|
||||||
|
#
|
||||||
# $abusehelper_botnets
|
# $abusehelper_botnets
|
||||||
# Array of botnet paths to start at boot.
|
# Array of botnet paths to start at boot.
|
||||||
#
|
#
|
||||||
|
@ -113,47 +116,60 @@ class abusehelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $abusehelper_botnets {
|
||||||
|
include abusehelper::init
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Install abusehelper init script.
|
||||||
|
#
|
||||||
|
class abusehelper::init {
|
||||||
|
|
||||||
|
if !$abusehelper_botnets {
|
||||||
|
fail("Must define \$abusehelper_botnets")
|
||||||
|
}
|
||||||
|
|
||||||
if !$abusehelper_user {
|
if !$abusehelper_user {
|
||||||
$abusehelper_user = "abusehel"
|
$abusehelper_user = "abusehel"
|
||||||
}
|
}
|
||||||
|
|
||||||
if $abusehelper_botnets {
|
file { "/etc/sysconfig/botnet":
|
||||||
file { "/etc/sysconfig/botnet":
|
ensure => present,
|
||||||
ensure => present,
|
name => $::operatingsystem ? {
|
||||||
name => $::operatingsystem ? {
|
"debian" => "/etc/default/botnet",
|
||||||
"debian" => "/etc/default/botnet",
|
"ubuntu" => "/etc/default/botnet",
|
||||||
"ubuntu" => "/etc/default/botnet",
|
default => "/etc/sysconfig/botnet",
|
||||||
default => "/etc/sysconfig/botnet",
|
},
|
||||||
},
|
mode => "0644",
|
||||||
mode => "0644",
|
owner => "root",
|
||||||
owner => "root",
|
group => "root",
|
||||||
group => "root",
|
content => template("abusehelper/botnet.sysconfig.erb"),
|
||||||
content => template("abusehelper/botnet.sysconfig.erb"),
|
before => Service["botnet"],
|
||||||
before => Service["botnet"],
|
}
|
||||||
}
|
|
||||||
|
|
||||||
file { "/etc/init.d/botnet":
|
file { "/etc/init.d/botnet":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
mode => "0755",
|
mode => "0755",
|
||||||
owner => "root",
|
owner => "root",
|
||||||
group => "root",
|
group => "root",
|
||||||
source => "puppet:///modules/abusehelper/botnet.init",
|
source => "puppet:///modules/abusehelper/botnet.init",
|
||||||
notify => Exec["add-service-botnet"],
|
notify => Exec["add-service-botnet"],
|
||||||
}
|
}
|
||||||
exec { "add-service-botnet":
|
exec { "add-service-botnet":
|
||||||
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
path => "/bin:/usr/bin:/sbin:/usr/sbin",
|
||||||
command => $::operatingsystem ? {
|
command => $::operatingsystem ? {
|
||||||
"debian" => "update-rc.d botnet defaults",
|
"debian" => "update-rc.d botnet defaults",
|
||||||
"ubuntu" => "update-rc.d botnet defaults",
|
"ubuntu" => "update-rc.d botnet defaults",
|
||||||
default => "chkconfig --add botnet",
|
default => "chkconfig --add botnet",
|
||||||
},
|
},
|
||||||
refreshonly => true,
|
refreshonly => true,
|
||||||
before => Service["botnet"],
|
before => Service["botnet"],
|
||||||
}
|
}
|
||||||
|
|
||||||
service { "botnet":
|
service { "botnet":
|
||||||
enable => true,
|
enable => true,
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
# $abusesa_datadir
|
# $abusesa_datadir
|
||||||
# AbuseSA home directory. Defaults to /var/lib/abusesa.
|
# AbuseSA home directory. Defaults to /var/lib/abusesa.
|
||||||
#
|
#
|
||||||
|
# $abusesa_botnets
|
||||||
|
# Array of botnet paths to start at boot.
|
||||||
|
#
|
||||||
class abusesa {
|
class abusesa {
|
||||||
|
|
||||||
case $::operatingsystem {
|
case $::operatingsystem {
|
||||||
|
@ -76,4 +79,10 @@ class abusesa {
|
||||||
}
|
}
|
||||||
python::setup::install { "/usr/local/src/abusesa": }
|
python::setup::install { "/usr/local/src/abusesa": }
|
||||||
|
|
||||||
|
if $abusesa_botnets {
|
||||||
|
$abusehelper_botnets = $abusesa_botnets
|
||||||
|
$abusehelper_user = "abusesa"
|
||||||
|
include abusehelper::init
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue