Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
bob111
Collaborator
Jump to solution

Changing a smartconsole user password with an API call

Hello all, I want to change a smartconsole user password via the API, in the docs there is set-user, but the users it refers to are the users in the Users object and the smartconsole users. Does anyone know if there is something else?
Thanks

0 Kudos
1 Solution

Accepted Solutions
Daniel_Kuhl1
Employee
Employee

Hi @bob111 ,

to be honest it's a little bit confusing, but the documentation says: "This command is available only after logging in to the System Data domain."

So you need to use the "login-to-domain" API call to gather the session-id even if you have a SMS:

curl --location 'https://<your-server>/web_api/login' \
--header 'Content-Type: application/json' \
--data '{
  "user" : "<your-username>",
  "password" : "<your-password>",
  "domain" : "System Data"
}'

...and then "set-administrator" to change the password:

curl --location 'https://<your-server>/web_api/set-administrator' \
--header 'Content-Type: application/json' \
--header 'X-chkp-sid: <your-session-id>' \
--data '{
  "name" : "<your-username>",
  "password" : "<new-password>"
}'

 That worked for me. Let us know if it worked for you.

View solution in original post

8 Replies
Amir_Senn
Employee
Employee

Hi Bob,

Try using "set administrator"

You can follow reference using in this link: https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/set-administrator~v2%20

 

Kind regards, Amir Senn
bob111
Collaborator

Thanks for the reply!
But this is a command executed in the cli no? Can it be done with an http request?
Also when I tried this command it gave me that it can only work on domains of type MDS. we do not use domains, can we still use the command?

0 Kudos
Tal_Paz-Fridman
Employee
Employee

All Management API commands have several options:

mgmt_cli tool
Web Services
SmartConsole CLI
Gaia CLI

 

In this case:

https://sc1.checkpoint.com/documents/latest/APIs/index.html#web/set-administrator~v2%20

 

It can also be used in MDS - there are examples at the bottom of the page

bob111
Collaborator

I get the error: This command can work only on domains of type MDS. Cannot execute it in current domain (current domain type is Domain)

0 Kudos
Daniel_Kuhl1
Employee
Employee

Hi @bob111 ,

to be honest it's a little bit confusing, but the documentation says: "This command is available only after logging in to the System Data domain."

So you need to use the "login-to-domain" API call to gather the session-id even if you have a SMS:

curl --location 'https://<your-server>/web_api/login' \
--header 'Content-Type: application/json' \
--data '{
  "user" : "<your-username>",
  "password" : "<your-password>",
  "domain" : "System Data"
}'

...and then "set-administrator" to change the password:

curl --location 'https://<your-server>/web_api/set-administrator' \
--header 'Content-Type: application/json' \
--header 'X-chkp-sid: <your-session-id>' \
--data '{
  "name" : "<your-username>",
  "password" : "<new-password>"
}'

 That worked for me. Let us know if it worked for you.

bob111
Collaborator

Thank you very much! It worked! I did not notice that you need to specify the domain on the login:) 

0 Kudos
bob111
Collaborator

I tried doing set-administrator without publishing by accident and I did not get an error but it locked the user I was trying to edit so I tried just publishing and it tells me that it cannot do it because other sessions are in progress and when I log in to the smartconsole I do not see any other sessions, do you why is that?  

0 Kudos
Daniel_Kuhl1
Employee
Employee

I guess your API session expired without publishing the changes. Maybe you can revert the changes back and do it again with a publish. 🙂

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events