def perform(self, achalls): """Perform the configuration related challenge. This function currently assumes all challenges will be fulfilled. If this turns out not to be the case in the future. Cleanup and outstanding challenges will have to be designed better. """ self._chall_out += len(achalls) responses = [None] * len(achalls) nginx_dvsni = dvsni.NginxDvsni(self) for i, achall in enumerate(achalls): if isinstance(achall, achallenges.DVSNI): # Currently also have dvsni hold associated index # of the challenge. This helps to put all of the responses back # together when they are all complete. nginx_dvsni.add_chall(achall, i) sni_response = nginx_dvsni.perform() # Must restart in order to activate the challenges. # Handled here because we may be able to load up other challenge types self.restart() # Go through all of the challenges and assign them to the proper place # in the responses return value. All responses must be in the same order # as the original challenges. for i, resp in enumerate(sni_response): responses[nginx_dvsni.indices[i]] = resp return responses
def setUp(self): super(DvsniPerformTest, self).setUp() config = util.get_nginx_configurator(self.config_path, self.config_dir, self.work_dir) from letsencrypt_nginx import dvsni self.sni = dvsni.NginxDvsni(config)
def setUp(self): super(DvsniPerformTest, self).setUp() config = util.get_nginx_configurator(self.config_path, self.config_dir, self.work_dir, self.ssl_options) rsa256_file = pkg_resources.resource_filename( "acme.jose", "testdata/rsa256_key.pem") rsa256_pem = pkg_resources.resource_string("acme.jose", "testdata/rsa256_key.pem") auth_key = le_util.Key(rsa256_file, rsa256_pem) from letsencrypt_nginx import dvsni self.sni = dvsni.NginxDvsni(config) self.achalls = [ achallenges.DVSNI(challb=acme_util.chall_to_challb( challenges.DVSNI(r="foo", nonce="bar"), "pending"), domain="www.example.com", key=auth_key), achallenges.DVSNI(challb=acme_util.chall_to_challb( challenges.DVSNI( r="\xba\xa9\xda?<m\xaewmx\xea\xad\xadv\xf4\x02\xc9y\x80" "\xe2_X\t\xe7\xc7\xa4\t\xca\xf7&\x945", nonce="Y\xed\x01L\xac\x95\xf7pW\xb1\xd7" "\xa1\xb2\xc5\x96\xba"), "pending"), domain="blah", key=auth_key), achallenges.DVSNI(challb=acme_util.chall_to_challb( challenges.DVSNI( r="\x8c\x8a\xbf_-f\\cw\xee\xd6\xf8/\xa5\xe3\xfd\xeb9" "\xf1\xf5\xb9\xefVM\xc9w\xa4u\x9c\xe1\x87\xb4", nonce="7\xbc^\xb7]>\x00\xa1\x9bOcU\x84^Z\x18"), "pending"), domain="www.example.org", key=auth_key) ]