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 ignore ssl param #29

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions certbot_dns_aliyun/alidns.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ class AliDNSClient():
_access_key = ''
_access_key_secret = ''
_ttl = 600
_ignore_ssl = False

def __init__(self, access_key, access_key_secret, ttl = 600):
def __init__(self, access_key, access_key_secret, ttl = 600, ignore_ssl = False):
self._access_key = access_key
self._access_key_secret = access_key_secret
self._ttl = ttl
self._ignore_ssl = ignore_ssl

def _find_domain_id(self, domain):
domain_name_guesses = dns_common.base_domain_name_guesses(domain)
Expand Down Expand Up @@ -114,7 +116,7 @@ def _request(self, action, data):
h = hmac.new((self._access_key_secret + '&').encode(), str_to_sign.encode(), sha1)
params['Signature'] = base64.b64encode(h.digest()).decode().rstrip('\n')

r = requests.get(API_ENDPOINT, params=params)
r = requests.get(API_ENDPOINT, params=params, verify=(not self._ignore_ssl))
r = r.json()

if 'Code' in r:
Expand Down
6 changes: 5 additions & 1 deletion certbot_dns_aliyun/dns_aliyun.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def __init__(self, *args, **kwargs):
def add_parser_arguments(cls, add): # pylint: disable=arguments-differ
super(Authenticator, cls).add_parser_arguments(add, default_propagation_seconds=30)
add('credentials', help='Aliyun DNS credentials INI file.')
add('ignore-ssl', help='Whether to ignore SSL for http requests.', default=False)

def more_info(self): # pylint: disable=missing-docstring,no-self-use
return 'This plugin configures a DNS TXT record to respond to a dns-01 challenge using ' + \
Expand All @@ -45,6 +46,7 @@ def _setup_credentials(self):
}
)


def _perform(self, domain, validation_name, validation):
self._get_alidns_client().add_txt_record(domain, validation_name, validation)

Expand All @@ -56,6 +58,8 @@ def _get_alidns_client(self):
self._alidns_client = AliDNSClient(
self.credentials.conf('access-key'),
self.credentials.conf('access-key-secret'),
self.ttl)
self.ttl,
self.conf('ignore-ssl'),
)
return self._alidns_client