SSH CA setup
#
DRHECK SSH CERTIFICATE IMPLEMENTATION PLAN
###
ARCHITECTURE & SECURITY OVERVIEW
*
sshd validates the certificate signature against the trusted DrHeck CA public key and checks that one of the certificate's valid principals matches the requested LDAP login username. No per-user ~/.ssh/authorized_keys`authorized_keys file is required.drheck_ca_user_key) and Host CA private key (drheck_ca_host_key) must drheck_ca_user_key.pub`pub and drheck_ca_host_key.pub`pub) to host ---
###
PHASE 1: CA GENERATION & VAULTWARDEN BACKUP
Generate CA Keypairs on a secure offline or admin workstation:
*When prompted by `ssh-, enter a strong, unique passphrase to encrypt each CA private key.keygen`keygen*
```bash
# Generate the User CA keypair
ssh-keygen -t ed25519 -f drheck_ca_user_key -C "drheck-user-ca"
# Generate the Host CA keypair
ssh-keygen -t ed25519 -f drheck_ca_host_key -C "drheck-host-ca"```
####
Secure Storage in Vaultwarden:
1.
drheck_ca_user_key, drheck_ca_host_key) and their passphrases.---
###
PHASE 2: MAIN SERVER CONFIGURATION (ul)
####
1. Deploy Trusted User CA Public Key
*
drheck_ca_user_key.pub`pub to host /etc/ssh/drheck_ca_user_key.pub`pub.bash
sudo chmod 644 /etc/ssh/drheck_ca_user_key.pub
sudo chown root:root /etc/ssh/drheck_ca_user_key.pub
####
2. Configure Host Certificate (Signed by Host CA)
*
To keep the private `drheck_ca_host_key`drheck_ca_host_key offline, the host key must be signed on your secure workstation:*
1.
- Copy
**ul**ul's public host key`/etc/ssh/ssh_host_ed25519_key.to your secure workstation.pub`pub2. - On your workstation, sign the host key (valid for 52 weeks):
```bashssh-keygen -s drheck_ca_host_key -I "drheck-ul-host-cert" -h -n ul,ul.drheck.dev -V +52w ssh_host_ed25519_key.pub
ssh_host_ed25519_key-cert.pub`pub back to /etc/ssh/ssh_host_ed25519_key-cert.pub`pub.bash
sudo chmod 644 /etc/ssh/ssh_host_ed25519_key-cert.pub
sudo chown root:root /etc/ssh/ssh_host_ed25519_key-cert.pub
####
3. Configure OpenSSH Daemon on ul
*
/etc/ssh/sshd_config.d/10-drheck-certs.conf`conf:bash
sudo vim /etc/ssh/sshd_config.d/10-drheck-certs.conf
text
TrustedUserCAKeys /etc/ssh/drheck_ca_user_key.pub
HostCertificate /etc/ssh/ssh_host_ed25519_key-cert.pub
####
4. Validate and Reload SSHD on ul
*
bash
sudo sshd -t
bash
sudo systemctl reload sshd
---
###
PHASE 3: CLIENT MACHINE ONBOARDING & SIGNING
####
1. Client Key Generation
*
bash
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -C "client key label"
####
2. Certificate Signing Request
*
~/.ssh/id_ed25519.pub`pub) and the target LDAP username to the DrHeck CA administrator.
####
3. Sign the Client Public Key
*
drheck_ca_user_key (defining the exact LDAP username as the principal):bash
ssh-keygen -s drheck_ca_user_key -I "client-hostname-YYYYMMDD" -n <ldap_username> -V +52w id_ed25519.pub
```
* -I`**I: Certificate identity string printed in the server's authentication logs.-n`**n: Valid principals; -V +52w`**52w: Certificate validity duration (e.g., 52 weeks or shorter).
####
4. Deploy the Client Certificate
*
id_ed25519-cert.pub`pub back to the client machine and place it in ~/.ssh/id_ed25519-cert.pub`pub (alongside the private key).bash
chmod 644 ~/.ssh/id_ed25519-cert.pub
####
5. Client SSH Configuration (~/.ssh/config)
*
Configure the host entry on the client machine to use the cert automatically:
```text
Host ul HostName <ul_fqdn_or_ipv6> User <ldap_username> IdentityFile ~/.ssh/id_ed25519
``` *(Note: OpenSSH automatically detects and presents `id_ed25519-cert. when utilizing pub`pub`id_ed25519`id_ed25519 if they are in the same folder).*
* **Trusting the Host CA:** Add this line to `/etc/ssh/ (system-wide) or ssh_known_hosts`ssh_known_hosts`~/.ssh/ on your client machines. This tells the clients to trust known_hosts`known_hosts**ul**ul's host certificate automatically without prompting about finger-prints:
```text @cert-authority * ssh-ed25519 <drheck_ca_host_key.pub_content>
```
---
###
PHASE 4: VERIFICATION & MIGRATION
####
1. Test Certificate Authentication
*
bash
ssh -v ul
text
Server accepts key: pkalg ssh-ed25519-cert-v01@openssh.com
####
2. Migration Strategy
*
PubkeyAuthentication yes`yes active on .ssh/authorized_keys`authorized_keys logins during client onboarding..ssh/authorized_keys`authorized_keys file lookups system-wide by adding the following line to /etc/ssh/sshd_config.d/10-drheck-certs.conf`conf:text
AuthorizedKeysFile /dev/null