def replacetlsstr(self, line):
l = line.replace("TLS_", "")
l = l.replace("\n", " ")
l = l.replace("\\", " ")
l = " ".join(l.split())
l = l.replace(" ", ":")
l = l.replace("_", "-")
l = l.replace("-WITH", "")
l = l.replace("AES-", "AES")
l = l.replace("POLY1305-SHA256", "POLY1305") return l
def replaceinstr(self, line): if line.startswith("TLSCiphersPrefer"): # the "TLS_" are changed into "".
l = self.replacetlsstr(line)
l = l.replace("TLSCiphersPrefer:", "SSLCipherSuite ") elif line.startswith("TLSCiphersSuppress"): # like SSLCipherSuite but with :!
l = self.replacetlsstr(line)
l = l.replace("TLSCiphersSuppress:", "SSLCipherSuite !")
l = l.replace(":", ":!") elif line.startswith("TLSCertificate"):
l = line.replace("TLSCertificate", "SSLCertificateFile") elif line.startswith("TLSProtocol"): # mod_ssl is different (+ no supported and 0x code have to be translated)
l = line.replace("TLSProtocol", "SSLProtocol")
l = l.replace("+", "")
l = l.replace("default", "all")
l = l.replace("0x0303", "1.2") # need to check 1.3 and 1.1 elif line.startswith("SSLProtocol"):
l = line # we have that in test/modules/tls/test_05_proto.py elif line.startswith("TLSHonorClientOrder"): # mod_ssl has SSLHonorCipherOrder on = use server off = use client.
l = line.lower() if"on"in l:
l = "SSLHonorCipherOrder off" else:
l = "SSLHonorCipherOrder on" elif line.startswith("TLSEngine"): # In fact it should go in the corresponding VirtualHost... Not sure how to do that.
l = "SSLEngine On" else: if line != "":
l = line.replace("TLS", "SSL") else:
l = line return l
def add(self, line: Any): # make we transform the TLS to SSL if we are using mod_ssl if isinstance(line, str): ifnot HttpdTestEnv.has_shared_module("tls"):
line = self.replaceinstr(line) if self._indents > 0:
line = f"{' ' * self._indents}{line}"
self._lines.append(line) else: ifnot HttpdTestEnv.has_shared_module("tls"):
new = []
previous = "" for l in line: if previous.startswith("SSLCipherSuite"): if l.startswith("TLSCiphersPrefer") or l.startswith("TLSCiphersSuppress"): # we need to merge it
l = self.replaceinstr(l)
l = l.replace("SSLCipherSuite ", ":")
previous = previous + l continue else: if self._indents > 0:
previous = f"{' ' * self._indents}{previous}"
new.append(previous)
previous = ""
l = self.replaceinstr(l) if l.startswith("SSLCipherSuite"):
previous = l continue if self._indents > 0:
l = f"{' ' * self._indents}{l}"
new.append(l) if previous != "": if self._indents > 0:
previous = f"{' ' * self._indents}{previous}"
new.append(previous)
self._lines.extend(new) else: if self._indents > 0:
line = [f"{' ' * self._indents}{l}"for l in line]
self._lines.extend(line) return self
def start_vhost(self, domains, port=None, doc_root="htdocs", with_ssl=None,
ssl_module=None, with_certificates=None): ifnot isinstance(domains, list):
domains = [domains] if port isNone:
port = self.env.https_port if ssl_module isNone:
ssl_module = self.env.ssl_module if with_ssl isNone:
with_ssl = self.env.https_port == port if with_ssl and ssl_module == 'mod_tls'and port notin self._tls_engine_ports:
self.add(f"TLSEngine {port}")
self._tls_engine_ports.add(port)
self.add("")
self.add(f"")
self._indents += 1
self.add(f"ServerName {domains[0]}") for alias in domains[1:]:
self.add(f"ServerAlias {alias}")
self.add(f"DocumentRoot {doc_root}") if with_ssl: if ssl_module == 'mod_ssl':
self.add("SSLEngine on") elif ssl_module == 'mod_gnutls':
self.add("GnuTLSEnable on") if with_certificates isnotFalse: for cred in self.env.get_credentials_for_name(domains[0]):
self.add_certificate(cred.cert_file, cred.pkey_file, ssl_module=ssl_module) if domains[0] in self._extras:
self.add(self._extras[domains[0]]) return self
if e1 isNone: return e2.copy() if e2 elseNone if e2 isNone: return e1.copy()
e3 = e1.copy() for name, val in e2.items(): if name in e3:
e3[name] = _concat(e3[name], val) else:
e3[name] = val return e3
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.