puppet: Set proxy environment variables.

These are respected by `urllib`, and thus also `requests`.  We set
`HTTP_proxy`, not `HTTP_PROXY`, because the latter is ignored in
situations which might be running under CGI -- in such cases it may be
coming from the `Proxy:` header in the request.
This commit is contained in:
Alex Vandiver
2020-10-15 09:43:44 +00:00
committed by Tim Abbott
parent 8b0f32ee07
commit 6b9d7000b5
6 changed files with 72 additions and 7 deletions

View File

@@ -114,6 +114,10 @@ def send_email_mirror(
# work, and connections to 127.0.0.1 are secure without SSL.
verify_ssl = False
# Because this script is run from postfix, it does not have any
# http proxy environment variables set which might interfere with
# access to localhost.
context = None
if not verify_ssl:
context = ssl.create_default_context()