Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to send Custom CA certs in case of self signed certificates. #67

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions artifactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def read_config(config_path=default_config_path):
[https://artifactory-instance.local/artifactory]
username = foo
password = @dmin
verify = false
verify = true/false or ~/path-to-ca-chain
cert = ~/path-to-cert

config-path - specifies where to read the config from
Expand All @@ -80,7 +80,14 @@ def read_config(config_path=default_config_path):
for section in p.sections():
username = p.get(section, 'username') if p.has_option(section, 'username') else None
password = p.get(section, 'password') if p.has_option(section, 'password') else None
verify = p.getboolean(section, 'verify') if p.has_option(section, 'verify') else True
if p.has_option(section, 'verify'):
try:
verify = p.getboolean(section, 'verify')
except ValueError:
# Verify CA cert path may contain '~'
verify = os.path.expanduser(p.get(section, 'verify'))
else:
verify = True
cert = p.get(section, 'cert') if p.has_option(section, 'cert') else None

result[section] = {'username': username,
Expand Down