Skip to content

Commit b82efac

Browse files
committed
config, backends: don't manually hunt for CA paths
1 parent 768cae6 commit b82efac

File tree

1 file changed

+3
-29
lines changed

1 file changed

+3
-29
lines changed

sopel/config/core_section.py

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
import os.path
4-
53
from sopel.config.types import (
64
BooleanAttribute,
75
ChoiceAttribute,
@@ -23,29 +21,6 @@
2321
"""Default URL schemes allowed for URLs."""
2422

2523

26-
def _find_certs():
27-
"""Find the TLS root CA store.
28-
29-
:returns: path to CA store file
30-
:rtype: str
31-
"""
32-
# check if the root CA store is at a known location
33-
locations = [
34-
'/etc/pki/tls/cert.pem', # best first guess
35-
'/etc/ssl/certs/ca-certificates.crt', # Debian
36-
'/etc/ssl/cert.pem', # FreeBSD base OpenSSL
37-
'/usr/local/openssl/cert.pem', # FreeBSD userland OpenSSL
38-
'/etc/pki/tls/certs/ca-bundle.crt', # RHEL 6 / Fedora
39-
'/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem', # RHEL 7 / CentOS
40-
'/etc/pki/tls/cacert.pem', # OpenELEC
41-
'/etc/ssl/ca-bundle.pem', # OpenSUSE
42-
]
43-
for certs in locations:
44-
if os.path.isfile(certs):
45-
return certs
46-
return None
47-
48-
4924
def configure(config):
5025
"""Interactively configure the bot's ``[core]`` config section.
5126
@@ -228,17 +203,16 @@ class CoreSection(StaticSection):
228203
229204
"""
230205

231-
ca_certs = FilenameAttribute('ca_certs', default=_find_certs())
232-
"""The path to the CA certs ``.pem`` file.
206+
ca_certs = FilenameAttribute('ca_certs')
207+
"""The path to the CA certs ``pem`` file.
233208
234209
Example:
235210
236211
.. code-block:: ini
237212
238213
ca_certs = /etc/ssl/certs/ca-certificates.crt
239214
240-
If not specified, Sopel will try to find the certificate trust store
241-
itself from a set of known locations.
215+
If not specified, the system default will be used.
242216
243217
If the given value is not an absolute path, it will be interpreted relative
244218
to the directory containing the config file with which Sopel was started.

0 commit comments

Comments
 (0)