0
votes

I've written a launch script to using php and the aws sdk, it calls the relevant userdata.sh script to set up the aws instance. Part of the scripts function is to set up the ssl cert via lets encrypt, after installing lets-encrypt and making changes for ip etc it eventually calls:

echo $(/opt/letsencrypt/certbot-auto certonly --webroot -w /var/www/html/$host.com/$environment.$domain.com -d $environment.$domain.com -d www.$environment.$domain.com -c /opt/letsencrypt/config.ini --agree-tos -n --dry-run)

The above returns:

Requesting to rerun /opt/letsencrypt/certbot-auto with root privileges... Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator webroot, Installer None Cert not due for renewal, but simulating renewal for dry run Renewing an existing certificate Performing the following challenges: http-01 challenge for environment.domain.com http-01 challenge for www.environment.domain.com Using the webroot path /var/www/html/host.com/environment.domain.com for all unmatched domains. Waiting for verification... Cleaning up challenges

IMPORTANT NOTES: - The dry run was successful.

I want to verify that the test was successful before attempting to run the same command again without the --dry-run flag. How can I do this?

1

1 Answers

0
votes

Hopefully this will help someone else in future:

$testval = /opt/letsencrypt/certbot-auto certonly --webroot -w /var/www/html/$host.com/$environment.$domain.com -d $environment.$domain.com -d www.$environment.$domain.com -c /opt/letsencrypt/config.ini --agree-tos -n --dry-run

if [[ $($testval) == *" - The dry run was successful."* ]]; then echo "true"; else echo "false"; fi