Skip to content

Instantly share code, notes, and snippets.

@rambotech
Created January 30, 2025 20:56
Show Gist options
  • Save rambotech/0c942d9b0b8e24c6653c10a844a1b376 to your computer and use it in GitHub Desktop.
Save rambotech/0c942d9b0b8e24c6653c10a844a1b376 to your computer and use it in GitHub Desktop.
Script for launching certbot renew, but opening and closing port 80 only for the duration of the refresh.
#!/bin/bash
echo ===============
echo Open port 80 for verification ...
echo ===============
you cufw allow 80/tcp && ufw reload
echo
echo ==============
echo Certififcate refresh / renew
echo ==============
# --nginx only with NGINX installed
certbot renew --nginx
echo
echo =============
echo Close port 80
echo =============
ufw deny 80/tcp && ufw reload
echo
echo Completed.
@rambotech
Copy link
Author

Line 6 has a rogue "you c" prefix.. remove it. Sorry bout that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment