SSH certificates explained:

Overview
========

User Certificates overview:

    User certificates are used to authenticate user identities and
    grant SSH access to accounts on servers.

    - You can control the range of user accounts a user may access to by listing
      those accounts as principals when you create his certificate. The certificate
      determines the range of user accounts on all servers.

    - There is nothing in user certificates limiting the range of
      servers where a user is granted access.  You can control the
      range of servers accessible by a CA's certificates by limiting
      the number of server hosts where the CA's public key is
      distributed.  The CA's server distribution list determines the
      range of servers of all it's certificates, if you expand that
      list, all new and existing certificates gain an expanded range
      of server hosts.
    
    When a user key, pubkey and certificate have been compromised.
    Your damage control strategy is to immediately revoke the key. You
    update the revoked users file on all servers in the CA's server
    distribution list.  Until a server containing the given CA in it's
    trusted CAs file has had its revoked users file updated, the door
    is open on that host.

    What you gain by using user certificates is a dramatic reduction
    in server maintenance.  You eliminate the need to manage
    authorized_keys files on all accounts on all servers.  You
    eliminate the need to remove a compromised key from every account
    on every server where that key exists in an authorized_keys file,
    instead you only need to update trusted cas and revoked keys files
    on each server.

    If you need to partition the set of all hosts where certificates
    grant access depending on class of user, you need to use different
    CA's for different classes of user each CA with a different
    subset of the set of all hosts as distribution list.  Then
    The CA you use to generate the user's certificate will determine
    to which subset of hosts access is granted by the certificate.


    

Host Certificates overview:

    Host certificates are used to authenticate server host identities and
    allow them to be recognized on client hosts as known.

Host Certificates configuration:

    To configure SERVER hosts to offer HOST certificates add this to
    /etc/ssh/sshd_config:

    "HostCertificate /etc/ssh/ssh_host_rsa_key-cert.pub"

    The CA generates the certificate from the host
    key file "ssh_host_rsa_key.pub" and places the resulting
    "ssh_host_rsa_key-cert.pub" in /etc/ssh/ on the  SERVER host.

    In order for an interested CLIENT host to verfify the validity of
    of a SERVER host certificate it needs to look up the signing CA
    its local file /etc/ssh_known_hosts.  It must also make sure the
    host certificate has not been revoked by making sure it does not
    appear in its local file /etc/revoked_host_keys.

    Consequently the CA must DISTRIBUTE to each host in its list of
    interested clients the CA's own public key for inclusion in
    ssh_known_hosts and its list of revoked hosts for inclusion in
    revoked_host_keys.

    Clients must have the union of all CA public keys for their
    ssh_known_hosts file and the union of all CAs' revoked keys
    for their revoked_host_keys file from all the CAs that
    show them an interest combined.

    All client hosts must have the following entries in
    their /etc/ssh/ssh_config file:
    
    "GlobalKnownHostsFile /etc/ssh/ssh_known_hosts"
    "RevokedHostKeys /etc/ssh/revoked_host_keys"

Note: server hosts  may also be client hosts  and client hosts  may also be server hosts.

Note: servers that are receiving ssh connection requests through a reverse tunnel only
      ever get connections from the 127.0.0.1 principal. This principal is authorized
      in EVERY host certificate, so *any* connection via reverse tunnel will be
      offered the given host certificate, and as long as that certificate is duly
      represented in ssh_known_hosts, the host will be considered known. The user
      thus knows it is A known host, but is not assured it is THE known host.
      
      We could conceivably check the identity in the certificate to confirm it is
      THE known host.  E.G. cat the host certificate.
      
      When you are not connecting via reverse tunnel, IF you can trust the
      DNS server that mapped the connection, you can trust that you are connecting
      to THE known host.  To fool you, an attacker would need to compromise
      your DNS mapping to give a different IP, and the bogus server would need
      to offer up a certificate duly signed by an ssh_known_hosts CA.

      So if any server is compromised, the certificate, the private
      key, and the public key can be transferred to a bogus server.  Once
      that is done, only compromising the DNS mapping is required, and
      not even that is required when access is via tunnel.

      Safety measure:
         - use DNSSEC
	 - dont use tunneled hosts as intermediary, only treat them as
	   endpoints, and minimize revealing sensitive information
	   on tunneled connections.
	   

Management practise:
      
      Make all host names unique in full scope of computers serviced.
      Make all user names unique in full scope of computers serviced.
      Use fully qualified domain names on desktop
      units even though you can't access them with that address.

      Maintain a users database and a hosts database.
      
      Support the idea that wherever a system has an account matching
      one of the user names, it is for the use of that user regardless
      of which host it is.
      
Certificate Authority is responsible for signing all host keys
and all user keys.

Certificate Authorty is responsible for updating, trustedcas, revokedkey, sshd_config, ssh_config
on all server hosts and client hosts.


todo:
- include host, client, and CA keys key revocation list
- enhance revoke command to revoke hosts and CAs
- refactor config_client (ssh_host, ssh_known_hosts)
- add port,user,host as alternate address for accessing hosts during:
  configure_server (to access the host for configuration)              done.
  certifyhostca (to fetch the host's pub key)
- publish need refactoring to publish full complement of information.
- prune fuction to remove all expired keys from the database.
- enhance revoke to be able to revoke CAs and hosts as well as users



  
  
  
