def check_key_file(user, source, config='.ssh/authorized_keys', saltenv='base'):
 keyfile = __salt__['cp.cache_file'](source, saltenv)
 if (not keyfile):
  return {}
 s_keys = _validate_keys(keyfile)
 if (not s_keys):
  err = 'No keys detected in {0}. Is file properly formatted?'.format(source)
  log.error(err)
  __context__['ssh_auth.error'] = err
  return {}
 else:
  ret = {}
  for key in s_keys:
   ret[key] = check_key(user, key, s_keys[key]['enc'], s_keys[key]['comment'], s_keys[key]['options'], config)
  return ret

def check_key_file ( user , source , config = '.ssh/authorized_keys' , saltenv = 'base' ) : keyfile = __salt__ [ 'cp.cache_file' ] ( source , saltenv ) if ( not keyfile ) : return { } s_keys = _validate_keys ( keyfile ) if ( not s_keys ) : err = 'No keys detected in {0}. Is file properly formatted?' . format ( source ) log . error ( err ) __context__ [ 'ssh_auth.error' ] = err return { } else : ret = { } for key in s_keys : ret [ key ] = check_key ( user , key , s_keys [ key ] [ 'enc' ] , s_keys [ key ] [ 'comment' ] , s_keys [ key ] [ 'options' ] , config ) return ret
check a keyfile from a source destination against the local keys and return the keys to change cli example: .