14.2.5. Machine Resolvers¶
Machine Resolvers are used to find machines in directories like LDAP, Active Directory or the /etc/hosts file.
Machines can then be used to assign applications and tokens to those machines.
14.2.5.1. Base class¶
- class edumfa.lib.machines.base.BaseMachineResolver(name, config=None)[source]¶
- Parameters:
name – The identifying name of the resolver
config
- Returns:
- static get_config_description()[source]¶
Returns a description what config values are expected and allowed.
- Returns:
dict
- get_machine_id(hostname=None, ip=None)[source]¶
Returns the machine id for a given hostname or IP address.
If hostname and ip is given, the resolver should also check that the hostname matches the IP. If it can check this and hostname and IP do not match, then an Exception must be raised.
- Parameters:
hostname (basestring) – The hostname of the machine
ip (netaddr) – IP address of the machine
- Returns:
The machine ID, which depends on the resolver
- Return type:
basestring
- get_machines(machine_id=None, hostname=None, ip=None, any=None, substring=False)[source]¶
Return a list of all machine objects in this resolver
- Parameters:
substring – If set to true, it will also match search_hostnames,
that only are a subnet of the machines hostname. :type substring: bool :param any: a substring that matches EITHER hostname, machineid or ip :type any: basestring :return: list of machine objects
14.2.5.2. Hosts Machine Resolver¶
- class edumfa.lib.machines.hosts.HostsMachineResolver(name, config=None)[source]¶
- Parameters:
name – The identifying name of the resolver
config
- Returns:
- classmethod get_config_description()[source]¶
Returns a description what config values are expected and allowed.
- Returns:
dict
- get_machine_id(hostname=None, ip=None)[source]¶
Returns the machine id for a given hostname or IP address.
If hostname and ip is given, the resolver should also check that the hostname matches the IP. If it can check this and hostname and IP do not match, then an Exception must be raised.
- Parameters:
hostname (basestring) – The hostname of the machine
ip (netaddr) – IP address of the machine
- Returns:
The machine ID, which depends on the resolver
- Return type:
basestring
- get_machines(machine_id=None, hostname=None, ip=None, any=None, substring=False)[source]¶
Return matching machines.
- Parameters:
machine_id – can be matched as substring
hostname – can be matched as substring
ip – can not be matched as substring
substring (bool) – Whether the filtering should be a substring matching
any (basestring) – a substring that matches EITHER hostname, machineid or ip
- Returns:
list of Machine Objects