spender-sandbox / cuckoo-modified

Modified edition of cuckoo
394 stars 178 forks source link

set up distributed cuckoo #306

Closed Nwinternights closed 8 years ago

Nwinternights commented 8 years ago

Hi all, I m trying to set up distributed cuckoo and I succesfully created master and slave :"{"url": "http://xxx.xxx.xxx.xxx:8090/", "name": "slave"} {"url": "http://xxx.xxx.xxx.xxx:8090/", "name": "master"} the problem is that if I try to submit a new analysis i always get "..... The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again..." any help is appreciated... Marco

doomedraven commented 8 years ago

Did you started api.py?

doomedraven commented 8 years ago

Can also you post how you try to upload task?

Nwinternights commented 8 years ago

yes the api.py is started on both (master/slave) . If i submit several files via Web interface (on master) it starts processing only itself creating the "pending" queue. if i use curl: (curl http://xxx.xxx.xxx.xxx:9003/task -F file=@xxxx.dll) i got the 404. If i enable debug on dist.py I "get DEBUG:cuckoo.distributed:Status.. slave -> {u'reported': 0, u'completed': 0, u'total': 0, u'running': 0, u'pending': 0}"

ghost commented 8 years ago

Try to submit files to the REST API (curl http:xxx.xxx.xxx.xxx:8090/tasks/create/file -F ...) of your master server instead. Your master server will then distribute samples between all servers.

doomedraven commented 8 years ago

yah you should upload to :8090, you can't upload to :9003

:9003 support only this queries

    restapi = DistRestApi(app)
    restapi.add_resource(NodeRootApi, "/node")
    restapi.add_resource(NodeApi, "/node/<string:name>")
    restapi.add_resource(StatusRootApi, "/status")

is done to remove extra load for dist, and leave it to be a broker/retriever only :)

doomedraven commented 8 years ago

read the documentation :)

https://github.com/spender-sandbox/cuckoo-modified/blob/master/docs/book/src/usage/dist.rst

doomedraven commented 8 years ago

oh i see we didn't remove old part of documentation, fixing

Nwinternights commented 8 years ago

Using the api.py was the first thing I tried but the result was the same. the master node takes all the files without distributing to slave node, Same result using wht web interface. :-( :(

doomedraven commented 8 years ago

well lets do by parts i use it daily for long time and i was one of that few guys who worked in improvements.

Master get tasks, and when no more free vms on master it will start send tasks to slaves

imagine, you have 10 vms on each node, so of there 30 tasks, it will first do a load of master vms, and later send to slave, if tasks in pend is more then number of vms on master

                    # If - master only used for storage, not check master queue
                    # elif -  master also analyze samples, check master queue
                    # send tasks to slaves if master queue has extra tasks(pending)
                    if master_storage_only:
                        self.submit_tasks(node, MINIMUMQUEUE[node.name] - status["pending"])
                    elif statuses.get("master", {}).get("pending", 0) > MINIMUMQUEUE.get("master", 0) and \
                         status["pending"] < MINIMUMQUEUE[node.name]:
                        self.submit_tasks(node, MINIMUMQUEUE[node.name] - status["pending"])
Nwinternights commented 8 years ago

ok I think I found the problem. Looking at dist-py with debug enabled I found that sometimes the distribution status cannot see the "slave". I tried to delete/disable node with no luck (when i try to re-create it says that "slave" already exists. so i tried to create another slave pointing to the same machine but called slave1 and now the distribution works 100%.

doomedraven commented 8 years ago

go to your database to which used for distributed, and remove that node, or use dist.py -h it works for delete, i think the restapi only disable it but not removes completely

Nwinternights commented 8 years ago

yep !!! thanks a lot for your support ! PS did u give up the integration with map and cuckoo ? :-)

doomedraven commented 8 years ago

you are welcome no, i never have time to finish the ajax callback, always have others priorities to finish before so everything works now?

Nwinternights commented 8 years ago

yes I close the thread !! thanks again