Question

Problems with creating an SSH CA, attempting to following the tutorial as a guide

  • Posted on February 12, 2015
  • beltorakAsked by beltorak

Hi; I am attempting to follow the tutorial posted here as a guide.

I’ve created three LXC machines to practice with: ssh-ca, ssh-server, and ssh-client.

On ssh-ca I self-signed the “ssh_host_ed25519_key” yielding “ssh_host_ed25519_key-cert.pub”.

I transferred the ssh-server “ssh_host_ed25519_key.pub” to the ssh-ca machine as “server.pub”, signed it with the ssh-ca’s “ssh_host_ed25519_key” yielding “server-cert.pub”, and transferred this back to ssh-server as “ssh_host_ed25519_key-cert.pub”. I edited ssh-server’s “sshd_config” to add HostCertificate /etc/ssh/ssh_host_ed25519_key-cert.pub and restarted the ssh-server sshd daemon (service ssh restart).

I transferred the ssh-ca “ssh_host_ed25519_key-cert.pub” to ssh-client and stuck it in ~/.ssh/known_hosts file as (roughly)

@cert-authority * ssh-ed25519-cert-v01@openssh.com AAAAIHN ... QFRDQ==  root@trusty-builds

However, attempting to log in from ssh-client to ssh-server (abbreviated ssh -v output):

debug1: Server host key: ED25519-CERT 85:46:34:5f:93:4c:d0:f5:c3:a4:14:87:38:b9:41:7d
debug1: ssh_ed25519_verify: signature correct
debug1: No matching CA found. Retry with plain key
The authenticity of host '10.0.1.222 (10.0.1.222)' can't be established.
ED25519 key fingerprint is 85:46:34:5f:93:4c:d0:f5:c3:a4:14:87:38:b9:41:7d.
Are you sure you want to continue connecting (yes/no)?

What am I doing wrong? Is * a valid hostname wildcard? Is it possible I messed up one of my signing commands? How could I verify that the ssh-server cert is signed by the ssh-ca key?

Thanks

Show comments

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

The ssh client tries to validate the hostname given in the certificate the server sent. The hostname had to be given after the -n switch, when signing the server’s public key.

ssh-keygen -s server_ca -I host_host1 -h -n host1.example.com -V +52w /etc/ssh/ssh_host_rsa_key.pub

If you have forgotten the name, you can also see it in the debug messages when you try to connect to the server via ssh with -vv. (I had the same problem…)

debug1: Server host certificate: ssh-rsa-cert-v01@openssh.com SHA256:...
debug2: Server host certificate hostname: host1.example.com
debug1: No matching CA found. Retry with plain key
The authenticity of host '192.168.33.12 (192.168.33.12)' can't be established.

When trying to connect to the host via IP, one has to give the hostname in the options:

ssh -o HostName=host1.example.com root@192.168.33.12

* is a valid hostname wildcard.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.