URL:
https://github.com/freeipa/freeipa/pull/2376
Author: flo-renaud
Title: #2376: ipa-advise: fix script for smart card preparation
Action: opened
PR body:
"""
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
**Important note**: ipa-4-7 and master use mod_ssl instead of mod_nss and do not see this
issue. The fix is required on ipa-4-6 branch only.
"""
To pull the PR as Git branch:
git remote add ghfreeipa
https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/2376/head:pr2376
git checkout pr2376