SSH keys
Add a public key so a person or a server can log in to a site over SSH, and remove it when it is no longer needed.
Before you start
- You can open the site in Managed Websites. Anyone who can open a site can add and remove its SSH keys.
- You have a public key of an accepted type.
- To connect, your IP address must also be on the site's firewall.
Add a key
Open Users & keys
Go to Managed Websites, choose the site, then Users & keys under Access & security. Each environment has its own keys: check the environment in the site header.
Paste the public key
Choose Add key and paste the contents of your
.pubfile into Public key. Enter a Name that says who or what uses the key, such asDaniel's ThinkPad.Choose who will log in with it
Under Who will log in with it, choose where the key works. Each choice shows how many environments it covers.
Choice Logs in as Works on This environment The shared username webThis environment only This website The shared username webEvery environment of this website My company The shared username webEvery environment of your organisation, including new ones Me logs in as your own username, on every environment you can reach.
Add the key
Choose Add key, then Done. The key appears in the list as Applying, then Applied.
My company needs the Create Company SSH Keys permission. Owners always have it; an owner can give it to other roles in Roles.
Connect
Copy the SSH command
Choose Connection details under Access & security and copy the command under SSH.
A key added as Me logs in with Your username in place of
web.
Remove a key
Open the key's menu
In Users & keys, open the … menu on the key and choose Remove….
Confirm with the key's name
Enter the name under Type the key's name to confirm and choose Remove key. The key shows Removing until it is gone.
A key from another source is changed where it was added. Follow the link on its row:
| Source | Link |
|---|---|
| Company | Edit at your company |
| Website | Edit at the website |
Keys for every environment of the organisation are on Organisation SSH keys.
A Personal key of your own has the link Your keys: edit in your profile: see Your SSH keys.
Accepted key types
A key is ed25519, ECDSA, or RSA of 3072 bits or more. DSA keys, shorter RSA keys, hardware-backed sk- keys and keys with options are refused.
To make a key, run ssh-keygen -t ed25519 and use the .pub file.
Automate this
Adds a public key at one level: a company or a website (for all or for selected environments), one environment, or yourself.
curl -X POST https://manage.corefinity.com/api/ssh/keys \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"applies_to": {
"environment_ids": [
1311
],
"mode": "selected"
},
"name": "Build server",
"owner": {
"id": 1204,
"type": "company"
},
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAAAExampleKeyOnlyDoNotUseThisIsNotARealKey2"
}'Your assistant calls corestack_ssh_key_add.
{
"name": "corestack_ssh_key_add",
"arguments": {
"owner": {
"type": "company",
"id": 4211
},
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl ci@example",
"name": "Bitbucket Pipelines"
}
}