2

I've been asked to remove certificates from some of our servers, but I don't know anything about httpd configuration. If I have one server where if I do this

/usr/sbin/httpd -t -DDUMP_CERTS 2>/dev/null | /bin/sort -u

I get

/etc/httpd/certs/domain1.certificate
/etc/httpd/certs/domain2.certificate
/etc/httpd/certs/domain3.cert
/etc/pki/tls/certs/localhost.crt

and I only want to keep domain3.cert. How can I remove the others?

If /etc/pki/tls/certs/localhost.crt is the only one on a machine, do I have to remove it in a different way? I tried commenting out the line mentioning that localhost.crt in /etc/httpd/conf.d/ssl.conf but then httpd reports failed when I do a service restart.

2

I know the question is one year old so the answer probably comes much too late but anyway, since somebody already dug this out, it may be worth putting an answer here for future visitors. Sadly we do not have any detailed info about the distro used and what particular package provides httpd functionality (Apache, Nginx, something else?) so it's going to be a bit of a shot in the dark but anyway:

The reason why the restart you mention fails is probably because you're commenting out the certificate in a general config file and leave it in some other file, probably in a vhost config. You could check for that with this: grep -E '(domain[12]\.certificate|localhost\.crt) /etc/httpd/sites-enabled/*', which will search for the strings: domain1.certificate, domain2.certificate and localhost.crt in all files in /etc/httpd/sites-enabled/ directory. If it finds either of these strings it will print out the relevant lines prepended with the filename containing them. You can then proceed to comment out those lines. You may have to change the certificate file path in order to provide another certificate or comment out the whole HTTPS section if you only want plain HTTP.

Try to restart (or test configuration) after you're done. If you get through a restart successfully, then the server has stopped using the certificates.

  • 1
    From the daemons and directories, it seems CentOS, maybe RedHat. By default, the configuration files live under /etc/httpd. sites-enabled is a Debian/SuSE construct afair. – Rui F Ribeiro Dec 7 '18 at 20:35

protected by Community Jan 31 '17 at 8:18

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.