diff --git a/awx/main/models/ad_hoc_commands.py b/awx/main/models/ad_hoc_commands.py index d6c97e6f86..ded2cd9b0f 100644 --- a/awx/main/models/ad_hoc_commands.py +++ b/awx/main/models/ad_hoc_commands.py @@ -3,6 +3,7 @@ # Python import datetime +import hashlib import hmac import logging from urlparse import urljoin @@ -152,7 +153,7 @@ class AdHocCommand(UnifiedJob, JobNotificationMixin): def task_auth_token(self): '''Return temporary auth token used for task requests via API.''' if self.status == 'running': - h = hmac.new(settings.SECRET_KEY, self.created.isoformat()) + h = hmac.new(settings.SECRET_KEY, self.created.isoformat(), digestmod=hashlib.sha1) return '%d-%s' % (self.pk, h.hexdigest()) @property diff --git a/awx/main/models/jobs.py b/awx/main/models/jobs.py index 388be47d17..5474eefd14 100644 --- a/awx/main/models/jobs.py +++ b/awx/main/models/jobs.py @@ -3,6 +3,7 @@ # Python import datetime +import hashlib import hmac import logging import time @@ -480,7 +481,7 @@ class Job(UnifiedJob, JobOptions, SurveyJobMixin, JobNotificationMixin): def task_auth_token(self): '''Return temporary auth token used for task requests via API.''' if self.status == 'running': - h = hmac.new(settings.SECRET_KEY, self.created.isoformat()) + h = hmac.new(settings.SECRET_KEY, self.created.isoformat(), digestmod=hashlib.sha1) return '%d-%s' % (self.pk, h.hexdigest()) @property