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

(-)Makefile (-24 / +17 lines)
Lines 1-18 Link Here
1
# Created by: Vincent Tantardini <vinc@freebsd-fr.org>
2
# $FreeBSD$
1
# $FreeBSD$
3
2
4
PORTNAME=	cacti
3
PORTNAME=	cacti
5
PORTVERSION=	0.8.8b${PATCHLEVEL}
4
PORTVERSION=	0.8.8b${PATCHLEVEL}
6
PORTREVISION=	2
5
PORTREVISION=	3
7
CATEGORIES=	net-mgmt www
6
CATEGORIES=	net-mgmt www
8
MASTER_SITES=	http://www.cacti.net/downloads/
7
MASTER_SITES=	http://www.cacti.net/downloads/
9
DISTNAME=	${PORTNAME}-${SITEDISTVERSION}
10
8
11
# Vendor's patches
9
# Vendor's patches
12
PATCH_SITES=	http://www.cacti.net/downloads/patches/${SITEDISTVERSION}/
10
PATCH_SITES=	http://www.cacti.net/downloads/patches/${SITEDISTVERSION}/
13
PATCHFILES=
11
PATCHFILES=	security.patch
14
PATCH_DIST_STRIP=	-p1
12
PATCH_DIST_STRIP=	-p1
15
PATCHLEVEL=
16
13
17
MAINTAINER=	ports@FreeBSD.org
14
MAINTAINER=	ports@FreeBSD.org
18
COMMENT=	Web-driven graphing interface for RRDTool
15
COMMENT=	Web-driven graphing interface for RRDTool
Lines 28-62 Link Here
28
WANT_PHP_WEB=	yes
25
WANT_PHP_WEB=	yes
29
NO_BUILD=	yes
26
NO_BUILD=	yes
30
PKGMESSAGE=	${WRKDIR}/pkg-message
27
PKGMESSAGE=	${WRKDIR}/pkg-message
31
PKGINSTALL=	${WRKDIR}/pkg-install
28
SUB_FILES=	pkg-message
32
SUB_FILES=	pkg-message pkg-install
33
29
34
CACTIDIR?=	share/cacti
30
CACTIDIR?=	share/cacti
35
CACTIUSER?=	cacti
31
CACTIUSER?=	cacti
36
CACTIGROUP?=	${CACTIUSER}
32
CACTIGROUP?=	cacti
33
34
USERS?=		${CACTIUSER}
35
GROUPS?=	${CACTIGROUP}
36
37
WRKSRC=		${WRKDIR}/${PORTNAME}-${SITEDISTVERSION}
37
WRKSRC=		${WRKDIR}/${PORTNAME}-${SITEDISTVERSION}
38
38
39
SITEDISTVERSION=	${PORTVERSION:S/${PATCHLEVEL}$//}
39
SITEDISTVERSION=	${PORTVERSION:S/${PATCHLEVEL}$//}
40
40
41
PLIST_SUB+=	CACTIDIR=${CACTIDIR}
41
PLIST_SUB+=	CACTIDIR=${CACTIDIR}  CACTIUSER=${CACTIUSER} \
42
		CACTIGROUP=${CACTIGROUP}
42
SUB_LIST+=	CACTIDIR=${CACTIDIR} CACTIUSER=${CACTIUSER} \
43
SUB_LIST+=	CACTIDIR=${CACTIDIR} CACTIUSER=${CACTIUSER} \
43
		CACTIGROUP=${CACTIGROUP}
44
		CACTIGROUP=${CACTIGROUP}
44
45
45
NO_STAGE=	yes
46
post-patch:
46
post-patch:
47
	@${FIND} ${WRKSRC} -name \*.orig -delete; \
47
	@${FIND} ${WRKSRC} -name \*.orig -delete; \
48
	${MV} ${WRKSRC}/include/config.php ${WRKSRC}/include/config.php.orig
48
	${MV} ${WRKSRC}/include/config.php ${WRKSRC}/include/config.php.sample
49
	${RM} -r ${WRKSRC}/log ${WRKSRC}/rra
49
50
50
pre-install:
51
	@${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
52
53
do-install:
51
do-install:
54
	@${MKDIR} ${PREFIX}/${CACTIDIR}; \
52
	${MKDIR} ${STAGEDIR}/${PREFIX}/${CACTIDIR}
55
	${CP} -R ${WRKSRC}/* ${PREFIX}/${CACTIDIR}/; \
53
	${MKDIR} ${STAGEDIR}/var/log/cacti
56
	if [ ! -f ${PREFIX}/${CACTIDIR}/include/config.php ]; then \
54
	${MKDIR} ${STAGEDIR}/var/db/cacti/rra
57
		${CP} ${PREFIX}/${CACTIDIR}/include/config.php.orig \
55
	${MKDIR} ${STAGEDIR}/var/db/cacti/scripts
58
			${PREFIX}/${CACTIDIR}/include/config.php; \
56
	${CP} -R ${WRKSRC}/* ${STAGEDIR}/${PREFIX}/${CACTIDIR}
59
	fi; \
60
	if [ -f ${PREFIX}/${CACTIDIR}/include/db-settings.php ]; then \
57
	if [ -f ${PREFIX}/${CACTIDIR}/include/db-settings.php ]; then \
61
		${ECHO_CMD} "======================================================================="; \
58
		${ECHO_CMD} "======================================================================="; \
62
		${ECHO_CMD} "WARNING! You have to move DB settings from"; \
59
		${ECHO_CMD} "WARNING! You have to move DB settings from"; \
Lines 64-71 Link Here
64
		${ECHO_CMD} "${PREFIX}/${CACTIDIR}/include/config.php and remove db-settings.php"; \
61
		${ECHO_CMD} "${PREFIX}/${CACTIDIR}/include/config.php and remove db-settings.php"; \
65
	fi
62
	fi
66
63
67
post-install:
68
	@${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
69
	@${CAT} ${PKGMESSAGE}
70
71
.include <bsd.port.mk>
64
.include <bsd.port.mk>
(-)distinfo (+2 lines)
Lines 1-2 Link Here
1
SHA256 (cacti-0.8.8b.tar.gz) = ef0e2a813139e0b4c2e066f0fdae1f4ad086bef0aa23446055df6331cb1af98c
1
SHA256 (cacti-0.8.8b.tar.gz) = ef0e2a813139e0b4c2e066f0fdae1f4ad086bef0aa23446055df6331cb1af98c
2
SIZE (cacti-0.8.8b.tar.gz) = 2272130
2
SIZE (cacti-0.8.8b.tar.gz) = 2272130
3
SHA256 (security.patch) = 73758bdf3f7846875f1620c35d1d982fa27366b053d8bd87363c618e7747c163
4
SIZE (security.patch) = 6909
(-)files/patch-include__global.php (+11 lines)
Line 0 Link Here
1
--- ./include/global.php.orig	2013-08-06 19:31:19.000000000 -0700
2
+++ ./include/global.php	2014-08-11 18:37:08.000000000 -0700
3
@@ -113,7 +113,7 @@
4
 	$config["library_path"] = preg_replace("/(.*[\/])include/", "\\1lib", dirname(__FILE__));
5
 }
6
 $config["include_path"] = dirname(__FILE__);
7
-$config["rra_path"] = $config["base_path"] . '/rra';
8
+$config["rra_path"] = '/var/db/cacti/rra';
9
 
10
 /* colors */
11
 $colors["dark_outline"] = "454E53";
(-)files/patch-include__global_settings.php (+14 lines)
Line 0 Link Here
1
--- ./include/global_settings.php.orig	2013-08-06 19:31:19.000000000 -0700
2
+++ ./include/global_settings.php	2014-08-11 18:37:08.000000000 -0700
3
@@ -96,9 +96,9 @@
4
 			),
5
 		"path_cactilog" => array(
6
 			"friendly_name" => "Cacti Log File Path",
7
-			"description" => "The path to your Cacti log file (if blank, defaults to <path_cacti>/log/cacti.log)",
8
+			"description" => "The path to your Cacti log file (if blank, defaults to /var/log/cacti.log)",
9
 			"method" => "filepath",
10
-			"default" => $config["base_path"] . "/log/cacti.log",
11
+			"default" => "/var/log/cacti/cacti.log",
12
 			"max_length" => "255"
13
 			),
14
 		"pollerpaths_header" => array(
(-)files/patch-install__index.php (+11 lines)
Line 0 Link Here
1
--- ./install/index.php.orig	2013-08-06 19:31:19.000000000 -0700
2
+++ ./install/index.php	2014-08-11 18:45:19.000000000 -0700
3
@@ -267,7 +267,7 @@
4
 if (config_value_exists("path_cactilog")) {
5
 	$input["path_cactilog"]["default"] = read_config_option("path_cactilog");
6
 } else {
7
-	$input["path_cactilog"]["default"] = $config["base_path"] . "/log/cacti.log";
8
+	$input["path_cactilog"]["default"] = "/var/log/cacti/cacti.log";
9
 }
10
 
11
 /* SNMP Version */
(-)files/patch-lib-rrd.php (-37 lines)
Lines 1-37 Link Here
1
Index: ./lib/rrd.php
2
===================================================================
3
--- ./lib/rrd.php	(Revision 7407)
4
+++ ./lib/rrd.php	(Arbeitskopie)
5
@@ -1343,20 +1343,20 @@
6
 		$need_rrd_nl = TRUE;
7
 
8
 		if ($graph_item_types{$graph_item["graph_type_id"]} == "COMMENT") {
9
+			# perform variable substitution first (in case this will yield an empty results or brings command injection problems)
10
+			$comment_arg = rrd_substitute_host_query_data($graph_variables["text_format"][$graph_item_id], $graph, $graph_item);
11
+			# next, compute the argument of the COMMENT statement and perform injection counter measures
12
+			if (trim($comment_arg) == '') { # an empty COMMENT must be treated with care
13
+				$comment_arg = cacti_escapeshellarg(' ' . $hardreturn[$graph_item_id]);
14
+			} else {
15
+				$comment_arg = cacti_escapeshellarg($comment_arg . $hardreturn[$graph_item_id]);
16
+			}
17
+
18
+			# create rrdtool specific command line
19
 			if (read_config_option("rrdtool_version") != "rrd-1.0.x") {
20
-				$comment_string = $graph_item_types{$graph_item["graph_type_id"]} . ":" . str_replace(":", "\:", cacti_escapeshellarg($graph_variables["text_format"][$graph_item_id] . $hardreturn[$graph_item_id])) . " ";
21
-				if (trim($comment_string) == 'COMMENT:"\n"') {
22
-					$txt_graph_items .= 'COMMENT:" \n"'; # rrdtool will skip a COMMENT that holds a NL only; so add a blank to make NL work
23
-				} else if (trim($comment_string) != "COMMENT:\"\"") {
24
-					$txt_graph_items .= rrd_substitute_host_query_data($comment_string, $graph, $graph_item);
25
-				}
26
+				$txt_graph_items .= $graph_item_types{$graph_item["graph_type_id"]} . ":" . str_replace(":", "\:", $comment_arg) . " ";
27
 			}else {
28
-				$comment_string = $graph_item_types{$graph_item["graph_type_id"]} . ":" . cacti_escapeshellarg($graph_variables["text_format"][$graph_item_id] . $hardreturn[$graph_item_id]) . " ";
29
-				if (trim($comment_string) == 'COMMENT:"\n"') {
30
-					$txt_graph_items .= 'COMMENT:" \n"'; # rrdtool will skip a COMMENT that holds a NL only; so add a blank to make NL work
31
-				} else if (trim($comment_string) != "COMMENT:\"\"") {
32
-					$txt_graph_items .= rrd_substitute_host_query_data($comment_string, $graph, $graph_item);
33
-				}
34
+				$txt_graph_items .= $graph_item_types{$graph_item["graph_type_id"]} . ":" . $comment_arg . " ";
35
 			}
36
 		}elseif (($graph_item_types{$graph_item["graph_type_id"]} == "GPRINT") && (!isset($graph_data_array["graph_nolegend"]))) {
37
 			$graph_variables["text_format"][$graph_item_id] = str_replace(":", "\:", $graph_variables["text_format"][$graph_item_id]); /* escape colons */
(-)files/patch-lib__rrd.php (+35 lines)
Line 0 Link Here
1
--- ./lib/rrd.php.orig	2014-08-11 17:34:23.000000000 -0700
2
+++ ./lib/rrd.php	2014-08-11 17:34:23.000000000 -0700
3
@@ -1343,20 +1343,20 @@
4
 		$need_rrd_nl = TRUE;
5
 
6
 		if ($graph_item_types{$graph_item["graph_type_id"]} == "COMMENT") {
7
+			# perform variable substitution first (in case this will yield an empty results or brings command injection problems)
8
+			$comment_arg = rrd_substitute_host_query_data($graph_variables["text_format"][$graph_item_id], $graph, $graph_item);
9
+			# next, compute the argument of the COMMENT statement and perform injection counter measures
10
+			if (trim($comment_arg) == '') { # an empty COMMENT must be treated with care
11
+				$comment_arg = cacti_escapeshellarg(' ' . $hardreturn[$graph_item_id]);
12
+			} else {
13
+				$comment_arg = cacti_escapeshellarg($comment_arg . $hardreturn[$graph_item_id]);
14
+			}
15
+
16
+			# create rrdtool specific command line
17
 			if (read_config_option("rrdtool_version") != "rrd-1.0.x") {
18
-				$comment_string = $graph_item_types{$graph_item["graph_type_id"]} . ":" . str_replace(":", "\:", cacti_escapeshellarg($graph_variables["text_format"][$graph_item_id] . $hardreturn[$graph_item_id])) . " ";
19
-				if (trim($comment_string) == 'COMMENT:"\n"') {
20
-					$txt_graph_items .= 'COMMENT:" \n"'; # rrdtool will skip a COMMENT that holds a NL only; so add a blank to make NL work
21
-				} else if (trim($comment_string) != "COMMENT:\"\"") {
22
-					$txt_graph_items .= rrd_substitute_host_query_data($comment_string, $graph, $graph_item);
23
-				}
24
+				$txt_graph_items .= $graph_item_types{$graph_item["graph_type_id"]} . ":" . str_replace(":", "\:", $comment_arg) . " ";
25
 			}else {
26
-				$comment_string = $graph_item_types{$graph_item["graph_type_id"]} . ":" . cacti_escapeshellarg($graph_variables["text_format"][$graph_item_id] . $hardreturn[$graph_item_id]) . " ";
27
-				if (trim($comment_string) == 'COMMENT:"\n"') {
28
-					$txt_graph_items .= 'COMMENT:" \n"'; # rrdtool will skip a COMMENT that holds a NL only; so add a blank to make NL work
29
-				} else if (trim($comment_string) != "COMMENT:\"\"") {
30
-					$txt_graph_items .= rrd_substitute_host_query_data($comment_string, $graph, $graph_item);
31
-				}
32
+				$txt_graph_items .= $graph_item_types{$graph_item["graph_type_id"]} . ":" . $comment_arg . " ";
33
 			}
34
 		}elseif (($graph_item_types{$graph_item["graph_type_id"]} == "GPRINT") && (!isset($graph_data_array["graph_nolegend"]))) {
35
 			$graph_variables["text_format"][$graph_item_id] = str_replace(":", "\:", $graph_variables["text_format"][$graph_item_id]); /* escape colons */
(-)files/patch-scripts-diskfree.pl (-9 lines)
Lines 1-9 Link Here
1
--- cacti-0.8.6j/scripts/diskfree.pl.orig	Wed Jan  4 06:08:30 2006
2
+++ cacti-0.8.6j/scripts/diskfree.pl	Fri Jan  6 00:16:58 2006
3
@@ -1,5 +1,5 @@
4
 #!/usr/bin/perl
5
-open(PROCESS,"df --block-size=1024 -P $ARGV[0] | grep -v Filesystem |");
6
+open(PROCESS,"df -k $ARGV[0] | grep -v Filesystem |");
7
 foreach (<PROCESS>) {
8
 	if ($_ =~ /($ARGV[0])(.* )(.*[0-9])(.* )(.*[0-9])(.* )(.*[0-9])(.* )(.*[0-9])%(.* )/) {
9
 		print "megabytes:$7 percent:$9";
(-)files/patch-scripts-ping.pl (-11 lines)
Lines 1-11 Link Here
1
--- ./scripts/ping.pl.orig	2011-10-26 09:31:56.000000000 -0400
2
+++ ./scripts/ping.pl	2011-10-26 09:32:02.000000000 -0400
3
@@ -6,7 +6,7 @@
4
 
5
 # old linux version use "icmp_seq"
6
 # newer use "icmp_req" instead
7
-open(PROCESS, "ping -c 1 $host | grep 'icmp_[s|r]eq' | grep time |");
8
+open(PROCESS, "/sbin/ping -c 1 $host | grep 'icmp_[s|r]eq' | grep time |");
9
 $ping = <PROCESS>;
10
 close(PROCESS);
11
 $ping =~ m/(.*time=)(.*) (ms|usec)/;
(-)files/patch-scripts__3com_cable_modem.pl (+8 lines)
Line 0 Link Here
1
--- ./scripts/3com_cable_modem.pl.orig	2013-08-06 19:31:19.000000000 -0700
2
+++ ./scripts/3com_cable_modem.pl	2014-08-11 18:37:08.000000000 -0700
3
@@ -1,4 +1,4 @@
4
-#!/usr/bin/perl
5
+#!/usr/local/bin/perl
6
 
7
 open(PROCESS, "/bin/bash -c 'wget --quiet -O - http://192.168.100.1/cgibin/opcfg | grep \"10.18.18.11\" -c' |");
8
 $status = <PROCESS>;
(-)files/patch-scripts__diskfree.pl (+10 lines)
Line 0 Link Here
1
--- ./scripts/diskfree.pl.orig	2013-08-06 19:31:19.000000000 -0700
2
+++ ./scripts/diskfree.pl	2014-08-11 17:34:23.000000000 -0700
3
@@ -1,5 +1,5 @@
4
-#!/usr/bin/perl
5
-open(PROCESS,"df --block-size=1024 -P $ARGV[0] | grep -v Filesystem |");
6
+#!/usr/local/bin/perl
7
+open(PROCESS,"df -k $ARGV[0] | grep -v Filesystem |");
8
 foreach (<PROCESS>) {
9
 	if ($_ =~ /($ARGV[0])(.* )(.*[0-9])(.* )(.*[0-9])(.* )(.*[0-9])(.* )(.*[0-9])%(.* )/) {
10
 		print "megabytes:$7 percent:$9";
(-)files/patch-scripts__linux_memory.pl (+8 lines)
Line 0 Link Here
1
--- ./scripts/linux_memory.pl.orig	2013-08-06 19:31:19.000000000 -0700
2
+++ ./scripts/linux_memory.pl	2014-08-11 18:37:08.000000000 -0700
3
@@ -1,4 +1,4 @@
4
-#!/usr/bin/perl
5
+#!/usr/local/bin/perl
6
 
7
 open(PROCESS, "cat /proc/meminfo | grep -w $ARGV[0] |");
8
 foreach (<PROCESS>) {
(-)files/patch-scripts__loadavg.pl (+8 lines)
Line 0 Link Here
1
--- ./scripts/loadavg.pl.orig	2013-08-06 19:31:19.000000000 -0700
2
+++ ./scripts/loadavg.pl	2014-08-11 18:37:08.000000000 -0700
3
@@ -1,4 +1,4 @@
4
-#!/usr/bin/perl
5
+#!/usr/local/bin/perl
6
 
7
 #get load avg for 5;15;30 min
8
 open(PROCESS,"uptime |");
(-)files/patch-scripts__loadavg_multi.pl (+8 lines)
Line 0 Link Here
1
--- ./scripts/loadavg_multi.pl.orig	2013-08-06 19:31:19.000000000 -0700
2
+++ ./scripts/loadavg_multi.pl	2014-08-11 18:37:08.000000000 -0700
3
@@ -1,4 +1,4 @@
4
-#!/usr/bin/perl
5
+#!/usr/local/bin/perl
6
 
7
 #get load avg for 1;5;10 min
8
 open(PROCESS, "uptime |");
(-)files/patch-scripts__ping.pl (+17 lines)
Line 0 Link Here
1
--- ./scripts/ping.pl.orig	2013-08-06 19:31:19.000000000 -0700
2
+++ ./scripts/ping.pl	2014-08-11 17:34:23.000000000 -0700
3
@@ -1,4 +1,4 @@
4
-#!/usr/bin/perl
5
+#!/usr/local/bin/perl
6
 
7
 # take care for tcp:hostname or TCP:ip@
8
 $host = $ARGV[0];
9
@@ -6,7 +6,7 @@
10
 
11
 # old linux version use "icmp_seq"
12
 # newer use "icmp_req" instead
13
-open(PROCESS, "ping -c 1 $host | grep 'icmp_[s|r]eq' | grep time |");
14
+open(PROCESS, "/sbin/ping -c 1 $host | grep 'icmp_[s|r]eq' | grep time |");
15
 $ping = <PROCESS>;
16
 close(PROCESS);
17
 $ping =~ m/(.*time=)(.*) (ms|usec)/;
(-)files/patch-scripts__query_unix_partitions.pl (+8 lines)
Line 0 Link Here
1
--- ./scripts/query_unix_partitions.pl.orig	2013-08-06 19:31:19.000000000 -0700
2
+++ ./scripts/query_unix_partitions.pl	2014-08-11 18:37:08.000000000 -0700
3
@@ -1,4 +1,4 @@
4
-#!/usr/bin/perl
5
+#!/usr/local/bin/perl
6
 
7
 if (($ARGV[0] ne "query") && ($ARGV[0] ne "get") && ($ARGV[0] ne "index") && ($ARGV[0] ne "num_indexes")) {
8
 	print "usage:\n\n";
(-)files/patch-scripts__unix_processes.pl (+8 lines)
Line 0 Link Here
1
--- ./scripts/unix_processes.pl.orig	2013-08-06 19:31:19.000000000 -0700
2
+++ ./scripts/unix_processes.pl	2014-08-11 18:37:08.000000000 -0700
3
@@ -1,4 +1,4 @@
4
-#!/usr/bin/perl
5
+#!/usr/local/bin/perl
6
 
7
 open(PROCESS, "ps ax | grep -c : |");
8
 $output = <PROCESS>;
(-)files/patch-scripts__unix_tcp_connections.pl (+8 lines)
Line 0 Link Here
1
--- ./scripts/unix_tcp_connections.pl.orig	2013-08-06 19:31:19.000000000 -0700
2
+++ ./scripts/unix_tcp_connections.pl	2014-08-11 18:37:08.000000000 -0700
3
@@ -1,4 +1,4 @@
4
-#!/usr/bin/perl
5
+#!/usr/local/bin/perl
6
 
7
 my $grep_string = $ARGV[0];
8
 
(-)files/patch-scripts__unix_users.pl (+8 lines)
Line 0 Link Here
1
--- ./scripts/unix_users.pl.orig	2013-08-06 19:31:19.000000000 -0700
2
+++ ./scripts/unix_users.pl	2014-08-11 18:37:08.000000000 -0700
3
@@ -1,4 +1,4 @@
4
-#!/usr/bin/perl
5
+#!/usr/local/bin/perl
6
 
7
 my $grep_string = $ARGV[0];
8
 
(-)files/patch-scripts__weatherbug.pl (+8 lines)
Line 0 Link Here
1
--- ./scripts/weatherbug.pl.orig	2013-08-06 19:31:19.000000000 -0700
2
+++ ./scripts/weatherbug.pl	2014-08-11 18:37:08.000000000 -0700
3
@@ -1,4 +1,4 @@
4
-#!/usr/bin/perl
5
+#!/usr/local/bin/perl
6
 
7
 $output = `/bin/bash -c 'wget --quiet -O - \"http:\/\/wisapidata.weatherbug.com\/WxDataISAPI\/WxDataISAPI.dll?Magic=10991&RegNum=3647055&ZipCode=17241&StationID=NWVLL&Units=0&Version=2.7&Fore=1&t=1015084854\/"'`;
8
 
(-)files/patch-scripts__webhits.pl (+8 lines)
Line 0 Link Here
1
--- ./scripts/webhits.pl.orig	2013-08-06 19:31:19.000000000 -0700
2
+++ ./scripts/webhits.pl	2014-08-11 18:37:08.000000000 -0700
3
@@ -1,4 +1,4 @@
4
-#!/usr/bin/perl
5
+#!/usr/local/bin/perl
6
 
7
 if ($ARGV[0] eq "") {
8
 	$log_path = "/var/log/httpd/access_log";
(-)files/pkg-install.in (-51 lines)
Lines 1-51 Link Here
1
#!/bin/sh
2
3
PW=/usr/sbin/pw
4
UID=107
5
GID=${UID}
6
CACTIUSER="%%CACTIUSER%%"
7
CACTIGROUP="%%CACTIGROUP%%"
8
CACTIDIR="%%CACTIDIR%%"
9
PREFIX="%%PREFIX%%"
10
11
case $2 in
12
13
PRE-INSTALL)
14
15
	if ${PW} group show "${CACTIGROUP}" 2>/dev/null; then
16
		echo "You already have a group \"${CACTIGROUP}\", so I will use it."
17
	else
18
		if ${PW} groupadd ${CACTIGROUP} -g ${GID}; then
19
			echo "Added group \"${CACTIGROUP}\"."
20
		else
21
			echo "Adding group \"${CACTIGROUP}\" failed..."
22
			exit 1
23
		fi
24
	fi
25
26
	if ${PW} user show "${CACTIUSER}" 2>/dev/null; then
27
		echo "You already have a user \"${CACTIUSER}\", so I will use it."
28
	else
29
		if ${PW} useradd ${CACTIUSER} -u ${UID} -g ${CACTIGROUP} -h - \
30
			-d "/nonexistent" -s /sbin/nologin -c "Cacti Sandbox"
31
		then
32
			echo "Added user \"${CACTIUSER}\"."
33
		else
34
			echo "Adding user \"${CACTIUSER}\" failed..."
35
			exit 1
36
		fi
37
	fi
38
	;;
39
40
POST-INSTALL)
41
42
	chown -R ${CACTIUSER}:${CACTIGROUP} "${PREFIX}/${CACTIDIR}/rra/"
43
	[ -d "${PREFIX}/${CACTIDIR}/log/" ] || mkdir -p "${PREFIX}/${CACTIDIR}/log/"
44
	chown -R ${CACTIUSER}:${CACTIGROUP} "${PREFIX}/${CACTIDIR}/log/"
45
	chmod -R a+r "${PREFIX}/${CACTIDIR}/scripts/"
46
	;;
47
*)
48
	exit 1
49
;;
50
esac
51
exit
(-)files/pkg-message.in (-16 / +66 lines)
Lines 2-23 Link Here
2
Cacti is now installed. If you intall it for the first time,
2
Cacti is now installed. If you intall it for the first time,
3
you may have to follow this steps to make it work correctly:
3
you may have to follow this steps to make it work correctly:
4
4
5
1. Create the MySQL database:
5
1. Create the MySQL database, a cacti user, and initialize:
6
# mysqladmin --user=root create cacti
6
   a) CREATE DATABASE cacti;
7
2. Create a mysql user/password for cacti:
7
   b) Create a mysql user/password for cacti:
8
   (change user and/or password if required)
8
      CREATE USER 'cacti'@'localhost' IDENTIFIED BY 'password';
9
# echo "GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactiuser'; FLUSH PRIVILEGES;" | mysql
9
      FLUSH PRIVILEGES;
10
3. Import the default cacti database:
10
   c) Add GRANTS:
11
# mysql cacti < %%PREFIX%%/%%CACTIDIR%%/cacti.sql
11
      GRANT ALL ON cacti.* TO 'cacti'@'localhost';
12
4. Edit %%PREFIX%%/%%CACTIDIR%%/include/config.php.
12
      FLUSH PRIVILEGES;
13
5. Add the line to cron jobs with the command:
13
   d) Import the default cacti database:
14
# crontab -u %%CACTIUSER%% -e
14
      mysql --database=cacti -ucacti -p < %%PREFIX%%/%%CACTIDIR%%/cacti.sql
15
16
 NOTE:
17
   * Cacti does not LOCK TABLES.
18
19
2. Edit %%PREFIX%%/%%CACTIDIR%%/include/config.php from the template
20
   config.php.orig.
21
22
   PHP requires the time zone to be explicitly set rather that rely on
23
   the system time zone, otherwise poller complains. I added the
24
   following line to my config.php:
25
26
   date_default_timezone_set('America/Los_Angeles');
27
28
3. Add the following line to cron for %%CACTIUSER%%:
15
*/5 * * * * %%LOCALBASE%%/bin/php %%PREFIX%%/%%CACTIDIR%%/poller.php > /dev/null 2>&1
29
*/5 * * * * %%LOCALBASE%%/bin/php %%PREFIX%%/%%CACTIDIR%%/poller.php > /dev/null 2>&1
16
6. Add alias in apache config for the cacti dir:
17
Alias /cacti "%%PREFIX%%/%%CACTIDIR%%/"
18
7. Be sure apache gives an access to the directory ('Allow from' keywords).
19
8. Open a cacti login page in your web browser and login with admin/admin.
20
30
21
If you update cacti, open a login page, an updating process
31
4. Example Apache 2.4 configuration:
22
will start automatically.
32
33
   LoadModule php5_module  libexec/apache22/libphp5.so
34
35
   <FilesMatch "\.php$">
36
       SetHandler application/x-httpd-php
37
   </FilesMatch>
38
   <FilesMatch "\.phps$">
39
       SetHandler application/x-httpd-php-source
40
   </FilesMatch>
41
42
   DirectoryIndex index.php
43
44
   DocumentRoot "/usr/local/share/cacti"
45
 
46
   Alias /cacti "/usr/local/share/cacti/"
47
   Alias /Cacti "/usr/local/share/cacti/"
48
49
   <Directory "/usr/local/share/cacti">
50
      Require all granted
51
      AllowOverride None
52
      Order Allow,deny
53
      Allow from all
54
   </Directory>
55
56
5. Open a Cacti login page in your web browser and login with
57
   admin/admin.
58
59
If you update cacti, open a login page and an updating process will
60
start automatically.
61
62
NOTEs as of 10Aug2014:
63
64
1) Cacti now better supports hier(7)
65
66
   a) Cacti log files are now found under /var/log/cacti where you can
67
      manage them using newsyslog.
68
   b) Cacti RRD files are now found under /var/db/cacti/rra.
69
70
2) The PERL paths in the Cacti PERL scripts have been updated to
71
   /usr/local/bin.
72
23
=======================================================================
73
=======================================================================
(-)pkg-plist (-8 / +12 lines)
Lines 222-230 Link Here
222
%%CACTIDIR%%/images/view_none.gif
222
%%CACTIDIR%%/images/view_none.gif
223
%%CACTIDIR%%/include/auth.php
223
%%CACTIDIR%%/include/auth.php
224
%%CACTIDIR%%/include/bottom_footer.php
224
%%CACTIDIR%%/include/bottom_footer.php
225
@unexec cmp -s %D/%%CACTIDIR%%/include/config.php.orig %D/%%CACTIDIR%%/include/config.php && rm -f %D/%%CACTIDIR%%/include/config.php || true
225
@sample %%CACTIDIR%%/include/config.php.sample
226
%%CACTIDIR%%/include/config.php.orig
227
@exec [ -f %D/%%CACTIDIR%%/include/config.php ] || cp %D/%%CACTIDIR%%/include/config.php.orig %D/%%CACTIDIR%%/include/config.php
228
%%CACTIDIR%%/include/global_form.php
226
%%CACTIDIR%%/include/global_form.php
229
%%CACTIDIR%%/include/global.php
227
%%CACTIDIR%%/include/global.php
230
%%CACTIDIR%%/include/global_arrays.php
228
%%CACTIDIR%%/include/global_arrays.php
Lines 444-451 Link Here
444
%%CACTIDIR%%/lib/utility.php
442
%%CACTIDIR%%/lib/utility.php
445
%%CACTIDIR%%/lib/variables.php
443
%%CACTIDIR%%/lib/variables.php
446
%%CACTIDIR%%/lib/xml.php
444
%%CACTIDIR%%/lib/xml.php
447
%%CACTIDIR%%/log/.htaccess
448
@unexec [ ! -s %%PREFIX%%/%%CACTIDIR%%/log/cacti.log ] && rm -f %%PREFIX%%/%%CACTIDIR%%/log/cacti.log
449
%%CACTIDIR%%/logout.php
445
%%CACTIDIR%%/logout.php
450
%%CACTIDIR%%/plugins.php
446
%%CACTIDIR%%/plugins.php
451
%%CACTIDIR%%/poller.php
447
%%CACTIDIR%%/poller.php
Lines 464-470 Link Here
464
%%CACTIDIR%%/resource/snmp_queries/netware_cpu.xml
460
%%CACTIDIR%%/resource/snmp_queries/netware_cpu.xml
465
%%CACTIDIR%%/resource/snmp_queries/netware_disk.xml
461
%%CACTIDIR%%/resource/snmp_queries/netware_disk.xml
466
%%CACTIDIR%%/rra.php
462
%%CACTIDIR%%/rra.php
467
%%CACTIDIR%%/rra/.htaccess
468
%%CACTIDIR%%/script_server.php
463
%%CACTIDIR%%/script_server.php
469
%%CACTIDIR%%/script_server.pl
464
%%CACTIDIR%%/script_server.pl
470
%%CACTIDIR%%/scripts/3com_cable_modem.pl
465
%%CACTIDIR%%/scripts/3com_cable_modem.pl
Lines 494-506 Link Here
494
%%CACTIDIR%%/user_admin.php
489
%%CACTIDIR%%/user_admin.php
495
%%CACTIDIR%%/utilities.php
490
%%CACTIDIR%%/utilities.php
496
@dirrm %%CACTIDIR%%/scripts
491
@dirrm %%CACTIDIR%%/scripts
497
@dirrmtry %%CACTIDIR%%/rra
498
@dirrm %%CACTIDIR%%/resource/snmp_queries
492
@dirrm %%CACTIDIR%%/resource/snmp_queries
499
@dirrm %%CACTIDIR%%/resource/script_server
493
@dirrm %%CACTIDIR%%/resource/script_server
500
@dirrm %%CACTIDIR%%/resource/script_queries
494
@dirrm %%CACTIDIR%%/resource/script_queries
501
@dirrm %%CACTIDIR%%/resource
495
@dirrm %%CACTIDIR%%/resource
502
@dirrmtry %%CACTIDIR%%/plugins
496
@dirrmtry %%CACTIDIR%%/plugins
503
@dirrmtry %%CACTIDIR%%/log
504
@dirrm %%CACTIDIR%%/lib/adodb/lang
497
@dirrm %%CACTIDIR%%/lib/adodb/lang
505
@dirrm %%CACTIDIR%%/lib/adodb/drivers
498
@dirrm %%CACTIDIR%%/lib/adodb/drivers
506
@dirrm %%CACTIDIR%%/lib/adodb/datadict
499
@dirrm %%CACTIDIR%%/lib/adodb/datadict
Lines 519-521 Link Here
519
@dirrm %%CACTIDIR%%/docs
512
@dirrm %%CACTIDIR%%/docs
520
@dirrm %%CACTIDIR%%/cli
513
@dirrm %%CACTIDIR%%/cli
521
@dirrmtry %%CACTIDIR%%
514
@dirrmtry %%CACTIDIR%%
515
@comment
516
@comment Manage the new Cacti dirs from their prior default location.
517
@comment
518
@owner %%CACTIUSER%%
519
@group %%CACTIGROUP%%
520
@dirrmtry /var/log/cacti
521
@dirrmtry /var/db/cacti/rra
522
@dirrmtry /var/db/cacti/scripts
523
@dirrmtry /var/db/cacti
524
@group wheel
525
@owner root

Return to bug 192618