SSH Certs Server Config

The /etc/ssh/trusted-user-ca-keys.pem file can be copied from a departmental server.

You must choose between:

  • a completely static setup with a configuration file for each account separately
  • a partially dynamic setup where the configuration of which KU Leuven account can login to which local account can be combined in a single file, but still allowing exceptions

Exclusively with Static Files

Config:

    TrustedUserCAKeys /etc/ssh/trusted-user-ca-keys.pem
    AuthorizedPrincipalsFile '/etc/ssh/auth_principals/principals-for-%u'

Each /etc/ssh/auth_principals/principals-for-X file contains the [ursm]-accounts (one per line) that are allowed to login to the account X

The /etc/ssh/auth_principals/principals-for-X files must be readable for the account itself (but probably best not writable).

Script and Static Files

Config:

    TrustedUserCAKeys /etc/ssh/trusted-user-ca-keys.pem
    AuthorizedPrincipalsFile none
    AuthorizedPrincipalsCommand /etc/ssh/auth_principals.sh '%u'
    AuthorizedPrincipalsCommandUser nobody

The command must be executable by the command user and must output on stdout the [ursm]-accounts (one per line) that are allowed to login to the account that is given as (sole) argument.

The departmental servers use a command something like this:

    # account names can only contain the following characters
    a=`echo "$1" | tr -d -c a-zA-Z0-9-`
    
    if [ -e "/etc/ssh/auth_principals/principals-for-$a" ]
    then
    	# when a specific configuration for the account is available
    	cat "/etc/ssh/auth_principals/principals-for-$a"
    elif [ -e "/etc/ssh/auth_principals/mapping-file" ]
    then
    	# when a mapping file is available
    	# several lines per account are possible, each prefixed with the account name
    	grep "^$a:" "/etc/ssh/auth_principals/mapping-file" | sed "s/^$a://"
    else
    	# when the accounts on the server are [ursm]-accounts themselves
    	echo "$a"
    fi
    
    exit 0