actually check request recipient

This commit is contained in:
Seth Schoen
2012-07-14 13:35:52 -07:00
parent 8036fcbb01
commit f82c259b1a
2 changed files with 7 additions and 3 deletions
+1 -2
View File
@@ -29,8 +29,7 @@ def init(m):
m.session = ""
def make_request(m, csr):
# TODO: take recipient from os.environ["CHOCOLATESERVER"]
m.request.recipient = "ca.example.com"
m.request.recipient = os.environ["CHOCOLATESERVER"]
m.request.timestamp = int(time.time())
m.request.csr = csr
+6 -1
View File
@@ -12,6 +12,11 @@ from google.protobuf.message import DecodeError
MaximumSessionAge = 100 # seconds, to demonstrate session timeout
MaximumChallengeAge = 600 # to demonstrate challenge timeout
try:
chocolate_server_name = open("SERVERNAME").read().rstrip()
except IOError:
raise IOError, "Please create a SERVERNAME file containing the server name."
urls = (
'.*', 'session'
)
@@ -217,7 +222,7 @@ class session(object):
if time.time() - timestamp > 100:
self.die(r, r.BadRequest, uri="https://ca.example.com/failures/past")
return
if recipient != "ca.example.com":
if recipient != chocolate_server_name:
self.die(r, r.BadRequest, uri="https://ca.example.com/failures/recipient")
return
if not CSR.parse(csr):