homebrew-core/Formula/suricata.rb

85 lines
3.1 KiB
Ruby

class Suricata < Formula
desc "Network IDS, IPS, and security monitoring engine"
homepage "https://suricata.io"
url "https://www.openinfosecfoundation.org/download/suricata-6.0.9.tar.gz"
sha256 "3225edcbd0277545b7128df7b71652e6816f3b4978347d2f4fe297d55ed070e8"
license "GPL-2.0-only"
livecheck do
url "https://suricata.io/download/"
regex(/href=.*?suricata[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
rebuild 1
sha256 arm64_ventura: "b44b931e92576744d41bcf2d56a032756c0e598df5ec91ad88a41ae802746dba"
sha256 arm64_monterey: "54b31e8ed41e4a7b0393ac92756c78071598e375e5d4e05ab12171cc930209fb"
sha256 arm64_big_sur: "aaa09cea15038f44049984def0233c38c4113d429a334e059b03da982b41b5f4"
sha256 ventura: "c92e6b5b13829a4488d28520c387a26954d79e2a9f2cd621c13d4899305d4039"
sha256 monterey: "c61a3c2247d304d022766d9192bccec95823b26852aec2f56580e8555522fa0a"
sha256 big_sur: "4f64f5dbe1acf76afd72edb4ee4cfda8b68f0c9bc37b753172062b9a031e93e8"
sha256 x86_64_linux: "8c802684f70f9164e199797f805fca059bcfd4d69e1d941df9211f76b192db7f"
end
depends_on "pkg-config" => :build
depends_on "rust" => :build
depends_on "jansson"
depends_on "libmagic"
depends_on "libnet"
depends_on "lz4"
depends_on "nspr"
depends_on "nss"
depends_on "pcre"
depends_on "python@3.11"
depends_on "pyyaml"
uses_from_macos "libpcap"
# Fix -flat_namespace being used on Big Sur and later.
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/03cf8088210822aa2c1ab544ed58ea04c897d9c4/libtool/configure-big_sur.diff"
sha256 "35acd6aebc19843f1a2b3a63e880baceb0f5278ab1ace661e57a502d9d78c93c"
directory "libhtp"
end
def install
jansson = Formula["jansson"]
libmagic = Formula["libmagic"]
libnet = Formula["libnet"]
args = %W[
--disable-silent-rules
--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}
]
if OS.mac?
args << "--enable-ipfw"
# Workaround for dyld[98347]: symbol not found in flat namespace '_iconv'
ENV.append "LIBS", "-liconv" if MacOS.version >= :monterey
else
args << "--with-libpcap-includes=#{Formula["libpcap"].opt_include}"
args << "--with-libpcap-libraries=#{Formula["libpcap"].opt_lib}"
end
system "./configure", *std_configure_args, *args
system "make", "install-full"
bin.env_script_all_files(libexec/"bin", PYTHONPATH: lib/"suricata/python")
# 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.to_s, shell_output("#{bin}/suricata --build-info")
assert_match "Found Suricata", shell_output("#{bin}/suricata-update list-sources")
end
end