Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #21  
Old 5th January 2008, 12:02
djtremors djtremors is offline
Senior Member
 
Join Date: Apr 2006
Location: Sydney
Posts: 278
Thanks: 0
Thanked 12 Times in 10 Posts
Default

Um, i just realised that there is a good chance that because freshclam switches to another user other than root, it has no permissions to access /var/log so you may either create the file and add 'admispconfig' as the file owner or change the path to another writeable path allowed by the 'admispconfig' user.

tested as below :
#----------
exec('/home/admispconfig/ispconfig/tools/clamav/bin/freshclam --log='.$conf['logfreshclam'].' 2>&1', $output, $retval);
print_r($output);
status_check($output);
#------------

Output I got.... which is what you probably have too...

root@ispc:~ # php clamavupdate.php
Array
(
[0] => ERROR: Problem with internal logger (--log=/var/log/clamav-fresh-update.log).
[1] => ERROR: Can't open /var/log/clamav-fresh-update.log in append mode (check permissions!).
)


so basically do a :
touch /var/log/clamav-fresh-update.log
chown admispconfig /var/log/clamav-fresh-update.log

or change the path in the file....

give that a try.. damn coding.. always have to delete all and start again to make sure bugs/problems are found.....
__________________
www.emperor-it.com for ISPConfig mods/hacks
Reply With Quote
Sponsored Links
  #22  
Old 5th January 2008, 14:25
davy davy is offline
Member
 
Join Date: Aug 2007
Posts: 43
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by djtremors
Um, i just realised that there is a good chance that because freshclam switches to another user other than root, it has no permissions to access /var/log so you may either create the file and add 'admispconfig' as the file owner or change the path to another writeable path allowed by the 'admispconfig' user.tested as below :#----------*** exec('/home/admispconfig/ispconfig/tools/clamav/bin/freshclam --log='.$conf['logfreshclam'].' 2>&1', $output, $retval);print_r($output);*** status_check($output);#------------Output I got.... which is what you probably have too...root@ispc:~ # php clamavupdate.phpArray(*** [0] => ERROR: Problem with internal logger (--log=/var/log/clamav-fresh-update.log).*** [1] => ERROR: Can't open /var/log/clamav-fresh-update.log in append mode (check permissions!).)so basically do a :touch /var/log/clamav-fresh-update.logchown admispconfig /var/log/clamav-fresh-update.logor change the path in the file....give that a try.. damn coding.. always have to delete all and start again to make sure bugs/problems are found.....
Error again:[root@dns1 ~]# php ./clamavupdate.phpPHP Warning:* fopen(/root/ispc.updates/clamav/clamav.tar.gz): failed to open stream: No such file or directory in /root/clamavupdate.php on line 243PHP Warning:* fwrite(): supplied argument is not a valid stream resource in /root/clamavupdate.php on line 246PHP Warning:* fwrite(): supplied argument is not a valid stream resource in /root/clamavupdate.php on line 246PHP Warning:* fclose(): supplied argument is not a valid stream resource in /root/clamavupdate.php on line 252PHP Notice:* Undefined variable: download_ok in /root/clamavupdate.php on line 253
clamav-fresh-update.log:

--------------------------------------
ClamAV update process started at Sat Jan 5 21:13:01 2008
SECURITY WARNING: NO SUPPORT FOR DIGITAL SIGNATURES
See the FAQ at http://www.clamav.net/support/faq for an explanation.
WARNING: Your ClamAV installation is OUTDATED!
WARNING: Local version: 0.91.2 Recommended version: 0.92
DON'T PANIC! Read http://www.clamav.net/support/faq
main.inc is up to date (version: 45, sigs: 169676, f-level: 21, builder: sven)
Downloading daily-5374.cdiff [100%]
daily.inc updated (version: 5374, sigs: 17353, f-level: 21, builder: ccordes)
Database updated (187029 signatures) from database.clamav.net (IP: 218.189.210.14)
2008/01/05 21:13:02 : Freshclam is reporting ClamAV is outdated, attempting to download new version.
2008/01/05 21:13:02 : ClamAV website release check reports version : 0.92
2008/01/05 21:13:49 : ClamAV-updater check already done within the last week, ignored.
--------------------------------------
ClamAV update process started at Sat Jan 5 21:13:49 2008
SECURITY WARNING: NO SUPPORT FOR DIGITAL SIGNATURES
See the FAQ at http://www.clamav.net/support/faq for an explanation.
WARNING: Your ClamAV installation is OUTDATED!
WARNING: Local version: 0.91.2 Recommended version: 0.92
DON'T PANIC! Read http://www.clamav.net/support/faq
main.inc is up to date (version: 45, sigs: 169676, f-level: 21, builder: sven)
daily.inc is up to date (version: 5374, sigs: 17353, f-level: 21, builder: ccordes)
2008/01/05 21:13:49 : Freshclam is reporting ClamAV is outdated, attempting to download new version.
2008/01/05 21:13:49 : ClamAV website release check reports version : 0.92
2008/01/05 21:16:32 : Mirror download problems Could not fetch updated clamav from any of the mirrors.

