Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
pepj
Participant

API timeout does not function R81 API 1.7.1

Hello

R81 API 1.7.1

Could someone confirm that it should function?

the API timeout does not function . ( on GUI timeout is OK )

The session return the default 600 see example below.

If I do not logout the session is still open after several days .... I have to close it properly with API.

Is it a bug ? Has anyone also this issue ?

Thank you for the feedback
Jean-Michel

example:

curl -k -H 'Content-Type: application/json' -X POST https://IP_SERVER/web_api/login -d {"user":"MY_USER","password":"*****" }
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
^M 0 0 0 0 0 43 0 348 --:--:-- --:--:-- --:--:-- 348^M1... 47 --:--:-- --:--:-- --:--:-- 451^M1....47 --:--:-- --:--:-- --:--:-- 451{
"uid" : "060..MY_USER..3a9",
"sid" : "DZ7..MY_USER..wqE",
"url" : "https://IP_SERVER:443/web_api",
"session-timeout" : 600,
"last-login-was-at" : {
"posix" : 1643892248929,
"iso-8601" : "2022-02-03T13:44+0100"
},
"api-server-version" : "1.7.1",
"user-name" : "MY_USER",
"user-uid" : "df8MY_USER83"
}SID=DZ7..MY_USER...wqE

session still opened after days

MANUAL close via API

curl -k -H 'Content-Type: application/json' -H X-chkp-sid:DZ7..MY_USER...wqE -X POST 'https://IP_SERVER/web_api/logout'

{
"message" : "OK"
}

0 Kudos
3 Replies
Bob_Zimmerman
Leader
Leader

I'm running R81 jumbo 51 on this box, and the API authentication timeout appears to work:

[Expert@DallasSA]# clock;mgmt_cli -f json  -s session.txt show hosts limit 1 details-level uid | jq -c '.objects[]'
Fri Feb  4 18:25:57 2022  -0.829022 seconds
"f752bfcd-8194-4831-a8cf-16dabecbac73"
[Expert@DallasSA]# clock;mgmt_cli -f json  -s session.txt show hosts limit 1 details-level uid | jq -c '.objects[]'
Fri Feb  4 18:40:12 2022  -0.426969 seconds
jq: error: Cannot iterate over null
[Expert@DallasSA]# mgmt_cli -f json -s session.txt logout
{
  "code" : "generic_err_wrong_session_id",
  "message" : "Wrong session id [7u4LYX9CFvgi6o3VarVlM_DsNHgMczw-gXwuGoOESco]. Session may be expired. Please check session id and resend the request"
}
[Expert@DallasSA]# 
0 Kudos
Tobias_L
Participant

Hi @pepj,

Can you still see your old expired session with the following command?
# mgmt_cli show session --format json

If necessary, you can extend the timeout with a keepalive.
# mgmt_cli  --conn-timeout 1200 ...

pepj
Participant

Hi

Thank you for the answer

I have take 44 perhaps some issue there

In the GUI I can see the session during days and the default is still 600 .

Only when I close ( I kept the ID ), the session is closing.

0 Kudos