Skip to content

Commit

Permalink
Add sharing_id configuration parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
obynio committed Jan 1, 2020
1 parent b12db36 commit 38d9159
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ customers to prove control of a domain name.

3. Create a `gandi.ini` config file with the following contents and apply `chmod 600 gandi.ini` on it:
```
# live dns v5 api key
certbot_plugin_gandi:dns_api_key=APIKEY
# optional organization id, remove it if not used
certbot_plugin_gandi:dns_sharing_id=SHARINGID
```
Replace `APIKEY` with your Gandi API key and ensure permissions are set
to disallow access to other users.
Expand Down
8 changes: 4 additions & 4 deletions certbot_plugin_gandi/gandi_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from collections import namedtuple
from certbot.plugins import dns_common

_GandiConfig = namedtuple('_GandiConfig', ('api_key',))
_GandiConfig = namedtuple('_GandiConfig', ('api_key', 'sharing_id',))
_BaseDomain = namedtuple('_BaseDomain', ('fqdn'))

def get_config(api_key):
return _GandiConfig(api_key=api_key)
def get_config(api_key, sharing_id):
return _GandiConfig(api_key=api_key, sharing_id=sharing_id)


def _get_json(response):
Expand Down Expand Up @@ -36,7 +36,7 @@ def _get_url(*segs):
def _request(cfg, method, segs, **kw):
headers = _headers(cfg)
url = _get_url(*segs)
return requests.request(method, url, headers=headers, **kw)
return requests.request(method, url, headers=headers, params={'sharing_id': cfg.sharing_id}, **kw)


def _get_base_domain(cfg, domain):
Expand Down
5 changes: 3 additions & 2 deletions certbot_plugin_gandi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def _setup_credentials(self):
'credentials',
'Gandi credentials INI file',
{
'api-key': 'API key for Gandi account'
'api-key': 'API key for Gandi account',
'sharing-id': 'Optional Gandi organization ID'
}
)

Expand All @@ -57,4 +58,4 @@ def _cleanup(self, domain, validation_name, validation):


def _get_gandi_config(self):
return gandi_api.get_config(api_key = self.credentials.conf('api-key'))
return gandi_api.get_config(api_key = self.credentials.conf('api-key'), sharing_id = self.credentials.conf('sharing-id'))
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='certbot-plugin-gandi',
version='1.2.2',
version='1.2.4',
author="Yohann Leon",
author_email="yohann@leon.re",
description="Certbot plugin for authentication using Gandi LiveDNS",
Expand Down

0 comments on commit 38d9159

Please sign in to comment.