2010-08-18 11:36:18 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Sshguard < Formula
|
2011-08-07 17:41:04 +00:00
|
|
|
url 'http://downloads.sourceforge.net/project/sshguard/sshguard/sshguard-1.5/sshguard-1.5.tar.bz2'
|
2010-08-18 11:36:18 +00:00
|
|
|
homepage 'http://www.sshguard.net/'
|
2012-09-03 18:33:56 +00:00
|
|
|
sha1 'f8f713bfb3f5c9877b34f6821426a22a7eec8df3'
|
2010-08-18 11:36:18 +00:00
|
|
|
|
2011-09-18 16:06:18 +00:00
|
|
|
def patches
|
|
|
|
# Fix blacklist flag (-b) so that it doesn't abort on first usage.
|
|
|
|
# Upstream bug report:
|
|
|
|
# http://sourceforge.net/tracker/?func=detail&aid=3252151&group_id=188282&atid=924685
|
|
|
|
"https://sourceforge.net/tracker/download.php?group_id=188282&atid=924685&file_id=405677&aid=3252151"
|
|
|
|
end
|
|
|
|
|
2010-08-18 11:36:18 +00:00
|
|
|
def install
|
|
|
|
system "./configure", "--disable-debug", "--disable-dependency-tracking",
|
|
|
|
"--prefix=#{prefix}",
|
|
|
|
"--with-firewall=ipfw"
|
|
|
|
system "make install"
|
2011-08-26 00:55:57 +00:00
|
|
|
|
2011-12-31 05:56:52 +00:00
|
|
|
plist_path.write startup_plist
|
|
|
|
plist_path.chmod 0644
|
2011-08-26 00:55:57 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def caveats; <<-EOS
|
|
|
|
1) Install the launchd item in /Library/LaunchDaemons, like so:
|
|
|
|
|
2011-12-31 05:56:52 +00:00
|
|
|
sudo cp -vf #{plist_path} /Library/LaunchDaemons/
|
|
|
|
sudo chown -v root:wheel /Library/LaunchDaemons/#{plist_path.basename}
|
2011-08-26 00:55:57 +00:00
|
|
|
|
|
|
|
2) Start the daemon using:
|
|
|
|
|
2011-12-31 05:56:52 +00:00
|
|
|
sudo launchctl load /Library/LaunchDaemons/#{plist_path.basename}
|
2011-08-26 00:55:57 +00:00
|
|
|
|
|
|
|
Next boot of system will automatically start sshguard.
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
def startup_plist
|
|
|
|
return <<-EOPLIST
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
|
|
<plist version="1.0">
|
|
|
|
<dict>
|
|
|
|
<key>Label</key>
|
2011-12-31 05:56:52 +00:00
|
|
|
<string>#{plist_name}</string>
|
2011-08-26 00:55:57 +00:00
|
|
|
<key>KeepAlive</key>
|
|
|
|
<true/>
|
|
|
|
<key>ProgramArguments</key>
|
|
|
|
<array>
|
|
|
|
<string>#{HOMEBREW_PREFIX}/sbin/sshguard</string>
|
|
|
|
<string>-l</string>
|
|
|
|
<string>/var/log/secure.log</string>
|
|
|
|
</array>
|
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOPLIST
|
2010-08-18 11:36:18 +00:00
|
|
|
end
|
|
|
|
end
|