View | Details | Raw Unified | Return to bug 152226
Collapse All | Expand All

(-)Makefile (-3 / +5 lines)
Lines 8-14 Link Here
8
PORTNAME=	sancp
8
PORTNAME=	sancp
9
PORTVERSION=	1.6.1
9
PORTVERSION=	1.6.1
10
DISTVERSIONSUFFIX=	-stable
10
DISTVERSIONSUFFIX=	-stable
11
PORTREVISION=	3
11
PORTREVISION=	4
12
CATEGORIES=	security
12
CATEGORIES=	security
13
MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}/${PORTNAME}-${PORTVERSION}-stable
13
MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}/${PORTNAME}-${PORTVERSION}-stable
14
14
Lines 16-24 Link Here
16
COMMENT=	A network connection profiler
16
COMMENT=	A network connection profiler
17
17
18
ALL_TARGET=	bsd
18
ALL_TARGET=	bsd
19
USE_RC_SUBR=	sancp.sh
19
USE_RC_SUBR=	sancp
20
SUB_FILES=	pkg-message
20
SUB_FILES=	pkg-message
21
21
22
USERS=		sancp
23
GROUPS=		sancp
24
22
PORTDOCS=	CHANGES INSTALL ISSUES README \
25
PORTDOCS=	CHANGES INSTALL ISSUES README \
23
		SETUP fields.LIST LICENSE
26
		SETUP fields.LIST LICENSE
24
27
Lines 26-32 Link Here
26
	@cd ${WRKSRC} && ${MV} LICENSE docs/
29
	@cd ${WRKSRC} && ${MV} LICENSE docs/
27
30
28
do-install:
31
do-install:
29
	@${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
30
	@${INSTALL_PROGRAM} ${WRKSRC}/sancp ${PREFIX}/bin
32
	@${INSTALL_PROGRAM} ${WRKSRC}/sancp ${PREFIX}/bin
31
	@${INSTALL_DATA} ${WRKSRC}/etc/sancp/sancp.conf ${PREFIX}/etc/sancp.conf-dist
33
	@${INSTALL_DATA} ${WRKSRC}/etc/sancp/sancp.conf ${PREFIX}/etc/sancp.conf-dist
32
	@${CP} -n ${PREFIX}/etc/sancp.conf-dist ${PREFIX}/etc/sancp.conf
34
	@${CP} -n ${PREFIX}/etc/sancp.conf-dist ${PREFIX}/etc/sancp.conf
(-)distinfo (-1 lines)
Lines 1-3 Link Here
1
MD5 (sancp-1.6.1-stable.tar.gz) = ffa64f2fdb49afd7ef16fbefda21e251
2
SHA256 (sancp-1.6.1-stable.tar.gz) = 9836262aaf02bde116a9e79d342ea3af8b4991c7ba27b816fb54ed6c0863ff48
1
SHA256 (sancp-1.6.1-stable.tar.gz) = 9836262aaf02bde116a9e79d342ea3af8b4991c7ba27b816fb54ed6c0863ff48
3
SIZE (sancp-1.6.1-stable.tar.gz) = 71748
2
SIZE (sancp-1.6.1-stable.tar.gz) = 71748
(-)pkg-deinstall (-24 / +2 lines)
Lines 4-31 Link Here
4
        exit 0
4
        exit 0
5
fi
5
fi
6
6
7
PATH=/bin:/usr/sbin
7
PATH=/bin:/usr/bin
8
USER=sancp
9
GROUP=${USER}
10
LOG_DIR=/var/log/sancp
11
8
12
# Remove the log directory
9
echo "* If you nolonger plan to run sancp delete /var/log/sancp, the user & group created during install *"
13
if [ -d ${LOG_DIR} ]; 
14
then 
15
	rmdir ${LOG_DIR} >/dev/null 2>&1; 
16
fi
17
18
if pw user show "${USER}" >/dev/null 2>&1; then
19
        if ! pw userdel ${USER} ;          
20
        then
21
                echo "Unable to remove user: ${USER}, remove it manually"
22
        fi
23
fi
24
25
26
if pw group show "${GROUP}" >/dev/null 2>&1; then
27
	if ! pw groupdel ${GROUP} ; 
28
	then
29
		echo "Unable to remove group: ${GROUP}, remove it manually"
30
	fi
31
fi
(-)pkg-install (-36 lines)
Lines 5-46 Link Here
5
fi
5
fi
6
6
7
PATH=/bin:/usr/sbin
7
PATH=/bin:/usr/sbin
8
USER=sancp
9
GROUP=${USER}
10
LOG_DIR=/var/log/sancp
8
LOG_DIR=/var/log/sancp
11
9
12
if [ ! -d ${LOG_DIR} ]; then mkdir ${LOG_DIR}; fi
13
14
if pw group show "${GROUP}" 2>/dev/null; then
15
	echo "You already have a group \"${GROUP}\", so I will use it."
16
else
17
	if pw groupadd ${GROUP}; then
18
		echo "Added group \"${GROUP}\"."
19
	else
20
		echo "Adding group \"${GROUP}\" failed..."
21
		exit 1
22
	fi
23
fi
24
25
if pw user show "${USER}" 2>/dev/null; then
26
	echo "You already have a user \"${USER}\", so I will use it."
27
	if pw usermod ${USER} -d ${LOG_DIR}
28
	then
29
		echo "Changed home directory of \"${USER}\" to \"${LOG_DIR}\""
30
	else
31
		echo "Changing home directory of \"${USER}\" to \"${LOG_DIR}\" failed..."
32
		exit 1
33
	fi
34
else
35
	if pw useradd ${USER} -g ${GROUP} -h - \
36
		-d ${LOG_DIR} -s /sbin/nologin -c "SANCP Daemon"
37
	then
38
		echo "Added user \"${USER}\"."
39
	else
40
		echo "Adding user \"${USER}\" failed..."
41
		exit 1
42
	fi
43
fi
44
45
chown -R ${USER}:${GROUP} ${LOG_DIR}
46
chmod 750 ${LOG_DIR}
10
chmod 750 ${LOG_DIR}
(-)files/sancp.in (+80 lines)
Added Link Here
1
#!/bin/sh
2
# 
3
4
# PROVIDE: sancp
5
# REQUIRE: DAEMON
6
# BEFORE: LOGIN
7
# KEYWORD: shutdown
8
9
# Add the following lines to /etc/rc.conf to enable sancp:
10
# sancp_enable (bool):	Set to YES to enable sancp
11
# 				Default: NO
12
# sancp_flags (str):		Extra flags passed to sancp
13
#				Default: -D
14
# sancp_conf (str):		Sancp configuration file
15
#				Default: %%PREFIX%%/etc/sancp.conf
16
# sancp_interface (str):	Default: none - MUST BE SET
17
#
18
# Command Line Options: (cmdline)
19
#   ---------------------
20
#
21
#	-? or -h  this help screen
22
#	-c <filename>  specify the configuration/rules filename
23
#	-d <directory>  specify the directory for output files
24
#	-i <device>  set the network device to listen on (default: 'any')
25
#	-g <gid>   set a group identity
26
#	-u <uid>   set a user identity
27
#	-r <pcapfile>  pcap file to read (overrides -i)
28
#	-B "<bpf expression>"  set a bpf expression (alternative to -F <filename>)
29
#	-D (daemon) forks, prints msgs to syslog only and overrides -C option
30
#	-K (console) enable additional printing of 'realtimes' to stdout (suppressed by option -D)
31
#	-F <bpf filename>  file containing a bpf filter expression, overrides (alternative to -B)
32
#	-H --human-readable  write IP addresses in dotted notation and TCPflag fields in hex 
33
#	-R  Set default for realtime to 'pass' (default is 'log') disables realtime, but rules can override
34
#	-S  Set default for stats to 'pass' (default is 'log') disables stats, but rules can override
35
#	-P  Set default for pcap to 'pass' (default is 'log') disables pcap, but rules can override
36
#	-I or --enable_icmp_mixed  record 'code' and 'type' fields for ICMP
37
#		to the fields 's_port' and 'd_port'.
38
#		note: affects how related icmp packets are correlated 
39
#	-V  display version
40
#    --shift  (debug) force interpretation of packet starting at byte[2] 
41
#                    normally performed when reading from the 'any' interface
42
#	--strip-80211  strip 802.1Q headers from 802.1Q packets; used to 
43
# 	  decode 802.1Q encapsulated packets - affects -A option, 
44
#	--log-facility <facility>  where facility can be 'LOCAL1' - 'LOCAL7'
45
#		The default log facility used by SANCP is LOG_DAEMON 
46
#
47
#      Debug mode for pcap data logging
48
#	-A  records ALL traffic frames to a pcap file named 'debug_pcap_raw'
49
#	  (despite rules). Packets are logged here prior to decoding or handling. 
50
#	  Use -F or -B option to restrict what is collectedi.
51
#	  Pcap data logged using this option is affected by the --strip-80211 cmdline option
52
#	  The configuration file equivalent to this is 'default debug_pcap_raw enable'
53
54
. /etc/rc.subr
55
56
name="sancp"
57
rcvar=`set_rcvar`
58
59
command="%%PREFIX%%/bin/sancp"
60
61
start_precmd=start_precmd
62
63
start_precmd()
64
{
65
	if [ -z "${sancp_interface}" ]; then
66
		err 1 "sancp_interface must set."
67
	fi
68
}
69
70
# set some defaults
71
load_rc_config $name
72
73
: ${sancp_enable="NO"}
74
: ${sancp_flags="-D"}
75
: ${sancp_conf="%%PREFIX%%/etc/sancp.conf"}
76
: ${sancp_interface=""}
77
78
command_args="-c ${sancp_conf} -i ${sancp_interface}"
79
80
run_rc_command "$1"
(-)files/sancp.sh.in (-80 lines)
Removed Link Here
1
#!/bin/sh
2
# 
3
4
# PROVIDE: sancp
5
# REQUIRE: DAEMON
6
# BEFORE: LOGIN
7
# KEYWORD: shutdown
8
9
# Add the following lines to /etc/rc.conf to enable sancp:
10
# sancp_enable (bool):	Set to YES to enable sancp
11
# 				Default: NO
12
# sancp_flags (str):		Extra flags passed to sancp
13
#				Default: -D
14
# sancp_conf (str):		Sancp configuration file
15
#				Default: %%PREFIX%%/etc/sancp.conf
16
# sancp_interface (str):	Default: none - MUST BE SET
17
#
18
# Command Line Options: (cmdline)
19
#   ---------------------
20
#
21
#	-? or -h  this help screen
22
#	-c <filename>  specify the configuration/rules filename
23
#	-d <directory>  specify the directory for output files
24
#	-i <device>  set the network device to listen on (default: 'any')
25
#	-g <gid>   set a group identity
26
#	-u <uid>   set a user identity
27
#	-r <pcapfile>  pcap file to read (overrides -i)
28
#	-B "<bpf expression>"  set a bpf expression (alternative to -F <filename>)
29
#	-D (daemon) forks, prints msgs to syslog only and overrides -C option
30
#	-K (console) enable additional printing of 'realtimes' to stdout (suppressed by option -D)
31
#	-F <bpf filename>  file containing a bpf filter expression, overrides (alternative to -B)
32
#	-H --human-readable  write IP addresses in dotted notation and TCPflag fields in hex 
33
#	-R  Set default for realtime to 'pass' (default is 'log') disables realtime, but rules can override
34
#	-S  Set default for stats to 'pass' (default is 'log') disables stats, but rules can override
35
#	-P  Set default for pcap to 'pass' (default is 'log') disables pcap, but rules can override
36
#	-I or --enable_icmp_mixed  record 'code' and 'type' fields for ICMP
37
#		to the fields 's_port' and 'd_port'.
38
#		note: affects how related icmp packets are correlated 
39
#	-V  display version
40
#    --shift  (debug) force interpretation of packet starting at byte[2] 
41
#                    normally performed when reading from the 'any' interface
42
#	--strip-80211  strip 802.1Q headers from 802.1Q packets; used to 
43
# 	  decode 802.1Q encapsulated packets - affects -A option, 
44
#	--log-facility <facility>  where facility can be 'LOCAL1' - 'LOCAL7'
45
#		The default log facility used by SANCP is LOG_DAEMON 
46
#
47
#      Debug mode for pcap data logging
48
#	-A  records ALL traffic frames to a pcap file named 'debug_pcap_raw'
49
#	  (despite rules). Packets are logged here prior to decoding or handling. 
50
#	  Use -F or -B option to restrict what is collectedi.
51
#	  Pcap data logged using this option is affected by the --strip-80211 cmdline option
52
#	  The configuration file equivalent to this is 'default debug_pcap_raw enable'
53
54
. /etc/rc.subr
55
56
name="sancp"
57
rcvar=`set_rcvar`
58
59
command="%%PREFIX%%/bin/sancp"
60
61
start_precmd=start_precmd
62
63
start_precmd()
64
{
65
	if [ -z "${sancp_interface}" ]; then
66
		err 1 "sancp_interface must set."
67
	fi
68
}
69
70
# set some defaults
71
load_rc_config $name
72
73
: ${sancp_enable="NO"}
74
: ${sancp_flags="-D"}
75
: ${sancp_conf="%%PREFIX%%/etc/sancp.conf"}
76
: ${sancp_interface=""}
77
78
command_args="${sancp_flags} -c ${sancp_conf} -i ${sancp_interface}"
79
80
run_rc_command "$1"

Return to bug 152226