Skip to content

snapshot restore functionality broken #31933

Description

@ngarafol

Describe the bug
Every time I run "vault operator snapshot restore " command, cluster where I am restoring ends up with corrupted data and needs stopping each node, removing raft data, initializing of cluster, restoring snapshot again with cluster root token.

To Reproduce
Steps to reproduce the behavior:

  1. On "origin" vault cluster run vault operator raft snapshot save snapshot-origin-cluster
  2. On "destination" vault cluster run vault operator raft snapshot restore (-force) snapshot-origin-cluster
  3. run vault status on destination vault cluster - no output
  4. try to unseal nodes:
{"errors":["node was removed from a HA cluster"]}
{"errors":["node was removed from a HA cluster"]}
{"errors":["node was removed from a HA cluster"]}
{"errors":["node was removed from a HA cluster"]}
{"errors":["node was removed from a HA cluster"]}
{"errors":["node was removed from a HA cluster"]}
  1. destination cluster is broken, fix it

Expected behaviorIf I am restoring snapshot from different cluster, I would expect destination cluster to seal since keys dont match.
If I am restoring snapshot from same cluster, I would expect destination cluster increasing raft index and staying unsealed

Environment:

  • Vault Server Version (retrieve with vault status): 1.21.0
  • Vault CLI Version (retrieve with vault version): v1.16.2
  • Server Operating System/Architecture: Ubuntu 24.04, amd64

Vault server configuration file(s):

{
    "api_addr": "https://n02.example.org:443",
    "cluster_addr": "https://n02.example.org:444",
    "disable_mlock": false,
    "listener": [
        {
            "tcp": {
                "address": "0.0.0.0:443",
                "cluster_address": "0.0.0.0:444",
                "telemetry": [
                    {
                        "unauthenticated_metrics_access": true
                    }
                ],
                "tls_cert_file": "/etc/letsencrypt/live/n02.example.org/fullchain.pem",
                "tls_client_ca_file": "/etc/ssl/certs/ca-certificates.crt",
                "tls_disable": false,
                "tls_key_file": "/etc/letsencrypt/live/n02.example.org/privkey.pem"
            }
        }
    ],
    "log_level": "Error",
    "storage": {
        "raft": {
            "path": "/etc/vault.d/raft",
            "performance_multiplier": "1",
            "retry_join": [
                {
                    "leader_api_addr": "https://n01.example.org",
                    "leader_ca_cert_file": "/etc/ssl/certs/ca-certificates.crt",
                    "leader_client_cert_file": "/etc/letsencrypt/live/n02.example.org/fullchain.pem",
                    "leader_client_key_file": "/etc/letsencrypt/live/n02.example.org/privkey.pem"
                },
                {
                    "leader_api_addr": "https://n02.example.org",
                    "leader_ca_cert_file": "/etc/ssl/certs/ca-certificates.crt",
                    "leader_client_cert_file": "/etc/letsencrypt/live/n02.example.org/fullchain.pem",
                    "leader_client_key_file": "/etc/letsencrypt/live/n02.example.org/privkey.pem"
                },
                {
                    "leader_api_addr": "https://n03.example.org",
                    "leader_ca_cert_file": "/etc/ssl/certs/ca-certificates.crt",
                    "leader_client_cert_file": "/etc/letsencrypt/live/n02.example.org/fullchain.pem",
                    "leader_client_key_file": "/etc/letsencrypt/live/n02.example.org/privkey.pem"
                },
                {
                    "leader_api_addr": "https://n04.example.org",
                    "leader_ca_cert_file": "/etc/ssl/certs/ca-certificates.crt",
                    "leader_client_cert_file": "/etc/letsencrypt/live/n02.example.org/fullchain.pem",
                    "leader_client_key_file": "/etc/letsencrypt/live/n02.example.org/privkey.pem"
                },
                {
                    "leader_api_addr": "https://n05.example.org",
                    "leader_ca_cert_file": "/etc/ssl/certs/ca-certificates.crt",
                    "leader_client_cert_file": "/etc/letsencrypt/live/n02.example.org/fullchain.pem",
                    "leader_client_key_file": "/etc/letsencrypt/live/n02.example.org/privkey.pem"
                }
            ]
        }
    },
    "telemetry": {
        "disable_hostname": true,
        "prometheus_retention_time": "30s"
    },
    "ui": false
}

Additional context
Before upgrading to 1.21.0 I used 1.16.0 and I had no issues with restoring with or without force option. It literally worked as expected behaviour. So, I assume somewhere between 1.16.0 and 1.21.0 snapshot restore got broken. Broken, because in my humble opinion it makes no sense if one restores SAME cluster data, that destination where snapshot is restored gets broken, needs raft data removed, cluster reinitialized and restored with force again...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUsed to indicate a potential bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions