Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Switch to Signature Canonicalization version 2" #303

Closed
wants to merge 1 commit into from
Closed
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
9 changes: 2 additions & 7 deletions lib/https.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,18 +666,14 @@ https_send(struct https_request *req, const char *method, const char *uri,
BIO *b64;
HMAC_CTX *hmac;
unsigned char MD[SHA512_DIGEST_LENGTH];
char *qs, *p, date[128];
char *qs, *p;
int i, n, is_get;
time_t t;

req->done = 0;

t = time(NULL);
strftime(date, sizeof date, "%a, %d %b %Y %T %z", localtime(&t));

/* Generate query string and canonical request to sign */
if ((qs = _argv_to_qs(argc, argv)) == NULL ||
(asprintf(&p, "%s\n%s\n%s\n%s\n%s", date, method, req->host, uri, qs)) < 0) {
(asprintf(&p, "%s\n%s\n%s\n%s", method, req->host, uri, qs)) < 0) {
free(qs);
ctx.errstr = strerror(errno);
return (HTTPS_ERR_LIB);
Expand All @@ -698,7 +694,6 @@ https_send(struct https_request *req, const char *method, const char *uri,
"User-Agent: %s\r\n",
useragent);
/* Add signature */
BIO_printf(req->cbio, "X-Duo-Date: %s\r\n", date);
BIO_puts(req->cbio, "Authorization: Basic ");

if ((hmac = HMAC_CTX_new()) == NULL) {
Expand Down
8 changes: 1 addition & 7 deletions tests/mockduo.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,7 @@ def _verify_sig(self):
if ikey != IKEY:
return False

# first look for x-duo-date header
datestring = self.headers.get("x-duo-date")
if datestring is None:
# if it doesn't exist, try looking for Date header
datestring = self.headers.get("Date")

canon = [datestring, self.method, self.headers["Host"].split(":")[0].lower(), self.path]
canon = [self.method, self.headers["Host"].split(":")[0].lower(), self.path]
l = []
for k in sorted(self.args.keys()):
l.append(
Expand Down
Loading