Skip to content

Commit 6b4a3bf

Browse files
Finalize cron safety checks and renewal wording
Agent-Logs-Url: https://github.com/8bitDream/AmiiboAPI/sessions/0306bdf9-88cc-41dd-8bde-09039539f355 Co-authored-by: AbandonedCart <1173913+AbandonedCart@users.noreply.github.com>
1 parent d5f84c6 commit 6b4a3bf

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ This script:
5252
- Registers/requests a certificate with certbot (`amiiboapi.org,www.amiiboapi.org` by default)
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
55-
- Installs `/etc/cron.d/amiiboapi-certbot` to run daily renewal checks
56-
- `certbot renew` renews 90-day certificates when they have 30 days or less remaining
55+
- 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
5757

5858
> [!IMPORTANT]
5959
> `certbot --standalone` needs port `80` available. Stop any process using port `80` before running issuance if needed.

scripts/certbot_certificate.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ renew_certificate() {
7272

7373
install_renewal_schedule() {
7474
local cron_cmd cron_line
75-
if [[ "$SCRIPT_PATH" == *" "* || "$LOG_FILE" == *" "* ]]; then
76-
echo "SCRIPT_PATH and LOG_FILE must not contain spaces for cron setup." >&2
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
7777
exit 1
7878
fi
7979

8080
cron_cmd="/bin/bash \"$SCRIPT_PATH\" renew >> \"$LOG_FILE\" 2>&1"
81-
cron_line="0 3 * * * root $cron_cmd"
81+
cron_line="0 3,15 * * * root $cron_cmd"
8282

8383
run_as_root touch "$LOG_FILE"
8484
run_as_root chmod 644 "$LOG_FILE"

0 commit comments

Comments
 (0)