Skip to content
This repository has been archived by the owner on May 30, 2020. It is now read-only.

Recently api usage is low but logs are complaining.. #7

Open
mick58 opened this issue Nov 2, 2017 · 10 comments
Open

Recently api usage is low but logs are complaining.. #7

mick58 opened this issue Nov 2, 2017 · 10 comments

Comments

@mick58
Copy link

mick58 commented Nov 2, 2017

But if I login to virustotal, there is only 300 requests for today.

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/amavisvt-0.5.3-py2.7.egg/amavisvt/client.py", line 529, in check_vt
raise Exception("API-Limit exceeded!")
Exception: API-Limit exceeded!
2017-11-02 09:01:37,514 ERROR [Thread-105] Error asking virustotal about files
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/amavisvt-0.5.3-py2.7.egg/amavisvt/client.py", line 529, in check_vt
bash: 2017-11-02: command not found
raise Exception("API-Limit exceeded!")
Exception: API-Limit exceeded!
root@smtp:/var/log# Traceback (most recent call last):
bash: syntax error near unexpected token most' root@smtp:/var/log# File "/usr/local/lib/python2.7/dist-packages/amavisvt-0.5.3-py2.7.egg/amavisvt/client.py", line 529, in check_vt bash: File: command not found root@smtp:/var/log# raise Exception("API-Limit exceeded!") bash: syntax error near unexpected token ('
root@smtp:/var/log# Exception: API-Limit exceeded!
bash: Exception:: command not found
root@smtp:/var/log# 2017-11-02 09:01:37,514 ERROR [Thread-105] Error asking virustotal about files
bash: 2017-11-02: command not found
root@smtp:/var/log# Traceback (most recent call last):
bash: syntax error near unexpected token most' root@smtp:/var/log# File "/usr/local/lib/python2.7/dist-packages/amavisvt-0.5.3-py2.7.egg/amavisvt/client.py", line 529, in check_vt bash: File: command not found root@smtp:/var/log# raise Exception("API-Limit exceeded!") bash: syntax error near unexpected token ('
root@smtp:/var/log# Exception: API-Limit exceeded!
bash: Exception:: command not found

@mick58
Copy link
Author

mick58 commented Nov 2, 2017

I've recently changed the starting script. Before I started manually. Now I am starting with proper init.d script. And update-rc.d.

#! /bin/sh
### BEGIN INIT INFO
# Provides:          amavisvt
# Required-Start:    $remote_fs $all
# Required-Stop:.
# Should-Start:......
# Should-Stop:.......
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts amavisvt
# Description:       Launches the Amavis Virus Total
### END INIT INFO


# Some things that run always
AMP="/usr/local/lib/python2.7/dist-packages/amavisvt-0.5.3-py2.7.egg/amavisvt"
PY="/usr/bin/python2.7"

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting amavisvtd"
    cd $AMP
    $PY $AMP/amavisvtd.py --socket /run/amavisvtd.sock &
    sleep 3
    chown amavis:amavis /run/amavisvtd.sock
    ;;
  stop)
    echo "Stopping amavisvtd"
    pkill -f amavisvtd
    rm -f /run/amavisvtd.sock
    ;;
  *)
    echo "Usage: /etc/init.d/amavisvt {start|stop}"
    exit 1
    ;;
esac

exit 0

@mick58
Copy link
Author

mick58 commented Nov 2, 2017

This script is not perfect, chown amavis:amavis /run/amavisvtd.sock does not work somehow I tried su, sudo, start-stop-daemon. This part is still "manual".

@ercpe
Copy link
Owner

ercpe commented Nov 2, 2017

The Virustotal API is not only limited by the total number of request per day, but also in a one minute-window:

is limited to at most 4 requests of any nature in any given 1 minute time frame.

Please make sure that the number of requests per minute is below that threshold.

@mick58
Copy link
Author

mick58 commented Nov 2, 2017 via email

@ercpe
Copy link
Owner

ercpe commented Nov 2, 2017

The socket is propably owned by root because the script is started as root.
Try something like sudo -u amavis $PY $AMP/amavisvtd.py --socket /run/amavisvtd.sock (first make sure the socket doesn't already exists).

@mick58
Copy link
Author

mick58 commented Nov 2, 2017 via email

@mick58
Copy link
Author

mick58 commented Nov 2, 2017 via email

@ercpe
Copy link
Owner

ercpe commented Nov 2, 2017

Try it without quotes as the init script is basically just a shell script. Also: which OS? Maybe it's safer to use the init systems daemon handler to launch it.

amavisvt works on mail parts. When you send a (HTML) mail, you typically send two parts: a plain text part and an HTML part. Each image / attachment adds another parts. amavisvt has a hardcoded list of mimetype which are sent to VT; so even if the mail looks "text only" (except when it's actually a plain text mail) multiple parts may be sent to Virustotal.

@mick58
Copy link
Author

mick58 commented Nov 2, 2017 via email

@mick58
Copy link
Author

mick58 commented Nov 8, 2017 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants