homebrew-core/Formula/suricata.rb

89 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.2.tar.gz"
sha256 "5e4647a07cb31b5d6d0049972a45375c137de908a964a44e2d6d231fa3ad4b52"
license "GPL-2.0-only"
livecheck do
url "https://suricata-ids.org/download/"
regex(/href=.*?suricata[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_big_sur: "c33d9b4e2bf3ea8c1f1d5c6d9020142f6d7da3b60fcc51b7a49f16a92cf060bc"
sha256 big_sur: "5751c86e66e385b9922f3e4eb0761df733ab00d1603c62e4534786e53e266634"
sha256 catalina: "5fdfcd49565c97630df59a4c02f2f5c93ee0a65265d04024f2db9d265539c164"
sha256 mojave: "a4c47459e160033762a12c8d613b70c3028e089e6e12db4cf3b03a10008b88f2"
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/a0/a4/d63f2d7597e1a4b55aa3b4d6c5b029991d3b824b5bd331af8d4ab1ed687d/PyYAML-5.4.1.tar.gz"
sha256 "607774cbba28732bfa802b54baa7484215f530991055bb562efbed5b2f20a45e"
end
resource "simplejson" do
url "https://files.pythonhosted.org/packages/49/45/a16db4f0fa383aaf0676fb7e3c660304fe390415c243f41a77c7f917d59b/simplejson-3.17.2.tar.gz"
sha256 "75ecc79f26d99222a084fbdd1ce5aad3ac3a8bd535cd9059528452da38b68841"
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