Bug 53971 - NFS mount policy evaluation always takes the first IPv4 address
NFS mount policy evaluation always takes the first IPv4 address
Status: NEW
Product: UCS
Classification: Unclassified
Component: NFS
UCS 5.0
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS maintainers
UCS maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-10-21 15:23 CEST by Florian Best
Modified: 2023-02-22 07:23 CET (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2021-10-21 15:23:12 CEST
The NFS mount policy evaluation always takes the first IPv4 address of any host DNS record matching the set FQDN.
Fallback is the FQDN.

base/univention-base-files/univention-directory-policy/nfsmounts.py
209 »   »   # get the ip of the share_host
210 »   »   hostname, domain = share_host.split('.', 1)
211 »   »   result = lo.lo.search_s(configRegistry['ldap/base'], ldap.SCOPE_SUBTREE, '(&(relativeDomainName=%s)(zoneName=%s))' % (hostname, domain), attrlist=['aRecord'])
212 »   »   try:
213 »   »   »   attributes = result[0][1]
214 »   »   »   nfs_path_ip = "%s:%s" % (attributes['aRecord'][0], share_path)
215 »   »   except LookupError:
216 »   »   »   nfs_path_ip = nfs_path_fqdn

Why are we specifying a IP address at all? Isn't the FQDN working?
(goes back to git:23b388d1700845c80a5f88c670620baa80f94bb9 - no information about it)

Is it correct to use the first IPv4 address? Could also be that that IP doesn't work for the network interface?

If there is no IPv4 address set, shouldn't we use a IPv6 address?

Is it correct that IPv4 has precedence over IPv6?

Can the LDAP search return multiple entries? Is it then correct to use the first one? I think the LDAP filter can also match CNAME records. (we should add sizelimit=1)
Comment 1 Philipp Hahn univentionstaff 2023-02-22 07:23:37 CET
Always prefer the DNS name as it will resolve to the correct address when it is resolved. At least for IPv6 it is required to use a `for addr in getaddrinfo(node): if connect(addr).successful: break` construct to try all returned addresses in order until one connects successful, which might also differ for individual programs.