Skip to content

Commit

Permalink
Add default locations for CA file
Browse files Browse the repository at this point in the history
Try to use default locations for CA files on RHEL/AlmaLinux and
Ubuntu/Debian if the CA file location has not been configured
by the user, so that Linux users usually don't have to configure
a CA file themselves.
  • Loading branch information
stsnel committed Nov 21, 2024
1 parent d8d3379 commit 1b7b357
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change log

## UNRELEASED

- Add some default values for the CA file location that also work in non-Yoda-server environments.

## 2024-10-14 v1.4.0

- Add support for new Python version of user exists rule (YDA-5393)
Expand Down
15 changes: 13 additions & 2 deletions yclienttools/common_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,19 @@


def get_ca_file() -> str:
return _get_parameter_with_default(
"ca_file", "/etc/irods/localhost_and_chain.crt")
configured_ca_file = _get_parameter_from_config("ca_file")
if configured_ca_file is None:
for standard_location in ["/etc/ssl/certs/ca-certificates.crt",
"/etc/pki/tls/certs/ca-bundle.crt",
"/etc/irods/localhost_and_chain.crt"]:
if os.path.isfile(standard_location):
return standard_location

print("Error: could not find CA bundle in a standard location. You will need to configure it (see the README file for details)")
sys.exit(1)

else:
return configured_ca_file


def get_default_yoda_version() -> str:
Expand Down

0 comments on commit 1b7b357

Please sign in to comment.