ipa-advise: fix script for smart card preparation
The script has 2 issues:
- if the http nickname contains spaces (like "CN=host,O=Example Org",
which can happen when the http cert is provided by an external CA),
the extraction of the nick from /etc/httpd/conf.d/nss.conf fails.
The nick name is build using
grep NSSNickname /etc/httpd/conf.d/nss.conf | cut -f 2 -d ' '
which results in "CN=host,O=Example
(note the end is missing).
The script should rather use cut -f 2- -d ' ' in order to extract the
whole nickname.
- when the http nickname is enclosed in single quote, the script should
remove them, otherwise the shell tries to escape them and fails to find
the cert in /etc/httpd/alias.
The fix is using sed "s/^'\(.*\)'$/\1/" in order to remove leading and
trailing single quote, if present.
Fixes: https://pagure.io/freeipa/issue/7706
Reviewed-By: Rob Crittenden <rcritten@redhat.com>