Tenable Security Center API: SSHKey

 

This endpoint may only be used by administrators.

/sshKey 

The /sshKey resource.

Methods
GET

Gets a list of SSH keys from the tns user's 'authorized_hosts' file

Request Query Parameters

None

Example Response
Expand
[
	{
		"hash" : "1fab2df0da66974356208fc695de",
		"type" : "dsa",
		"comment" : "tns@scautotest",
		"key" : "AAA346sfqmF+ICrDHGyl1354RkqiEEYk\/Xb6Gsd8PTVn1dKIjEV645sPXBnqXhAoQBLmLgm\/diXQ=="
	},
	{
		"hash" : "694a87b1fa16asvwe062d66be1110",
		"type" : "dsa",
		"comment" : "tns@scbuild1",
		"key" : "AAAAB\/fogTEadsfURiLQj0mH11gp+x\/E9R57wBYl7oDEjjz123523uEWgwaevawUrcrPEmyxVye6Jo\/JfH"
	}
]

 

POST

Adds an SSH key (in the correct format) to the tns user's 'authorized_hosts' file. Optionally, assign/override the 'comment' portion of the entry.

Request Parameters
Expand

NOTE: The key is a string separated by spaces, containing a type, key, and comment. The "type" inside of the key string must be one of: "ssh-dss" | "ssh-rsa". The "comment" inside the key string is optional but we require the "comment" parameter. If it is empty, we default to the session user's username plus the date.

{
	"key" : <string:"type key comment">,
	"comment" : <string:"some comment">
}
Example Response
Expand
{
	"type":"regular",
	"response": {
		"hash" : "63c84acew353verdfdcb39ed",
		"comment" : "tns@scautotest3",
		"key" : "AAAAaIwRkqiEEYk\/Xb6Gsd8PTVn1dKIjEVD0LKqLt5sPXBnqXhAoQBLmLgm\/diXQ==",
		"type" : "ssh-dss"
	},
	"error_code" : 0,
	"error_msg" : "",
	"warnings" : [],
	"timestamp" : 1426796233
}

DELETE

Deletes the SSH Key associated with {hash}, depending on access and permissions.

Request Parameters
Expand
{
	"hash" : "63c8caew435cdcb39ed"
}
Example Response
Expand
{
    "type" : "regular",
    "response" : "",
    "error_code" : 0,
    "error_msg" : "",
    "warnings" : [],
    "timestamp" : 1403100582
}

/sshKey/download

Methods

GET

Downloads Tenable.sc's RSA public key.

Request Parameters

None

Example Response
Expand

ssh-rsa AAAABURLhAMUqUpGu4rrl5e7sdfU4Yc7FCLO+GZSePYouoQ5ntoay0VCzBL2Uvuy7SLUaCjgXGPjUZhCTdBC0g/I7t4Lk7/YEH+ZU0xsdlq3KdJLZ1WO4pKF4P1fKwG1o8/ym4IcY9Q/yWN9vw== tns@johndoe

/sshKey/installRemoteKey

Methods

POST

Installs the Public SSH key for Tenable.sc on to the specified, remote host.

Request Parameters
Expand
{
	"host" : <string>,
	"username" : <string>,
	"password" : <string>
}
Example Response
Expand
{
	"type" : "regular",
	"response" : {
		"comment" : "tns@John-Dev",
		"key" : "AAAAB3NzaC154629gho\/5K8Dawv4398dtmz2kiCAQdiZwtJnXv9KYKKrzVqGCNQD43cv34eEcV\/cgRMAGAKFEsTk3\/X7hYbNSnF4UA7Y=",
		"type" : "ssh-dss"
	},
	"error_code" : 0,
	"error_msg" : "",
	"warnings" : [],
	"timestamp" : 1403011994
}