Skip to content

Instantly share code, notes, and snippets.

@Brainiarc7
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Brainiarc7/3f2c99941d50b53f52e5 to your computer and use it in GitHub Desktop.
Save Brainiarc7/3f2c99941d50b53f52e5 to your computer and use it in GitHub Desktop.
PKGBUILD for Suricata with CUDA Toolkit v. 6.5+ support
# Maintainer: Dennis E. Mungai <dmngaie@gmail.com>
pkgname=suricata-pfring-git
_pkgname=oisf
pkgver=suricata.2.1beta3.r21.gbc2c7f4
pkgrel=1
pkgdesc="A NextGen multithreaded IDS/IPS with pf_ring, JSON Output and GeoIP support"
arch=('i686' 'x86_64')
url="http://openinfosecfoundation.org/index.php/download-suricata"
license=('GPL2')
depends=('libcap-ng' 'libnet' 'libpfring-svn' 'libyaml' 'pcre' 'jansson' 'geoip' 'libnfnetlink' 'python' 'libpcap-pfring-svn' 'libhtp-git')
optdepends=('snort: suricata can use rulesets provided by snort' 'coccinelle')
makedepends=('autoconf' 'make' 'pkg-config' 'git')
backup=('etc/suricata/suricata.yaml')
conflicts=('suricata' 'suricata-dev')
provides=('suricata')
install='suricata.install'
source=('git+https://github.com/Brainiarc7/oisf'
'suricata.tmpfile'
'suricata.defaults'
'suricata.service'
'suricata.yaml'
'suricata.install')
sha1sums=('SKIP'
'c688d217fe17a31639b4f80cdd49e3f15c24dca3'
'd1991f4a29bc2587456b12e1941baa837381d6e8'
'd526fb6eb95f4c0a19174485eebd780c60cda9c8'
'5deb7617fe4b9ba49bbdc2754a2076e7da779a91'
'78891e2a2623584082da0296b90e811090caa0e6')
pkgver() {
cd "$srcdir/$_pkgname"
( set -o pipefail
git describe --long --tags 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
)
}
build() {
cd ${srcdir}/$_pkgname
./autogen.sh
sed -i s/pfring_recv_chunk=\"no\"/pfring_recv_chunk=\"yes\"/ configure
LIBS="-lrt -lnuma" ./configure --prefix=/usr \
--sysconfdir=/etc --localstatedir=/var \
--enable-pfring --enable-geoip --enable-non-bundled-htp -enable-cuda -with-cuda-includes=/opt/cuda/include/ -with-cuda-libraries=/opt/cuda/lib64/ \
# --with-libpcap-includes=/usr/include/libpcap --with-libpcap-libraries=/usr/lib/libpcap \
make ${MAKEFLAGS}
}
package() {
cd ${srcdir}/$_pkgname
make DESTDIR=${pkgdir} install
install -d ${pkgdir}/etc/suricata/rules
install -d ${pkgdir}/var/log/suricata
install -d "${pkgdir}"/run/suricata
install -Dm644 ${srcdir}/suricata.tmpfile ${pkgdir}/etc/tmpfiles.d/suricata.config
install -Dm644 ${srcdir}/suricata.defaults ${pkgdir}/etc/default/suricata
install -Dm644 ${srcdir}/suricata.service ${pkgdir}/usr/lib/systemd/system/suricata.service
install -Dm644 ${srcdir}/suricata.yaml ${pkgdir}/etc/suricata/suricata-arch.yaml
install -Dm644 ${srcdir}/${_pkgname}/suricata.yaml ${pkgdir}/etc/suricata/suricata.yaml
install -Dm644 ${srcdir}/${_pkgname}/classification.config ${pkgdir}/etc/suricata/classification.config
install -Dm644 ${srcdir}/${_pkgname}/reference.config ${pkgdir}/etc/suricata/reference.config
install -Dm644 ${srcdir}/${_pkgname}/threshold.config ${pkgdir}/etc/suricata/threshold.config
install -d ${pkgdir}/usr/share/licenses/${pkgname}
install -d ${pkgdir}/usr/share/doc/${pkgname}
install -Dm644 ${srcdir}/${_pkgname}/LICENSE $pkgdir/usr/share/licenses/${pkgname}/LICENSE
install -Dm644 ${srcdir}/${_pkgname}/ChangeLog $pkgdir/usr/share/doc/suricata/ChangeLog
}
@Brainiarc7
Copy link
Author

This will build suricata-pfring-git r4.b417dbe-1 package for Arch Linux.
Ensure you have the following files copied to the same directory as the PKGBUILD:

suricata.defaults
suricata.install
suricata.service
suricata.tmpfile
suricata.yaml

You can get these files by cloning this repo first:

git clone https://github.com/Brainiarc7/oisf

Then, cd into the oisf directory AND cp the files from the ServiceFiles directory to the same directory where the PKGBUILD is.

Build the package directly with makepkg on Arch or any Arch Linux derivative.

@Brainiarc7
Copy link
Author

Added support for CUDA 7.0 SDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment