---
title: "corestack_ssh_host_keys_rotate"
url: https://docs.corefinity.com/mcp/tools/corestack_ssh_host_keys_rotate
type: tool
last_updated: 2026-11-13
feature: ssh-keys
related:
  - https://docs.corefinity.com/guides/sites/access-and-security/ssh-keys.md
---
# corestack_ssh_host_keys_rotate

**Rotate SSH host keys.** Rotates an environment's SSH host keys (confirm_environment typed). Prefer action stage. Follow the rotation with corestack_ssh_host_keys_get. Scope: write. Long-running: answers with a task.

- Scope: `write`
- Confirmation: `confirm_environment`
- Runs as a task: yes

## When to use it

Rotate an environment's SSH host keys. Type the environment's name as `confirm_environment` exactly as corestack_ssh_host_keys_get shows it. Prefer `stage` (new keys offered now, switched in 7 days); `now` switches at once and every client sees a host-key warning; `finish` and `cancel` end a staged rotation. The answer comes at once with `rotation` (its `rotation_id` and `state`) and no task: the rotation carries on by itself. Read corestack_ssh_host_keys_get until `rotation.state` is `done`, `cancelled`, `aborted` or `failed` for the same `rotation.rotation_id`; a staged rotation stays `offered` until it is finished or its day comes. `change` is null, because a rotation is not a change corestack_ssh_change_get answers.

## Inputs

- `enterprise_env_id` (integer): a CoreStack Enterprise environment's id (`environment.id` in corestack_ssh_keys_list). Give this or `site_id`.
- `site_id` (integer): a CoreStack or CoreCluster environment row, as the other corestack tools take it. Give this or `enterprise_env_id`.
- `action` (string, required): `stage`, `now`, `finish` or `cancel`.
- `confirm_environment` (string, required): the environment's name.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "action": {
      "description": "stage: offer new host keys now and switch in 7 days (recommended); now: switch at once (only if a key may be compromised — every client sees a host-key warning); finish: switch a staged rotation now; cancel: withdraw a staged rotation.",
      "enum": [
        "stage",
        "now",
        "finish",
        "cancel"
      ],
      "type": "string"
    },
    "confirm_environment": {
      "description": "Type the environment's name exactly as corestack_ssh_host_keys_get shows it (environment.name).",
      "maxLength": 190,
      "minLength": 1,
      "type": "string"
    },
    "enterprise_env_id": {
      "description": "A CoreStack Enterprise environment's id (environment.id in corestack_ssh_keys_list); for CoreStack or CoreCluster give site_id.",
      "minimum": 1,
      "type": "integer"
    },
    "site_id": {
      "description": "A CoreStack or CoreCluster environment row's site_id.",
      "minimum": 1,
      "type": "integer"
    }
  },
  "required": [
    "action",
    "confirm_environment"
  ],
  "type": "object"
}
```

## Refusals

- `managed_elsewhere` (message: "This site is managed by another control panel"): another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).
- `switched_off`: SSH keys are not switched on for this object yet.
- `confirm_mismatch`: the typed name is not this environment's.
- `ssh_host_keys_unmanaged`: CoreStack Enterprise host keys are Corefinity's.
- `ssh_rotation_unavailable`: this environment cannot rotate its host keys yet.
- `ssh_rotation_in_progress`: another rotation is running.
- `enterprise_panel_only`: SSH keys for CoreStack Enterprise environments are managed in the Control Panel only at the moment.

## Example

```json
{
  "name": "corestack_ssh_host_keys_rotate",
  "arguments": {
    "site_id": 912,
    "action": "stage",
    "confirm_environment": "Production"
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_ssh_host_keys_rotate with site_id 912, action stage. (Rotate SSH host keys.) Tell me what it returned.
```

## The same task elsewhere

- Guide: [SSH keys](https://docs.corefinity.com/guides/sites/access-and-security/ssh-keys.md)
