cancel
Showing results for 
Search instead for 
Did you mean: 

clamscan command from the java program gives the exit code 127

ayushi_agrahari
Confirmed Champ
Confirmed Champ

I am exploring the addon GitHub - fegorama/alfviral: Alfresco Virus Alert 

I am using the COMMAND mode to scan the files for virus.I have the following configuration in alfviral.properties file.

alfviral.mode=COMMAND

alfviral.command.exec=/usr/bin/clamscan

When the following code is executed 

ProcessBuilder pb = new ProcessBuilder(this.command);
Process process = pb.start();
res = process.waitFor();

   logger.debug(" ++++++the value of res is++++++++"+res);

and uploaded a file of mimetype application/x-dosexec,I got the following logs

2018-03-07 19:12:38,753 DEBUG com.fegor.alfresco.services.AntivirusServiceImpl: [Type: application/x-dosexec]
com.fegor.alfresco.services.AntivirusServiceImpl: [Mode: COMMAND]
2018-03-07 19:12:38,753 DEBUG  [security.antivirus.CommandScan] [http-apr-8080-exec-10] ++++++the value of res is++++++++127

So,when I have done a little bit of googling,I have understood that 127 is a special exit code which means that the command is not found.

I am surprised that logs are showing that the command is not found because when I have directly run the clamscan on a file,it is working perfectly and showing that the file is infected if the file is infected and clean if the file is not infected.

ayushi@ayushi-GA-78LMT-S2PT:~$ clamscan ~/Downloads/stepup.exe
/home/ayushi/Downloads/stepup.exe: OK

----------- SCAN SUMMARY -----------
Known viruses: 6431792
Engine version: 0.99.2
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 9.14 MB
Data read: 2.46 MB (ratio 3.72:1)
Time: 13.816 sec (0 m 13 s)

Also,when I have scanned the file with virustotal mode,it is working perfectly.

21 REPLIES 21

Hi!

Without path is:

alfviral.command.exec=clamscan

El 9 mar. 2018 3:50 p. m., "ayushi.agrahari" <community@alfresco.com>

escribió:

Alfresco Community

<https://community.alfresco.com/?et=watches.email.thread>

Re: clamscan command from the java program gives the exit code 127

respuesta de Ayushi Agrahatri

<https://community.alfresco.com/people/ayushi.agrahari?et=watches.email.thread>

en Alfresco Content Services (ECM) - Ver la discusión completa

<https://community.alfresco.com/message/829605-re-clamscan-command-from-the-java-program-gives-the-exit-code-127?commentID=829605&et=watches.email.thread#comment-829605>

Okie I will try it and will let u know

Thanks fegor

On doing

alfviral.command.exec=clamscan

it still is showing the status as 127 means that the command is not found.

The logs are

the value of command is[clamscan, /home/alfresco_installation/Alfviral/alf_data/contentstore/2018/3/6/18/3/d66b45ad-992e-4154-b844-c1b8e0cdb03e.bin]
 2018-03-12 13:40:00,338  DEBUG [security.antivirus.CommandScan] [DefaultScheduler_Worker-2] ++++++the value of res is++++++++127

but on directly running the command,the command is working perfectly.

clamscan /home/alfresco_installation/Alfviral/alf_data/contentstore/2018/3/6/18/3/d66b45ad-992e-4154-b844-c1b8e0cdb03e.bin

the output is

/home/alfresco_installation/Alfviral/alf_data/contentstore/2018/3/6/18/3/d66b45ad-992e-4154-b844-c1b8e0cdb03e.bin: Eicar-Test-Signature FOUND

----------- SCAN SUMMARY -----------
Known viruses: 6434688
Engine version: 0.99.2
Scanned directories: 0
Scanned files: 1
Infected files: 1
Data scanned: 0.00 MB
Data read: 0.00 MB (ratio 0.00:1)
Time: 12.821 sec (0 m 12 s)

But, the Alfresco user and this user is same?

ayushi@ayushi-GA-78LMT-S2PT:/opt/alfresco_installation$ ls -ltr
total 4
drwxr-xr-x 15 root root 4096 Mar 12 13:09 Alfviral

fegor
Star Collaborator
Star Collaborator

And, as Mkel say, which user runs Alfresco?

And finally, the best method to use Alfviral is through ICAP protocol 😉

Best regards,

Fegor

fegor
Star Collaborator
Star Collaborator

Ok, I test in my system in some days and I say you...

@Fernando González

Hi fegor,

are you able to replicate the problem in your system and have you find any solution to the above stated problem.I am in urgent need to solve this problem.

Best regards,

Ayushi Agrahatri

Hi Ayushi Agrahatri

I test in my system this weekend (I make this project only in my free time) and send my results.

Best regards,

Fegor

Hi fegor,

Plz test it and let me know the results.

Best regards,

Ayushi Agrahari