diff --git a/net-mgmt/fastnetmon/Makefile b/net-mgmt/fastnetmon/Makefile index fdd483db3138..25b0aaf72038 100644 --- a/net-mgmt/fastnetmon/Makefile +++ b/net-mgmt/fastnetmon/Makefile @@ -1,78 +1,68 @@ PORTNAME= fastnetmon -PORTVERSION= 1.2.5 DISTVERSIONPREFIX= v -PORTREVISION= 4 +DISTVERSION= 1.2.6 CATEGORIES= net-mgmt security +PATCH_SITES= https://github.com/pavel-odintsov/${PORTNAME}/commit/ +PATCHFILES= fad8757b8986226024d549a6dfb40abbab01643e.patch:-p2 + MAINTAINER= farrokhi@FreeBSD.org COMMENT= Very fast DDoS analyzer with sflow/netflow/mirror support WWW= https://fastnetmon.com LICENSE= GPLv2 -LICENSE_FILE= ${WRKSRC}/LICENSE +LICENSE_FILE= ${WRKSRC}/../LICENSE -BROKEN_armv6= does not build: invokes x86 assembler -BROKEN_armv7= does not build: invokes x86 assembler +BROKEN_armv6= does not build: invokes x86 assembler +BROKEN_armv7= does not build: invokes x86 assembler LIB_DEPENDS= libboost_regex.so:devel/boost-libs \ liblog4cpp.so:devel/log4cpp \ libmongoc-1.0.so:devel/mongo-c-driver \ - libjson-c.so:devel/json-c \ libbson-1.0.so:devel/libbson \ libcapnp.so:devel/capnproto \ - libgrpc.so:devel/grpc142 \ + libgrpc.so:devel/grpc \ libprotobuf.so:devel/protobuf \ libabsl_base.so:devel/abseil \ libhiredis.so:databases/hiredis -USES= cmake compiler:c++17-lang pkgconfig localbase:ldflags ssl -USE_CXXSTD= c++17 +USES= cmake compiler:c++20-lang localbase:ldflags pkgconfig ssl + USE_GITHUB= yes GH_ACCOUNT= pavel-odintsov -USE_RC_SUBR= ${PORTNAME} - -CMAKE_ARGS+= -DENABLE_NETMAP_SUPPORT=ON \ - -DLINK_WITH_ABSL=ON \ - -DSET_ABSOLUTE_INSTALL_PATH=OFF \ - -DCMAKE_INSTALL_MANDIR=${PREFIX}/man -CMAKE_INSTALL_PREFIX= ${PREFIX} -CMAKE_SOURCE_PATH= ${WRKSRC}/src - -CFLAGS_i386= -march=i586 -CXXFLAGS+= -DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED \ - -D_GNU_SOURCE -LDFLAGS+= -labsl_log_internal_message -labsl_log_internal_nullguard -USERS= ${PORTNAME} -GROUPS= ${PORTNAME} +WRKSRC_SUBDIR= src +USE_RC_SUBR= ${PORTNAME} +USERS= ${PORTNAME} +GROUPS= ${PORTNAME} PORTDOCS= * -OPTIONS_DEFINE= DOCS - -.include +CFLAGS_i386= -march=i586 +CXXFLAGS+= -D_GNU_SOURCE -.if ${OPSYS} == FreeBSD && ( ${OSVERSION} >= 1400091 || ( ${OSVERSION} >= 1302505 && ${OSVERSION} < 1400000 )) -USES+= llvm:max=15 -.endif +CMAKE_OFF= SET_ABSOLUTE_INSTALL_PATH +CMAKE_ON= ENABLE_NETMAP_SUPPORT \ + LINK_WITH_ABSL -.include +OPTIONS_DEFINE= DOCS post-patch: @${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|; \ s|/var/run|&/fastnetmon|g; s|/var/log|&/fastnetmon|g; \ s|"/etc/|"${PREFIX}/etc/|g; s|/root/fastnetmon|${DATADIR}|g' \ - ${WRKSRC}/src/fastnetmon.conf ${WRKSRC}/src/fastnetmon.cpp + ${WRKSRC}/fastnetmon.conf ${WRKSRC}/fastnetmon.cpp @${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \ - ${WRKSRC}/src/man/fastnetmon.8 + ${WRKSRC}/man/fastnetmon.8 post-install: - ${MV} ${STAGEDIR}${PREFIX}/etc/${PORTNAME}.conf \ - ${STAGEDIR}${PREFIX}/etc/${PORTNAME}.conf.sample + ${INSTALL_DATA} ${WRKSRC}/fastnetmon.conf ${STAGEDIR}${PREFIX}/etc/fastnetmon.conf.sample + ${INSTALL_DATA} ${WRKSRC}/networks_list ${STAGEDIR}${PREFIX}/etc/networks_list.sample + ${INSTALL_DATA} ${WRKSRC}/networks_whitelist ${STAGEDIR}${PREFIX}/etc/networks_whitelist.sample ${MKDIR} ${STAGEDIR}/var/run/fastnetmon ${STAGEDIR}/var/log/fastnetmon_attacks - ${INSTALL_SCRIPT} ${WRKSRC}/src/notify_about_attack.sh ${STAGEDIR}${PREFIX}/bin + ${INSTALL_SCRIPT} ${WRKSRC}/notify_about_attack.sh ${STAGEDIR}${PREFIX}/bin/notify_about_attack.sh.sample post-install-DOCS-on: - cd ${WRKSRC} && ${COPYTREE_SHARE} "README.md docs" ${STAGEDIR}${DOCSDIR} + cd ${WRKSRC}/../ && ${COPYTREE_SHARE} "README.md docs" ${STAGEDIR}${DOCSDIR} -.include +.include diff --git a/net-mgmt/fastnetmon/distinfo b/net-mgmt/fastnetmon/distinfo index ef5b9939a04a..f8d70d4ffad9 100644 --- a/net-mgmt/fastnetmon/distinfo +++ b/net-mgmt/fastnetmon/distinfo @@ -1,3 +1,5 @@ -TIMESTAMP = 1686746794 -SHA256 (pavel-odintsov-fastnetmon-v1.2.5_GH0.tar.gz) = d92a1f16e60b6ab6f5c5e023a215570e9352ce9d0c9a9d7209416f8cd0227ae6 -SIZE (pavel-odintsov-fastnetmon-v1.2.5_GH0.tar.gz) = 1383370 +TIMESTAMP = 1706176431 +SHA256 (pavel-odintsov-fastnetmon-v1.2.6_GH0.tar.gz) = b6a7d1e9ba98c1c042d774bff82ea3e8bbf03085e0be43a2676e41d590f668cf +SIZE (pavel-odintsov-fastnetmon-v1.2.6_GH0.tar.gz) = 1421719 +SHA256 (fad8757b8986226024d549a6dfb40abbab01643e.patch) = 22e739071959c4e2b88cca4ad8278c07be998505c152952d6f18b69227cc8844 +SIZE (fad8757b8986226024d549a6dfb40abbab01643e.patch) = 2694 diff --git a/net-mgmt/fastnetmon/files/fastnetmon.in b/net-mgmt/fastnetmon/files/fastnetmon.in index c6ee5b2aa52e..598dbc0382d8 100644 --- a/net-mgmt/fastnetmon/files/fastnetmon.in +++ b/net-mgmt/fastnetmon/files/fastnetmon.in @@ -1,30 +1,30 @@ #!/bin/sh # PROVIDE: fastnetmon # REQUIRE: NETWORKING SERVERS LOGIN # BEFORE: securelevel # KEYWORD: shutdown # Add the following line to /etc/rc.conf to enable 'fastnetmon': # # fastnetmon_enable="YES" # . /etc/rc.subr name=fastnetmon desc="fastnetmon startup script" rcvar=fastnetmon_enable load_rc_config "$name" : ${fastnetmon_enable:=NO} : ${fastnetmon_conf:=%%PREFIX%%/etc/$name.conf} : ${fastnetmon_flags:=} : ${fastnetmon_user:=fastnetmon} command=%%PREFIX%%/bin/fastnetmon -command_args="--daemonize --configuration_file ${fastnetmon_conf} ${fastnetmon_flags}" +command_args="--daemonize --configuration_file ${fastnetmon_conf} --pid_logic ${fastnetmon_flags}" pidfile=/var/run/fastnetmon/$name.pid run_rc_command "$1" diff --git a/net-mgmt/fastnetmon/files/patch-CMakeLists.txt b/net-mgmt/fastnetmon/files/patch-CMakeLists.txt new file mode 100644 index 000000000000..d833ac56fc9d --- /dev/null +++ b/net-mgmt/fastnetmon/files/patch-CMakeLists.txt @@ -0,0 +1,30 @@ +--- CMakeLists.txt.orig 2023-10-14 15:48:26 UTC ++++ CMakeLists.txt +@@ -47,7 +47,8 @@ set(GTEST_INSTALL_PATH "${FASTNETMON_LIBRARIES_GLOBAL_ + # In order to get a warning about an unused function parameter, you must either specify -Wextra -Wunused (note that -Wall implies -Wunused), or separately specify -Wunused-parameter. + # TODO: return -Wunused-parameter and address all warning later, I started it but did not finish as we have too many of them + # catch-value is documented here: https://patchwork.ozlabs.org/project/gcc/patch/tkrat.8c7b4260a533be2f@netcologne.de/#1680619 +-add_definitions("-Wreorder -Wunused -Wparentheses -Wimplicit-fallthrough -Wreturn-type -Wuninitialized -Winit-self -Wmaybe-uninitialized -Wcatch-value=3 -Wclass-memaccess") ++# add_definitions("-Wreorder -Wunused -Wparentheses -Wimplicit-fallthrough -Wreturn-type -Wuninitialized -Winit-self -Wmaybe-uninitialized -Wcatch-value=3 -Wclass-memaccess") ++add_definitions("-Wreorder -Wunused -Wparentheses -Wimplicit-fallthrough -Wreturn-type -Wuninitialized -Winit-self") + + # On Windows we need to build libgcc and libstdc++ statically to avoid need to carry dlls with us + if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") +@@ -81,7 +82,7 @@ option(KAFKA_SUPPORT "Enables Kafka support" OFF) + option(KAFKA_SUPPORT "Enables Kafka support" OFF) + + # We need to add it into include path as gRPC uses it include path +-include_directories("${ABSL_INSTALL_PATH}/include") ++# include_directories("${ABSL_INSTALL_PATH}/include") + + option(DO_NOT_USE_SYSTEM_LIBRARIES_FOR_BUILD "Disables use of libraries from system path" OFF) + +@@ -848,7 +849,7 @@ if (ENABLE_CAPNP_SUPPORT) + message(FATAL_ERROR "Could not find capnp libraries") + endif() + +- include_directories("${CAPNP_CUSTOM_INSTALL_PATH}/include") ++ # include_directories("${CAPNP_CUSTOM_INSTALL_PATH}/include") + + target_link_libraries(simple_packet_capnp ${CAPNP_LIBRARY_PATH} ${CAPNP_KJ_LIBRARY_PATH}) + diff --git a/net-mgmt/fastnetmon/files/patch-src_fastnetmon.cpp b/net-mgmt/fastnetmon/files/patch-src_fastnetmon.cpp index 0883c1581808..74155be61ca9 100644 --- a/net-mgmt/fastnetmon/files/patch-src_fastnetmon.cpp +++ b/net-mgmt/fastnetmon/files/patch-src_fastnetmon.cpp @@ -1,29 +1,29 @@ ---- src/fastnetmon.cpp.orig 2023-05-23 06:20:59 UTC -+++ src/fastnetmon.cpp +--- fastnetmon.cpp.orig 2023-05-23 06:20:59 UTC ++++ fastnetmon.cpp @@ -156,7 +156,7 @@ unsigned int stats_thread_initial_call_delay = 30; std::string reporting_server = "community-stats.fastnetmon.com"; // Path to temporarily store backtrace when fatal failure happened -std::string backtrace_path = "/var/log/fastnetmon_backtrace.dump"; +std::string backtrace_path = "/var/log/fastnetmon/fastnetmon_backtrace.dump"; // Each this seconds we will check about available data in bucket unsigned int check_for_availible_for_processing_packets_buckets = 1; @@ -430,7 +430,7 @@ std::string exabgp_community_subnet = ""; std::string exabgp_community_host = ""; -std::string exabgp_command_pipe = "/var/run/exabgp.cmd"; +std::string exabgp_command_pipe = "/var/run/fastnetmon/exabgp.cmd"; std::string exabgp_next_hop = ""; // Graphite monitoring @@ -514,7 +514,7 @@ void sigpipe_handler_for_popen(int signo) { #ifdef GEOIP bool geoip_init() { // load GeoIP ASN database to memory - geo_ip = GeoIP_open("/root/fastnetmon/GeoIPASNum.dat", GEOIP_MEMORY_CACHE); + geo_ip = GeoIP_open("/usr/local/share/fastnetmon/GeoIPASNum.dat", GEOIP_MEMORY_CACHE); if (geo_ip == NULL) { return false; diff --git a/net-mgmt/fastnetmon/files/patch-src_man_fastnetmon.8 b/net-mgmt/fastnetmon/files/patch-src_man_fastnetmon.8 index bb43f4f3a050..75d8a25831a5 100644 --- a/net-mgmt/fastnetmon/files/patch-src_man_fastnetmon.8 +++ b/net-mgmt/fastnetmon/files/patch-src_man_fastnetmon.8 @@ -1,11 +1,11 @@ ---- src/man/fastnetmon.8.orig 2023-03-03 16:20:18 UTC -+++ src/man/fastnetmon.8 +--- man/fastnetmon.8.orig 2023-03-03 16:20:18 UTC ++++ man/fastnetmon.8 @@ -8,7 +8,7 @@ fastnetmon [--daemonize] .SH DESCRIPTION FastNetMon - a high performance DoS/DDoS load analyzer built on top of multiple packet capture engines (NetFlow, IPFIX, sFlow, port mirror). -For more information about configuration, please look at the comments in /etc/fastnetmon.conf and check the project GitHub page: https://github.com/pavel-odintsov/fastnetmon. +For more information about configuration, please look at the comments in %%PREFIX%%/etc/fastnetmon.conf and check the project GitHub page: https://github.com/pavel-odintsov/fastnetmon. .SH OPTIONS fastnetmon has only a single command line option --daemonize which is used for forking and detaching it from the terminal. .SH SEE ALSO diff --git a/net-mgmt/fastnetmon/files/patch-src_netmap__plugin_netmap__collector.cpp b/net-mgmt/fastnetmon/files/patch-src_netmap__plugin_netmap__collector.cpp index 19a3f3d8b17d..1bc5cd90e69f 100644 --- a/net-mgmt/fastnetmon/files/patch-src_netmap__plugin_netmap__collector.cpp +++ b/net-mgmt/fastnetmon/files/patch-src_netmap__plugin_netmap__collector.cpp @@ -1,10 +1,10 @@ ---- src/netmap_plugin/netmap_collector.cpp.orig 2023-03-01 14:23:34 UTC -+++ src/netmap_plugin/netmap_collector.cpp +--- netmap_plugin/netmap_collector.cpp.orig 2023-03-01 14:23:34 UTC ++++ netmap_plugin/netmap_collector.cpp @@ -19,6 +19,7 @@ // Disable debug messages from Netmap #define NETMAP_NO_DEBUG +typedef bool _Bool; #include #include diff --git a/net-mgmt/fastnetmon/pkg-plist b/net-mgmt/fastnetmon/pkg-plist index 6c244f25be27..2912f9ef0846 100644 --- a/net-mgmt/fastnetmon/pkg-plist +++ b/net-mgmt/fastnetmon/pkg-plist @@ -1,11 +1,11 @@ bin/fastnetmon bin/fastnetmon_api_client bin/fastnetmon_client -bin/notify_about_attack.sh -etc/networks_list -etc/networks_whitelist -man/man8/fastnetmon.8.gz -man/man1/fastnetmon_client.1.gz +share/man/man8/fastnetmon.8.gz +share/man/man1/fastnetmon_client.1.gz +@sample bin/notify_about_attack.sh.sample +@sample etc/networks_list.sample +@sample etc/networks_whitelist.sample @sample etc/fastnetmon.conf.sample @dir(fastnetmon,fastnetmon) /var/run/fastnetmon @dir(fastnetmon,fastnetmon) /var/log/fastnetmon_attacks