def activate_ssl(self, name, domain, plugin='default'): lb = LoadBalancer.find(name) if lb is None: raise storage.InstanceNotFoundError() if not self._check_dns(name, domain): raise SslError('rpaas IP is not registered for this DNS name') key = ssl.generate_key() csr = ssl.generate_csr(key, domain) if plugin == 'le': try: self.task_manager.create(name) task = tasks.DownloadCertTask().delay(self.config, name, plugin, csr, key, domain) self.task_manager.update(name, task.task_id) return '' except Exception: raise SslError('rpaas IP is not registered for this DNS name') else: p_ssl = ssl_plugins.default.Default(domain) cert = p_ssl.download_crt(key=key) self.update_certificate(name, cert, key) return ''
def renew(self, cert, config): key = ssl.generate_key() csr = ssl.generate_csr(key, cert["domain"]) DownloadCertTask().delay(config=config, name=cert["name"], plugin="le", csr=csr, key=key, domain=cert["domain"])