dns share public key

To add an ed25519 public key to a DNS server, you can use the following command:

nsupdate -k /path/to/private.key update add ssh.backup.example.hiddenssh.com. 60 IN TXT "ssh-ed25519 AAAA... user@server" send   

Replace /path/to/private.key with the path to your private key, AAAA... with your ed25519 public key, and user@server with your username and hostname.

To extract your backup key from the DNS server, you can use the following command:

nslookup -type=txt ssh.backup.example.hiddenssh.com | grep 'text = "' | sed 's/.*text = "\(.*\)".*/\1/' >> authorized_keys_backup   

This command retrieves the TXT record for ssh.backup.example.hiddenssh.com — this TXT record can contain information like hidden SSH endpoints or metadata , filters it using grep and sed, and appends the result to your authorized_keys_backup file.

Pros:

Cons: