AC_SUBST(CONFIGURE_LOCALSTATEDIR)
AC_SUBST(PACKAGE_VERSION)
-AC_OUTPUT(Makefile src/Makefile rust/Makefile rust/Cargo.toml rust/.cargo/config qa/Makefile qa/coccinelle/Makefile rules/Makefile doc/Makefile doc/userguide/Makefile contrib/Makefile contrib/file_processor/Makefile contrib/file_processor/Action/Makefile contrib/file_processor/Processor/Makefile contrib/tile_pcie_logd/Makefile suricata.yaml etc/Makefile etc/suricata.logrotate etc/suricata.service python/Makefile python/suricata/config/defaults.py python/bin/suricatasc ebpf/Makefile)
+AC_OUTPUT(Makefile src/Makefile rust/Makefile rust/Cargo.toml rust/.cargo/config qa/Makefile qa/coccinelle/Makefile rules/Makefile doc/Makefile doc/userguide/Makefile contrib/Makefile contrib/file_processor/Makefile contrib/file_processor/Action/Makefile contrib/file_processor/Processor/Makefile contrib/tile_pcie_logd/Makefile suricata.yaml etc/Makefile etc/suricata.logrotate etc/suricata.service python/Makefile python/suricata/config/defaults.py ebpf/Makefile)
SURICATA_BUILD_CONF="Suricata Configuration:
AF_PACKET support: ${enable_af_packet}
build
lib/
scripts-*/
-bin/suricatasc
-!bin/suricatasc.in
suricata/config/defaults.py
!suricata/config/defaults.py.in
from suricata.sc import *
+try:
+ from suricata.config import defaults
+ has_defaults = True
+except:
+ has_defaults = False
+
parser = argparse.ArgumentParser(prog='suricatasc', description='Client for Suricata unix socket')
parser.add_argument('-v', '--verbose', action='store_const', const=True, help='verbose output (including JSON dump)')
parser.add_argument('-c', '--command', default=None, help='execute on single command and return JSON')
if args.socket != None:
SOCKET_PATH = args.socket
+elif has_defaults:
+ SOCKET_PATH = os.path.join(defaults.localstatedir, "suricata-command.socket")
else:
- SOCKET_PATH = "@e_localstatedir@/suricata-command.socket"
+ print("Unable to determine path to suricata-command.socket.", file=sys.stderr)
+ sys.exit(1)
sc = SuricataSC(SOCKET_PATH, verbose=args.verbose)
try:
import os
import re
import sys
+import shutil
from distutils.core import setup
+from distutils.command.build_py import build_py
version = None
if os.path.exists("../configure.ac"):
print("error: failed to parse Suricata version, will use 0.0.0",
file=sys.stderr)
version = "0.0.0"
-
+
+class do_build(build_py):
+ def run(self):
+ build_py.run(self)
+ defaults_py_out = os.path.join(
+ self.build_lib, "suricata", "config", "defaults.py")
+ if not os.path.exists(defaults_py_out):
+ # Must be an out of tree build, find defaults.py.
+ defaults_py_in = os.path.join(
+ self.build_lib, "..", "suricata", "config", "defaults.py")
+ if os.path.exists(defaults_py_in):
+ shutil.copy(defaults_py_in, defaults_py_out)
+ else:
+ print("error: failed to find defaults.py")
+ sys.exit(1)
+
setup(
name="suricata",
description="Suricata control tools",
'Programming Language :: Python',
'Topic :: System :: Systems Administration',
],
+ cmdclass={'build_py': do_build},
)
sysconfdir = "@e_sysconfdir@"
datarulesdir = "@e_datarulesdir@"
+localstatedir = "@e_localstatedir@"