Fixes #6566 - If the certname does not match the hostname, nil the certname

Resolves http://projects.theforeman.org/issues/6566 by generalizing the solution from http://projects.theforeman.org/issues/3222