Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions doc/admin-guide/plugins/url_sig.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,20 @@ Example
{ [data not shown]
* Connection #0 to host localhost left intact


Replay test support
===================

To assist in log replay an option is available in the config file which
will ignore the expiration date. This allows all url_sig tests to
pass the expiration date.

The config file option to enable this is::

ignore_expiry = true

Once updated, touch `remap.config` then issue a
:option:`traffic_ctl config reload` to make the settings active.

Do NOT deploy this to production as it will disable valid checks
on signed urls!
26 changes: 17 additions & 9 deletions plugins/experimental/url_sig/url_sig.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct config {
pcre_extra *regex_extra;
int pristine_url_flag;
char *sig_anchor;
bool ignore_expiry;
};

static void
Expand Down Expand Up @@ -217,6 +218,11 @@ TSRemapNewInstance(int argc, char *argv[], void **ih, char *errbuf, int errbuf_s
cfg->regex_extra = pcre_study(
cfg->regex, options, &errptr); // We do not need to check the error here because we can still run without the studying?
}
} else if (strncmp(line, "ignore_expiry", 13) == 0) {
if (strncmp(value, "true", 4) == 0) {
cfg->ignore_expiry = true;
TSError("[url_sig] Plugin IGNORES sig expiration");
}
} else {
TSError("[url_sig] Error parsing line %d of file %s (%s)", line_no, config_file, line);
}
Expand Down Expand Up @@ -667,17 +673,19 @@ TSRemapDoRemap(void *ih, TSHttpTxn txnp, TSRemapRequestInfo *rri)
}

// Expiration
cp = strstr(query, EXP_QSTRING "=");
if (cp != NULL) {
cp += strlen(EXP_QSTRING) + 1;
if (sscanf(cp, "%" SCNu64, &expiration) != 1 || (time_t)expiration < time(NULL)) {
err_log(url, "Invalid expiration, or expired");
if (!cfg->ignore_expiry) {
cp = strstr(query, EXP_QSTRING "=");
if (cp != NULL) {
cp += strlen(EXP_QSTRING) + 1;
if (sscanf(cp, "%" SCNu64, &expiration) != 1 || (time_t)expiration < time(NULL)) {
err_log(url, "Invalid expiration, or expired");
goto deny;
}
TSDebug(PLUGIN_NAME, "Exp: %" PRIu64, expiration);
} else {
err_log(url, "Expiration query string not found");
goto deny;
}
TSDebug(PLUGIN_NAME, "Exp: %" PRIu64, expiration);
} else {
err_log(url, "Expiration query string not found");
goto deny;
}
// Algorithm
cp = strstr(query, ALG_QSTRING "=");
Expand Down