File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ This script:
5353- Copies ` fullchain.pem ` and ` privkey.pem ` from ` /etc/letsencrypt/live/amiiboapi.org/ ` into the project root
5454- Sets file permissions to read/write for owner+group (` 660 ` ) on both certificate files
5555- Installs ` /etc/cron.d/amiiboapi-certbot ` to run renewal checks twice daily
56- - ` certbot renew ` renews certificates (90-day validity) when they have 30 days or less remaining
56+ - ` certbot renew ` attempts renewal for certificates with 30 days or less remaining (90-day validity period)
5757
5858> [ !IMPORTANT]
5959> ` certbot --standalone ` needs port ` 80 ` available. Stop any process using port ` 80 ` before running issuance if needed.
Original file line number Diff line number Diff line change @@ -71,13 +71,15 @@ renew_certificate() {
7171}
7272
7373install_renewal_schedule () {
74- local cron_cmd cron_line
75- if [[ ! " $SCRIPT_PATH " =~ ^[A-Za-z0-9._/-]+$ || ! " $ LOG_FILE" =~ ^[A-Za-z0-9._/-]+$ ]]; then
76- echo " SCRIPT_PATH and LOG_FILE contain unsupported characters for cron setup." >&2
74+ local quoted_script_path quoted_log_file cron_cmd cron_line
75+ if [[ " $SCRIPT_PATH " != / * || " $LOG_FILE " != / * || " $SCRIPT_PATH " == * $' \n ' * || " $ LOG_FILE" == * $' \n ' * ]]; then
76+ echo " SCRIPT_PATH and LOG_FILE must be absolute single-line paths for cron setup." >&2
7777 exit 1
7878 fi
7979
80- cron_cmd=" /bin/bash \" $SCRIPT_PATH \" renew >> \" $LOG_FILE \" 2>&1"
80+ printf -v quoted_script_path ' %q' " $SCRIPT_PATH "
81+ printf -v quoted_log_file ' %q' " $LOG_FILE "
82+ cron_cmd=" /bin/bash $quoted_script_path renew >> $quoted_log_file 2>&1"
8183 cron_line=" 0 3,15 * * * root $cron_cmd "
8284
8385 run_as_root touch " $LOG_FILE "
You can’t perform that action at this time.
0 commit comments