#9085 ipa-client-install fails if pre-existing NIS domain contains a "%"
Closed: fixed 2 years ago by abbra. Opened 2 years ago by caligatio.

Issue

ipa-client-install fails with an exception if the client is being configured on a host with a pre-existing NIS domain that contains the character "%".

Please note that I didn't pick the original NIS domain and am migrating this set up to FreeIPA.

Steps to Reproduce

  1. Have a host on a pre-configured NIS domain that contains the character "%"
  2. Run ipa-client-install, omitting the --no-nisdomain flag

Actual behavior

The client exits unsuccessfully throwing an exception that includes "invalid interpolation syntax"

Expected behavior

For the client to install.

Version/Release/Distribution

FreeIPA client 4.8.6-1ubuntu2 on Ubuntu 20.04.3 but latest is also affected.

Additional info:

I've traced the underlying problem to the save() function in ipalib/sysrestore.py which uses Python's configparser.ConfigParser class. ConfigParser exposes an interpolation syntax that is keyed/trigged by the use of "%". The docs state that "%" characters should be escaped by adding an additional "%" (e.g. "%" should be sent in as "%%").


I've been unable to find what the valid character set for a NIS domain consists of. Typically it is just a normal domain name where % would be illegal but it isn't entirely clear from the NIS documentation I've been able to find.

I completely agree that having a "%" in your NIS domain is super abnormal and, if I'm being honest, I'm shocked that it hasn't caused any issues until now.

I would point out that this is a symptom of a possible larger bug which is any value containing a "%" that is saved via backup_state would cause a similar error. Looking through the code, it doesn't appear that the interpolation functionality of ConfigParser is used anywhere so the easiest/cleanest fix would be to just disable interpolation completely by setting interpolation=None when instantiating the ConfigParser class.

master:

  • ba796e3 ipalib: Handle percent signs in saved values

ipa-4-9:

  • 8377021 ipalib: Handle percent signs in saved values

Metadata Update from @abbra:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

2 years ago

Login to comment on this ticket.

Metadata