homebrew-core/Formula/suricata.rb

90 lines
3.2 KiB
Ruby

class Suricata < Formula
desc "Network IDS, IPS, and security monitoring engine"
homepage "https://suricata-ids.org/"
url "https://www.openinfosecfoundation.org/download/suricata-6.0.0.tar.gz"
sha256 "3c175a6dee9071141391f64828502cfb6e48dc1a20833e1411fb45be5368923b"
license "GPL-2.0-only"
revision 1
livecheck do
url "https://suricata-ids.org/download/"
regex(/href=.*?suricata[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 "1ea262ba672f76134a1f03b5807fe51b2a9836be5aa425195403933ca7d41ace" => :big_sur
sha256 "357f14c8a5904953453139e1d9363388d1f5779fa21ab413357a4b476eff6c24" => :catalina
sha256 "aa86c75ad788ab24ccd6b3dcf47e21e2766bcf018a302d67bfa569289da59edb" => :mojave
sha256 "5d885e9492f79dcc5cb039f3a5012dc8eb3549ccbf91695c563e73ffd205a329" => :high_sierra
end
depends_on "pkg-config" => :build
depends_on "rust" => :build
depends_on "jansson"
depends_on "libmagic"
depends_on "libnet"
depends_on "libyaml"
depends_on "lz4"
depends_on "nspr"
depends_on "nss"
depends_on "pcre"
depends_on "python@3.9"
resource "argparse" do
url "https://files.pythonhosted.org/packages/18/dd/e617cfc3f6210ae183374cd9f6a26b20514bbb5a792af97949c5aacddf0f/argparse-1.4.0.tar.gz"
sha256 "62b089a55be1d8949cd2bc7e0df0bddb9e028faefc8c32038cc84862aefdd6e4"
end
resource "PyYAML" do
url "https://files.pythonhosted.org/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz"
sha256 "b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d"
end
resource "simplejson" do
url "https://files.pythonhosted.org/packages/98/87/a7b98aa9256c8843f92878966dc3d8d914c14aad97e2c5ce4798d5743e07/simplejson-3.17.0.tar.gz"
sha256 "2b4b2b738b3b99819a17feaf118265d0753d5536049ea570b3c43b51c4701e81"
end
def install
python3 = Formula["python@3.9"].opt_bin/"python3"
xy = Language::Python.major_minor_version python3
ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python#{xy}/site-packages"
resources.each do |r|
r.stage do
system python3, *Language::Python.setup_install_args(libexec/"vendor")
end
end
jansson = Formula["jansson"]
libmagic = Formula["libmagic"]
libnet = Formula["libnet"]
args = %W[
--disable-dependency-tracking
--disable-silent-rules
--prefix=#{prefix}
--sysconfdir=#{etc}
--localstatedir=#{var}
--with-libjansson-includes=#{jansson.opt_include}
--with-libjansson-libraries=#{jansson.opt_lib}
--with-libmagic-includes=#{libmagic.opt_include}
--with-libmagic-libraries=#{libmagic.opt_lib}
--with-libnet-includes=#{libnet.opt_include}
--with-libnet-libraries=#{libnet.opt_lib}
--enable-ipfw
]
system "./configure", *args
system "make", "install-full"
bin.env_script_all_files(libexec/"bin", PYTHONPATH: ENV["PYTHONPATH"])
# Leave the magic-file: prefix in otherwise it overrides a commented out line rather than intended line.
inreplace etc/"suricata/suricata.yaml", %r{magic-file: /.+/magic}, "magic-file: #{libmagic.opt_share}/misc/magic"
end
test do
assert_match(/#{version}/, shell_output("#{bin}/suricata --build-info"))
end
end