Thanks.
Reply With Quote
  #23  
Old 5th January 2008, 14:38
djtremors djtremors is offline
Senior Member
 
Join Date: Apr 2006
Location: Sydney
Posts: 278
Thanks: 0
Thanked 12 Times in 10 Posts
Default

it's trying to create a file .
$fw = fopen('/root/ispc.updates/clamav/clamav.tar.gz','w');
Does this path exist? it should already have been created unless not run as root.
__________________
www.emperor-it.com for ISPConfig mods/hacks
Reply With Quote
  #24  
Old 14th January 2008, 14:08
MTvermoes MTvermoes is offline
Junior Member
 
Join Date: Dec 2007
Posts: 17
Thanks: 1
Thanked 10 Times in 5 Posts
Default

The following fixed it :
as root do :
Code:
mkdir /root/ispc.updates/clamav
chmod 777 /root/ispc.updates/clamav
allso
adding :
Code:
#!/usr/bin/php -q
as first line in the script.
then as root do :
Code:
chown root:root clamavupdate.php
chmod 755 clamavupdate.php
mv ./clamavupdate.php /usr/sbin/clamavupdate.php
then call the script once a week from cron

cat /etc/cron.weekly/clamavupdate.cron
Code:
#!/bin/bash
/usr/sbin/clamavupdate.php
exit 0
Perfect Setup....THX A LOT for the script.

--------------------------------------------------------
Setup script that installs the script and runs it once a week via cron :
cat /root/setup-clamupdate.sh
Code:
#!/bin/sh
cd /root
touch /var/log/clamav-fresh-update.log
chown admispconfig /var/log/clamav-fresh-update.log
mkdir /root/ispc.updates
mkdir /root/ispc.updates/clamav
chmod 777 /root/ispc.updates
chmod 777 /root/ispc.updates/clamav
wget http://www.djtremors.com/downloads/clamavupdate.php.txt -O clamavupdate.php.txt
cat <<EOF>>clamavupdate.php
#!/usr/bin/php -q
EOF
cat ./clamavupdate.php.txt>>clamavupdate.php
chown root:root clamavupdate.php
chmod 755 clamavupdate.php
mv ./clamavupdate.php /usr/sbin/clamavupdate.php
cat <<EOF>>/etc/cron.weekly/clamavupdate.cron
#!/bin/bash
/usr/sbin/clamavupdate.php
exit 0
EOF
chown root:root /etc/cron.weekly/clamavupdate.cron
chmod 755 /etc/cron.weekly/clamavupdate.cron
/usr/sbin/clamavupdate.php
Allso remember to change :
$conf['admin'] = "your-email@yourdomain.com";

in the script

vi /usr/sbin/clamavupdate.php

Have patience with the setup script...it will update clamav if needed (download compile,install)

/Mark

Last edited by MTvermoes; 14th January 2008 at 15:39.
Reply With Quote
  #25  
Old 15th January 2008, 06:48
djtremors djtremors is offline
Senior Member
 
Join Date: Apr 2006
Location: Sydney
Posts: 278
Thanks: 0
Thanked 12 Times in 10 Posts
Default

@Mark.

Thanks for the update. I'll add the the first part to my script to make sure the path exists. My mistake again.

The reason I don't use the :
#!/usr/bin/php -q

at the top is because sometimes people have their php elsewhere which then breaks their script and they have to modify it.<edit>could use /root/ispconfig/php/bin/php which everyone should have, i used typical functions to keep it simple so should work. let me know your thoughts</edit>
So I usually prefer that they use their own call in crontab and let it find their own path :
PHP Code:
10 * * * * root php /root/clamavupdate.php 
this way no need to use `which php` or anything. up to the user really.

Also, haven't you just complicated the install a bit too much?
All they need to do is....
PHP Code:
wget http://www.djtremors.com/downloads/clamavupdate.php.txt -O /root/clamavupdate.php 
and then put their email in the file, then do a test run `php /root/clamavupdate.php` and if all is well, add it to their crontab.
PHP Code:
# Redhat/Centos
echo "35 */3 * * * root php /root/clamavupdate.php" >> /var/spool/cron/root

# Debian/ubuntu (I think, make sure you check yours)
echo "35 */3 * * * root php /root/clamavupdate.php" >> /var/spool/cron/crontabs/root

# etc. 
thanks for the input...
__________________
www.emperor-it.com for ISPConfig mods/hacks

Last edited by djtremors; 15th January 2008 at 07:24.
Reply With Quote
  #26  
Old 15th January 2008, 19:46
tensor tensor is offline
Member
 
Join Date: Jul 2007
Posts: 51
Thanks: 11
Thanked 9 Times in 6 Posts
Default

Is it possible to prevent ISPConfig to use its own version of ClamAV, install or upgrade it? I just want to use a version from my linux distribution...
Reply With Quote
  #27  
Old 15th January 2008, 22:31
djtremors djtremors is offline
Senior Member
 
Join Date: Apr 2006
Location: Sydney
Posts: 278
Thanks: 0
Thanked 12 Times in 10 Posts
Default

ISPConfig have fixed full paths to their bins in their code/scripts when they do the scanning of mail so you'd have to replace all occurances of these calls with your ones.

eg.
PHP Code:
/root/ispconfig/isp/conf/antivirus.rc.master
:0fw
| /home/admispconfig/ispconfig/tools/clamav/bin/clamassassin

:0:
* ^
X-Virus-StatusYes
/dev/null 
Not sure where else besides freshclam cron daemon are there any other references to it.

I find the distros aren't fast enough on updating their releases because they have to package it up etc.etc.. so I like my tar ball versions as it's immediate, as long as it works :P
__________________
www.emperor-it.com for ISPConfig mods/hacks
Reply With Quote
  #28  
Old 16th January 2008, 10:53
tensor tensor is offline
Member
 
Join Date: Jul 2007
Posts: 51
Thanks: 11
Thanked 9 Times in 6 Posts
Default

Quote:
as long as it works
The keyword here is "works".

I want it to be stable and clean. I do not mind pulling updates from "testing" branch of the Debian distro...

Thanks for the hints. I will grep for more occurences of the ClamAV.
Reply With Quote
  #29  
Old 1st April 2008, 10:50
alibaba alibaba is offline
Junior Member
 
Join Date: Mar 2008
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Hi,

I tried the php script but I have this :

Quote:
PHP Warning: Module 'json' already loaded in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/odbc.so' - /usr/lib/php5/20060613+lfs/odbc.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/pdo_odbc.so' - /usr/lib/php5/20060613+lfs/pdo_odbc.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/pdo_pgsql.so' - /usr/lib/php5/20060613+lfs/pdo_pgsql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/pgsql.so' - /usr/lib/php5/20060613+lfs/pgsql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/sybase_ct.so' - /usr/lib/php5/20060613+lfs/sybase_ct.so: cannot open shared object file: No such file or directory in Unknown on line 0
Do you know why ?
Thanks.
Reply With Quote
  #30  
Old 1st April 2008, 12:22
djtremors djtremors is offline
Senior Member
 
Join Date: Apr 2006
Location: Sydney
Posts: 278
Thanks: 0
Thanked 12 Times in 10 Posts
 
Default

I don't believe this is coming from my script. This is a configuration issue with php itself...

try running at a shell prompt the following :

PHP Code:
#   php -r 'echo "hello";'

#hope this renders properly in this forum 
if you get the same sort of errors then it's definately php.ini related or something as I don't even use oracle libraries or any of others.

EDIT: Actually.. you MUST have some php.ini problem because it's trying to load those modules in (oh der, didn't think of that).
__________________
www.emperor-it.com for ISPConfig mods/hacks

Last edited by djtremors; 1st April 2008 at 12:40.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
High Availability Samba cluster - DRBD + Heartbeat djalex Server Operation 58 25th May 2007 19:38
HotSaNIC domino Tips/Tricks/Mods 23 6th November 2006 05:19
Spamassissin ClamAV with ISPConfig update?? Mounir Installation/Configuration 2 2nd August 2006 23:23
Apache2 and DNS Made Easy browngb Server Operation 4 28th July 2006 14:23
How to update clamAV in ISPConfing? tom Installation/Configuration 3 22nd April 2006 16:31


All times are GMT +2. The time now is 01:34.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.