Skip to content

Instantly share code, notes, and snippets.

@vittorio-nardone
Created May 4, 2020 14:14
Show Gist options
  • Save vittorio-nardone/97bb7ed679770ab4a9dd3e3101a845c8 to your computer and use it in GitHub Desktop.
Save vittorio-nardone/97bb7ed679770ab4a9dd3e3101a845c8 to your computer and use it in GitHub Desktop.
Write token file and upload it to correct S3 bucket
def upload_auth():
''' Write token file and upload it to correct S3 bucket and folder
S3 Bucket name and cert domain must be the same!
'''
f = open("/tmp/verification.txt", "w")
f.write(os.environ['CERTBOT_VALIDATION'])
f.close()
s3object = ".well-known/acme-challenge/" + os.environ['CERTBOT_TOKEN']
upload_file("/tmp/verification.txt", os.environ['CERTBOT_DOMAIN'], s3object)
os.remove("/tmp/verification.txt")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment