How to set AV just for server wide but not email? |
![]() ![]() |
How to set AV just for server wide but not email? |
Jul 14 2008, 09:36 AM
Post
#1
|
|
![]() Advanced Member ![]() ![]() ![]() Group: Members Posts: 274 Joined: 12-March 06 Member No.: 946 |
Hi Pairote,
is there a way to install just the AntiVirus to check the data on a server but not for email? Regards, Sergio -------------------- |
|
|
|
Jul 14 2008, 11:22 AM
Post
#2
|
|
|
Administrator ![]() ![]() ![]() Group: Admin Posts: 4,252 Joined: 13-June 03 Member No.: 1 |
You can scan your files using clamdscan. Try this command to scan the whole /home.
locate -i -r '^/home/' | xargs -i clamdscan --no-summary '{}' It will take 15 - 30 minutes. You should test it by replacing /home to one of your client folder to see its result. |
|
|
|
Jul 14 2008, 12:43 PM
Post
#3
|
|
![]() Advanced Member ![]() ![]() ![]() Group: Members Posts: 274 Joined: 12-March 06 Member No.: 946 |
You can scan your files using clamdscan. Try this command to scan the whole /home. locate -i -r '^/home/' | xargs -i clamdscan --no-summary '{}' It will take 15 - 30 minutes. You should test it by replacing /home to one of your client folder to see its result. Thank you Pairote. This is a really nice command, it even could be set in a cron on the server. Why is not this a regular practice in all servers? or is only me? Regards, Sergio -------------------- |
|
|
|
Jul 14 2008, 12:56 PM
Post
#4
|
|
![]() Advanced Member ![]() ![]() ![]() Group: Members Posts: 274 Joined: 12-March 06 Member No.: 946 |
You can scan your files using clamdscan. Try this command to scan the whole /home. locate -i -r '^/home/' | xargs -i clamdscan --no-summary '{}' It will take 15 - 30 minutes. You should test it by replacing /home to one of your client folder to see its result. Thank you Pairote. This is a really nice command, it even could be set in a cron on the server. Why is not this a regular practice in all servers? or is only me? Regards, Sergio Working on your locate -i -r '^/home/' | xargs -i clamdscan --no-summary '{}' I have tweaked it a little bit and found that: find /home/*/public_html -name *.php | xargs -i clamdscan --no-summary '{}' runs a lot lot faster as it will only check on php files and not images files. A few seconds compared to a few minutes in the same account. Regards, Sergio -------------------- |
|
|
|
Jul 14 2008, 01:32 PM
Post
#5
|
|
|
Administrator ![]() ![]() ![]() Group: Admin Posts: 4,252 Joined: 13-June 03 Member No.: 1 |
Not sure on find command. I used to try it but it run slower and resource intensive.
PS: find has -exec which can execute clamdscan without to pipe (|). I believe that it consumes resouce lower than using pipe. |
|
|
|
Jul 22 2008, 12:21 AM
Post
#6
|
|
![]() Advanced Member ![]() ![]() ![]() Group: Members Posts: 274 Joined: 12-March 06 Member No.: 946 |
Not sure on find command. I used to try it but it run slower and resource intensive. PS: find has -exec which can execute clamdscan without to pipe (|). I believe that it consumes resouce lower than using pipe. Hi Pairote, looking around for xargs and exec, I found the following article: QUOTE xargs is the preferred method. It's a lot faster than -exec. Also, with a large number of files, it's possible to overflow the command line buffer. See this link: http://www.unixreview.com/documents/s=8274...0306g/0306g.htm I have read a lot of different places and all of them recommends xarg over exec in find, I have used the XARG and it is really fast. I have checked my home directory with thousands of index.php files and it is done in less than 10 minutes in a double quad server, I like it. -------------------- |
|
|
|
Jul 22 2008, 10:24 AM
Post
#7
|
|
|
Administrator ![]() ![]() ![]() Group: Admin Posts: 4,252 Joined: 13-June 03 Member No.: 1 |
Sorry, I am wrong. I thought find -exec faster. I trust you, now xargs is my choice.
If you runtime is not too long, I would suggest you remove public_html and also scan .html, .htm. find /home/* -name *.php | xargs -i clamdscan --no-summary '{}' find /home/* -name *.htm | xargs -i clamdscan --no-summary '{}' |
|
|
|
Jul 22 2008, 11:33 AM
Post
#8
|
|
![]() Advanced Member ![]() ![]() ![]() Group: Members Posts: 274 Joined: 12-March 06 Member No.: 946 |
Sorry, I am wrong. I thought find -exec faster. I trust you, now xargs is my choice. If you runtime is not too long, I would suggest you remove public_html and also scan .html, .htm. find /home/* -name *.php | xargs -i clamdscan --no-summary '{}' find /home/* -name *.htm | xargs -i clamdscan --no-summary '{}' just elaborating a little bit more... find /home/* -name *.php -o -name *.htm | xargs -i clamdscan --no-summary '{}' This gives us a one line command checking for php or htm files, what do you think? Now... How may I can set this in a cron? -------------------- |
|
|
|
Jul 22 2008, 12:27 PM
Post
#9
|
|
|
Administrator ![]() ![]() ![]() Group: Admin Posts: 4,252 Joined: 13-June 03 Member No.: 1 |
Not sure on -o option. If you want to run as a cron, do it as caution. It might overload and take your server down. You write a simple script here if you want to test it.
CODE #!/usr/bin/perl -w
BEGIN { push( @INC, '/scripts' ); } use strict; use cPScript::OSSys (); cPScript::OSSys::nice(19); my ($runTime, $startTime); $startTime = time(); system("find /home/* -name *.php -o -name *.htm | xargs -i clamdscan --no-summary '{}' | grep FOUND"); $runTime = (time() - $startTime) / 60; print "Total runtime: $runTime minutes. \n\n"; |
|
|
|
Jul 25 2008, 01:42 AM
Post
#10
|
|
![]() Advanced Member ![]() ![]() ![]() Group: Members Posts: 274 Joined: 12-March 06 Member No.: 946 |
I am not happy with CLAMAV, it didn't find trojans in a web page.
After playing with the find command I did a test with a trojan code that could be injected in a web page, like the one listed here: http://www.webtalkforums.com/showthread.php?p=204106 but CLAMAV didn't find it I wanted to create a cron like the one that you kindly wrote, but it seems that it will not work for what I am intending to do, that is to check in the server for this type of malicious code. Any idea of what other AV could be used instead of CLAMAV? -------------------- |
|
|
|
Jul 25 2008, 10:19 AM
Post
#11
|
|
|
Administrator ![]() ![]() ![]() Group: Admin Posts: 4,252 Joined: 13-June 03 Member No.: 1 |
Other AV engine will not find it as well. For such code, by itself alone it is not trojan. But if you call to that page, it will call to another website which is not on your server and download trojan.
|
|
|
|
Jul 26 2008, 02:32 PM
Post
#12
|
|
![]() Advanced Member ![]() ![]() ![]() Group: Members Posts: 274 Joined: 12-March 06 Member No.: 946 |
Now I understood why CLAMAV didn't find it.
The weird thing is that I have copied all the code into a TXT file in my computer and my AntiVirus deleted the file because it says it is indeed a trojan horse virus. Any way, I am using now the following find command: CODE find /home/ -name *.htm? -exec grep "C7D36720260A79BEECF3B8D6D" '{}' \; -print Regards, Sergio -------------------- |
|
|
|
Apr 25 2010, 10:55 PM
Post
#13
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 45 Joined: 8-March 04 Member No.: 152 |
What does 'C7D36720260A79BEECF3B8D6D' mean?
|
|
|
|
Apr 26 2010, 08:04 PM
Post
#14
|
|
![]() Advanced Member ![]() ![]() ![]() Group: Members Posts: 274 Joined: 12-March 06 Member No.: 946 |
What does 'C7D36720260A79BEECF3B8D6D' mean? That was part of virus in the form of 64 eval code. With that search you can check if any of your pages is infected with that script. Regards, Sergio -------------------- |
|
|
|
![]() ![]() |
| Lo-Fi Version | Time is now: 3rd September 2010 - 01:38 AM |