KU Leuven MFA SSH Certs @cs.kuleuven.be

The Department of Computer Science wants to limit the use of passwords and self-signed SSH keys as much as possible and use SSH Certs, activated by means of the KU Leuven MFA, instead.

To use KU Leuven MFA SSH Certs @cs.kuleuven.be, you need 2 things:

  • a KU Leuven account that can do KU Leuven MFA
  • the tool for your platform to activate KU Leuven MFA SSH Certs: Linux, MacOS and Windows
    • access using SSH Certs from tablets and smartphones is currently not supported

KU Leuven MFA account

  • your own KU Leuven account: u1234567, r1234567, s1234567, m1234567

SSH Cert-tools

Configuration

  • no local configuration of the kmk nor certagent tools is needed - just install/copy them
  • access to your own personal departmental account with your own KU Leuven account is enabled/configured by default
  • access to private/local/service accounts must be configured for each such account separately
    • ask helpdesk to configure your access

Usage

  • activate a valid SSH cert in your SSH/Cert agent using kmk or certagent:
    • when activating an SSH cert, you will be asked to authenticate using the KU Leuven MFA
      • you must therefore have (one of) your MFA device(s) available
    • on system administered Linux systems:
      • the kmk tool is already installed - just use it as: KMK_USER=u0123456 /usr/local/cs-adm/bin/kmk
    • on self administered MacOS and Linux systems:
      • download the right kmk tool from the link above and use it to activate a cert: KMK_USER=u0123456 /path/to/your/kmk
    • on self administered Windows systems:
      • download certagent.exe from the link above
      • certagent.exe is the executable/application, no installation needed, just put it somewhere and use it
      • the first time you use it, it will ask for the username to use - enter your KU Leuven [ursm]-account
      • it definitely works with the built-in Windows command line ssh - we expect it to work with others as well, but have received no experiences so far
  • check whether this really was succesfull: ssh-add -l
    • optionally check the expiration of the cert: ssh-add -L | ssh-keygen -Lf -
    • do notice that the SSH certs are only valid for a limited time (less than a day) - after that you just have to activate a new one as described above
  • use SSH to access the machine:
    • students:
      • directly: ssh r0123456@machine.student.cs.kuleuven.be
      • via jumphost: ssh -J r0123456@st.cs.kuleuven.be r0123456@machine.student.cs.kuleuven.be
    • personnel:
      • directly: ssh youraccount@machine.cs.kuleuven.be
      • via jumphost: ssh -J yourdeptaccount@ssh.cs.kuleuven.be yourlocalaccount@machine.cs.kuleuven.be
      • depending on which machine you are connecting to, yourlocalaccount might be the same as yourdeptaccount
      • you can use ssh1 and/or ssh2 as well from anywhere in the world
    • optionally use the -p 1234 option for SSH services that listen on a non-standard port (with the right port number of course)
    • some SSH implementations allow the use of a configuration file where you can specify a jumphost for all or a selection of destination hosts - in this way you do not need to specify the -J option and its argument each time:
        	Host *.student.cs.kuleuven.be
        		User r0123456
        		ProxyJump r0123456@st.cs.kuleuven.be
    • there is more information about using SSH and/or accessing departmental services from outside the department.

Known Issues:

  • if you have another SSH key in your key-agent that is accepted by the machine you are connecting to, it might not be clear which key/cert is actually used to connect - if you want to be sure the SSH cert is used:
    • either delete all other (private) keys from your key-agent that are also known on the departmental machine
    • or delete all the corresponding public keys that are in your authorized_keys file on the departmental machine
    • the latter is the best option and we will probably enforce their removal some time in the future

SSH Certs on your own SSH Server

If you want to use these SSH certs on your own SSH server (e.g. your VM in the departmental cloud), you can do so using the following (simple) SSH configuration:

  • add to your SSH server configuration: TrustedUserCAKeys /path/to/your/trusted-user-ca-keys.pem
    and copy /etc/ssh/trusted-user-ca-keys.pem from a departmental server to your own machine
  • choose whether to use static SSH Cert principals with: AuthorizedPrincipalsFile
    or dynamic SSH Cert principals with: AuthorizedPrincipalsCommand and AuthorizedPrincipalsCommandUser
  • the simplest setup is using:
    • AuthorizedPrincipalsFile '/path/to/your/principals/%u'
    • create a file for each local account with the name of that account (= the %u part in the above configuration) that you want to access using these SSH Certs
    • add the [urms]-accounts, one per line, that you want to give access to that account
  • more details and advanced setup is described elsewhere

Planning

Todo

  • advise users to remove their own ssh keys from their authorized_keys and start using SSH certs instead

Done - should be active now:

  • removed access with cs-staff ssh keys
  • access to your own dept. account on intranet machines and public ssh servers
  • access to student computer lab systems with your KULeuven [mrsu]-account
  • cs-staff/root access is (correctly) configured everywhere
  • replace student ssh keys documentation with this MFA SSH Certs documentation
  • remove existing public keys from private/local/service accounts