tgstation / Tgstation.Server.ControlPanel

Official client for tgstation-server
GNU General Public License v3.0
7 stars 11 forks source link

Cannot set Deployment & Dream Daemon Security Levels via UI #77

Closed skull132 closed 3 years ago

skull132 commented 3 years ago

The Security Level control on the Dream Daemon is, by default, set to "Safe" and the radio buttons do not work. Same goes for the Deployment screen: the API validation security level is set to "Safe" and none of the radio buttons update anything. Tested as being an issue on both Windows and Linux versions of the panel.

ORCACommander commented 3 years ago

Confirmed this, Current work around is to shut down the server service, open the instance in the database and manually set the flag from 1 to 0 for trusted

Cyberboss commented 3 years ago

That's not a supported workaround. The supported way is to make the API calls in a different fashion. i.e. with curl.

Login:

curl -v -X POST -H "Api: Tgstation.Server.Api/<current api version>" -H "Accept: application/json" -H "Authorization: Basic <credentials>" -H "Content-Type: application/json" --data "{}" <server url>

current api version: 8.1.2 at time of writing credentials: <username>:<password> base64 encoded Save the value of bearer returned

List instances for IDs:

curl -v -X GET -H "Api: Tgstation.Server.Api/<current api version>" -H "Accept: application/json" -H "Authorization: Bearer <bearer token>" -H "Content-Type: application/json" <server url>/Instance

bearer token: Token received in step 1 Save the id value of the instance you wish to modify

Update the API validation security level:

curl -v -X POST -H "Api: Tgstation.Server.Api/<current api version>" -H "Accept: application/json" -H "Authorization: Bearer <bearer token>" -H `Instance: <instance id>` -H "Content-Type: application/json" --data "{apiValidationSecurityLevel: <target security level>}" <server url>/DreamMaker

instance id: Id of the target instance from step 2 target security level: 0 for trusted, 1 for safe, 2 for ultrasafe.

Update the watchdog security level:

curl -v -X POST -H "Api: Tgstation.Server.Api/<current api version>" -H "Accept: application/json" -H "Authorization: Bearer <bearer token>" -H `Instance: <instance id>` -H "Content-Type: application/json" --data "{securityLevel: <target security level>}" <server url>/DreamDaemon