Loop
September 20th, 2004, 04:39
OK, I'm sure this is a permission issue, problem is, I can't figure out what the correct permissions are.

I have installed mailgraph from ports, and mailgraph.pl is generating the .rrd's and images. The .rrd's are in the correct directory, but the images are staying put in the temporary directory.

How do I get them into a directory so apache can display them, or is it ok for them to stay there but modify the config of apache to look for images in /tmp/mailgraph (which is not the idea, I feel)?


loop@erwin ~ % ls -la /tmp/mailgraph
total 6
drwxr-xr-x 2 www wheel 512 Jun 5 20:40 ,cgi-bin,mailgraph.cgi
drwxr-xr-x 3 www wheel 512 Feb 11 2004 .
drwxrwxrwt 12 root wheel 2048 Sep 20 18:24 ..
loop@erwin ~ % ls -la /tmp/mailgraph/,cgi-bin,mailgraph.cgi
total 36
drwxr-xr-x 2 www wheel 512 Jun 5 20:40 .
drwxr-xr-x 3 www wheel 512 Feb 11 2004 ..
-rw-r--r-- 1 www wheel 2416 Jun 9 19:33 mailgraph_0.png
-rw-r--r-- 1 www wheel 2464 Jun 9 19:33 mailgraph_0_err.png
-rw-r--r-- 1 www wheel 2561 Jun 9 19:33 mailgraph_1.png
-rw-r--r-- 1 www wheel 2541 Jun 9 19:33 mailgraph_1_err.png
-rw-r--r-- 1 www wheel 2468 Jun 9 19:33 mailgraph_2.png
-rw-r--r-- 1 www wheel 2455 Jun 9 19:33 mailgraph_2_err.png
-rw-r--r-- 1 www wheel 2583 Jun 9 19:33 mailgraph_3.png
-rw-r--r-- 1 www wheel 2558 Jun 9 19:33 mailgraph_3_err.png

molotov
September 20th, 2004, 11:25
I wouldnt keep them there, someone create files that include other files that would display information you dont want public.

example
I create bs.php in /tmp/mailgraph which includes a file that has your database password in it (include config.inc.php for example) and the dump out the password hashes for your db users. bad.

Loop
September 21st, 2004, 07:24
I wouldnt keep them there, someone create files that include other files that would display information you dont want public.

example
I create bs.php in /tmp/mailgraph which includes a file that has your database password in it (include config.inc.php for example) and the dump out the password hashes for your db users. bad.

Yeah, I kinda figured that was not optimal. However, still haven't got a solution as to why the files aren't moved to where apache can see them ... or how and where to move them to

draconius
September 21st, 2004, 16:30
you have to configure the mailgraph.pl script to put the images somewhere...just make sure that whatever user your mailgraph script runs as , has permission to place files in some directory...for example, I run all of mine under user www, and then in my www dir, it places images in mailgraph/images/ ... i think thats how it works anyways....I will have to check to make sure...I setup mailgraph awhile go!

Loop
September 23rd, 2004, 03:09
OK, I edited mailgraph.cgi and set the $tmp_dir to be /usr/local/www/data/mailgraph. I've also realised now that there are no new rrd files <grumble>.

mailgraph, running as user www, does have write access to /var/db/mailgraph and /usr/local/www/data/mailgraph as well as having read access to /var/log/maillog.

mailgraph also has shocking documentation.

draconius
September 23rd, 2004, 15:38
hmmm I think that perhaps I misinformed you...I have mailgraph running as my postfix user so that it can read the logs, and then I have both the RRD's and the mailgraph.pl in the same directory /www/mailgraph....I will look for sure when I am home this weekend

Loop
September 29th, 2004, 10:44
So darconius ... have you been able to confirm mailgraph's settings?

draconius
October 1st, 2004, 14:47
This is the relevant beginning to my mailgraph.pl ....

#!/usr/bin/perl -w

# mailgraph -- a postfix statistics rrdtool frontend
# released under the GNU General Public License

use RRDs;
use POSIX qw(uname);

my $VERSION = "1.9";

my $host = (POSIX::uname())[1];
my $scriptname = 'mailgraph.cgi';
my $xpoints = 540;
my $points_per_sample = 3;
my $ypoints = 160;
my $ypoints_err = 96;
my $rrd = '/www/mailgraph/mailgraph.rrd'; # path to where the RRD database is
my $rrd_virus = '/www/mailgraph/mailgraph_virus.rrd'; # path to where the Virus RRD database is
my $tmp_dir = '/www/tmp/mailgraph'; # temporary directory where to store the images



Then, depending on how you start up mailgraph, you have to set the same options in mailgraph-init script...
#!/bin/sh

# $Id: mailgraph-init,v 1.1 2003/01/05 12:01:38 dws Exp $
# example init script for mailgraph

MAILGRAPH_PL=/www/mailgraph/mailgraph.pl
MAIL_LOG=/var/log/maillog
PID_FILE=/var/run/mailgraph.pid
RRD_DIR=/www/mailgraph

thats the only place where I can think that you might encounter problems....

I also have everything running as the user postfix, and the user postfix own the dir /www/mailgraph, and then my /www/tmp is world writeable , for other purposes, but anything can be put there basically.

Loop
October 5th, 2004, 17:37
Thanks for your help, but I cannot get this thing to work. It should work straight out of the box since I installed it from ports!