GANDI的Lexicion DNS提供程序身份验证失败

时间:2018-12-28 16:11:31

标签: api dns ansible lexicon

对于那些使用词典进行dns操作的人

我正在尝试使用带有Gandi的词典dns api作为dns提供程序,并且出现身份验证错误。

实际上,我正尝试使用ansible剧本在gandi托管的我的域上,在一个不可公开访问的无业游民的盒子上生成letencrypt证书。

在文档page的提供程序列表中,我没有看到gandi名称。

这就是为什么它失败了吗?我在潜在提供商列表中看到了AWS Route53,这是否意味着词典支持AWS还是不支持AWS?

这是我执行剧本时遇到的错误:

fatal: [172.16.2.15]: FAILED! => {"changed": true, "cmd": "/srv/dehydrated/dehydrated --cron --hook /srv/dehydrated/dehydrated.default.sh --challenge dns-01 --accept-terms", "delta": "0:00:05.839602", "end": "2018-12-28 15:34:52.558788", "msg": "non-zero return code", "rc": 1, "start": "2018-12-28 15:34:46.719186", "stderr": "#\n# !! WARNING !! No main config file found, using default config!\n#\nTraceback (most recent call last):\n  File \"/usr/local/lib/python3.6/dist-packages/lexicon/providers/gandi.py\", line 286, in authenticate\n    payload = self._api.domain.info(self._api_key, self._domain)\n  File \"/usr/lib/python3.6/xmlrpc/client.py\", line 1112, in __call__\n    return self.__send(self.__name, args)\n  File \"/usr/lib/python3.6/xmlrpc/client.py\", line 1452, in __request\n    verbose=self.__verbose\n  File \"/usr/lib/python3.6/xmlrpc/client.py\", line 1154, in request\n    return self.single_request(host, handler, request_body, verbose)\n  File \"/usr/lib/python3.6/xmlrpc/client.py\", line 1170, in single_request\n    return self.parse_response(resp)\n  File \"/usr/lib/python3.6/xmlrpc/client.py\", line 1342, in parse_response\n    return u.close()\n  File \"/usr/lib/python3.6/xmlrpc/client.py\", line 656, in close\n    raise Fault(**self._stack[0])\nxmlrpc.client.Fault: <Fault 510150: 'Error on object : OBJECT_ACCOUNT (CAUSE_NORIGHT) [Invalid API key]'>\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/usr/local/bin/lexicon\", line 11, in <module>\n    sys.exit(main())\n  File \"/usr/local/lib/python3.6/dist-packages/lexicon/cli.py\", line 102, in main\n    results = client.execute()\n  File \"/usr/local/lib/python3.6/dist-packages/lexicon/client.py\", line 64, in execute\n    self.provider.authenticate()\n  File \"/usr/local/lib/python3.6/dist-packages/lexicon/providers/gandi.py\", line 81, in authenticate\n    domain_id = self.rpc_helper.authenticate()\n  File \"/usr/local/lib/python3.6/dist-packages/lexicon/providers/gandi.py\", line 290, in authenticate\n    raise Exception(\"Failed to authenticate: '{0}'\".format(err))\nException: Failed to authenticate: '<Fault 510150: 'Error on object : OBJECT_ACCOUNT (CAUSE_NORIGHT) [Invalid API key]'>'", "stderr_lines": ["#", "# !! WARNING !! No main config file found, using default config!", "#", "Traceback (most recent call last):", "  File \"/usr/local/lib/python3.6/dist-packages/lexicon/providers/gandi.py\", line 286, in authenticate", "    payload = self._api.domain.info(self._api_key, self._domain)", "  File \"/usr/lib/python3.6/xmlrpc/client.py\", line 1112, in __call__", "    return self.__send(self.__name, args)", "  File \"/usr/lib/python3.6/xmlrpc/client.py\", line 1452, in __request", "    verbose=self.__verbose", "  File \"/usr/lib/python3.6/xmlrpc/client.py\", line 1154, in request", "    return self.single_request(host, handler, request_body, verbose)", "  File \"/usr/lib/python3.6/xmlrpc/client.py\", line 1170, in single_request", "    return self.parse_response(resp)", "  File \"/usr/lib/python3.6/xmlrpc/client.py\", line 1342, in parse_response", "    return u.close()", "  File \"/usr/lib/python3.6/xmlrpc/client.py\", line 656, in close", "    raise Fault(**self._stack[0])", "xmlrpc.client.Fault: <Fault 510150: 'Error on object : OBJECT_ACCOUNT (CAUSE_NORIGHT) [Invalid API key]'>", "", "During handling of the above exception, another exception occurred:", "", "Traceback (most recent call last):", "  File \"/usr/local/bin/lexicon\", line 11, in <module>", "    sys.exit(main())", "  File \"/usr/local/lib/python3.6/dist-packages/lexicon/cli.py\", line 102, in main", "    results = client.execute()", "  File \"/usr/local/lib/python3.6/dist-packages/lexicon/client.py\", line 64, in execute", "    self.provider.authenticate()", "  File \"/usr/local/lib/python3.6/dist-packages/lexicon/providers/gandi.py\", line 81, in authenticate", "    domain_id = self.rpc_helper.authenticate()", "  File \"/usr/local/lib/python3.6/dist-packages/lexicon/providers/gandi.py\", line 290, in authenticate", "    raise Exception(\"Failed to authenticate: '{0}'\".format(err))", "Exception: Failed to authenticate: '<Fault 510150: 'Error on object : OBJECT_ACCOUNT (CAUSE_NORIGHT) [Invalid API key]'>'"], "stdout": "+ Generating account key...\n+ Registering account key with ACME server...\n + Creating chain cache directory /srv/dehydrated/chains\nProcessing gitlab.lescdn.com\n + Creating new directory /srv/dehydrated/certs/gitlab.lescdn.com ...\n + Signing domains...\n + Generating private key...\n + Generating signing request...\n + Requesting new certificate order from CA...\n + Received 1 authorizations URLs from the CA\n + Handling authorization for gitlab.lescdn.com\n + 1 pending challenge(s)\n + Deploying challenge tokens...\ndeploy_challenge called: gitlab.lescdn.com, 1ifWXObduKNTkKbqkpXEtBpie_p1p1xL2ivugVS9Z3c, 2TgAYwV1RyI-gy6cXAtav36NI7LElHLjoKhcv0ugsag", "stdout_lines": ["+ Generating account key...", "+ Registering account key with ACME server...", " + Creating chain cache directory /srv/dehydrated/chains", "Processing gitlab.lescdn.com", " + Creating new directory /srv/dehydrated/certs/gitlab.lescdn.com ...", " + Signing domains...", " + Generating private key...", " + Generating signing request...", " + Requesting new certificate order from CA...", " + Received 1 authorizations URLs from the CA", " + Handling authorization for gitlab.lescdn.com", " + 1 pending challenge(s)", " + Deploying challenge tokens...", "deploy_challenge called: gitlab.lescdn.com, 1ifWXObduKNTkKbqkpXEtBpie_p1p1xL2ivugVS9Z3c, 2TgAYwV1RyI-gy6cXAtav36NI7LElHLjoKhcv0ugsag"]}

我可以看到文件/usr/local/lib/python3.6/dist-packages/lexicon/providers/gandi.py已执行并在第 286 行失败,因此对于我的gandi提供程序而言,该文件受支持但未在词典页面中列出,因此我对此感到困惑ansible任务失败。

1 个答案:

答案 0 :(得分:0)

我找到了问题。

它特定于 gandi 提供程序词典模块,默认情况下使用 rpc 协议。

当我使用gandi liveDNS API时,我应该使用其余的协议。

为解决该问题,我使用从我的剧本中设置的 LEXICON_GANDI_API_PROTOCOL 动态环境变量设置为休息,并且可以正常工作。