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
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.
For context of others, I see you've also recently posted related questions such as:
It sounds as if you're getting closer to solving it - please let us know how you get on.
Regards,
Jan
Hi!
Please, test if the call /usr/bin/clamscan is fine!
if not, use:
whereis clamscan
for found this executable.
Best regards,
Fegor
Also, test from command line using the same user as the Alfresco process
I have installed the amps in alfresco 5.2 and keep the following configuration in alfviral.properties file
alfviral.mode=COMMAND
alfviral.command.exec=/usr/bin/clamscan
when I run the clamscan command in terminal,it is working perfectly.
but when I have tried to run the command through java code,it is giving the exit code 127 which means that the command is not found
I have the following code in CommandScan.java class
logger.debug(" ++++++the value of res is++++++++"+res);
and when I have uploaded a file of mimetype application/x-dosexec,I got the following logs
2018-03-07 19:12:38,753 DEBUG [security.antivirus.CommandScan] [http-apr-8080-exec-10] ++++++the value of res is++++++++127
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.
Can anyone tell me why the clamscan command is giving the value 127(command not found) through the java class but running perfectly through the terminal.
Fernando González
ayushi@ayushi-GA-78LMT-S2PT:~$ whereis clamscan
clamscan: /usr/bin/clamscan /usr/share/man/man1/clamscan.1.gz
ayushi@ayushi-GA-78LMT-S2PT:~$ which clamscan
/usr/bin/clamscan
Please, in java code insert:
logger.debug(" ++++++ The value of command is: " + this.command);
And return this info.
Best regards,
Fegor
And, as Mkel say, which user runs Alfresco?
And finally, the best method to use Alfviral is through ICAP protocol ;-)
Best regards,
Fegor
when I put this
logger.debug(" ++++++ The value of command is: " + this.command);
the logs are
2018-03-09 19:00:06,535 DEBUG [security.antivirus.CommandScan] [DefaultScheduler_Worker-10] ++++++ the value of command is[/usr/bin/clamscan, /home/alfresco_installation/Alfviral/alf_data/contentstore/2018/3/9/14/46/aeaa46c1-9af5-4d1d-9750-24656ad3da5b.bin]
Hi!
One, exist the bin file?, '/home/alfresco_installation/Alfviral/alf_data/contentstore/2018/3/9/14/46/aeaa46c1-9af5-4d1d-9750-24656ad3da5b.bin'
Two, can you prove without path?, only with clamscan.
Best regards,
Fegor
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.