We have our own company wide certificate authority which we use to signa SSL certificates. Mostly, this is working fine as long as you have your OS (CentOS 7 in our case) register that authority. It is stored here:
/etc/pki/ca-trust/source/anchors/company_ca.pem
This allows Firefox/chrome to trust the SSL certificates that were signed via it.
I am using sphinx-build -W -blinkcheck […]
to check that the links in my Python project are still valid as link rot sucks in documentation. This is fine for all external links.
However, when linking to our own SSL version of mantis (a bug tracker), I get a
SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),)))
error. Mantis, in our set up, only runs on https.
How do I tell sphinx to add the company-wide authority?
I run this generally via tox like thus:
The tox fragement which runs this:
[testenv:docs]
basepython=python2.7
deps=-r{toxinidir}/requirements/requirements.txt
commands=./check_docs.bash
The bash script:
#!/bin/bash
set -eux
sphinx-apidoc --force --separate --private --module-first -o docs src/ '*/*test*'
cd docs
pytest --maxfail=1 \
--tb=line \
-v \
--junitxml=junit_sphinx.xml \
--exitfirst \
--failed-first \
--full-trace \
-ra \
--capture=no \
check_sphinx.py
And the pythons script:
import subprocess
def test_linkcheck(tmpdir):
doctrees = tmpdir.join("doctrees")
htmldir = tmpdir.join("html")
subprocess.check_call([
"sphinx-build", "-W", "-blinkcheck", "-d",
str(doctrees), ".",
str(htmldir)
])
def test_build_docs(tmpdir):
doctrees = tmpdir.join("doctrees")
htmldir = tmpdir.join("html")
subprocess.check_call([
"sphinx-build", "-W", "-bhtml", "-d",
str(doctrees), ".",
str(htmldir)
])
Sphinx uses
requests
which usescertifi
-- thanks to sraw who kindly pointed this out in a comment. You can modify thecertifi.where()
to include your own certificate authority.Because you might run tox or re-build your virtual environement, doing so manually is tedious and error prone. A fixture makes this much easier to deal with.
The Python script changes to the following.