diff --git a/lets_do_dns/acme_dns_auth/authenticate.py b/lets_do_dns/acme_dns_auth/authenticate.py index 3b75e87..7e915af 100644 --- a/lets_do_dns/acme_dns_auth/authenticate.py +++ b/lets_do_dns/acme_dns_auth/authenticate.py @@ -40,7 +40,10 @@ def _delete_resource(self): def _run_post_cmd(self): if self._env.post_cmd: run(self._env.post_cmd, - env={'CERTBOT_HOSTNAME': self._env.fqdn}) + env={'CERTBOT_HOSTNAME': self._env.fqdn, + 'PATH': ["/bin", "/sbin", + "/usr/bin", "/usr/sbin", + "/usr/local/bin", "/usr/local/sbin"]}) def _create_resource(self): self._resource.create() diff --git a/tests/unit/acme_dns_auth/authenticate/test_cleanup_stage.py b/tests/unit/acme_dns_auth/authenticate/test_cleanup_stage.py index 1281b6d..3601713 100644 --- a/tests/unit/acme_dns_auth/authenticate/test_cleanup_stage.py +++ b/tests/unit/acme_dns_auth/authenticate/test_cleanup_stage.py @@ -73,4 +73,8 @@ def test_passes_postcmd_to_run(mocker, fqdn): authentication.perform() mock_run.assert_called_once_with( - 'test-program --help', env={'CERTBOT_HOSTNAME': fqdn}) + 'test-program --help', + env={'CERTBOT_HOSTNAME': fqdn, + 'PATH': ["/bin", "/sbin", + "/usr/bin", "/usr/sbin", + "/usr/local/bin", "/usr/local/sbin"]})