I am running Gateone in an embedded environment and I get an error when trying to access the page. The error that the Gateone server is kicking out is:
[E 180828 06:23:43 gateone:1112] Unknown WebSocket action: authenticate
[I 180828 06:24:18 gateone:1147] WebSocket closed (ANONYMOUS).
[I 180828 06:24:22 web:1462] 200 GET /combined_js (58.84.52.130) 36.01ms
[I 180828 06:24:23 web:1462] 200 GET /auth?check=True (58.84.52.130) 1.04ms
[I 180828 06:24:23 gateone:1063] WebSocket opened (ANONYMOUS).
[E 180828 06:24:23 gateone:1112] Unknown WebSocket action: authenticate
gateone server api_key config is below:
auth = "api"
........
api_keys = "YmQwODI3ZTkwMTFiNDc0YWFhOWJjZGUwMDEyODY5MjdiY:NTMwYmI5NWEzZTM3NDMwZTk1Zjc1ZjJjYzlkMTk2OGIxM"
and python code is like this:
def authodj(secret, *parts):
"""
对secret值安装gateone的要求加密
"""
hash = hmac.new(secret, digestmod=hashlib.sha1)
for parts in parts:
hash.update(str(parts))
return hash.hexdigest()
the front is :
$(document).ready(
function () {
var ip = "login ip";//要登陆的server
var port = "22";
var user = "root";
var ssh_url = "ssh://" + user + "@" + ip + ":" + port;
//登陆前获取验证的api_key和密码
var request = $.ajax(
{
url: "/server/get_valid",//请求后台函数,负责校验算法
type: "GET",
dataType: "json"
}
);
//提交给gateone验证
request.done(function (auth_info) {
I am running Gateone in an embedded environment and I get an error when trying to access the page. The error that the Gateone server is kicking out is: [E 180828 06:23:43 gateone:1112] Unknown WebSocket action: authenticate [I 180828 06:24:18 gateone:1147] WebSocket closed (ANONYMOUS). [I 180828 06:24:22 web:1462] 200 GET /combined_js (58.84.52.130) 36.01ms [I 180828 06:24:23 web:1462] 200 GET /auth?check=True (58.84.52.130) 1.04ms [I 180828 06:24:23 gateone:1063] WebSocket opened (ANONYMOUS). [E 180828 06:24:23 gateone:1112] Unknown WebSocket action: authenticate
gateone server api_key config is below: auth = "api" ........ api_keys = "YmQwODI3ZTkwMTFiNDc0YWFhOWJjZGUwMDEyODY5MjdiY:NTMwYmI5NWEzZTM3NDMwZTk1Zjc1ZjJjYzlkMTk2OGIxM"
and python code is like this: def authodj(secret, *parts): """ 对secret值安装gateone的要求加密 """ hash = hmac.new(secret, digestmod=hashlib.sha1) for parts in parts: hash.update(str(parts)) return hash.hexdigest()
def get_valid(request): user = "root" gateone_server = "https://x.x.x.x:443"
api_key = "YmQwODI3ZTkwMTFiNDc0YWFhOWJjZGUwMDEyODY5MjdiY" secret = "NTMwYmI5NWEzZTM3NDMwZTk1Zjc1ZjJjYzlkMTk2OGIxM".encode() print(type(secret)) authodj_dict = { "api_key": api_key, "upn": "gateone", "timestamp": str(int(time.time() * 1000)), "signature_method": "HMAC-SHA1", "api_verion": "1.0" } myhash = hmac.new(secret, digestmod=hashlib.sha1) update_data = authodj_dict['api_key'] + authodj_dict['upn'] + authodj_dict['timestamp'] print(type(update_data)) myhash.update(update_data.encode())
myhash.update(update_data)
the front is : $(document).ready( function () { var ip = "login ip";//要登陆的server var port = "22"; var user = "root"; var ssh_url = "ssh://" + user + "@" + ip + ":" + port; //登陆前获取验证的api_key和密码 var request = $.ajax( { url: "/server/get_valid",//请求后台函数,负责校验算法 type: "GET", dataType: "json" } ); //提交给gateone验证 request.done(function (auth_info) {
i checked the gateone server api_key and python code api_key is the same,plz give me a help for the error?