#6214 ipa-client-install fails when ptp interfaces are present
Closed: Fixed None Opened 7 years ago by icon.

ipa-client-install relies on the output of "ip -oneline address show" to figure out its ips and interfaces. However, it always assumes that the IP address will be in the format of xx.xx.xx.xx/xx, which is not true if the output contains ptp devices:

1: lo    inet 127.0.0.1/8 scope host lo\       valid_lft forever preferred_lft forever
1: lo    inet6 ::1/128 scope host \       valid_lft forever preferred_lft forever
2: eth0    inet 10.30.48.3/23 brd 10.30.49.255 scope global dynamic eth0\       valid_lft 86388sec preferred_lft 86388sec
2: eth0    inet6 fe80::f816:3eff:fe72:82c3/64 scope link \       valid_lft forever preferred_lft forever
3: eth1    inet [redacted]/24 brd 162.253.54.255 scope global dynamic eth1\       valid_lft 86390sec preferred_lft 86390sec
3: eth1    inet6 [redacted]/64 scope global mngtmpaddr dynamic \       valid_lft 2591990sec preferred_lft 604790sec
3: eth1    inet6 fe80::f816:3eff:fe7e:8731/64 scope link \       valid_lft forever preferred_lft forever
4: tun0    inet 172.30.100.225 peer 172.30.100.226/32 scope global tun0\       valid_lft forever preferred_lft forever

You will see that tun0 doesn't have a /32 in the 4th field, so ipa-client-install crashes:

Traceback (most recent call last):
  File "/sbin/ipa-client-install", line 3102, in <module>
    sys.exit(main())
  File "/sbin/ipa-client-install", line 3083, in main
    rval = install(options, env, fstore, statestore)
  File "/sbin/ipa-client-install", line 2721, in install
    if configure_sssd_conf(fstore, cli_realm, cli_domain, cli_server, options, client_domain, hostname):
  File "/sbin/ipa-client-install", line 1307, in configure_sssd_conf
    iface = get_server_connection_interface(cli_server[0])
  File "/sbin/ipa-client-install", line 1750, in get_server_connection_interface
    return get_iface_from_ip(ip)
  File "/sbin/ipa-client-install", line 1537, in get_iface_from_ip
    (ip, mask) = fields[3].rsplit('/', 1)
ValueError: need more than 1 value to unpack

This hacky patch fixes the problem:

--- ipa-client-install.orig     2016-08-13 19:55:07.196216547 +0000
+++ ipa-client-install  2016-08-13 19:59:37.925503720 +0000
@@ -1534,8 +1534,8 @@
             continue
         if fields[2] not in ['inet', 'inet6']:
             continue
-        (ip, mask) = fields[3].rsplit('/', 1)
-        if ip == ip_addr:
+        chunks = fields[3].rsplit('/', 1)
+        if chunks[0] == ip_addr:
             return fields[1]
     else:
         raise RuntimeError("IP %s not assigned to any interface." % ip_addr)
@@ -1554,7 +1554,8 @@
             continue
         if fields[2] not in ['inet', 'inet6']:
             continue
-        (ip, mask) = fields[3].rsplit('/', 1)
+        chunks = fields[3].rsplit('/', 1)
+        ip = chunks[0]
         try:
             ips.append(ipautil.CheckedIPAddress(ip))
         except ValueError:

This should be already fixed in IPA 4.4, see commit 70fd789.

Metadata Update from @icon:
- Issue assigned to someone
- Issue set to the milestone: FreeIPA 4.4

7 years ago

Login to comment on this ticket.

Metadata