diff --git a/README.md b/README.md index 5609116..1e2f593 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/certbot_plugin_gandi/gandi_api.py b/certbot_plugin_gandi/gandi_api.py index 79a6999..9ba7597 100644 --- a/certbot_plugin_gandi/gandi_api.py +++ b/certbot_plugin_gandi/gandi_api.py @@ -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): @@ -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): diff --git a/certbot_plugin_gandi/main.py b/certbot_plugin_gandi/main.py index 4f6d0dc..842f820 100644 --- a/certbot_plugin_gandi/main.py +++ b/certbot_plugin_gandi/main.py @@ -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' } ) @@ -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')) diff --git a/setup.py b/setup.py index 50bec8e..5c8deaa 100644 --- a/setup.py +++ b/setup.py @@ -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",