Closed
Description
Hello!
I met a problem, I click on the ADD NEW API error in Kibana:
Unexpected error. Wazuh - Python Internal error: Wazuh - framework is not found.
Wazuh-API error log is as follows:
WazuhAPI 17:05:06:2017-05-31: : FFFF: 192.168.162.58 GET/agents / : agent_id
WazuhAPI 17:05:06:2017-05-31 CMD -command: python args: / var/ossec/API/models/wazuh - API. Py stdin: {" function ":"/agents / : agent_id ", "the arguments" : {" agent_id ":" 000 "}, "ossec_path" : "/ var/ossec"}
WazuhAPI 17:05:06 2017-05-31: CMD - Exit code: 0
WazuhAPI 17:05:06:2017-05-31 CMD - STDOUT:
-- -- --
{" message ":" Wazuh - Python Internal Error: Wazuh - framework is not found. ", "Error" : 1000}
-- -- --
WazuhAPI 17:05:06:2017-05-31 CMD - STDOUT: 86 bytes
WazuhAPI 2017-05-31 17:05:06: [: : FFFF: 192.168.162.58] GET/agents / 000?- 200 - error: '1000'.
Activity
jesuslinares commentedon May 31, 2017
Hi @ttany,
what version are you running?.
In order to check your version, execute the following commands:
Thanks.
Regards.
ttany commentedon May 31, 2017
Thanks @jesuslinares:
[root@WazuhServer logs]# cat /etc/ossec-init.conf
[root@WazuhServer logs]# cat /var/ossec/api/package.json | grep version
"version": "2.0.0",
ELK is v5.4.0!
ttany commentedon May 31, 2017
jesuslinares commentedon May 31, 2017
Hi,
It seems the error is in the API, not in kibana. So, execute the following query in your manager:
Let me know if it works and paste here the api logs. I hope with this information we can determine what is happening.
Thanks.
ttany commentedon Jun 1, 2017
Hi!
Is python module is not installed?
jesuslinares commentedon Jun 1, 2017
Please, go to
/var/ossec/api/configuration/config.js
and change:config.logs = "info";
to
config.logs = "debug";
Then restart the API and send the request. Let's see what says the API log (
/var/ossec/logs/api.log
).Do you have Python installed?.
Regards.
ttany commentedon Jun 1, 2017
I have installed Python and changed the config.logs to "debug"!
[root@WazuhServer configuration]# cat /var/ossec/api/configuration/config.js | grep config.logs
config.logs = "debug";
tail -f /var/ossec/logs/api.log
jesuslinares commentedon Jun 1, 2017
Check if the following directory exists:
/var/ossec/api/framework
.The error is due to
/var/ossec/api/models/wazuh-api.py
is not able to find the framework. You can fixed manually, changing the line:path.append(path[0].replace('models','framework'))
for
path.append('/var/ossec/api/framework')
What is your Python version?.
Thanks.
ttany commentedon Jun 1, 2017
Python version is 2.7.13
jesuslinares commentedon Jun 1, 2017
Is it working changing that line?
Laxman-SM commentedon Jun 14, 2017
Hi,
i am configuring this on AWS.
root@ip-10:/var/ossec/api/configuration# cat /etc/ossec-init.conf
DIRECTORY="/var/ossec"
VERSION="v2.8.3"
DATE="Wed Jun 8 23:47:29 UTC 2016"
TYPE="server"
root@ip-10-:/var/ossec/api/configuration# cat /var/ossec/api/package.json | grep version
"version": "2.0.0",
my password authentication working fine. i already checked browser as well
curl -s -u laxman:qwer1234 -k -X GET "http://127.0.0.1:55000/"
{"error":0,"data":"Welcome to Wazuh HIDS API"}
curl -s -u laxman:qwer1234 -k -X GET "http://127.0.0.1:55000/agents"
{"error":1000,"message":"Wazuh-Python Internal Error: unable to open database file"}
after enabling debug on config.json getting this output.
WazuhAPI 2017-06-14 12:24:15: ::ffff:12.107.176.9 GET /agents
WazuhAPI 2017-06-14 12:24:15: CMD - Command: python args:/var/ossec/api/models/wazuh-api.py stdin:{"function":"/agents","arguments":{},"ossec_path":"/var/ossec"}
WazuhAPI 2017-06-14 12:24:15: CMD - Exit code: 0
WazuhAPI 2017-06-14 12:24:15: CMD - STDOUT:
{"message": "Wazuh-Python Internal Error: unable to open database file", "error": 1000}
WazuhAPI 2017-06-14 12:24:15: CMD - STDOUT: 88 bytes
WazuhAPI 2017-06-14 12:24:15: [::ffff:12.107.176.9] GET /agents/ - 200 - error: '1000'.
command execution working fine.
#echo '{"function":"/agents/:agent_id","arguments":{"agent_id":"000"},"ossec_path":"/var/ossec"}' | /var/ossec/api/models/wazuh-api.py --pretty --debug
{
"data": {
"status": "Active",
"name": "ip-10-50-xx-xxx",
"ip": "127.0.0.1",
"dateAdd": "2017-06-13 08:53:39",
"version": "Wazuh v2.0",
"os_family": "Linux",
"lastKeepAlive": "9999-12-31 23:59:59",
"os": "Linux ip-10-50-xx-xxx 3.19.0-84-generic #92-Ubuntu SMP Fri Mar 24 15:46:19 UTC 2017 x86_64",
"id": "000"
},
"error": 0
}
any idea what is wrong in configuration
Laxman-SM commentedon Jun 14, 2017
python --version
Python 2.7.9
elk component version 5.4
ttany commentedon Jun 15, 2017
jesuslinares,Thank you very much!I have solved my problem!Python is not install according to your requirements!
Laxman-SM commentedon Jun 15, 2017
@ttany what kind of change you made for python. how to add user through this command. i used below mentioned command as well sudo htpasswd -c user laxman, but that not working.
sudo node htpasswd -c user laxman
module.js:327
throw err;
^
Error: Cannot find module '/var/ossec/api/scripts/htpasswd'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:968:3
roman-vynar commentedon Jun 26, 2017
I had the same issue:
The actual error was:
In my case, it was broken because I copied the data dir to another partition and looks like there was a symlink badly copied. Not sure why do we need it there at all.
Fix in my case on Centos 7:
7 remaining items