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