From eada91c4b3e846a5abad50a600a7591628178f57b34081cf1542244006e1c623 Mon Sep 17 00:00:00 2001 From: Lars Vogdt Date: Tue, 4 Dec 2018 15:14:34 +0000 Subject: [PATCH] Accepting request 652057 from home:mnhauke:security - Drop support for older distributions - Update to version 1.7.2 + nfacctd, sfacctd: added Kafka broker among the options to receive NetFlow/IPFIX, sFlow data from. Host, port and topic should all be specified along with an optional config file to pass to librdkafka. + nfacctd, sfacctd, pmtelemetryd: added ZeroMQ queue among the options to receive NetFlow/IPFIX, sFlow or Streaming Telemetry data from. An IP address and port should be specified. + nfacctd, sfacctd: added sampling_direction to the set of supported primitives, valid values being ingress, egress and unknown. + nfacctd, sfacctd: stats, ie. amount of NetFlow/IPFIX or sFlow packets received per router, are now available when in tee mode. Stats can be retrieved via a SIGUSR1 UNIX signal. + pcap_savefile_replay: a feature to replay content for the specified amounf of time when reading from a pcap_savefile. + pre_tag_map: added several new keys: src_net and dst_net (to tag on source and destination IP prefixes respectively), bgp_nexthop (to tag on BGP nexthop) and nat_event. + BGP daemon: added bgp_lrgcomm_pattern feature to filter large BGP communities (in addition to existing equivalent knobs to filter on standard and extended communities). + BMP, Streaming Telemetry daemons: msglog_file and dump_file config directives now offer $bmp_router, $bmp_router_port, $telemetry_node and $telemetry_node_port variables. + BGP, BMP, Streaming Telemetry daemons: added BGP, BMP and Streaming Telemetry exporter TCP/UDP port as variable for dump/log filenames (to better support NAT traversal scenarios). + BGP, BMP daemons: added message sequencing to both BGP and BMP dumps (bgp_table_dump_*, bmp_dump_*). If dumping and logging are enabled in parallel then sequencing the dumps allows for check pointing at OBS-URL: https://build.opensuse.org/request/show/652057 OBS-URL: https://build.opensuse.org/package/show/server:monitoring/pmacct?expand=0&rev=85 --- nfacctd.init | 262 ------------------------------------------- pmacct-1.7.1.tar.gz | 3 - pmacct-1.7.2.tar.gz | 3 + pmacct.changes | 156 ++++++++++++++++++++++++++ pmacct.spec | 125 +++++---------------- pmacctd.init | 262 ------------------------------------------- sfacctd.init | 268 -------------------------------------------- uacctd.init | 262 ------------------------------------------- 8 files changed, 188 insertions(+), 1153 deletions(-) delete mode 100644 nfacctd.init delete mode 100644 pmacct-1.7.1.tar.gz create mode 100644 pmacct-1.7.2.tar.gz delete mode 100644 pmacctd.init delete mode 100644 sfacctd.init delete mode 100644 uacctd.init diff --git a/nfacctd.init b/nfacctd.init deleted file mode 100644 index 2358b8e..0000000 --- a/nfacctd.init +++ /dev/null @@ -1,262 +0,0 @@ -#! /bin/sh -# Copyright (c) 1995-2004 SUSE Linux AG, Nuernberg, Germany. -# All rights reserved. -# -# Author: Peter Nixon http://peternixon.net -# -# /etc/init.d/nfacctd -# and its symbolic link -# /(usr/)sbin/rcnfacctd -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# LSB compatible service control script; see http://www.linuxbase.org/spec/ -# -### BEGIN INIT INFO -# Provides: nfacctd -# Required-Start: $syslog $network $remote_fs -# Should-Start: $time postgresql mysql -# Required-Stop: $syslog $remote_fs -# Should-Stop: $time -# Default-Start: 3 5 -# Default-Stop: 0 1 2 6 -# Short-Description: nfacctd daemon providing Netflow collection service -# Description: Start nfacctd to allow collection of Netflow data from network equipment -### END INIT INFO -# -# Any extensions to the keywords given above should be preceeded by -# X-VendorTag- (X-UnitedLinux- X-SuSE- for us) according to LSB. -# -# Notes on Required-Start/Should-Start: -# * There are two different issues that are solved by Required-Start -# and Should-Start -# (a) Hard dependencies: This is used by the runlevel editor to determine -# which services absolutely need to be started to make the start of -# this service make sense. Example: nfsserver should have -# Required-Start: $portmap -# Also, required services are started before the dependent ones. -# The runlevel editor will warn about such missing hard dependencies -# and suggest enabling. During system startup, you may expect an error, -# if the dependency is not fulfilled. -# (b) Specifying the init script ordering, not real (hard) dependencies. -# This is needed by insserv to determine which service should be -# started first (and at a later stage what services can be started -# in parallel). The tag Should-Start: is used for this. -# It tells, that if a service is available, it should be started -# before. If not, never mind. -# * When specifying hard dependencies or ordering requirements, you can -# use names of services (contents of their Provides: section) -# or pseudo names starting with a $. The following ones are available -# according to LSB (1.1): -# $local_fs all local file systems are mounted -# (most services should need this!) -# $remote_fs all remote file systems are mounted -# (note that /usr may be remote, so -# many services should Require this!) -# $syslog system logging facility up -# $network low level networking (eth card, ...) -# $named hostname resolution available -# $netdaemons all network daemons are running -# The $netdaemons pseudo service has been removed in LSB 1.2. -# For now, we still offer it for backward compatibility. -# These are new (LSB 1.2): -# $time the system time has been set correctly -# $portmap SunRPC portmapping service available -# UnitedLinux extensions: -# $ALL indicates that a script should be inserted -# at the end -# * The services specified in the stop tags -# (Required-Stop/Should-Stop) -# specify which services need to be still running when this service -# is shut down. Often the entries there are just copies or a subset -# from the respective start tag. -# * Should-Start/Stop are now part of LSB as of 2.0, -# formerly SUSE/Unitedlinux used X-UnitedLinux-Should-Start/-Stop. -# insserv does support both variants. -# * X-UnitedLinux-Default-Enabled: yes/no is used at installation time -# (%fillup_and_insserv macro in %post of many RPMs) to specify whether -# a startup script should default to be enabled after installation. -# It's not used by insserv. -# -# Note on runlevels: -# 0 - halt/poweroff 6 - reboot -# 1 - single user 2 - multiuser without network exported -# 3 - multiuser w/ network (text mode) 5 - multiuser w/ network and X11 (xdm) -# -# Note on script names: -# http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/scrptnames.html -# A registry has been set up to manage the init script namespace. -# http://www.lanana.org/ -# Please use the names already registered or register one or use a -# vendor prefix. - - -# Check for missing binaries (stale symlinks should not happen) -# Note: Special treatment of stop for LSB conformance -NFACCTD_BIN=/usr/sbin/nfacctd -test -x $NFACCTD_BIN || { echo "$NFACCTD_BIN not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } - -# Check for existence of needed config file and read it -NFACCTD_CONFIG=/etc/pmacct/nfacctd.conf -test -r $NFACCTD_CONFIG || { echo "$NFACCTD_CONFIG not existing"; - if [ "$1" = "stop" ]; then exit 0; - else exit 6; fi; } - -# Read config -#. $NFACCTD_CONFIG - -# Source LSB init functions -# providing start_daemon, killproc, pidofproc, -# log_success_msg, log_failure_msg and log_warning_msg. -# This is currently not used by UnitedLinux based distributions and -# not needed for init scripts for UnitedLinux only. If it is used, -# the functions from rc.status should not be sourced or used. -#. /lib/lsb/init-functions - -# Shell functions sourced from /etc/rc.status: -# rc_check check and set local and overall rc status -# rc_status check and set local and overall rc status -# rc_status -v be verbose in local rc status and clear it afterwards -# rc_status -v -r ditto and clear both the local and overall rc status -# rc_status -s display "skipped" and exit with status 3 -# rc_status -u display "unused" and exit with status 3 -# rc_failed set local and overall rc status to failed -# rc_failed set local and overall rc status to -# rc_reset clear both the local and overall rc status -# rc_exit exit appropriate to overall rc status -# rc_active checks whether a service is activated by symlinks -. /etc/rc.status - -# Reset status of this service -rc_reset - -# Return values acc. to LSB for all commands but status: -# 0 - success -# 1 - generic or unspecified error -# 2 - invalid or excess argument(s) -# 3 - unimplemented feature (e.g. "reload") -# 4 - user had insufficient privileges -# 5 - program is not installed -# 6 - program is not configured -# 7 - program is not running -# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl) -# -# Note that starting an already running service, stopping -# or restarting a not-running service as well as the restart -# with force-reload (in case signaling is not supported) are -# considered a success. - -case "$1" in - start) - echo -n "Starting nfacctd " - ## Start daemon with startproc(8). If this fails - ## the return value is set appropriately by startproc. - /sbin/startproc $NFACCTD_BIN -f $NFACCTD_CONFIG - - # Remember status and be verbose - rc_status -v - ;; - stop) - echo -n "Shutting down nfacctd " - ## Stop daemon with killproc(8) and if this fails - ## killproc sets the return value according to LSB. - - /sbin/killproc -TERM $NFACCTD_BIN - - # Remember status and be verbose - rc_status -v - ;; - try-restart|condrestart) - ## Do a restart only if the service was active before. - ## Note: try-restart is now part of LSB (as of 1.9). - ## RH has a similar command named condrestart. - if test "$1" = "condrestart"; then - echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" - fi - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - # Remember status and be quiet - rc_status - ;; - restart) - ## Stop the service and regardless of whether it was - ## running or not, start it again. - $0 stop - $0 start - - # Remember status and be quiet - rc_status - ;; - force-reload) - ## Signal the daemon to reload its config. Most daemons - ## do this on signal 1 (SIGHUP). - ## If it does not support it, restart the service if it - ## is running. - - echo -n "Reload service nfacctd " - ## if it supports it: - /sbin/killproc -HUP $NFACCTD_BIN - #touch /var/run/nfacctd.pid - rc_status -v - - ## Otherwise: - #$0 try-restart - #rc_status - ;; - reload) - ## Like force-reload, but if daemon does not support - ## signaling, do nothing (!) - - # If it supports signaling: - echo -n "Reload service nfacctd " - /sbin/killproc -HUP $NFACCTD_BIN - #touch /var/run/nfacctd.pid - rc_status -v - - ## Otherwise if it does not support reload: - #rc_failed 3 - #rc_status -v - ;; - status) - echo -n "Checking for service nfacctd " - ## Check status with checkproc(8), if process is running - ## checkproc will return with exit status 0. - - # Return value is slightly different for the status command: - # 0 - service up and running - # 1 - service dead, but /var/run/ pid file exists - # 2 - service dead, but /var/lock/ lock file exists - # 3 - service not running (unused) - # 4 - service status unknown :-( - # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) - - # NOTE: checkproc returns LSB compliant status values. - /sbin/checkproc $NFACCTD_BIN - # NOTE: rc_status knows that we called this init script with - # "status" option and adapts its messages accordingly. - rc_status -v - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" - exit 1 - ;; -esac -rc_exit diff --git a/pmacct-1.7.1.tar.gz b/pmacct-1.7.1.tar.gz deleted file mode 100644 index 964d4aa..0000000 --- a/pmacct-1.7.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:03c3f561522d0a876b96d1303b760b111fbf9f9ef3672c4f7756a45924605c23 -size 1392360 diff --git a/pmacct-1.7.2.tar.gz b/pmacct-1.7.2.tar.gz new file mode 100644 index 0000000..8cf62e9 --- /dev/null +++ b/pmacct-1.7.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:970b98c53fa97171371337dcd327ccb588613a3e9e100099eaa61d9aaa249201 +size 1416302 diff --git a/pmacct.changes b/pmacct.changes index 8271b2d..ab396b4 100644 --- a/pmacct.changes +++ b/pmacct.changes @@ -1,3 +1,159 @@ +------------------------------------------------------------------- +Mon Nov 26 18:57:52 UTC 2018 - mardnh@gmx.de + +- Drop support for older distributions +- Update to version 1.7.2 + + nfacctd, sfacctd: added Kafka broker among the options to receive + NetFlow/IPFIX, sFlow data from. Host, port and topic should all be + specified along with an optional config file to pass to librdkafka. + + nfacctd, sfacctd, pmtelemetryd: added ZeroMQ queue among the options + to receive NetFlow/IPFIX, sFlow or Streaming Telemetry data from. An + IP address and port should be specified. + + nfacctd, sfacctd: added sampling_direction to the set of supported + primitives, valid values being ingress, egress and unknown. + + nfacctd, sfacctd: stats, ie. amount of NetFlow/IPFIX or sFlow packets + received per router, are now available when in tee mode. Stats can be + retrieved via a SIGUSR1 UNIX signal. + + pcap_savefile_replay: a feature to replay content for the specified + amounf of time when reading from a pcap_savefile. + + pre_tag_map: added several new keys: src_net and dst_net (to tag on + source and destination IP prefixes respectively), bgp_nexthop (to + tag on BGP nexthop) and nat_event. + + BGP daemon: added bgp_lrgcomm_pattern feature to filter large BGP + communities (in addition to existing equivalent knobs to filter on + standard and extended communities). + + BMP, Streaming Telemetry daemons: msglog_file and dump_file config + directives now offer $bmp_router, $bmp_router_port, $telemetry_node + and $telemetry_node_port variables. + + BGP, BMP, Streaming Telemetry daemons: added BGP, BMP and Streaming + Telemetry exporter TCP/UDP port as variable for dump/log filenames + (to better support NAT traversal scenarios). + + BGP, BMP daemons: added message sequencing to both BGP and BMP dumps + (bgp_table_dump_*, bmp_dump_*). If dumping and logging are enabled + in parallel then sequencing the dumps allows for check pointing at + regular time intervals. + + BMP daemon: implemented draft-hsmit-bmp-extensible-routemon-msgs for + a tlv-based encoding of route-monitoring messages with a new message + type. + + Streaming Telemetry daemon: added sample decoders for gRPC / GPB for + Cisco and Huawei platforms, written in Python. Telemetry data is + decoded using vendor-supplied proto files and output in JSON format + in a ZeroMQ queue - suitable for ingestion in pmtelemetryd. Docs and + sample code is available in the telemetry/ directory. This is all in + addition to TCP/UDP transports and JSON encoding supported natively + in pmtelemetryd. + + kafka plugin: introduced support for Confluent Schema Registry via + libserdes. A registry can be supplied via kafka_avro_schema_registry + config directive; the schema is generated automatically. The feature + enables validation of data passed through a Kafka broker and uses + Avro encoding. + + kafka plugin: added $in_iface key (input interface) to the set of + variables supported by kafka_partition_key. Extremely useful when + coupled to $peer_src_ip in some scenarios. + + print, IMT plugins: separator for CSV format can now be space (\s) + or tab (\t). + + tee plugin: added Kafka broker among the emitters. kafka_broker and + kafka_topic knobs are now available in the tee_receivers map and a + tee_kafka_config_file directive allows to define a file with config + to pass to librdkafka. + + tee plugin: added ZeroMQ queue among the emitters. zmq_address knob + defines the queue IP address and port to emit to. + + tee plugin: introducing support for complex pre_tag_map when doing + replication of NetFlow/IPFIX (sFlow replication had already this). + With this feature flows are individually evaluated against supplied + filters (input interface, BGP next-hop, etc.) and (not) replicated + accordingly. + + GeoIP v2: added support for latitude and longitude primitives via + src_host_coords and dst_host_coords knobs. This is in addition to + existing country and pocode supports. + + files_uid, files_gid: now also user and group strings are accepted. + This is in addition to user and group IDs. + ! fix, nfacctd: NF_evaluate_flow_type() improved to not detect Cisco + ASA flows (ie. those including initiator and responder octets) as + events. Also improved sanity checking of received NetFlow v9/IPFIX + data and options templates and reviwed modulo functions and improved + template hashing. + ! fix, BGP, BMP, Streaming Telemetry daemons: improved log sequencing + by handling counter wrap-up more gracefully. Also a log sequencing + API was developed to improve code re-use. + ! fix, BGP daemon: added check for duplicate Router-IDs at BGP OPEN + parsing time. If a duplicate is detected, the session BGP OPENing of + the new session is dropped. + ! fix, BGP daemon: ADD-PATH capability was checked only in the first + AFI/SAFI and was being set in the reply for last AFI/SAFI RECEIVE(1) + if first included SEND(2) or SEND-RECEIVE(3). Thanks to Markus Weber + ( @FvDxxx ) for his patch. + ! fix, BGP daemon: upon route lookup, don't perform ADD-PATH logics if + no PATH-ID (even if ADD-PATH capability is announced by the peer). + Thanks to Camilo Cardona ( @jccardonar ) for his support solving the + issue. + ! fix, BGP daemon: graceful handling of invalid AS-PATH segment types + (ie. AS-PATH in BGP UPDATE inconsistent with capabilities passed in + BGP OPEN) in order to avoid SEGVs. + ! fix, pmtelemetryd: improved support for UDP timeouts. Also reviewed + natively supported encodings: removed zjson and GPB was moved to pre- + processors (with samples available in telemetry/decoders directory). + ! fix, pmtelemetryd: no dump_init / dump_close events sequencing since + all messages are sequenced anyway (consistency with other daemons). + ! fix, kafka_common.c: now destroying both config and topic config as + part of p_kafka_close() in order to avoid memory leaks. Also, port is + omitted from broker string if not passed to p_kafka_set_broker(). And + finally output queue length checks in p_kafka_check_outq_len() have + been relaxed (to counter temporary hickups that need more patience). + ! fix, kafka plugin: kafka_partition default was zero (that is, a valid + partition number) instead of -1 (RD_KAFKA_PARTITION_UA or unassigned) + which allows librdkafka to attach a partitioner. + ! fix, SQL plugins: sql_table_schema is honoured even if sql_table_name + is non-dynamic. This is to cover cases where the table is rotated + externally. + ! fix, mysql plugin: my_bool replaced with bool. The plugin now does + compile against MySQL 8.0. Also added inclusion of stdbool.h as on + some systems bool is not defined. Improved overall probing for MySQL + headers. + ! fix, pgsql plugin: sql_recovery_backup_host was not being honoured. + PG_create_backend() now composes a proper conn_string. + ! fix, print plugin: increase successful queries number, QN, only if + the output file was successfully opened. + ! fix, zmq_common.c: moved ZAP socket initialization inside the ZAP + handler. See: https://github.com/zeromq/libzmq/issues/3313 . + ! fix, util.c: length checks in handle_dynname_internal_strings() were + reviewed. Existings were not working in absence of starting/trailing + non-variable strings. + ! fix, util.c: use lockf() instead of more problematic flock(). Thanks + to Yuri Lachin ( @yuyutime ) and Miki Takata ( @mikiT ) for their + support. + ! fix, util.c: in compose_timestamp() pad usecs and use "%ld" since + time fields are signed longs. Thanks to @raymondrussell for the + patch. + ! fix, ndpi_util.c: a protocol bitmask is now set in order to increase + match rate. Patch is courtesy by @rsolsn. + ! fix, compile time warnings: several warnings were addressed including + but not restricted to -Wreturn-time, -Wunused-variable, implicit func + declarations, -Wformat-extra-args, -Wunused-label, -Wunused-value, + -Wunused-function, sbrk calls, -Wpointer-to-int-cast, -Wparentheses + and -Wint-to-pointer-cast. + ! fix, dangerous uninitialized values: net_aggr.c, pmacct.c: in merge() + argument with non-NULL attribute could be passed NULL; bmp_msg.c: in + bmp_process_msg_route_monitor() bdata.tstamp could be uninitialized; + sfprobe_plugin.c: calloc() return value (possibly null) was not being + checked; sflow_agent.c: uninitialized ret value in sfl_agent_init() + could lead to undefined bind() error behaviour. + ! fix, thread_pool.c: reviewed logics in deallocate_thread_pool() and + solved a minor memory leak in allocate_thread_pool(). + - pmacctd: removed support for FDDI + - nfacctd: discontinued support for NetFlow v1, v7 and v8 collection + and replication. + - pre_tag_map: matching on 'sampling_rate' is not supported anymore as + a sampling_rate primitive is now available; the 'return' feature to + return matched data before completing the map workflow has started + being obsoleted (retired from docs but still available). + - plugin_pipe_check_core_pid: deprecating feature given RabbitMQ and + Kafka are not supported anymore for internal message delivery. + - tee plugin: obsoleted tee_dissect_send_full_pkt knob, entire packets + are now replicated only if no pre_tag_map or a simple pre_tag_map is + defined. + - nfprobe plugin: removed support for NetFlow v1 export. + ------------------------------------------------------------------- Sun May 6 14:10:10 UTC 2018 - mardnh@gmx.de diff --git a/pmacct.spec b/pmacct.spec index 355710e..42d1a35 100644 --- a/pmacct.spec +++ b/pmacct.spec @@ -1,7 +1,7 @@ # # spec file for package pmacct # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,32 +12,22 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # - #Compat macro for new _fillupdir macro introduced in Nov 2017 %if ! %{defined _fillupdir} %define _fillupdir /var/adm/fillup-templates %endif -%if 0%{?suse_version} > 1230 -%bcond_without systemd -%else -%bcond_with systemd -%endif - Name: pmacct -Version: 1.7.1 +Version: 1.7.2 Release: 0 Summary: Accounting and aggregation toolsuite for IPv4 and IPv6 -License: GPL-2.0 +License: GPL-2.0-only Group: Productivity/Networking/Diagnostic -Url: http://www.pmacct.net/ +URL: http://www.pmacct.net/ Source: http://www.pmacct.net/pmacct-%{version}.tar.gz -Source1: nfacctd.init -Source2: pmacctd.init -Source3: sfacctd.init Source4: pmacct.nfacctd.service Source5: pmacct.pmacctd.service Source6: pmacct.sfacctd.service @@ -48,33 +38,22 @@ Source10: nfacctd.conf Source11: pmacctd.conf Source12: sfacctd.conf Source20: pmacct.1 -BuildRequires: automake -BuildRequires: libtool BuildRequires: autoconf -# +BuildRequires: automake BuildRequires: libmysqlclient-devel BuildRequires: libpcap-devel BuildRequires: libstdc++-devel -BuildRequires: pkg-config +BuildRequires: libtool +BuildRequires: pkgconfig BuildRequires: postgresql-devel BuildRequires: sqlite-devel >= 3.0.0 +BuildRequires: systemd-rpm-macros +BuildRequires: pkgconfig(geoip) +BuildRequires: pkgconfig(jansson) +BuildRequires: pkgconfig(libndpi) %if 0%{?is_opensuse} == 1 BuildRequires: libnetfilter_log-devel %endif -%if 0%{?suse_version} > 1110 -BuildRequires: libGeoIP-devel -%endif -%if 0%{?suse_version} >= 1310 && 0%{?is_opensuse} == 1 -BuildRequires: pkgconfig(jansson) -%endif -BuildRequires: pkgconfig(libndpi) -%if %{with systemd} -%{?systemd_requires} -BuildRequires: systemd-rpm-macros -%else -PreReq: %insserv_prereq -%endif -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description pmacct is a small set of passive network monitoring tools to measure, account, @@ -97,15 +76,14 @@ autoreconf -fiv export CFLAGS="%{optflags} -Wno-return-type -D_FORTIFY_SOURCE=0" %configure \ --sysconfdir=%{_sysconfdir}/%{name} \ + --docdir="%{_docdir}/%{name}" \ --enable-mmap \ --enable-l2 \ --enable-ipv6 \ --enable-mysql \ --enable-pgsql \ --enable-sqlite3 \ - %if 0%{?suse_version} > 1110 --enable-geoip \ - %endif %if 0%{?suse_version} >= 1310 && 0%{?is_opensuse} == 1 --enable-jansson \ %endif @@ -119,30 +97,17 @@ make %{?_smp_mflags} %install -make DESTDIR=%{buildroot} install %{?_smp_mflags} +%make_install -install -d 0755 "%{buildroot}%{_fillupdir}/" -install -m 0644 %{SOURCE7} "%{buildroot}%{_fillupdir}/sysconfig.nfacctd" -install -m 0644 %{SOURCE8} "%{buildroot}%{_fillupdir}/sysconfig.pmacctd" -install -m 0644 %{SOURCE9} "%{buildroot}%{_fillupdir}/sysconfig.sfacctd" +install -d %{buildroot}%{_fillupdir} +install -m 0644 %{SOURCE7} %{buildroot}%{_fillupdir}/sysconfig.nfacctd +install -m 0644 %{SOURCE8} %{buildroot}%{_fillupdir}/sysconfig.pmacctd +install -m 0644 %{SOURCE9} %{buildroot}%{_fillupdir}/sysconfig.sfacctd -%if %{with systemd} install -d %{buildroot}%{_unitdir} install -m 0644 %{SOURCE4} %{buildroot}%{_unitdir}/nfacctd.service -ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcnfacctd install -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}/pmacctd.service -ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcpmacctd install -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/sfacctd.service -ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcsfacctd -%else -install -d %{buildroot}%{_sysconfdir}/init.d -install -m 0755 %{SOURCE1} %{buildroot}/%{_sysconfdir}/init.d/nfacctd -install -m 0755 %{SOURCE2} %{buildroot}/%{_sysconfdir}/init.d/pmacctd -install -m 0755 %{SOURCE3} %{buildroot}/%{_sysconfdir}/init.d/sfacctd -ln -sf ../..%{_initddir}/nfacctd %{buildroot}%{_sbindir}/rcnfacctd -ln -sf ../..%{_initddir}/pmacctd %{buildroot}%{_sbindir}/rcpmacctd -ln -sf ../..%{_initddir}/sfacctd %{buildroot}%{_sbindir}/rcsfacctd -%endif # examples install -d %{buildroot}%{_sysconfdir}/pmacct/ @@ -151,79 +116,47 @@ install -m 0600 %{SOURCE11} %{buildroot}/%{_sysconfdir}/pmacct/pmacctd.conf install -m 0600 %{SOURCE12} %{buildroot}/%{_sysconfdir}/pmacct/sfacctd.conf # manpage -install -d "%{buildroot}%{_mandir}/man1/" -install -m 644 %{SOURCE20} "%{buildroot}%{_mandir}/man1/" -# -rm -rf examples/lg +install -d %{buildroot}%{_mandir}/man1 +install -m 0644 %{SOURCE20} %{buildroot}%{_mandir}/man1 + +# remove unneeded files +rm -rf %{buildroot}/%{_datadir}/pmacct/examples/lg +rm -rf %{buildroot}/%{_datadir}/pmacct/{CONFIG-KEYS,FAQS,QUICKSTART,UPGRADE,docs} + %pre -%if %{with systemd} %service_add_pre nfacctd.service pmacctd.service sfacctd.service -%endif %post -%if %{with systemd} %service_add_post nfacctd.service pmacctd.service sfacctd.service %{fillup_only -n nfacctd} %{fillup_only -n pmacctd} %{fillup_only -n sfacctd} -%else -%{fillup_and_insserv -n nfacctd} -%{fillup_and_insserv -n pmacctd} -%{fillup_and_insserv -n sfacctd} -%endif %preun -%if %{with systemd} %service_del_preun nfacctd.service pmacctd.service sfacctd.service -%else -%stop_on_removal nfacctd pmacctd sfacctd -%endif %postun -%if %{with systemd} %service_del_postun nfacctd.service pmacctd.service sfacctd.service -%else -%restart_on_update nfacctd pmacctd sfacctd -%insserv_cleanup -%endif - %files -%defattr(-,root,root) -%doc AUTHORS ChangeLog CONFIG-KEYS COPYING FAQS QUICKSTART TOOLS UPGRADE -%doc docs examples sql -# -%{_mandir}/man1/pmacct.1%{ext_man} -# +%license COPYING +%doc AUTHORS ChangeLog CONFIG-KEYS FAQS QUICKSTART UPGRADE +%{_mandir}/man1/pmacct.1%{?ext_man} %{_bindir}/pmacct -# %{_sbindir}/nfacctd %{_sbindir}/pmacctd %{_sbindir}/sfacctd - -%if 0%{?is_opensuse} == 1 %{_sbindir}/uacctd -%endif %{_sbindir}/pmtelemetryd %{_sbindir}/pmbgpd %{_sbindir}/pmbmpd -# -%{_sbindir}/rcnfacctd -%{_sbindir}/rcpmacctd -%{_sbindir}/rcsfacctd -# -%if %{with systemd} +%{_datadir}/pmacct %{_unitdir}/*.service -%else -%config %{_sysconfdir}/init.d/* -%endif -# %dir %{_sysconfdir}/pmacct %config(noreplace) %{_sysconfdir}/pmacct/nfacctd.conf %config(noreplace) %{_sysconfdir}/pmacct/pmacctd.conf %config(noreplace) %{_sysconfdir}/pmacct/sfacctd.conf - %{_fillupdir}/sysconfig.* %changelog diff --git a/pmacctd.init b/pmacctd.init deleted file mode 100644 index 0505647..0000000 --- a/pmacctd.init +++ /dev/null @@ -1,262 +0,0 @@ -#! /bin/sh -# Copyright (c) 1995-2004 SUSE Linux AG, Nuernberg, Germany. -# All rights reserved. -# -# Author: Peter Nixon http://peternixon.net -# -# /etc/init.d/pmacctd -# and its symbolic link -# /(usr/)sbin/rcpmacctd -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# LSB compatible service control script; see http://www.linuxbase.org/spec/ -# -### BEGIN INIT INFO -# Provides: pmacctd -# Required-Start: $syslog $network $remote_fs -# Should-Start: $time postgresql mysql -# Required-Stop: $syslog $remote_fs -# Should-Stop: $time -# Default-Start: 3 5 -# Default-Stop: 0 1 2 6 -# Short-Description: pmacctd daemon providing Promiscious Mode Accounting services -# Description: Start pmacctd to collect Promiscious Mode Accounting data on local interfaces -### END INIT INFO -# -# Any extensions to the keywords given above should be preceeded by -# X-VendorTag- (X-UnitedLinux- X-SuSE- for us) according to LSB. -# -# Notes on Required-Start/Should-Start: -# * There are two different issues that are solved by Required-Start -# and Should-Start -# (a) Hard dependencies: This is used by the runlevel editor to determine -# which services absolutely need to be started to make the start of -# this service make sense. Example: nfsserver should have -# Required-Start: $portmap -# Also, required services are started before the dependent ones. -# The runlevel editor will warn about such missing hard dependencies -# and suggest enabling. During system startup, you may expect an error, -# if the dependency is not fulfilled. -# (b) Specifying the init script ordering, not real (hard) dependencies. -# This is needed by insserv to determine which service should be -# started first (and at a later stage what services can be started -# in parallel). The tag Should-Start: is used for this. -# It tells, that if a service is available, it should be started -# before. If not, never mind. -# * When specifying hard dependencies or ordering requirements, you can -# use names of services (contents of their Provides: section) -# or pseudo names starting with a $. The following ones are available -# according to LSB (1.1): -# $local_fs all local file systems are mounted -# (most services should need this!) -# $remote_fs all remote file systems are mounted -# (note that /usr may be remote, so -# many services should Require this!) -# $syslog system logging facility up -# $network low level networking (eth card, ...) -# $named hostname resolution available -# $netdaemons all network daemons are running -# The $netdaemons pseudo service has been removed in LSB 1.2. -# For now, we still offer it for backward compatibility. -# These are new (LSB 1.2): -# $time the system time has been set correctly -# $portmap SunRPC portmapping service available -# UnitedLinux extensions: -# $ALL indicates that a script should be inserted -# at the end -# * The services specified in the stop tags -# (Required-Stop/Should-Stop) -# specify which services need to be still running when this service -# is shut down. Often the entries there are just copies or a subset -# from the respective start tag. -# * Should-Start/Stop are now part of LSB as of 2.0, -# formerly SUSE/Unitedlinux used X-UnitedLinux-Should-Start/-Stop. -# insserv does support both variants. -# * X-UnitedLinux-Default-Enabled: yes/no is used at installation time -# (%fillup_and_insserv macro in %post of many RPMs) to specify whether -# a startup script should default to be enabled after installation. -# It's not used by insserv. -# -# Note on runlevels: -# 0 - halt/poweroff 6 - reboot -# 1 - single user 2 - multiuser without network exported -# 3 - multiuser w/ network (text mode) 5 - multiuser w/ network and X11 (xdm) -# -# Note on script names: -# http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/scrptnames.html -# A registry has been set up to manage the init script namespace. -# http://www.lanana.org/ -# Please use the names already registered or register one or use a -# vendor prefix. - - -# Check for missing binaries (stale symlinks should not happen) -# Note: Special treatment of stop for LSB conformance -PMACCTD_BIN=/usr/sbin/pmacctd -test -x $PMACCTD_BIN || { echo "$PMACCTD_BIN not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } - -# Check for existence of needed config file and read it -PMACCTD_CONFIG=/etc/pmacct/pmacctd.conf -test -r $PMACCTD_CONFIG || { echo "$PMACCTD_CONFIG not existing"; - if [ "$1" = "stop" ]; then exit 0; - else exit 6; fi; } - -# Read config -#. $PMACCTD_CONFIG - -# Source LSB init functions -# providing start_daemon, killproc, pidofproc, -# log_success_msg, log_failure_msg and log_warning_msg. -# This is currently not used by UnitedLinux based distributions and -# not needed for init scripts for UnitedLinux only. If it is used, -# the functions from rc.status should not be sourced or used. -#. /lib/lsb/init-functions - -# Shell functions sourced from /etc/rc.status: -# rc_check check and set local and overall rc status -# rc_status check and set local and overall rc status -# rc_status -v be verbose in local rc status and clear it afterwards -# rc_status -v -r ditto and clear both the local and overall rc status -# rc_status -s display "skipped" and exit with status 3 -# rc_status -u display "unused" and exit with status 3 -# rc_failed set local and overall rc status to failed -# rc_failed set local and overall rc status to -# rc_reset clear both the local and overall rc status -# rc_exit exit appropriate to overall rc status -# rc_active checks whether a service is activated by symlinks -. /etc/rc.status - -# Reset status of this service -rc_reset - -# Return values acc. to LSB for all commands but status: -# 0 - success -# 1 - generic or unspecified error -# 2 - invalid or excess argument(s) -# 3 - unimplemented feature (e.g. "reload") -# 4 - user had insufficient privileges -# 5 - program is not installed -# 6 - program is not configured -# 7 - program is not running -# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl) -# -# Note that starting an already running service, stopping -# or restarting a not-running service as well as the restart -# with force-reload (in case signaling is not supported) are -# considered a success. - -case "$1" in - start) - echo -n "Starting pmacctd " - ## Start daemon with startproc(8). If this fails - ## the return value is set appropriately by startproc. - /sbin/startproc $PMACCTD_BIN -f $PMACCTD_CONFIG - - # Remember status and be verbose - rc_status -v - ;; - stop) - echo -n "Shutting down pmacctd " - ## Stop daemon with killproc(8) and if this fails - ## killproc sets the return value according to LSB. - - /sbin/killproc -TERM $PMACCTD_BIN - - # Remember status and be verbose - rc_status -v - ;; - try-restart|condrestart) - ## Do a restart only if the service was active before. - ## Note: try-restart is now part of LSB (as of 1.9). - ## RH has a similar command named condrestart. - if test "$1" = "condrestart"; then - echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" - fi - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - # Remember status and be quiet - rc_status - ;; - restart) - ## Stop the service and regardless of whether it was - ## running or not, start it again. - $0 stop - $0 start - - # Remember status and be quiet - rc_status - ;; - force-reload) - ## Signal the daemon to reload its config. Most daemons - ## do this on signal 1 (SIGHUP). - ## If it does not support it, restart the service if it - ## is running. - - echo -n "Reload service pmacctd " - ## if it supports it: - /sbin/killproc -HUP $PMACCTD_BIN - #touch /var/run/pmacctd.pid - rc_status -v - - ## Otherwise: - #$0 try-restart - #rc_status - ;; - reload) - ## Like force-reload, but if daemon does not support - ## signaling, do nothing (!) - - # If it supports signaling: - echo -n "Reload service pmacctd " - /sbin/killproc -HUP $PMACCTD_BIN - #touch /var/run/pmacctd.pid - rc_status -v - - ## Otherwise if it does not support reload: - #rc_failed 3 - #rc_status -v - ;; - status) - echo -n "Checking for service pmacctd " - ## Check status with checkproc(8), if process is running - ## checkproc will return with exit status 0. - - # Return value is slightly different for the status command: - # 0 - service up and running - # 1 - service dead, but /var/run/ pid file exists - # 2 - service dead, but /var/lock/ lock file exists - # 3 - service not running (unused) - # 4 - service status unknown :-( - # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) - - # NOTE: checkproc returns LSB compliant status values. - /sbin/checkproc $PMACCTD_BIN - # NOTE: rc_status knows that we called this init script with - # "status" option and adapts its messages accordingly. - rc_status -v - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" - exit 1 - ;; -esac -rc_exit diff --git a/sfacctd.init b/sfacctd.init deleted file mode 100644 index 303e4cd..0000000 --- a/sfacctd.init +++ /dev/null @@ -1,268 +0,0 @@ -#! /bin/sh -# Copyright (c) 1995-2004 SUSE Linux AG, Nuernberg, Germany. -# All rights reserved. -# -# Author: Peter Nixon http://peternixon.net -# -# /etc/init.d/sfacctd -# and its symbolic link -# /(usr/)sbin/rcsfacctd -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# LSB compatible service control script; see http://www.linuxbase.org/spec/ -# -# Note: This template uses functions rc_XXX defined in /etc/rc.status on -# UnitedLinux (UL) based Linux distributions. If you want to base your -# script on this template and ensure that it works on non UL based LSB -# compliant Linux distributions, you either have to provide the rc.status -# functions from UL or change the script to work without them. -# -### BEGIN INIT INFO -# Provides: sfacctd -# Required-Start: $syslog $network $remote_fs -# Should-Start: $time postgresql mysql -# Required-Stop: $syslog $remote_fs -# Should-Stop: $time -# Default-Start: 3 5 -# Default-Stop: 0 1 2 6 -# Short-Description: sfacctd daemon providing sflow collection -# Description: Start sfacctd to provide sflow collection services -### END INIT INFO -# -# Any extensions to the keywords given above should be preceeded by -# X-VendorTag- (X-UnitedLinux- X-SuSE- for us) according to LSB. -# -# Notes on Required-Start/Should-Start: -# * There are two different issues that are solved by Required-Start -# and Should-Start -# (a) Hard dependencies: This is used by the runlevel editor to determine -# which services absolutely need to be started to make the start of -# this service make sense. Example: nfsserver should have -# Required-Start: $portmap -# Also, required services are started before the dependent ones. -# The runlevel editor will warn about such missing hard dependencies -# and suggest enabling. During system startup, you may expect an error, -# if the dependency is not fulfilled. -# (b) Specifying the init script ordering, not real (hard) dependencies. -# This is needed by insserv to determine which service should be -# started first (and at a later stage what services can be started -# in parallel). The tag Should-Start: is used for this. -# It tells, that if a service is available, it should be started -# before. If not, never mind. -# * When specifying hard dependencies or ordering requirements, you can -# use names of services (contents of their Provides: section) -# or pseudo names starting with a $. The following ones are available -# according to LSB (1.1): -# $local_fs all local file systems are mounted -# (most services should need this!) -# $remote_fs all remote file systems are mounted -# (note that /usr may be remote, so -# many services should Require this!) -# $syslog system logging facility up -# $network low level networking (eth card, ...) -# $named hostname resolution available -# $netdaemons all network daemons are running -# The $netdaemons pseudo service has been removed in LSB 1.2. -# For now, we still offer it for backward compatibility. -# These are new (LSB 1.2): -# $time the system time has been set correctly -# $portmap SunRPC portmapping service available -# UnitedLinux extensions: -# $ALL indicates that a script should be inserted -# at the end -# * The services specified in the stop tags -# (Required-Stop/Should-Stop) -# specify which services need to be still running when this service -# is shut down. Often the entries there are just copies or a subset -# from the respective start tag. -# * Should-Start/Stop are now part of LSB as of 2.0, -# formerly SUSE/Unitedlinux used X-UnitedLinux-Should-Start/-Stop. -# insserv does support both variants. -# * X-UnitedLinux-Default-Enabled: yes/no is used at installation time -# (%fillup_and_insserv macro in %post of many RPMs) to specify whether -# a startup script should default to be enabled after installation. -# It's not used by insserv. -# -# Note on runlevels: -# 0 - halt/poweroff 6 - reboot -# 1 - single user 2 - multiuser without network exported -# 3 - multiuser w/ network (text mode) 5 - multiuser w/ network and X11 (xdm) -# -# Note on script names: -# http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/scrptnames.html -# A registry has been set up to manage the init script namespace. -# http://www.lanana.org/ -# Please use the names already registered or register one or use a -# vendor prefix. - - -# Check for missing binaries (stale symlinks should not happen) -# Note: Special treatment of stop for LSB conformance -SFACCTD_BIN=/usr/sbin/sfacctd -test -x $SFACCTD_BIN || { echo "$SFACCTD_BIN not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } - -# Check for existence of needed config file and read it -SFACCTD_CONFIG=/etc/pmacct/sfacctd.conf -test -r $SFACCTD_CONFIG || { echo "$SFACCTD_CONFIG not existing"; - if [ "$1" = "stop" ]; then exit 0; - else exit 6; fi; } - -# Read config -#. $SFACCTD_CONFIG - -# Source LSB init functions -# providing start_daemon, killproc, pidofproc, -# log_success_msg, log_failure_msg and log_warning_msg. -# This is currently not used by UnitedLinux based distributions and -# not needed for init scripts for UnitedLinux only. If it is used, -# the functions from rc.status should not be sourced or used. -#. /lib/lsb/init-functions - -# Shell functions sourced from /etc/rc.status: -# rc_check check and set local and overall rc status -# rc_status check and set local and overall rc status -# rc_status -v be verbose in local rc status and clear it afterwards -# rc_status -v -r ditto and clear both the local and overall rc status -# rc_status -s display "skipped" and exit with status 3 -# rc_status -u display "unused" and exit with status 3 -# rc_failed set local and overall rc status to failed -# rc_failed set local and overall rc status to -# rc_reset clear both the local and overall rc status -# rc_exit exit appropriate to overall rc status -# rc_active checks whether a service is activated by symlinks -. /etc/rc.status - -# Reset status of this service -rc_reset - -# Return values acc. to LSB for all commands but status: -# 0 - success -# 1 - generic or unspecified error -# 2 - invalid or excess argument(s) -# 3 - unimplemented feature (e.g. "reload") -# 4 - user had insufficient privileges -# 5 - program is not installed -# 6 - program is not configured -# 7 - program is not running -# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl) -# -# Note that starting an already running service, stopping -# or restarting a not-running service as well as the restart -# with force-reload (in case signaling is not supported) are -# considered a success. - -case "$1" in - start) - echo -n "Starting sfacctd " - ## Start daemon with startproc(8). If this fails - ## the return value is set appropriately by startproc. - /sbin/startproc $SFACCTD_BIN -f $SFACCTD_CONFIG - - # Remember status and be verbose - rc_status -v - ;; - stop) - echo -n "Shutting down sfacctd " - ## Stop daemon with killproc(8) and if this fails - ## killproc sets the return value according to LSB. - - /sbin/killproc -TERM $SFACCTD_BIN - - # Remember status and be verbose - rc_status -v - ;; - try-restart|condrestart) - ## Do a restart only if the service was active before. - ## Note: try-restart is now part of LSB (as of 1.9). - ## RH has a similar command named condrestart. - if test "$1" = "condrestart"; then - echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" - fi - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - # Remember status and be quiet - rc_status - ;; - restart) - ## Stop the service and regardless of whether it was - ## running or not, start it again. - $0 stop - $0 start - - # Remember status and be quiet - rc_status - ;; - force-reload) - ## Signal the daemon to reload its config. Most daemons - ## do this on signal 1 (SIGHUP). - ## If it does not support it, restart the service if it - ## is running. - - echo -n "Reload service sfacctd " - ## if it supports it: - /sbin/killproc -HUP $SFACCTD_BIN - #touch /var/run/sfacctd.pid - rc_status -v - - ## Otherwise: - #$0 try-restart - #rc_status - ;; - reload) - ## Like force-reload, but if daemon does not support - ## signaling, do nothing (!) - - # If it supports signaling: - echo -n "Reload service sfacctd " - /sbin/killproc -HUP $SFACCTD_BIN - #touch /var/run/sfacctd.pid - rc_status -v - - ## Otherwise if it does not support reload: - #rc_failed 3 - #rc_status -v - ;; - status) - echo -n "Checking for service sfacctd " - ## Check status with checkproc(8), if process is running - ## checkproc will return with exit status 0. - - # Return value is slightly different for the status command: - # 0 - service up and running - # 1 - service dead, but /var/run/ pid file exists - # 2 - service dead, but /var/lock/ lock file exists - # 3 - service not running (unused) - # 4 - service status unknown :-( - # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) - - # NOTE: checkproc returns LSB compliant status values. - /sbin/checkproc $SFACCTD_BIN - # NOTE: rc_status knows that we called this init script with - # "status" option and adapts its messages accordingly. - rc_status -v - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" - exit 1 - ;; -esac -rc_exit diff --git a/uacctd.init b/uacctd.init deleted file mode 100644 index 4e2741a..0000000 --- a/uacctd.init +++ /dev/null @@ -1,262 +0,0 @@ -#! /bin/sh -# Copyright (c) 1995-2004 SUSE Linux AG, Nuernberg, Germany. -# All rights reserved. -# -# Author: Peter Nixon http://peternixon.net -# -# /etc/init.d/uacctd -# and its symbolic link -# /(usr/)sbin/rcuacctd -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# LSB compatible service control script; see http://www.linuxbase.org/spec/ -# -### BEGIN INIT INFO -# Provides: uacctd -# Required-Start: $syslog $network $remote_fs -# Should-Start: $time postgresql mysql -# Required-Stop: $syslog $remote_fs -# Should-Stop: $time -# Default-Start: 3 5 -# Default-Stop: 0 1 2 6 -# Short-Description: uacctd daemon providing Netflow collection service -# Description: Start uacctd to allow collection of Netflow data from network equipment -### END INIT INFO -# -# Any extensions to the keywords given above should be preceeded by -# X-VendorTag- (X-UnitedLinux- X-SuSE- for us) according to LSB. -# -# Notes on Required-Start/Should-Start: -# * There are two different issues that are solved by Required-Start -# and Should-Start -# (a) Hard dependencies: This is used by the runlevel editor to determine -# which services absolutely need to be started to make the start of -# this service make sense. Example: nfsserver should have -# Required-Start: $portmap -# Also, required services are started before the dependent ones. -# The runlevel editor will warn about such missing hard dependencies -# and suggest enabling. During system startup, you may expect an error, -# if the dependency is not fulfilled. -# (b) Specifying the init script ordering, not real (hard) dependencies. -# This is needed by insserv to determine which service should be -# started first (and at a later stage what services can be started -# in parallel). The tag Should-Start: is used for this. -# It tells, that if a service is available, it should be started -# before. If not, never mind. -# * When specifying hard dependencies or ordering requirements, you can -# use names of services (contents of their Provides: section) -# or pseudo names starting with a $. The following ones are available -# according to LSB (1.1): -# $local_fs all local file systems are mounted -# (most services should need this!) -# $remote_fs all remote file systems are mounted -# (note that /usr may be remote, so -# many services should Require this!) -# $syslog system logging facility up -# $network low level networking (eth card, ...) -# $named hostname resolution available -# $netdaemons all network daemons are running -# The $netdaemons pseudo service has been removed in LSB 1.2. -# For now, we still offer it for backward compatibility. -# These are new (LSB 1.2): -# $time the system time has been set correctly -# $portmap SunRPC portmapping service available -# UnitedLinux extensions: -# $ALL indicates that a script should be inserted -# at the end -# * The services specified in the stop tags -# (Required-Stop/Should-Stop) -# specify which services need to be still running when this service -# is shut down. Often the entries there are just copies or a subset -# from the respective start tag. -# * Should-Start/Stop are now part of LSB as of 2.0, -# formerly SUSE/Unitedlinux used X-UnitedLinux-Should-Start/-Stop. -# insserv does support both variants. -# * X-UnitedLinux-Default-Enabled: yes/no is used at installation time -# (%fillup_and_insserv macro in %post of many RPMs) to specify whether -# a startup script should default to be enabled after installation. -# It's not used by insserv. -# -# Note on runlevels: -# 0 - halt/poweroff 6 - reboot -# 1 - single user 2 - multiuser without network exported -# 3 - multiuser w/ network (text mode) 5 - multiuser w/ network and X11 (xdm) -# -# Note on script names: -# http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/scrptnames.html -# A registry has been set up to manage the init script namespace. -# http://www.lanana.org/ -# Please use the names already registered or register one or use a -# vendor prefix. - - -# Check for missing binaries (stale symlinks should not happen) -# Note: Special treatment of stop for LSB conformance -NFACCTD_BIN=/usr/sbin/uacctd -test -x $NFACCTD_BIN || { echo "$NFACCTD_BIN not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } - -# Check for existence of needed config file and read it -NFACCTD_CONFIG=/etc/pmacct/uacctd.conf -test -r $NFACCTD_CONFIG || { echo "$NFACCTD_CONFIG not existing"; - if [ "$1" = "stop" ]; then exit 0; - else exit 6; fi; } - -# Read config -#. $NFACCTD_CONFIG - -# Source LSB init functions -# providing start_daemon, killproc, pidofproc, -# log_success_msg, log_failure_msg and log_warning_msg. -# This is currently not used by UnitedLinux based distributions and -# not needed for init scripts for UnitedLinux only. If it is used, -# the functions from rc.status should not be sourced or used. -#. /lib/lsb/init-functions - -# Shell functions sourced from /etc/rc.status: -# rc_check check and set local and overall rc status -# rc_status check and set local and overall rc status -# rc_status -v be verbose in local rc status and clear it afterwards -# rc_status -v -r ditto and clear both the local and overall rc status -# rc_status -s display "skipped" and exit with status 3 -# rc_status -u display "unused" and exit with status 3 -# rc_failed set local and overall rc status to failed -# rc_failed set local and overall rc status to -# rc_reset clear both the local and overall rc status -# rc_exit exit appropriate to overall rc status -# rc_active checks whether a service is activated by symlinks -. /etc/rc.status - -# Reset status of this service -rc_reset - -# Return values acc. to LSB for all commands but status: -# 0 - success -# 1 - generic or unspecified error -# 2 - invalid or excess argument(s) -# 3 - unimplemented feature (e.g. "reload") -# 4 - user had insufficient privileges -# 5 - program is not installed -# 6 - program is not configured -# 7 - program is not running -# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl) -# -# Note that starting an already running service, stopping -# or restarting a not-running service as well as the restart -# with force-reload (in case signaling is not supported) are -# considered a success. - -case "$1" in - start) - echo -n "Starting uacctd " - ## Start daemon with startproc(8). If this fails - ## the return value is set appropriately by startproc. - /sbin/startproc $NFACCTD_BIN -f $NFACCTD_CONFIG - - # Remember status and be verbose - rc_status -v - ;; - stop) - echo -n "Shutting down uacctd " - ## Stop daemon with killproc(8) and if this fails - ## killproc sets the return value according to LSB. - - /sbin/killproc -TERM $NFACCTD_BIN - - # Remember status and be verbose - rc_status -v - ;; - try-restart|condrestart) - ## Do a restart only if the service was active before. - ## Note: try-restart is now part of LSB (as of 1.9). - ## RH has a similar command named condrestart. - if test "$1" = "condrestart"; then - echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" - fi - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - # Remember status and be quiet - rc_status - ;; - restart) - ## Stop the service and regardless of whether it was - ## running or not, start it again. - $0 stop - $0 start - - # Remember status and be quiet - rc_status - ;; - force-reload) - ## Signal the daemon to reload its config. Most daemons - ## do this on signal 1 (SIGHUP). - ## If it does not support it, restart the service if it - ## is running. - - echo -n "Reload service uacctd " - ## if it supports it: - /sbin/killproc -HUP $NFACCTD_BIN - #touch /var/run/uacctd.pid - rc_status -v - - ## Otherwise: - #$0 try-restart - #rc_status - ;; - reload) - ## Like force-reload, but if daemon does not support - ## signaling, do nothing (!) - - # If it supports signaling: - echo -n "Reload service uacctd " - /sbin/killproc -HUP $NFACCTD_BIN - #touch /var/run/uacctd.pid - rc_status -v - - ## Otherwise if it does not support reload: - #rc_failed 3 - #rc_status -v - ;; - status) - echo -n "Checking for service uacctd " - ## Check status with checkproc(8), if process is running - ## checkproc will return with exit status 0. - - # Return value is slightly different for the status command: - # 0 - service up and running - # 1 - service dead, but /var/run/ pid file exists - # 2 - service dead, but /var/lock/ lock file exists - # 3 - service not running (unused) - # 4 - service status unknown :-( - # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) - - # NOTE: checkproc returns LSB compliant status values. - /sbin/checkproc $NFACCTD_BIN - # NOTE: rc_status knows that we called this init script with - # "status" option and adapts its messages accordingly. - rc_status -v - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}" - exit 1 - ;; -esac -rc_exit